feat: slightly better PPU timings

This commit is contained in:
EliseZeroTwo 2024-01-06 17:24:29 -07:00
parent 8ae96ec880
commit c37d5d5e84
Signed by: elise
GPG key ID: FA8F56FFFE6E8B3E
35 changed files with 397 additions and 56 deletions

View file

@ -161,3 +161,59 @@ jobs:
- name: Run test ROM (mooneye-test-suite unused_hwio-GS) - name: Run test ROM (mooneye-test-suite unused_hwio-GS)
if: always() if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb test -m 100000000 -s meowgb-tests/expected_output/unused_hwio-GS.bin run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb test -m 100000000 -s meowgb-tests/expected_output/unused_hwio-GS.bin
- name: Run test ROM (mooneye-test-suite vblank_stat_intr-GS)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/vblank_stat_intr-GS.gb test -m 100000000 -s meowgb-tests/expected_output/vblank_stat_intr-GS.bin
- name: Run test ROM (mooneye-test-suite bits_bank1)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank1.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank1.bin
- name: Run test ROM (mooneye-test-suite bits_bank2)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank2.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank2.bin
- name: Run test ROM (mooneye-test-suite bits_mode)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_mode.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_mode.bin
- name: Run test ROM (mooneye-test-suite bits_ramg)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_ramg.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_ramg.bin
- name: Run test ROM (mooneye-test-suite multicart_rom_8Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/multicart_rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/multicart_rom_8Mb.bin
- name: Run test ROM (mooneye-test-suite ram_256kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_256kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_256kb.bin
- name: Run test ROM (mooneye-test-suite ram_64kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_64kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_64kb.bin
- name: Run test ROM (mooneye-test-suite rom_16Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_16Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_16Mb.bin
- name: Run test ROM (mooneye-test-suite rom_1Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_1Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_1Mb.bin
- name: Run test ROM (mooneye-test-suite rom_2Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_2Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_2Mb.bin
- name: Run test ROM (mooneye-test-suite rom_4Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_4Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_4Mb.bin
- name: Run test ROM (mooneye-test-suite rom_512kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_512kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_512kb.bin
- name: Run test ROM (mooneye-test-suite rom_8Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_8Mb.bin

View file

@ -161,3 +161,59 @@ jobs:
- name: Run test ROM (mooneye-test-suite unused_hwio-GS) - name: Run test ROM (mooneye-test-suite unused_hwio-GS)
if: always() if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb test -m 100000000 -s meowgb-tests/expected_output/unused_hwio-GS.bin run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb test -m 100000000 -s meowgb-tests/expected_output/unused_hwio-GS.bin
- name: Run test ROM (mooneye-test-suite vblank_stat_intr-GS)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/vblank_stat_intr-GS.gb test -m 100000000 -s meowgb-tests/expected_output/vblank_stat_intr-GS.bin
- name: Run test ROM (mooneye-test-suite bits_bank1)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank1.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank1.bin
- name: Run test ROM (mooneye-test-suite bits_bank2)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank2.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank2.bin
- name: Run test ROM (mooneye-test-suite bits_mode)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_mode.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_mode.bin
- name: Run test ROM (mooneye-test-suite bits_ramg)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_ramg.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_ramg.bin
- name: Run test ROM (mooneye-test-suite multicart_rom_8Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/multicart_rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/multicart_rom_8Mb.bin
- name: Run test ROM (mooneye-test-suite ram_256kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_256kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_256kb.bin
- name: Run test ROM (mooneye-test-suite ram_64kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_64kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_64kb.bin
- name: Run test ROM (mooneye-test-suite rom_16Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_16Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_16Mb.bin
- name: Run test ROM (mooneye-test-suite rom_1Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_1Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_1Mb.bin
- name: Run test ROM (mooneye-test-suite rom_2Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_2Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_2Mb.bin
- name: Run test ROM (mooneye-test-suite rom_4Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_4Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_4Mb.bin
- name: Run test ROM (mooneye-test-suite rom_512kb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_512kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_512kb.bin
- name: Run test ROM (mooneye-test-suite rom_8Mb)
if: always()
run: ./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_8Mb.bin

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/zsh
GH_ACTION_OUTPUT_FILE=./.github/workflows/action.yml GH_ACTION_OUTPUT_FILE=./.github/workflows/action.yml
FJ_ACTION_OUTPUT_FILE=./.forgejo/workflows/action.yml FJ_ACTION_OUTPUT_FILE=./.forgejo/workflows/action.yml
TEST_SCRIPT_OUTPUT_FILE=./run-test-roms.sh TEST_SCRIPT_OUTPUT_FILE=./run-test-roms.sh
@ -50,7 +50,7 @@ cat >>$TEST_MD_FILE << EOF
EOF EOF
for full_f in ./test-roms/blargg/roms/* for full_f in ./test-roms/blargg/roms/*.gb
do do
f="${full_f##*/}"; f="${f%.*}"; f="${full_f##*/}"; f="${f%.*}";
TEST_CMD="./target/release/meowgb-tests test-roms/blargg/roms/$f.gb test -m 100000000 -s meowgb-tests/expected_output/$f.bin" TEST_CMD="./target/release/meowgb-tests test-roms/blargg/roms/$f.gb test -m 100000000 -s meowgb-tests/expected_output/$f.bin"
@ -86,7 +86,7 @@ cat >>$TEST_MD_FILE << EOF
EOF EOF
for full_f in ./test-roms/mooneye-test-suite/roms/* for full_f in ./test-roms/mooneye-test-suite/roms/*.gb
do do
f="${full_f##*/}"; f="${f%.*}"; f="${full_f##*/}"; f="${f%.*}";
TEST_CMD="./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/$f.gb test -m 100000000 -s meowgb-tests/expected_output/$f.bin" TEST_CMD="./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/$f.gb test -m 100000000 -s meowgb-tests/expected_output/$f.bin"
@ -97,6 +97,42 @@ echo "Running test ROM $full_f"
TEST_TOTAL=\$((TEST_TOTAL + 1)) TEST_TOTAL=\$((TEST_TOTAL + 1))
if res=\$($TEST_CMD 2>&1 > /dev/null) ; then
TEST_SUCCESS=\$((TEST_SUCCESS + 1))
else
echo "Failed: \$res"
fi
EOF
cat >>$TEST_MD_FILE << EOF
* $f.gb - [ROM]($full_f) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/$f.bin)
EOF
tee -a $GH_ACTION_OUTPUT_FILE $FJ_ACTION_OUTPUT_FILE >/dev/null << EOF
- name: Run test ROM (mooneye-test-suite $f)
if: always()
run: $TEST_CMD
EOF
done
cat >>$TEST_MD_FILE << EOF
### MBC1
EOF
for full_f in ./test-roms/mooneye-test-suite/roms/MBC1/**.gb
do
f="${full_f##*/}"; f="${f%.*}";
TEST_CMD="./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/$f.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/$f.bin"
cat >>$TEST_SCRIPT_OUTPUT_FILE << EOF
echo "Running test ROM $full_f"
TEST_TOTAL=\$((TEST_TOTAL + 1))
if res=\$($TEST_CMD 2>&1 > /dev/null) ; then if res=\$($TEST_CMD 2>&1 > /dev/null) ; then
TEST_SUCCESS=\$((TEST_SUCCESS + 1)) TEST_SUCCESS=\$((TEST_SUCCESS + 1))
else else

View file

@ -221,7 +221,10 @@ impl<S: SerialWriter> Gameboy<S> {
} }
0xFF41 => self.ppu.set_stat(&mut self.interrupts, value), 0xFF41 => self.ppu.set_stat(&mut self.interrupts, value),
0xFF42 => self.ppu.registers.scy = value, 0xFF42 => self.ppu.registers.scy = value,
0xFF43 => self.ppu.registers.scx = value, 0xFF43 => {
// println!("Setting SCX to {} from {}", value, self.ppu.registers.scx);
self.ppu.registers.scx = value;
},
0xFF44 => {} // LY is read only 0xFF44 => {} // LY is read only
0xFF45 => self.ppu.set_lyc(&mut self.interrupts, value), 0xFF45 => self.ppu.set_lyc(&mut self.interrupts, value),
0xFF46 => self.dma.init_request(value), 0xFF46 => self.dma.init_request(value),

View file

@ -94,7 +94,7 @@ impl<const SIZE: usize> WrappedBuffer<SIZE> {
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PPUMode { pub enum PPUMode {
/// Mode 0 /// Mode 0
HBlank, HBlank = 0,
/// Mode 1 /// Mode 1
VBlank, VBlank,
/// Mode 2 /// Mode 2
@ -272,6 +272,8 @@ pub struct PpuRegisters {
pub scy: u8, pub scy: u8,
pub scx: u8, pub scx: u8,
pub ly: u8, pub ly: u8,
cycles_since_last_ly_increment: u64,
cycles_since_last_last_mode_start_increment: [u64; 4],
pub lyc: u8, pub lyc: u8,
pub wy: u8, pub wy: u8,
pub wx: u8, pub wx: u8,
@ -335,6 +337,8 @@ impl Ppu {
scy: 0, scy: 0,
scx: 0, scx: 0,
ly: 0, ly: 0,
cycles_since_last_ly_increment: 0,
cycles_since_last_last_mode_start_increment: [0; 4],
lyc: 0, lyc: 0,
wy: 0, wy: 0,
wx: 0, wx: 0,
@ -517,6 +521,7 @@ impl Ppu {
} }
pub fn set_mode(&mut self, interrupts: &mut Interrupts, mode: PPUMode) { pub fn set_mode(&mut self, interrupts: &mut Interrupts, mode: PPUMode) {
self.registers.cycles_since_last_last_mode_start_increment[mode.mode_flag() as usize] = 0;
if mode == PPUMode::HBlank { if mode == PPUMode::HBlank {
assert_eq!(self.mode(), PPUMode::TransferringData); assert_eq!(self.mode(), PPUMode::TransferringData);
assert!(self.current_dot >= 172); assert!(self.current_dot >= 172);
@ -545,6 +550,18 @@ impl Ppu {
} }
fn set_scanline(&mut self, interrupts: &mut Interrupts, scanline: u8) { fn set_scanline(&mut self, interrupts: &mut Interrupts, scanline: u8) {
// println!("LY incrementing: {} cycles since last incrementation. cycles since: {:?}", self.registers.cycles_since_last_ly_increment, self.registers.cycles_since_last_last_mode_start_increment.iter().enumerate().map(|(idx, value)| {
// let idx_enum = match idx {
// 0 => PPUMode::HBlank,
// 1 => PPUMode::VBlank,
// 2 => PPUMode::SearchingOAM,
// 3 => PPUMode::TransferringData,
// _ => unreachable!(),
// };
// (idx_enum, value)
// }).collect::<Vec<_>>());
self.registers.cycles_since_last_ly_increment = 0;
self.registers.ly = scanline; self.registers.ly = scanline;
self.handle_stat_irq(interrupts); self.handle_stat_irq(interrupts);
self.registers.ly_lyc = self.registers.ly == self.registers.lyc; self.registers.ly_lyc = self.registers.ly == self.registers.lyc;
@ -552,8 +569,10 @@ impl Ppu {
pub fn tick(&mut self, interrupts: &mut Interrupts) -> bool { pub fn tick(&mut self, interrupts: &mut Interrupts) -> bool {
if self.enabled() { if self.enabled() {
self.registers.cycles_since_last_ly_increment += 1;
match self.mode() { match self.mode() {
PPUMode::SearchingOAM => { PPUMode::SearchingOAM => {
self.registers.cycles_since_last_last_mode_start_increment[2] += 1;
if self.current_dot == 0 { if self.current_dot == 0 {
if self.registers.ly == 0 { if self.registers.ly == 0 {
self.wy_match = self.registers.wy == self.registers.ly; self.wy_match = self.registers.wy == self.registers.ly;
@ -600,6 +619,7 @@ impl Ppu {
false false
} }
PPUMode::TransferringData => { PPUMode::TransferringData => {
self.registers.cycles_since_last_last_mode_start_increment[3] += 1;
if !self.first_frame && self.current_dot == 0 { if !self.first_frame && self.current_dot == 0 {
assert_eq!(self.total_dots, 80); assert_eq!(self.total_dots, 80);
} }
@ -617,11 +637,8 @@ impl Ppu {
self.current_dot += 1; self.current_dot += 1;
self.total_dots += 1; self.total_dots += 1;
// if self.current_dot == self.dot_target - 1 {
// self.handle_stat_irq(interrupts, true);
// }
if self.current_dot == self.dot_target { if self.current_dot == self.dot_target {
// println!("Mode 3 DT: {}", self.dot_target);
// assert_eq!(self.total_dots, match self.first_frame && self.first_line { // assert_eq!(self.total_dots, match self.first_frame && self.first_line {
// true => self.dot_target, // true => self.dot_target,
// false => 80 + self.dot_target // false => 80 + self.dot_target
@ -633,17 +650,24 @@ impl Ppu {
false false
} }
PPUMode::HBlank => { PPUMode::HBlank => {
if self.first_line && self.current_dot == 64 && self.dot_target == 0 { self.registers.cycles_since_last_last_mode_start_increment[0] += 1;
self.current_dot += 1;
self.total_dots += 1;
if !self.first_line {
assert_ne!(self.dot_target, 0);
}
if self.first_line && self.current_dot == 80 && self.dot_target == 0 {
self.set_mode(interrupts, PPUMode::TransferringData); self.set_mode(interrupts, PPUMode::TransferringData);
} else if self.dot_target != 0 && self.current_dot == self.dot_target { } else if self.dot_target != 0 && self.current_dot == self.dot_target {
// println!("Mode 0 DT: {}", self.dot_target);
self.set_scanline(interrupts, self.registers.ly + 1); self.set_scanline(interrupts, self.registers.ly + 1);
assert_eq!( assert_eq!(
self.total_dots, self.total_dots,
match self.first_frame && self.first_line { 456 // match self.first_frame && self.first_line {
true => 456 - (80 - 64), // true => 456 - (80 - 64),
false => 456, // false => 456,
} // }
); );
self.total_dots = 0; self.total_dots = 0;
self.first_line = false; self.first_line = false;
@ -654,18 +678,14 @@ impl Ppu {
}; };
self.set_mode(interrupts, next_mode); self.set_mode(interrupts, next_mode);
} else {
self.current_dot += 1;
self.total_dots += 1;
if !self.first_line {
assert_ne!(self.dot_target, 0);
}
} }
false false
} }
PPUMode::VBlank => { PPUMode::VBlank => {
if self.current_dot != 0 && self.current_dot % 456 == 0 { self.registers.cycles_since_last_last_mode_start_increment[1] += 1;
self.current_dot += 1;
if self.current_dot % 456 == 0 {
if self.registers.ly >= 153 { if self.registers.ly >= 153 {
self.set_scanline(interrupts, 0); self.set_scanline(interrupts, 0);
self.set_mode(interrupts, PPUMode::SearchingOAM); self.set_mode(interrupts, PPUMode::SearchingOAM);
@ -673,12 +693,10 @@ impl Ppu {
true true
} else { } else {
self.set_scanline(interrupts, self.registers.ly + 1); self.set_scanline(interrupts, self.registers.ly + 1);
self.current_dot += 1;
false false
} }
} else { } else {
assert!(self.current_dot < 4560); assert!(self.current_dot < 4560);
self.current_dot += 1;
false false
} }
} }
@ -711,8 +729,10 @@ impl Ppu {
Some(state) => state, Some(state) => state,
None => { None => {
let scrolling_delay = self.registers.scx % 8; let scrolling_delay = self.registers.scx % 8;
// println!("{}", scrolling_delay);
self.dot_target += scrolling_delay as u16; self.dot_target += scrolling_delay as u16;
if scrolling_delay != 0 { if scrolling_delay != 0 {
// println!("Scrolling delay of {:#X} with scx of {}", scrolling_delay, self.registers.scx);
LineDrawingState::BackgroundScrolling( LineDrawingState::BackgroundScrolling(
scrolling_delay as usize, scrolling_delay as usize,
self.registers.scx, self.registers.scx,

View file

@ -0,0 +1 @@
 "

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
BBBBBB

View file

@ -0,0 +1 @@
 "

View file

@ -367,4 +367,144 @@ else
echo "Failed: $res" echo "Failed: $res"
fi fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/vblank_stat_intr-GS.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/vblank_stat_intr-GS.gb test -m 100000000 -s meowgb-tests/expected_output/vblank_stat_intr-GS.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/bits_bank1.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank1.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank1.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/bits_bank2.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_bank2.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_bank2.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/bits_mode.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_mode.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_mode.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/bits_ramg.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/bits_ramg.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/bits_ramg.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/multicart_rom_8Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/multicart_rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/multicart_rom_8Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/ram_256kb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_256kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_256kb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/ram_64kb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/ram_64kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/ram_64kb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_16Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_16Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_16Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_1Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_1Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_1Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_2Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_2Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_2Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_4Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_4Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_4Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_512kb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_512kb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_512kb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Running test ROM ./test-roms/mooneye-test-suite/roms/MBC1/rom_8Mb.gb"
TEST_TOTAL=$((TEST_TOTAL + 1))
if res=$(./target/release/meowgb-tests test-roms/mooneye-test-suite/roms/MBC1/rom_8Mb.gb test -m 100000000 -s meowgb-tests/expected_output/MBC1/rom_8Mb.bin 2>&1 > /dev/null) ; then
TEST_SUCCESS=$((TEST_SUCCESS + 1))
else
echo "Failed: $res"
fi
echo "Succeeded in running $TEST_SUCCESS/$TEST_TOTAL" echo "Succeeded in running $TEST_SUCCESS/$TEST_TOTAL"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -8,36 +8,53 @@
## Mooneye Test Suite ## Mooneye Test Suite
* basic.gb - [ROM](./test-roms/mooneye-test-suite/roms/basic.gb) - [Expected Serial Output](./meowgb-tests/expected_output/basic.bin) * basic.gb - [ROM](./test-roms/mooneye-test-suite/roms/basic.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/basic.bin)
* boot_hwio-dmgABCmgb.gb - [ROM](./test-roms/mooneye-test-suite/roms/boot_hwio-dmgABCmgb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/boot_hwio-dmgABCmgb.bin) * boot_hwio-dmgABCmgb.gb - [ROM](./test-roms/mooneye-test-suite/roms/boot_hwio-dmgABCmgb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/boot_hwio-dmgABCmgb.bin)
* boot_regs-dmgABC.gb - [ROM](./test-roms/mooneye-test-suite/roms/boot_regs-dmgABC.gb) - [Expected Serial Output](./meowgb-tests/expected_output/boot_regs-dmgABC.bin) * boot_regs-dmgABC.gb - [ROM](./test-roms/mooneye-test-suite/roms/boot_regs-dmgABC.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/boot_regs-dmgABC.bin)
* daa.gb - [ROM](./test-roms/mooneye-test-suite/roms/daa.gb) - [Expected Serial Output](./meowgb-tests/expected_output/daa.bin) * daa.gb - [ROM](./test-roms/mooneye-test-suite/roms/daa.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/daa.bin)
* div_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/div_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/div_timing.bin) * div_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/div_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/div_timing.bin)
* div_write.gb - [ROM](./test-roms/mooneye-test-suite/roms/div_write.gb) - [Expected Serial Output](./meowgb-tests/expected_output/div_write.bin) * div_write.gb - [ROM](./test-roms/mooneye-test-suite/roms/div_write.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/div_write.bin)
* ei_sequence.gb - [ROM](./test-roms/mooneye-test-suite/roms/ei_sequence.gb) - [Expected Serial Output](./meowgb-tests/expected_output/ei_sequence.bin) * ei_sequence.gb - [ROM](./test-roms/mooneye-test-suite/roms/ei_sequence.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/ei_sequence.bin)
* ei_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/ei_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/ei_timing.bin) * ei_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/ei_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/ei_timing.bin)
* halt_ime0_ei.gb - [ROM](./test-roms/mooneye-test-suite/roms/halt_ime0_ei.gb) - [Expected Serial Output](./meowgb-tests/expected_output/halt_ime0_ei.bin) * halt_ime0_ei.gb - [ROM](./test-roms/mooneye-test-suite/roms/halt_ime0_ei.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/halt_ime0_ei.bin)
* intr_1_2_timing-GS.gb - [ROM](./test-roms/mooneye-test-suite/roms/intr_1_2_timing-GS.gb) - [Expected Serial Output](./meowgb-tests/expected_output/intr_1_2_timing-GS.bin) * intr_1_2_timing-GS.gb - [ROM](./test-roms/mooneye-test-suite/roms/intr_1_2_timing-GS.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/intr_1_2_timing-GS.bin)
* intr_2_0_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/intr_2_0_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/intr_2_0_timing.bin) * intr_2_0_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/intr_2_0_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/intr_2_0_timing.bin)
* mem_oam.gb - [ROM](./test-roms/mooneye-test-suite/roms/mem_oam.gb) - [Expected Serial Output](./meowgb-tests/expected_output/mem_oam.bin) * mem_oam.gb - [ROM](./test-roms/mooneye-test-suite/roms/mem_oam.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/mem_oam.bin)
* oam_dma_restart.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_restart.gb) - [Expected Serial Output](./meowgb-tests/expected_output/oam_dma_restart.bin) * oam_dma_restart.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_restart.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/oam_dma_restart.bin)
* oam_dma_start.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_start.gb) - [Expected Serial Output](./meowgb-tests/expected_output/oam_dma_start.bin) * oam_dma_start.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_start.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/oam_dma_start.bin)
* oam_dma_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/oam_dma_timing.bin) * oam_dma_timing.gb - [ROM](./test-roms/mooneye-test-suite/roms/oam_dma_timing.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/oam_dma_timing.bin)
* rapid_di_ei.gb - [ROM](./test-roms/mooneye-test-suite/roms/rapid_di_ei.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rapid_di_ei.bin) * rapid_di_ei.gb - [ROM](./test-roms/mooneye-test-suite/roms/rapid_di_ei.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/rapid_di_ei.bin)
* rapid_toggle.gb - [ROM](./test-roms/mooneye-test-suite/roms/rapid_toggle.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rapid_toggle.bin) * rapid_toggle.gb - [ROM](./test-roms/mooneye-test-suite/roms/rapid_toggle.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/rapid_toggle.bin)
* reg_f.gb - [ROM](./test-roms/mooneye-test-suite/roms/reg_f.gb) - [Expected Serial Output](./meowgb-tests/expected_output/reg_f.bin) * reg_f.gb - [ROM](./test-roms/mooneye-test-suite/roms/reg_f.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/reg_f.bin)
* reg_read.gb - [ROM](./test-roms/mooneye-test-suite/roms/reg_read.gb) - [Expected Serial Output](./meowgb-tests/expected_output/reg_read.bin) * reg_read.gb - [ROM](./test-roms/mooneye-test-suite/roms/reg_read.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/reg_read.bin)
* stat_irq_blocking.gb - [ROM](./test-roms/mooneye-test-suite/roms/stat_irq_blocking.gb) - [Expected Serial Output](./meowgb-tests/expected_output/stat_irq_blocking.bin) * stat_irq_blocking.gb - [ROM](./test-roms/mooneye-test-suite/roms/stat_irq_blocking.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/stat_irq_blocking.bin)
* stat_lyc_onoff.gb - [ROM](./test-roms/mooneye-test-suite/roms/stat_lyc_onoff.gb) - [Expected Serial Output](./meowgb-tests/expected_output/stat_lyc_onoff.bin) * stat_lyc_onoff.gb - [ROM](./test-roms/mooneye-test-suite/roms/stat_lyc_onoff.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/stat_lyc_onoff.bin)
* tim00.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim00.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim00.bin) * tim00.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim00.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim00.bin)
* tim00_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim00_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim00_div_trigger.bin) * tim00_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim00_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim00_div_trigger.bin)
* tim01.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim01.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim01.bin) * tim01.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim01.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim01.bin)
* tim01_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim01_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim01_div_trigger.bin) * tim01_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim01_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim01_div_trigger.bin)
* tim10.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim10.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim10.bin) * tim10.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim10.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim10.bin)
* tim10_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim10_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim10_div_trigger.bin) * tim10_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim10_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim10_div_trigger.bin)
* tim11.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim11.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim11.bin) * tim11.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim11.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim11.bin)
* tim11_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim11_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tim11_div_trigger.bin) * tim11_div_trigger.gb - [ROM](./test-roms/mooneye-test-suite/roms/tim11_div_trigger.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tim11_div_trigger.bin)
* tima_reload.gb - [ROM](./test-roms/mooneye-test-suite/roms/tima_reload.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tima_reload.bin) * tima_reload.gb - [ROM](./test-roms/mooneye-test-suite/roms/tima_reload.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tima_reload.bin)
* tima_write_reloading.gb - [ROM](./test-roms/mooneye-test-suite/roms/tima_write_reloading.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tima_write_reloading.bin) * tima_write_reloading.gb - [ROM](./test-roms/mooneye-test-suite/roms/tima_write_reloading.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tima_write_reloading.bin)
* tma_write_reloading.gb - [ROM](./test-roms/mooneye-test-suite/roms/tma_write_reloading.gb) - [Expected Serial Output](./meowgb-tests/expected_output/tma_write_reloading.bin) * tma_write_reloading.gb - [ROM](./test-roms/mooneye-test-suite/roms/tma_write_reloading.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/tma_write_reloading.bin)
* unused_hwio-GS.gb - [ROM](./test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb) - [Expected Serial Output](./meowgb-tests/expected_output/unused_hwio-GS.bin) * unused_hwio-GS.gb - [ROM](./test-roms/mooneye-test-suite/roms/unused_hwio-GS.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/unused_hwio-GS.bin)
* vblank_stat_intr-GS.gb - [ROM](./test-roms/mooneye-test-suite/roms/vblank_stat_intr-GS.gb) - [Expected Serial Output](./meowgb-tests/expected_output/MBC1/vblank_stat_intr-GS.bin)
### MBC1
* bits_bank1.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/bits_bank1.gb) - [Expected Serial Output](./meowgb-tests/expected_output/bits_bank1.bin)
* bits_bank2.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/bits_bank2.gb) - [Expected Serial Output](./meowgb-tests/expected_output/bits_bank2.bin)
* bits_mode.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/bits_mode.gb) - [Expected Serial Output](./meowgb-tests/expected_output/bits_mode.bin)
* bits_ramg.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/bits_ramg.gb) - [Expected Serial Output](./meowgb-tests/expected_output/bits_ramg.bin)
* multicart_rom_8Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/multicart_rom_8Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/multicart_rom_8Mb.bin)
* ram_256kb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/ram_256kb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/ram_256kb.bin)
* ram_64kb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/ram_64kb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/ram_64kb.bin)
* rom_16Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_16Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_16Mb.bin)
* rom_1Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_1Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_1Mb.bin)
* rom_2Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_2Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_2Mb.bin)
* rom_4Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_4Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_4Mb.bin)
* rom_512kb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_512kb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_512kb.bin)
* rom_8Mb.gb - [ROM](./test-roms/mooneye-test-suite/roms/MBC1/rom_8Mb.gb) - [Expected Serial Output](./meowgb-tests/expected_output/rom_8Mb.bin)