Annotation of hatari/src/uae-cpu/memory.h, revision 1.1.1.3

1.1       root        1:  /*
                      2:   * UAE - The Un*x Amiga Emulator
                      3:   *
                      4:   * memory management
                      5:   *
                      6:   * Copyright 1995 Bernd Schmidt
1.1.1.2   root        7:   *
                      8:   * Adaptation to Hatari by Thomas Huth
1.1       root        9:   */
                     10: 
1.1.1.3 ! root       11: #ifndef UAE_MEMORY_H
        !            12: #define UAE_MEMORY_H
        !            13: 
        !            14: #include "maccess.h"
1.1       root       15: 
                     16: 
                     17: /* Enabling this adds one additional native memory reference per 68k memory
                     18:  * access, but saves one shift (on the x86). Enabling this is probably
                     19:  * better for the cache. My favourite benchmark (PP2) doesn't show a
                     20:  * difference, so I leave this enabled. */
                     21: #if 1 || defined SAVE_MEMORY
                     22: #define SAVE_MEMORY_BANKS
                     23: #endif
                     24: 
                     25: extern int special_mem;
                     26: #define S_READ 1
                     27: #define S_WRITE 2
                     28: 
                     29: typedef uae_u32 (*mem_get_func)(uaecptr) REGPARAM;
                     30: typedef void (*mem_put_func)(uaecptr, uae_u32) REGPARAM;
                     31: typedef uae_u8 *(*xlate_func)(uaecptr) REGPARAM;
                     32: typedef int (*check_func)(uaecptr, uae_u32) REGPARAM;
                     33: 
                     34: extern char *address_space, *good_address_map;
                     35: 
                     36: #undef DIRECT_MEMFUNCS_SUCCESSFUL
                     37: /*#include "machdep/maccess.h"*/
                     38: 
                     39: #ifndef CAN_MAP_MEMORY
                     40: #undef USE_COMPILER
                     41: #endif
                     42: 
                     43: #if defined(USE_COMPILER) && !defined(USE_MAPPED_MEMORY)
                     44: #define USE_MAPPED_MEMORY
                     45: #endif
                     46: 
1.1.1.2   root       47: #define ROMmem_start 0x00E00000
                     48: #define ROMmem_size  (0x00FF0000-0x00E00000)
