From: Forgotten <for...@us...> - 2004-03-20 00:28:27
|
Update of /cvsroot/vba/VisualBoyAdvance/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11808/src Modified Files: GBA.cpp Gfx.h arm-new.h thumb.h Log Message: Final updates Index: Gfx.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Gfx.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Gfx.h 16 Feb 2004 03:08:40 -0000 1.10 --- Gfx.h 20 Mar 2004 00:18:33 -0000 1.11 *************** *** 26,29 **** --- 26,31 ---- #include "Port.h" + //#define SPRITE_DEBUG + void gfxDrawTextScreen(u16, u16, u16, u32 *); void gfxDrawRotScreen(u16, *************** *** 763,766 **** --- 765,773 ---- } + #ifdef SPRITE_DEBUG + int maskX = sizeX-1; + int maskY = sizeY-1; + #endif + int sy = (a0 & 255); *************** *** 828,844 **** (xxx & 7))&0x7FFF)]; if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; } if (a0 & 0x1000) { - if (m) - lineOBJ[sx]=lineOBJ[sx-1]; m++; if (m==mosaicX) m=0; } } sx = (sx+1)&511;; --- 835,857 ---- (xxx & 7))&0x7FFF)]; if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! if((a0 & 0x1000) && m) ! lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; ! } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; } if (a0 & 0x1000) { m++; if (m==mosaicX) m=0; } + #ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || x == 0 || x == maskX) + lineOBJ[sx] = 0x001F; + #endif } sx = (sx+1)&511;; *************** *** 871,887 **** if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette+color]) | prio; } } ! if (a0 & 0x1000) { ! if (m) ! lineOBJ[sx]=lineOBJ[sx-1]; m++; if (m==mosaicX) m=0; } sx = (sx+1)&511;; realX += dx; --- 884,907 ---- if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! if((a0 & 0x1000) && m) ! lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; ! } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette+color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; } } ! if((a0 & 0x1000) && m) { m++; if (m==mosaicX) m=0; } + + #ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || x == 0 || x == maskX) + lineOBJ[sx] = 0x001F; + #endif sx = (sx+1)&511;; realX += dx; *************** *** 929,944 **** u8 color = vram[address]; if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; } if (a0 & 0x1000) { - if (m) - lineOBJ[sx]=lineOBJ[sx-1]; m++; if (m==mosaicX) m=0; } } --- 949,972 ---- u8 color = vram[address]; if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! if((a0 & 0x1000) && m) ! lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; ! } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; } + if (a0 & 0x1000) { m++; if (m==mosaicX) m=0; } + + #ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; + #endif } *************** *** 998,1014 **** if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; } } if (a0 & 0x1000) { - if (m) - lineOBJ[sx]=lineOBJ[sx-1]; m++; if (m==mosaicX) m=0; } sx = (sx+1) & 511; xxx--; --- 1026,1048 ---- if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! if((a0 & 0x1000) && m) ! lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; ! } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; } } if (a0 & 0x1000) { m++; if (m==mosaicX) m=0; } + #ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; + #endif sx = (sx+1) & 511; xxx--; *************** *** 1032,1048 **** if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; } } if (a0 & 0x1000) { - if (m) - lineOBJ[sx]=lineOBJ[sx-1]; m++; if (m==mosaicX) m=0; } sx = (sx+1) & 511; xxx++; --- 1066,1089 ---- if ((color==0) && (((prio >> 25)&3) < ! ((lineOBJ[sx]>>25)&3))) { lineOBJ[sx] = (lineOBJ[sx] & 0xF9FFFFFF) | prio; ! if((a0 & 0x1000) && m) ! lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; ! } else if((color) && (prio < (lineOBJ[sx]&0xFF000000))) { lineOBJ[sx] = READ16LE(&spritePalette[palette + color]) | prio; + if((a0 & 0x1000) && m) + lineOBJ[sx]=(lineOBJ[sx-1] & 0xF9FFFFFF) | prio; + } } if (a0 & 0x1000) { m++; if (m==mosaicX) m=0; } + #ifdef SPRITE_DEBUG + if(t == 0 || t == maskY || xx == 0 || xx == maskX) + lineOBJ[sx] = 0x001F; + #endif sx = (sx+1) & 511; xxx++; Index: arm-new.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/arm-new.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** arm-new.h 8 Dec 2003 11:38:17 -0000 1.8 --- arm-new.h 20 Mar 2004 00:18:33 -0000 1.9 *************** *** 1817,1821 **** u32 opcode = CPUReadMemoryQuick(armNextPC); ! clockTicks = memoryWait32[(armNextPC >> 24) & 15]; #ifndef FINAL_VERSION --- 1817,1821 ---- u32 opcode = CPUReadMemoryQuick(armNextPC); ! clockTicks = memoryWaitFetch32[(armNextPC >> 24) & 15]; #ifndef FINAL_VERSION Index: thumb.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/thumb.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** thumb.h 4 Nov 2003 14:11:52 -0000 1.9 --- thumb.h 20 Mar 2004 00:18:34 -0000 1.10 *************** *** 764,768 **** u32 opcode = CPUReadHalfWordQuick(armNextPC); ! clockTicks = thumbCycles[opcode >> 8] + cpuMemoryWait[(armNextPC >> 24) & 15]; #ifndef FINAL_VERSION if(armNextPC == stop) { --- 764,768 ---- u32 opcode = CPUReadHalfWordQuick(armNextPC); ! clockTicks = thumbCycles[opcode >> 8] + memoryWaitFetch[(armNextPC >> 24) & 15]; #ifndef FINAL_VERSION if(armNextPC == stop) { Index: GBA.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/GBA.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** GBA.cpp 6 Feb 2004 11:26:58 -0000 1.52 --- GBA.cpp 20 Mar 2004 00:18:33 -0000 1.53 *************** *** 165,169 **** { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; int memoryWait32[16] = ! { 0, 0, 6, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 0 }; int memoryWaitSeq[16] = { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; --- 165,169 ---- { 0, 0, 2, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0 }; int memoryWait32[16] = ! { 0, 0, 9, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 0 }; int memoryWaitSeq[16] = { 0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 4, 4, 8, 8, 4, 0 }; *************** *** 529,540 **** } ! inline void CPUUpdateTicks(int &cpuLoopTicks) { ! cpuLoopTicks = lcdTicks; if(soundTicks < cpuLoopTicks) cpuLoopTicks = soundTicks; ! if(timer0On && (timer0Ticks < cpuLoopTicks)) { cpuLoopTicks = timer0Ticks; } --- 529,540 ---- } ! inline int CPUUpdateTicks() { ! int cpuLoopTicks = lcdTicks; if(soundTicks < cpuLoopTicks) cpuLoopTicks = soundTicks; ! if(timer0On && !(TM0CNT & 4) && (timer0Ticks < cpuLoopTicks)) { cpuLoopTicks = timer0Ticks; } *************** *** 556,559 **** --- 556,560 ---- #endif cpuSavedTicks = cpuLoopTicks; + return cpuLoopTicks; } *************** *** 2650,2690 **** break; case 0x204: - memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; - - if(!speedHack) { - memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 7]; - memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = - gamepakWaitState0[(value >> 2) & 7]; - - memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 7]; - memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = - gamepakWaitState1[(value >> 5) & 7]; - - memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 7]; - memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = - gamepakWaitState2[(value >> 8) & 7]; - } else { - memoryWait[0x08] = memoryWait[0x09] = 4; - memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 2; - - memoryWait[0x0a] = memoryWait[0x0b] = 4; - memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 4; - - memoryWait[0x0c] = memoryWait[0x0d] = 4; - memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 8; - } { ! for(int i = 0; i < 16; i++) { memoryWaitFetch32[i] = memoryWait32[i] = memoryWait[i] * (memory32[i] ? 1 : 2); memoryWaitFetch[i] = memoryWait[i]; } ! } ! if(value & 0x4000) { ! for(int i = 0; i < 16; i++) { ! memoryWaitFetch32[i] = memoryWaitFetch[i] = cpuMemoryWait[i]; } } - UPDATE_REG(0x204, value); break; case 0x208: --- 2651,2696 ---- break; case 0x204: { ! int i; ! memoryWait[0x0e] = memoryWaitSeq[0x0e] = gamepakRamWaitState[value & 3]; ! ! if(!speedHack) { ! memoryWait[0x08] = memoryWait[0x09] = gamepakWaitState[(value >> 2) & 7]; ! memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = ! gamepakWaitState0[(value >> 2) & 7]; ! ! memoryWait[0x0a] = memoryWait[0x0b] = gamepakWaitState[(value >> 5) & 7]; ! memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = ! gamepakWaitState1[(value >> 5) & 7]; ! ! memoryWait[0x0c] = memoryWait[0x0d] = gamepakWaitState[(value >> 8) & 7]; ! memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = ! gamepakWaitState2[(value >> 8) & 7]; ! } else { ! memoryWait[0x08] = memoryWait[0x09] = 4; ! memoryWaitSeq[0x08] = memoryWaitSeq[0x09] = 2; ! ! memoryWait[0x0a] = memoryWait[0x0b] = 4; ! memoryWaitSeq[0x0a] = memoryWaitSeq[0x0b] = 4; ! ! memoryWait[0x0c] = memoryWait[0x0d] = 4; ! memoryWaitSeq[0x0c] = memoryWaitSeq[0x0d] = 8; ! } ! for(i = 0; i < 16; i++) { memoryWaitFetch32[i] = memoryWait32[i] = memoryWait[i] * (memory32[i] ? 1 : 2); memoryWaitFetch[i] = memoryWait[i]; } ! memoryWaitFetch32[3] += 1; ! memoryWaitFetch32[2] += 3; ! ! if(value & 0x4000) { ! for(i = 8; i < 16; i++) { ! memoryWaitFetch32[i] = 2*cpuMemoryWait[i]; ! memoryWaitFetch[i] = cpuMemoryWait[i]; ! } } + UPDATE_REG(0x204, value); } break; case 0x208: *************** *** 3348,3352 **** extTicks = &ticks; ! CPUUpdateTicks(cpuLoopTicks); if(cpuLoopTicks > ticks) { cpuLoopTicks = ticks; --- 3354,3358 ---- extTicks = &ticks; ! cpuLoopTicks = CPUUpdateTicks(); if(cpuLoopTicks > ticks) { cpuLoopTicks = ticks; *************** *** 3423,3426 **** --- 3429,3433 ---- clockTicks = cpuSavedTicks;// + cpuLoopTicks; } + cpuDmaTicksToUpdate = -cpuLoopTicks; updateLoop: *************** *** 3866,3870 **** ticks -= clockTicks; ! CPUUpdateTicks(cpuLoopTicks); if(cpuDmaTicksToUpdate > 0) { --- 3873,3877 ---- ticks -= clockTicks; ! cpuLoopTicks = CPUUpdateTicks(); if(cpuDmaTicksToUpdate > 0) { |