Skip to content
Snippets Groups Projects
Verified Commit 5fc2d300 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

fix: interrupt timing issue

Allows blargg's test ROM to pass.
parent cc9bf51f
No related branches found
No related tags found
No related merge requests found
Pipeline #4047 passed
......@@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
*
* Issue related to interrupt timing, reduce interrupt to 20 cycles instead of 24
## [0.9.18] - 2024-01-02
......
frontends/sdl/res/test/blargg/interrupt_time/interrupt_time.png

480 B

......@@ -70,6 +70,22 @@ mod tests {
assert!(image_result);
}
#[test]
fn test_blargg_interrupt_time() {
let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
"../../res/roms/test/blargg/interrupt_time/interrupt_time.gb",
Some(20000000),
TestOptions {
mode: Some(GameBoyMode::Cgb),
..TestOptions::default()
},
)
.unwrap();
let image_result =
compare_images(&result, "res/test/blargg/interrupt_time/interrupt_time.png");
assert!(image_result);
}
#[test]
fn test_blargg_dmg_sound() {
let result: [u8; FRAME_BUFFER_SIZE] = run_image_test(
......
......@@ -172,7 +172,7 @@ impl Cpu {
self.halted = false;
}
return 24;
return 20;
} else if (self.mmu.ie & 0x02 == 0x02) && self.mmu.ppu().int_stat() {
debugln!("Going to run LCD STAT interrupt handler (0x48)");
......@@ -190,7 +190,7 @@ impl Cpu {
self.halted = false;
}
return 24;
return 20;
} else if (self.mmu.ie & 0x04 == 0x04) && self.mmu.timer().int_tima() {
debugln!("Going to run Timer interrupt handler (0x50)");
......@@ -208,7 +208,7 @@ impl Cpu {
self.halted = false;
}
return 24;
return 20;
} else if (self.mmu.ie & 0x08 == 0x08) && self.mmu.serial().int_serial() {
debugln!("Going to run Serial interrupt handler (0x58)");
......@@ -226,7 +226,7 @@ impl Cpu {
self.halted = false;
}
return 24;
return 20;
} else if (self.mmu.ie & 0x10 == 0x10) && self.mmu.pad().int_pad() {
debugln!("Going to run JoyPad interrupt handler (0x60)");
......@@ -244,7 +244,7 @@ impl Cpu {
self.halted = false;
}
return 24;
return 20;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment