Skip to content

Commit

Permalink
#13 pass halt_ime0_nointr_timing test
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsuki105 committed May 30, 2020
1 parent 34e695c commit 7adfd40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/emulator/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ func (cpu *CPU) exec() bool {

func (cpu *CPU) execScanline() (scx uint, scy uint, ok bool) {
// OAM mode2
cpu.cycle.scanline = 0
cpu.setOAMRAMMode()
for cpu.cycle.scanline <= 20*cpu.boost {
if inBreak := cpu.exec(); inBreak {
Expand All @@ -513,7 +512,7 @@ func (cpu *CPU) execScanline() (scx uint, scy uint, ok bool) {
}

// LCD Driver mode3
cpu.cycle.scanline = 0
cpu.cycle.scanline -= 20 * cpu.boost
cpu.setLCDMode()
for cpu.cycle.scanline <= 42*cpu.boost {
if inBreak := cpu.exec(); inBreak {
Expand All @@ -524,13 +523,15 @@ func (cpu *CPU) execScanline() (scx uint, scy uint, ok bool) {
scrollX, scrollY := cpu.GPU.GetScroll()

// HBlank mode0
cpu.cycle.scanline = 0
cpu.cycle.scanline -= 42 * cpu.boost
cpu.setHBlankMode()
for cpu.cycle.scanline <= (cyclePerLine-(20+42))*cpu.boost {
if inBreak := cpu.exec(); inBreak {
return 0, 0, false
}
}
cpu.cycle.scanline -= (cyclePerLine - (20 + 42)) * cpu.boost

cpu.incrementLY()
return scrollX, scrollY, true
}
Expand All @@ -551,4 +552,5 @@ func (cpu *CPU) execVBlank() {
break
}
}
cpu.cycle.scanline = 0
}

0 comments on commit 7adfd40

Please sign in to comment.