| version 1.6, 2003/12/27 11:55:23 | version 1.8, 2004/02/20 16:09:04 | 
| Line 1 | Line 1 | 
 |  |  | 
 | #ifndef NP2_I386C_MEMORY_H__ | #ifndef NP2_I386C_MEMORY_H__ | 
 | #define NP2_I386C_MEMORY_H__ | #define NP2_I386C_MEMORY_H__ | 
 |  |  | 
| #ifdef NP2_MEMORY_ASM                                   // アセンブラ版は 必ずfastcallで | #ifdef NP2_MEMORY_ASM                   // アセンブラ版は 必ずfastcallで | 
 | #undef  MEMCALL | #undef  MEMCALL | 
 | #define MEMCALL FASTCALL | #define MEMCALL FASTCALL | 
 | #endif | #endif | 
| Line 37 | Line 36 | 
 | #define FONT_ADRS       0x110000 | #define FONT_ADRS       0x110000 | 
 | #define ITF_ADRS        0x1f8000 | #define ITF_ADRS        0x1f8000 | 
 |  |  | 
 | #if defined(CPUCORE_IA32) |  | 
 | #if 0 |  | 
 | #define LOWMEM          0x100000 |  | 
 | #else |  | 
 | #define LOWMEM          0x10fff0 |  | 
 | #endif |  | 
 | #endif  /* CPUCORE_IA32 */ |  | 
 |  |  | 
 |  |  | 
 | #if defined(BYTESEX_LITTLE) |  | 
 |  |  | 
 | #define MEM_SETB(pos, data)             mem[pos] = data |  | 
 | #define MEM_ANDB(pos, data)             mem[pos] &= data |  | 
 | #define MEM_XORB(pos, data)             mem[pos] ^= data |  | 
 | #define MEM_ORB(pos, data)              mem[pos] |= data |  | 
 | #define MEM_SETW(pos, data)             *(WORD *)(mem + (pos)) = (data) |  | 
 | #define MEM_SETD(pos, data)             *(DWORD *)(mem + (pos)) = (data) |  | 
 | #define MEM_GETB(pos)                   (mem[pos]) |  | 
 | #define MEM_GETW(pos)                   (*(WORD *)(mem + (pos))) |  | 
 | #define MEM_GETD(pos)                   (*(DWORD *)(mem + (pos))) |  | 
 |  |  | 
 | #elif defined(BYTESEX_BIG) |  | 
 |  |  | 
 | #define MEM_SETB(pos, data)             mem[pos] = data |  | 
 | #define MEM_ANDB(pos, data)             mem[pos] &= data |  | 
 | #define MEM_XORB(pos, data)             mem[pos] ^= data |  | 
 | #define MEM_ORB(pos, data)              mem[pos] |= data |  | 
 | #define MEM_SETW(pos, data)                                                                                             \ |  | 
 | mem[(pos)] = (BYTE)data;                                                                        \ |  | 
 | mem[(pos) + 1] = (BYTE)(data >> 8); |  | 
 | #define MEM_SETD(pos, data)                                                                                             \ |  | 
 | mem[(pos)] = (BYTE)data;                                                                        \ |  | 
 | mem[(pos) + 1] = (BYTE)(data >> 8);                                                     \ |  | 
 | mem[(pos) + 2] = (BYTE)(data >> 16);                                            \ |  | 
 | mem[(pos) + 3] = (BYTE)(data >> 24); |  | 
 | #define MEM_GETB(pos)                   (mem[pos]) |  | 
 | #define MEM_GETW(pos)                                                                                                   \ |  | 
 | (((WORD)mem[(pos) + 1] << 8) | mem[(pos)]) |  | 
 | #define MEM_GETD(pos)                                                                                                   \ |  | 
 | (((DWORD)mem[(pos) + 3] << 24) |                                                        \ |  | 
 | ((DWORD)mem[(pos) + 2] << 16) |                                                        \ |  | 
 | ((WORD)mem[(pos) + 1] <<  8) | mem[(pos)]) |  | 
 | #endif |  | 
 |  |  | 
 |  |  | 
 | #ifdef __cplusplus | #ifdef __cplusplus | 
 | extern "C" { | extern "C" { | 
 | #endif | #endif | 
| Line 91  extern BYTE mem[0x200000]; | Line 45  extern BYTE mem[0x200000]; | 
 | void MEMCALL i286_memorymap(UINT type); | void MEMCALL i286_memorymap(UINT type); | 
 | void MEMCALL i286_vram_dispatch(UINT operate); | void MEMCALL i286_vram_dispatch(UINT operate); | 
 |  |  | 
| void MEMCALL __i286_memorywrite(UINT32 address, REG8 value); | void MEMCALL i286_memorywrite(UINT32 address, REG8 value); | 
| void MEMCALL __i286_memorywrite_w(UINT32 address, REG16 value); | void MEMCALL i286_memorywrite_w(UINT32 address, REG16 value); | 
| void MEMCALL __i286_memorywrite_d(UINT32 address, UINT32 value); | void MEMCALL i286_memorywrite_d(UINT32 address, UINT32 value); | 
| REG8 MEMCALL __i286_memoryread(UINT32 address); | REG8 MEMCALL i286_memoryread(UINT32 address); | 
| REG16 MEMCALL __i286_memoryread_w(UINT32 address); | REG16 MEMCALL i286_memoryread_w(UINT32 address); | 
| UINT32 MEMCALL __i286_memoryread_d(UINT32 address); | UINT32 MEMCALL i286_memoryread_d(UINT32 address); | 
|  |  | 
| #ifndef CPUCORE_IA32 |  | 
| #define i286_memorywrite(a,v)   __i286_memorywrite(a,v) |  | 
| #define i286_memorywrite_w(a,v) __i286_memorywrite_w(a,v) |  | 
| #define i286_memorywrite_d(a,v) __i286_memorywrite_d(a,v) |  | 
| #define i286_memoryread(a)              __i286_memoryread(a) |  | 
| #define i286_memoryread_w(a)    __i286_memoryread_w(a) |  | 
| #define i286_memoryread_d(a)    __i286_memoryread_d(a) |  | 
| #else   /* CPUCORE_IA32 */ |  | 
| void MEMCALL cpu_memorywrite(DWORD address, BYTE value); |  | 
| void MEMCALL cpu_memorywrite_w(DWORD address, WORD value); |  | 
| void MEMCALL cpu_memorywrite_d(DWORD address, DWORD value); |  | 
| BYTE MEMCALL cpu_memoryread(DWORD address); |  | 
| WORD MEMCALL cpu_memoryread_w(DWORD address); |  | 
| DWORD MEMCALL cpu_memoryread_d(DWORD address); |  | 
| #define i286_memorywrite(a,v)   cpu_memorywrite(a,v) |  | 
| #define i286_memorywrite_w(a,v) cpu_memorywrite_w(a,v) |  | 
| #define i286_memorywrite_d(a,v) cpu_memorywrite_d(a,v) |  | 
| #define i286_memoryread(a)              cpu_memoryread(a) |  | 
| #define i286_memoryread_w(a)    cpu_memoryread_w(a) |  | 
| #define i286_memoryread_d(a)    cpu_memoryread_d(a) |  | 
| #endif  /* !CPUCORE_IA32 */ |  | 
 |  |  | 
 | #ifdef NP2_MEMORY_ASM | #ifdef NP2_MEMORY_ASM | 
| BYTE MEMCALL i286_membyte_read(WORD seg, WORD off); | REG8 MEMCALL i286_membyte_read(UINT seg, UINT off); | 
| WORD MEMCALL i286_memword_read(WORD seg, WORD off); | REG16 MEMCALL i286_memword_read(UINT seg, UINT off); | 
| void MEMCALL i286_membyte_write(WORD seg, WORD off, BYTE dat); | void MEMCALL i286_membyte_write(UINT seg, UINT off, REG8 dat); | 
| void MEMCALL i286_memword_write(WORD seg, WORD off, WORD dat); | void MEMCALL i286_memword_write(UINT seg, UINT off, REG16 dat); | 
 | #else | #else | 
| #define i286_membyte_read(a, b)                                                                         \ | #define i286_membyte_read(a, b) \ | 
| i286_memoryread(((DWORD)(a) << 4) + (WORD)(b)) | i286_memoryread(((UINT32)(a) << 4) + (UINT16)(b)) | 
| #define i286_memword_read(a, b)                                                                         \ | #define i286_memword_read(a, b) \ | 
| i286_memoryread_w(((DWORD)(a) << 4) + (WORD)(b)) | i286_memoryread_w(((UINT32)(a) << 4) + (UINT16)(b)) | 
|  |  | 
| #define i286_membyte_write(a, b, c)                                                                     \ | #define i286_membyte_write(a, b, c) \ | 
| i286_memorywrite(((DWORD)(a) << 4) + (WORD)(b), (c)) | i286_memorywrite(((UINT32)(a) << 4) + (UINT16)(b), (c)) | 
| #define i286_memword_write(a, b, c)                                                                     \ | #define i286_memword_write(a, b, c) \ | 
| i286_memorywrite_w(((DWORD)(a) << 4) + (WORD)(b), (c)) | i286_memorywrite_w(((UINT32)(a) << 4) + (UINT16)(b), (c)) | 
 | #endif | #endif | 
 |  |  | 
 | void MEMCALL i286_memstr_read(UINT seg, UINT off, void *dat, UINT leng); | void MEMCALL i286_memstr_read(UINT seg, UINT off, void *dat, UINT leng); | 
| void MEMCALL i286_memstr_write(UINT seg, UINT off, | void MEMCALL i286_memstr_write(UINT seg, UINT off, const void *dat, UINT leng); | 
| const void *dat, UINT leng); |  | 
 | void MEMCALL i286_memx_read(UINT32 address, void *dat, UINT leng); | void MEMCALL i286_memx_read(UINT32 address, void *dat, UINT leng); | 
 | void MEMCALL i286_memx_write(UINT32 address, const void *dat, UINT leng); | void MEMCALL i286_memx_write(UINT32 address, const void *dat, UINT leng); | 
 |  |  | 
| Line 148  void MEMCALL i286_memx_write(UINT32 addr | Line 79  void MEMCALL i286_memx_write(UINT32 addr | 
 | #endif | #endif | 
 |  |  | 
 | #endif  /* !NP2_I386C_MEMORY_H__ */ | #endif  /* !NP2_I386C_MEMORY_H__ */ | 
 |  |  |