| version 1.5, 2003/11/29 00:36:00 | version 1.9, 2003/12/03 07:59:57 | 
| Line 9 | Line 9 | 
 |  |  | 
 |  |  | 
 | #define USE_HIMEM | #define USE_HIMEM | 
 |  | #if defined(TRACE) | 
 | #define MEMORY_DEBUG | #define MEMORY_DEBUG | 
 |  | #endif | 
 |  |  | 
 | // ---- write byte | // ---- write byte | 
 |  |  | 
 | static void MEMCALL i286_wt(UINT32 address, REG8 value) { | static void MEMCALL i286_wt(UINT32 address, REG8 value) { | 
 |  |  | 
| mem[address & extmem.adrsmask] = (BYTE)value; | mem[address & i286core.s.adrsmask] = (BYTE)value; | 
 | } | } | 
 |  |  | 
 | static void MEMCALL tram_wt(UINT32 address, REG8 value) { | static void MEMCALL tram_wt(UINT32 address, REG8 value) { | 
| Line 193  static void MEMCALL i286_wn(UINT32 addre | Line 195  static void MEMCALL i286_wn(UINT32 addre | 
 |  |  | 
 | static REG8 MEMCALL i286_rd(UINT32 address) { | static REG8 MEMCALL i286_rd(UINT32 address) { | 
 |  |  | 
| return(mem[address & extmem.adrsmask]); | return(mem[address & i286core.s.adrsmask]); | 
 | } | } | 
 |  |  | 
 | static REG8 MEMCALL tram_rd(UINT32 address) { | static REG8 MEMCALL tram_rd(UINT32 address) { | 
| Line 283  static REG8 MEMCALL emmc_rd(UINT32 addre | Line 285  static REG8 MEMCALL emmc_rd(UINT32 addre | 
 |  |  | 
 | static REG8 MEMCALL i286_itf(UINT32 address) { | static REG8 MEMCALL i286_itf(UINT32 address) { | 
 |  |  | 
| if (itf.bank) { | if (i286core.s.itfbank) { | 
 | address = ITF_ADRS + LOW15(address); | address = ITF_ADRS + LOW15(address); | 
 | } | } | 
 | return(mem[address]); | return(mem[address]); | 
| Line 296  static void MEMCALL i286w_wt(UINT32 addr | Line 298  static void MEMCALL i286w_wt(UINT32 addr | 
 |  |  | 
 | BYTE    *ptr; | BYTE    *ptr; | 
 |  |  | 
| ptr = mem + (address & extmem.adrsmask); | ptr = mem + (address & i286core.s.adrsmask); | 
 | STOREINTELWORD(ptr, value); | STOREINTELWORD(ptr, value); | 
 | } | } | 
 |  |  | 
| Line 461  static void MEMCALL emmcw_wt(UINT32 addr | Line 463  static void MEMCALL emmcw_wt(UINT32 addr | 
 | } | } | 
 | else { | else { | 
 | extmem.pageptr[(address >> 14) & 3][0x3fff] = (BYTE)value; | extmem.pageptr[(address >> 14) & 3][0x3fff] = (BYTE)value; | 
| extmem.pageptr[((address + 1)>> 14) & 3][0] = (BYTE)(value >> 8); | extmem.pageptr[((address + 1) >> 14) & 3][0] = (BYTE)(value >> 8); | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 478  static REG16 MEMCALL i286w_rd(UINT32 add | Line 480  static REG16 MEMCALL i286w_rd(UINT32 add | 
 |  |  | 
 | BYTE    *ptr; | BYTE    *ptr; | 
 |  |  | 
| ptr = mem + (address & extmem.adrsmask); | ptr = mem + (address & i286core.s.adrsmask); | 
 | return(LOADINTELWORD(ptr)); | return(LOADINTELWORD(ptr)); | 
 | } | } | 
 |  |  | 
| Line 543  static REG16 MEMCALL grcgw_tcr0(UINT32 a | Line 545  static REG16 MEMCALL grcgw_tcr0(UINT32 a | 
 | if (!(grcg.modereg & 8)) { | if (!(grcg.modereg & 8)) { | 
 | ret |= LOADINTELWORD(vram + VRAM0_E) ^ grcg.tile[3].w; | ret |= LOADINTELWORD(vram + VRAM0_E) ^ grcg.tile[3].w; | 
 | } | } | 
| return(~ret); | return((UINT16)~ret); | 
 | } | } | 
 |  |  | 
 | static REG16 MEMCALL grcgw_tcr1(UINT32 address) { | static REG16 MEMCALL grcgw_tcr1(UINT32 address) { | 
| Line 592  static REG16 MEMCALL egcw_rd(UINT32 addr | Line 594  static REG16 MEMCALL egcw_rd(UINT32 addr | 
 |  |  | 
 | static REG16 MEMCALL emmcw_rd(UINT32 address) { | static REG16 MEMCALL emmcw_rd(UINT32 address) { | 
 |  |  | 
| BYTE    *ptr; | const BYTE      *ptr; | 
|  | REG16   ret; | 
 |  |  | 
| ptr = extmem.pageptr[(address >> 14) & 3] + LOW14(address); | if ((address & 0x3fff) != 0x3fff) { | 
| return(LOADINTELWORD(ptr)); | ptr = extmem.pageptr[(address >> 14) & 3] + LOW14(address); | 
|  | return(LOADINTELWORD(ptr)); | 
|  | } | 
|  | else { | 
|  | ret = extmem.pageptr[(address >> 14) & 3][0x3fff]; | 
|  | ret += extmem.pageptr[((address + 1) >> 14) & 3][0] << 8; | 
|  | return(ret); | 
|  | } | 
 | } | } | 
 |  |  | 
 | static REG16 MEMCALL i286w_itf(UINT32 address) { | static REG16 MEMCALL i286w_itf(UINT32 address) { | 
 |  |  | 
| if (itf.bank) { | if (i286core.s.itfbank) { | 
 | address = ITF_ADRS + LOW15(address); | address = ITF_ADRS + LOW15(address); | 
 | } | } | 
 | return(LOADINTELWORD(mem + address)); | return(LOADINTELWORD(mem + address)); | 
| Line 789  static REG16 MEMCALL _i286_memoryread_w( | Line 799  static REG16 MEMCALL _i286_memoryread_w( | 
 | REG8 MEMCALL i286_memoryread(UINT32 address) { | REG8 MEMCALL i286_memoryread(UINT32 address) { | 
 |  |  | 
 | REG8    r; | REG8    r; | 
 |  |  | 
 | r = _i286_memoryread(address); | r = _i286_memoryread(address); | 
 | if (r & 0xffffff00) { | if (r & 0xffffff00) { | 
| TRACEOUT(("error i286_memoryread %x", r)); | TRACEOUT(("error i286_memoryread %x %x", address, r)); | 
 | } | } | 
 | return(r); | return(r); | 
 | } | } | 
| Line 802  REG16 MEMCALL i286_memoryread_w(UINT32 a | Line 813  REG16 MEMCALL i286_memoryread_w(UINT32 a | 
 |  |  | 
 | r = _i286_memoryread_w(address); | r = _i286_memoryread_w(address); | 
 | if (r & 0xffff0000) { | if (r & 0xffff0000) { | 
| TRACEOUT(("error i286_memoryread_w %x", r)); | TRACEOUT(("error i286_memoryread_w %x %x", address, r)); | 
 | } | } | 
 | return(r); | return(r); | 
 | } | } |