diff options
author | Alec Murphy <alec@checksum.fail> | 2017-06-10 22:07:11 -0400 |
---|---|---|
committer | Alec Murphy <alec@checksum.fail> | 2017-06-10 22:07:11 -0400 |
commit | eb0a45c306b47f2bd21f675273803cfa6979d9cc (patch) | |
tree | 0e776a015291a30e098cd7b34db4c92af3e34786 | |
parent | 330a440cabc0a896ce060f31b6ba6025c06e7293 (diff) |
Fixes #2
-rw-r--r-- | LCD.HC | 34 | ||||
-rw-r--r-- | LCDController.HC | 3 | ||||
-rw-r--r-- | Load.HC | 15 |
3 files changed, 17 insertions, 35 deletions
@@ -78,6 +78,10 @@ U0 renderBG_ScanLine() I64 bg_tc_row=0; I64 bg_tc_ec=0; I64 bg_tc_tc=0; + + bg_tc_row=memory[0xFF42]/8; + bg_tc_ec=memory[0xFF42]%8; + while (bg_tc_tc<actualScanLine) { bg_tc_tc++; @@ -85,6 +89,8 @@ U0 renderBG_ScanLine() if (bg_tc_ec>7) { bg_tc_ec=0; bg_tc_row++; }; }; + if (bg_tc_row>31) { bg_tc_row-=32; }; + bg_tctr=(32*bg_tc_row); bg_bx=0; bg_by=0; @@ -154,34 +160,18 @@ U0 renderBG_ScanLine() }; }; - GrBlot(bgr,-memory[0xFF43],-memory[0xFF42]+actualScanLine,bg_s); - if (memory[0xFF42]) - { - GrBlot(bgr,memory[0xFF43],memory[0xFF42]+256+actualScanLine,bg_s); - }; + GrBlot(bgr,-memory[0xFF43],actualScanLine,bg_s); if (memory[0xFF43]) { - GrBlot(bgr,-memory[0xFF43]+256,-memory[0xFF42]+actualScanLine,bg_s); - }; - if (memory[0xFF42] && memory[0xFF43]) - { - GrBlot(bgr,-memory[0xFF43]+256,-memory[0xFF42]+256+actualScanLine,bg_s); + GrBlot(bgr,-memory[0xFF43]+256,actualScanLine,bg_s); }; if (sp0_e) { - GrBlot(sp0,-memory[0xFF43],-memory[0xFF42]+actualScanLine,sp0_s); - if (memory[0xFF42]) - { - GrBlot(sp0,memory[0xFF43],memory[0xFF42]+256+actualScanLine,sp0_s); - }; + GrBlot(sp0,-memory[0xFF43],actualScanLine,sp0_s); if (memory[0xFF43]) { - GrBlot(sp0,-memory[0xFF43]+256,-memory[0xFF42]+actualScanLine,sp0_s); - }; - if (memory[0xFF42] && memory[0xFF43]) - { - GrBlot(sp0,-memory[0xFF43]+256,-memory[0xFF42]+256+actualScanLine,sp0_s); + GrBlot(sp0,-memory[0xFF43]+256,actualScanLine,sp0_s); }; }; @@ -260,7 +250,7 @@ U0 renderSprites() tp3=0; }; - if ((memory[0xFE00+oam_ctr+3]>>7)&1==0) + if ((memory[0xFE00+oam_ctr+3]>>7)&1==0) { odc=sp1; } else { @@ -287,7 +277,7 @@ U0 renderSprites() if((tp2>>bg_px)&1){odc->color=sp01;}else{odc->color=TRANSPARENT;}; }; if (odc->color!=TRANSPARENT) { - GrPlot(odc,memory[0xFE00+oam_ctr+1]-8+(7-sp_px),(-8*sp_yf)+8+memory[0xFE00+oam_ctr]-16+sp_py); + GrPlot(odc,memory[0xFE00+oam_ctr+1]-8+(7-sp_px),(-8*sp_yf)+8+memory[0xFE00+oam_ctr]-16+sp_py); }; }; diff --git a/LCDController.HC b/LCDController.HC index e94e727..7c99618 100644 --- a/LCDController.HC +++ b/LCDController.HC @@ -23,7 +23,7 @@ U0 notifyScanline() if (windowLeft < 160) { ++windowSourceLine; - } + } } U0 scanLineMode0() @@ -141,6 +141,7 @@ U0 scanLine(I64 line) } else { //VBlank Ending (We're on the last actual scan line) if (memory[0xFF44] == 153) { + memory[0xFF44] = 0; //LY register resets to 0 early. matchLYC; //LY==LYC Test is early here (Fixes specific one-line glitches (example: Kirby2 intro)). } @@ -650,7 +650,7 @@ U0 memoryWrite(I64 address, I64 data) currMBCRAMBank = data & 0x03; currMBCRAMBankPosition = (currMBCRAMBank << 13) - 0xA000; } else { - //We might have encountered illegal RAM writing or such, so just do nothing... + //We might have encountered illegal RAM writing or such, so just do nothing... } } else { //We might have encountered illegal RAM writing or such, so just do nothing... @@ -661,15 +661,6 @@ U0 memoryWrite(I64 address, I64 data) if (modeSTAT < 3) { // Bkg Tile data area if (address < 0x9800) { - //I64 tileIndex = ((address - 0x8000) >> 4); - //if (tileReadState[tileIndex] == 1) { - // I64 r = count(tileData) - tileCount + tileIndex; - // do { - // tileData[r] = null; - // r -= tileCount; - // } while (r >= 0); - // tileReadState[tileIndex] = 0; - //} } memory[address] = data; } @@ -912,13 +903,13 @@ U0 updateCore() audioTicks += timedTicks; //Not the same as the LCD timing (Cannot be altered by display on/off changes!!!). //Are we past the granularity setting? if (audioTicks >= audioGranularity) { + sc=InU8(0x60); //Emulator Timing (Timed against audio for optimization): emulatorTicks += audioTicks; if (emulatorTicks >= machineCyclesPerLoop) { //LCD off takes at least 2 frames. if (drewBlank == 0) { - sc=InU8(0x60); renderSprites; drawFrameBuffer; }; @@ -1050,7 +1041,7 @@ U0 executeIteration() for (keyCtr=0;keyCtr<8;keyCtr++) { joyPadEvent(keyCtr,jp_state[keyCtr]); }; - + Sleep(0); }; } |