moonoeye if_ie_registers test

This commit is contained in:
Franco Colmenarez 2021-11-04 13:13:22 -05:00
parent c5ff92c0ab
commit b7236e862a
4 changed files with 7 additions and 4 deletions

View File

@ -59,7 +59,7 @@ pub struct Bus {
impl Bus {
pub fn new() -> Self {
let game_rom = match ROM::load_file("ignore/m3_scy_change.gb".to_string()) {
let game_rom = match ROM::load_file("ignore/mooneye/acceptance/if_ie_registers.gb".to_string()) {
// let game_rom = match ROM::load_file("roms/cpu_instrs.gb".to_string()) {
// let game_rom = match ROM::load_file("roms/cpu_instrs_individual/01-special.gb".to_string()) {
// let game_rom = match ROM::load_file("roms/cpu_instrs_individual/02-interrupts.gb".to_string()) {
@ -110,6 +110,9 @@ impl Bus {
pub fn read(&self, address: u16) -> u8 {
if BANK_ZERO.in_range(address) || BANK_SWITCHABLE.in_range(address) {
return self.game_rom.read(address);
} else if address == INTERRUPT_ENABLE_ADDRESS || address == INTERRUPT_FLAG_ADDRESS {
return 0b11100000 | self.data[address as usize];
}
self.data[address as usize]
}

View File

@ -102,7 +102,7 @@ impl Emulator {
pub fn run(&mut self, cpu_cycles: Cycles, frame_buffer: &mut [u8]) {
self.cpu.reset_cycles();
while self.cpu.get_cycles().0 <= cpu_cycles.0 {
while self.cpu.get_cycles().to_t() <= cpu_cycles.0 {
self.cpu.run(&mut self.bus);
if self.bus.reset_timer {
self.bus.reset_timer = false;

View File

@ -120,7 +120,7 @@ impl PPU {
pub fn do_cycles(&mut self, bus: &mut Bus, cycles: Cycles, frame_buffer: &mut [u8]) {
let mut count = 0;
while count < cycles.0 {
while count < cycles.to_t() {
self.cycle(bus, frame_buffer);
count += 1;
}

View File

@ -67,7 +67,7 @@ pub fn start_eventloop() {
emulator.run(Cycles(70224), pixels.get_frame());
// emulator.draw(pixels.get_frame());
// thread::sleep(time::Duration::from_millis(1000));
// thread::sleep(time::Duration::from_millis(500));
window.request_redraw();
},
Event::RedrawRequested(_) => {