1.1       root       49: 
                     50: #define STmem_start 0x00000000
                     51: #define TTmem_start 0x01000000
                     52: 
                     53: #define IOmem_start 0x00FF8000
                     54: #define IOmem_size  32768
                     55: 
                     56: typedef struct {
                     57:     /* These ones should be self-explanatory... */
                     58:     mem_get_func lget, wget, bget;
                     59:     mem_put_func lput, wput, bput;
                     60:     /* Use xlateaddr to translate an Amiga address to a uae_u8 * that can
                     61:      * be used to address memory without calling the wget/wput functions.
                     62:      * This doesn't work for all memory banks, so this function may call
                     63:      * abort(). */
                     64:     xlate_func xlateaddr;
                     65:     /* To prevent calls to abort(), use check before calling xlateaddr.
                     66:      * It checks not only that the memory bank can do xlateaddr, but also
                     67:      * that the pointer points to an area of at least the specified size.
                     68:      * This is used for example to translate bitplane pointers in custom.c */
                     69:     check_func check;
                     70: } addrbank;
                     71: 
                     72: extern uae_u8 filesysory[65536];
                     73: 
                     74: extern addrbank STmem_bank;
                     75: extern addrbank ROMmem_bank;
                     76: extern addrbank custom_bank;
                     77: extern addrbank TTmem_bank;
                     78: 
                     79: extern void rtarea_init (void);
                     80: extern void rtarea_setup (void);
                     81: extern void expamem_init (void);
                     82: extern void expamem_reset (void);
                     83: 
                     84: extern uae_u32 gfxmem_start;
                     85: extern uae_u8 *gfxmemory;
                     86: extern uae_u32 gfxmem_mask;
                     87: extern int address_space_24;
                     88: 
                     89: /* Default memory access functions */
                     90: 
                     91: extern int default_check(uaecptr addr, uae_u32 size) REGPARAM;
                     92: extern uae_u8 *default_xlate(uaecptr addr) REGPARAM;
                     93: 
                     94: #define bankindex(addr) (((uaecptr)(addr)) >> 16)
                     95: 
                     96: #ifdef SAVE_MEMORY_BANKS
                     97: extern addrbank *mem_banks[65536];
                     98: #define get_mem_bank(addr) (*mem_banks[bankindex(addr)])
                     99: #define put_mem_bank(addr, b) (mem_banks[bankindex(addr)] = (b))
                    100: #else
                    101: extern addrbank mem_banks[65536];
                    102: #define get_mem_bank(addr) (mem_banks[bankindex(addr)])
                    103: #define put_mem_bank(addr, b) (mem_banks[bankindex(addr)] = *(b))
                    104: #endif
                    105: 
                    106: extern void memory_init(void);
                    107: extern void map_banks(addrbank *bank, int first, int count);
                    108: 
                    109: #ifndef NO_INLINE_MEMORY_ACCESS
                    110: 
                    111: #define longget(addr) (call_mem_get_func(get_mem_bank(addr).lget, addr))
                    112: #define wordget(addr) (call_mem_get_func(get_mem_bank(addr).wget, addr))
                    113: #define byteget(addr) (call_mem_get_func(get_mem_bank(addr).bget, addr))
                    114: #define longput(addr,l) (call_mem_put_func(get_mem_bank(addr).lput, addr, l))
                    115: #define wordput(addr,w) (call_mem_put_func(get_mem_bank(addr).wput, addr, w))
                    116: #define byteput(addr,b) (call_mem_put_func(get_mem_bank(addr).bput, addr, b))
                    117: 
                    118: #else
                    119: 
                    120: extern uae_u32 alongget(uaecptr addr);
                    121: extern uae_u32 awordget(uaecptr addr);
                    122: extern uae_u32 longget(uaecptr addr);
                    123: extern uae_u32 wordget(uaecptr addr);
                    124: extern uae_u32 byteget(uaecptr addr);
                    125: extern void longput(uaecptr addr, uae_u32 l);
                    126: extern void wordput(uaecptr addr, uae_u32 w);
                    127: extern void byteput(uaecptr addr, uae_u32 b);
                    128: 
                    129: #endif
                    130: 
                    131: #ifndef MD_HAVE_MEM_1_FUNCS
                    132: 
                    133: #define longget_1 longget
                    134: #define wordget_1 wordget
                    135: #define byteget_1 byteget
                    136: #define longput_1 longput
                    137: #define wordput_1 wordput
                    138: #define byteput_1 byteput
                    139: 
                    140: #endif
                    141: 
                    142: STATIC_INLINE uae_u32 get_long(uaecptr addr)
                    143: {
                    144:     return longget_1(addr);
                    145: }
                    146: STATIC_INLINE uae_u32 get_word(uaecptr addr)
                    147: {
                    148:     return wordget_1(addr);
                    149: }
                    150: STATIC_INLINE uae_u32 get_byte(uaecptr addr)
                    151: {
                    152:     return byteget_1(addr);
                    153: }
                    154: STATIC_INLINE void put_long(uaecptr addr, uae_u32 l)
                    155: {
                    156:     longput_1(addr, l);
                    157: }
                    158: STATIC_INLINE void put_word(uaecptr addr, uae_u32 w)
                    159: {
                    160:     wordput_1(addr, w);
                    161: }
                    162: STATIC_INLINE void put_byte(uaecptr addr, uae_u32 b)
                    163: {
                    164:     byteput_1(addr, b);
                    165: }
                    166: 
                    167: STATIC_INLINE uae_u8 *get_real_address(uaecptr addr)
                    168: {
                    169:     return get_mem_bank(addr).xlateaddr(addr);
                    170: }
                    171: 
                    172: STATIC_INLINE int valid_address(uaecptr addr, uae_u32 size)
                    173: {
                    174:     return get_mem_bank(addr).check(addr, size);
                    175: }
                    176: 
                    177: /* For faster access in custom chip emulation.  */
                    178: extern uae_u32 chipmem_lget (uaecptr) REGPARAM;
                    179: extern uae_u32 chipmem_wget (uaecptr) REGPARAM;
                    180: extern uae_u32 chipmem_bget (uaecptr) REGPARAM;
                    181: extern void chipmem_lput (uaecptr, uae_u32) REGPARAM;
                    182: extern void chipmem_wput (uaecptr, uae_u32) REGPARAM;
                    183: extern void chipmem_bput (uaecptr, uae_u32) REGPARAM;
                    184: 
                    185: 
1.1.1.3 ! root      186: #endif /* UAE_MEMORY_H */

unix.superglobalmegacorp.com

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