|
|
| version 1.4, 2003/11/28 08:01:32 | version 1.8, 2004/01/30 14:33:27 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "memory.h" | #include "cpucore.h" |
| #include "egcmem.h" | #include "egcmem.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| Line 701 static void shiftinput_decw(void) { | Line 701 static void shiftinput_decw(void) { |
| } | } |
| static void gdc_ope(UINT32 ad, UINT16 value, int func) { | static void gdc_ope(UINT32 ad, REG16 value, int func) { |
| EGCQUAD pat; | EGCQUAD pat; |
| EGCQUAD dst; | EGCQUAD dst; |
| Line 721 static void gdc_ope(UINT32 ad, UINT16 va | Line 721 static void gdc_ope(UINT32 ad, UINT16 va |
| pat.d[1] = egc.fgc.d[1]; | pat.d[1] = egc.fgc.d[1]; |
| break; | break; |
| default: | default: |
| if ((egc.ope & 0x0300) == 0x0100) { // ver0.29 | if ((egc.ope & 0x0300) == 0x0100) { |
| pat.d[0] = egc_src.d[0]; | pat.d[0] = egc_src.d[0]; |
| pat.d[1] = egc_src.d[1]; | pat.d[1] = egc_src.d[1]; |
| } | } |
| Line 801 static void gdc_ope(UINT32 ad, UINT16 va | Line 801 static void gdc_ope(UINT32 ad, UINT16 va |
| break; | break; |
| default: | default: |
| #if defined(BYTESEX_LITTLE) | #if defined(BYTESEX_LITTLE) |
| data.w[0] = value; | data.w[0] = (UINT16)value; |
| data.w[1] = value; | data.w[1] = (UINT16)value; |
| data.w[2] = value; | data.w[2] = (UINT16)value; |
| data.w[3] = value; | data.w[3] = (UINT16)value; |
| #else | #else |
| data._b[0][0] = (BYTE)value; | data._b[0][0] = (BYTE)value; |
| data._b[0][1] = (BYTE)(value >> 8); | data._b[0][1] = (BYTE)(value >> 8); |
| Line 816 static void gdc_ope(UINT32 ad, UINT16 va | Line 816 static void gdc_ope(UINT32 ad, UINT16 va |
| } | } |
| } | } |
| BYTE MEMCALL egc_read(UINT32 addr) { | REG8 MEMCALL egc_read(UINT32 addr) { |
| UINT32 ad; | UINT32 ad; |
| UINT ext; | UINT ext; |
| Line 824 BYTE MEMCALL egc_read(UINT32 addr) { | Line 824 BYTE MEMCALL egc_read(UINT32 addr) { |
| if (gdcs.access) { | if (gdcs.access) { |
| addr += VRAM_STEP; | addr += VRAM_STEP; |
| } | } |
| ad = VRAM_POS(addr); | ad = VRAMADDRMASKEX(addr); |
| ext = EGCADDR(addr & 1); | ext = EGCADDR(addr & 1); |
| egc.lastvram._b[0][ext] = mem[ad + VRAM_B]; | egc.lastvram._b[0][ext] = mem[ad + VRAM_B]; |
| egc.lastvram._b[1][ext] = mem[ad + VRAM_R]; | egc.lastvram._b[1][ext] = mem[ad + VRAM_R]; |
| Line 859 BYTE MEMCALL egc_read(UINT32 addr) { | Line 859 BYTE MEMCALL egc_read(UINT32 addr) { |
| } | } |
| void MEMCALL egc_write(UINT32 addr, BYTE value) { | void MEMCALL egc_write(UINT32 addr, REG8 value) { |
| UINT ext; | UINT ext; |
| UINT16 wvalue; | REG16 wvalue; |
| addr = LOW15(addr); | addr = LOW15(addr); |
| ext = EGCADDR(addr & 1); | ext = EGCADDR(addr & 1); |
| Line 882 void MEMCALL egc_write(UINT32 addr, BYTE | Line 882 void MEMCALL egc_write(UINT32 addr, BYTE |
| egc.patreg._b[3][ext] = mem[addr + VRAM_E]; | egc.patreg._b[3][ext] = mem[addr + VRAM_E]; |
| } | } |
| wvalue = (value << 8) | (value); // ver0.28/pr4 | value = (BYTE)value; |
| wvalue = (value << 8) + value; | |
| if (!ext) { | if (!ext) { |
| gdc_ope(addr, wvalue, egc.func + 6); | gdc_ope(addr, wvalue, egc.func + 6); |
| } | } |
| Line 909 void MEMCALL egc_write(UINT32 addr, BYTE | Line 910 void MEMCALL egc_write(UINT32 addr, BYTE |
| } | } |
| } | } |
| UINT16 MEMCALL egc_read_w(UINT32 addr) { | REG16 MEMCALL egc_read_w(UINT32 addr) { |
| UINT32 ad; | UINT32 ad; |
| Line 917 UINT16 MEMCALL egc_read_w(UINT32 addr) { | Line 918 UINT16 MEMCALL egc_read_w(UINT32 addr) { |
| if (gdcs.access) { | if (gdcs.access) { |
| addr += VRAM_STEP; | addr += VRAM_STEP; |
| } | } |
| ad = VRAM_POS(addr); | ad = VRAMADDRMASKEX(addr); |
| egc.lastvram.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]); | egc.lastvram.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]); |
| egc.lastvram.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]); | egc.lastvram.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]); |
| egc.lastvram.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]); | egc.lastvram.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]); |
| Line 965 UINT16 MEMCALL egc_read_w(UINT32 addr) { | Line 966 UINT16 MEMCALL egc_read_w(UINT32 addr) { |
| return(LOADINTELWORD(mem + addr)); | return(LOADINTELWORD(mem + addr)); |
| } | } |
| else if (!(egc.sft & 0x1000)) { | else if (!(egc.sft & 0x1000)) { |
| UINT16 ret; | REG16 ret; |
| ret = egc_read(addr); | ret = egc_read(addr); |
| ret |= egc_read(addr+1) << 8; | ret |= egc_read(addr+1) << 8; |
| return(ret); | return(ret); |
| } | } |
| else { | else { |
| UINT16 ret; | REG16 ret; |
| ret = egc_read(addr+1) << 8; | ret = egc_read(addr+1) << 8; |
| ret |= egc_read(addr); | ret |= egc_read(addr); |
| return(ret); | return(ret); |
| } | } |
| } | } |
| void MEMCALL egc_write_w(UINT32 addr, UINT16 value) { | void MEMCALL egc_write_w(UINT32 addr, REG16 value) { |
| if (!(addr & 1)) { // word access | if (!(addr & 1)) { // word access |
| addr = LOW15(addr); | addr = LOW15(addr); |
| Line 1018 void MEMCALL egc_write_w(UINT32 addr, UI | Line 1019 void MEMCALL egc_write_w(UINT32 addr, UI |
| } | } |
| } | } |
| else if (!(egc.sft & 0x1000)) { | else if (!(egc.sft & 0x1000)) { |
| egc_write(addr, (BYTE)value); | egc_write(addr, (REG8)value); |
| egc_write(addr+1, (BYTE)(value >> 8)); | egc_write(addr+1, (REG8)(value >> 8)); |
| } | } |
| else { | else { |
| egc_write(addr+1, (BYTE)(value >> 8)); | egc_write(addr+1, (REG8)(value >> 8)); |
| egc_write(addr, (BYTE)value); | egc_write(addr, (REG8)value); |
| } | } |
| } | } |