Annotation of previous/src/nextMemory.c, revision 1.1.1.2

1.1       root        1: /*
                      2:   Hatari - stMemory.c
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: 
                      7:   ST Memory access functions.
                      8: */
                      9: const char STMemory_fileid[] = "Hatari stMemory.c : " __DATE__ " " __TIME__;
                     10: 
                     11: #include "nextMemory.h"
                     12: #include "configuration.h"
                     13: #include "ioMem.h"
                     14: #include "log.h"
                     15: #include "memory.h"
                     16: #include "memorySnapShot.h"
                     17: 
                     18: /*
                     19:  * main RAM buffer (8mb for stock Next)
                     20:  */
                     21: Uint8 NEXTRam[64*1024*1024];
                     22: 
                     23: Uint32 NEXTRamEnd;            /* End of ST Ram, above this address is no-mans-land and ROM/IO memory */
                     24: 
                     25: 
                     26: Uint8 NEXTRom[0x20000];
                     27: 
                     28: Uint8 NEXTIo[0x20000];
                     29: 
                     30: /**
                     31:  * Clear section of NEXT's memory space.
                     32:  */
                     33: void NEXTMemory_Clear(Uint32 StartAddress, Uint32 EndAddress)
                     34: {
                     35:        memset(&NEXTRam[StartAddress], 0, EndAddress-StartAddress);
                     36: }
                     37: 
1.1.1.2 ! root       38: /** --useful for next?
        !            39:  * Copy given memory area safely to Atari RAM.
        !            40:  * If the memory area isn't fully within RAM, only the valid parts are written.
        !            41:  * Useful for all kinds of IO operations.
        !            42:  * 
        !            43:  * addr - destination Atari RAM address
        !            44:  * src - source Hatari memory address
        !            45:  * len - number of bytes to copy
        !            46:  * name - name / description if this memory copy for error messages
        !            47:  * 
        !            48:  * Return true if whole copy was safe / valid.
        !            49:  */
        !            50: /**
        !            51: bool NEXTMemory_SafeCopy(Uint32 addr, Uint8 *src, unsigned int len, const char *name)
        !            52: {
        !            53:     Uint32 end;
        !            54: 
        !            55:     if (NEXTMemory_ValidArea(addr, len))
        !            56:     {
        !            57:         memcpy(&NEXTRam[addr], src, len);
        !            58:         return true;
        !            59:     }
        !            60:     Log_Printf(LOG_WARN, "Invalid '%s' RAM range 0x%x+%i!\n", name, addr, len);
        !            61: 
        !            62:     for (end = addr + len; addr < end; addr++, src++)
        !            63:     {
        !            64:         if (NEXTMemory_ValidArea(addr, 1))
        !            65:             NEXTRam[addr] = *src;
        !            66:     }
        !            67:     return false;
        !            68: }
        !            69: */
        !            70: 
1.1       root       71: 
                     72: /**
                     73:  * TODO 
                     74:  */
                     75: void NEXTMemory_MemorySnapShot_Capture(bool bSave)
                     76: {
                     77:        MemorySnapShot_Store(&NEXTRamEnd, sizeof(NEXTRamEnd));
                     78: 
                     79:        /* Only save/restore area of memory machine is set to, eg 1Mb */
                     80:        MemorySnapShot_Store(NEXTRam, NEXTRamEnd);
                     81: }
                     82: 
                     83: 
                     84: /**
                     85:  * TODO
                     86:  */
                     87: void NEXTMemory_SetDefaultConfig(void)
                     88: {
                     89: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.