Accuracy fixed, major regression fix

This commit is contained in:
Lior Halphon 2019-07-19 18:19:53 +03:00
parent 10038ec76d
commit 32c781c531
3 changed files with 7 additions and 5 deletions

View File

@ -772,9 +772,6 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
// Todo: unverified timing
gb->current_lcd_line++;
if (gb->icd_hreset_callback) {
gb->icd_hreset_callback(gb);
}
if (gb->current_lcd_line == LINES && GB_is_sgb(gb)) {
display_vblank(gb);
@ -915,6 +912,10 @@ void GB_display_run(GB_gameboy_t *gb, uint8_t cycles)
}
GB_SLEEP(gb, display, 11, LINE_LENGTH - gb->cycles_for_line);
gb->mode_for_interrupt = 2;
if (gb->icd_hreset_callback) {
gb->icd_hreset_callback(gb);
}
}
/* Lines 144 - 152 */

View File

@ -1,3 +1,4 @@
auto ICD::ppuScanline() -> void {
if(++writeY == 8) {
writeBank = (writeBank + 1) & 3;
@ -10,7 +11,7 @@ auto ICD::ppuOutput(uint2 color) -> void {
if(writeX >= 160) return; // Unverified behavior
if(writeY >= 8) return; // Should never happen
uint addr = writeBank * 512 + writeY * 2 + writeX / 8 * 16;
uint addr = (writeBank & 3) * 512 + writeY * 2 + writeX / 8 * 16;
output[addr + 0] = (output[addr + 0] << 1) | !!(color & 1);
output[addr + 1] = (output[addr + 1] << 1) | !!(color & 2);
writeX++;

View File

@ -3,7 +3,7 @@ auto ICD::readIO(uint addr, uint8 data) -> uint8 {
//LY counter
if(addr == 0x6000) {
uint y = min((uint8)143, ly);
uint y = ly;
return (y & ~7) | writeBank;
}