chore: remove Cycle struct and begin scheduler design

This commit is contained in:
2021-09-12 04:55:14 -03:00
parent 10ac579c40
commit 6087e3b20b
8 changed files with 226 additions and 305 deletions

View File

@@ -1,10 +1,10 @@
use crate::apu::Apu;
use crate::bus::{Bus, BusIo};
use crate::instruction::cycle::Cycle;
use crate::instruction::Instruction;
use crate::interrupt::{InterruptEnable, InterruptFlag};
use crate::joypad::Joypad;
use crate::ppu::Ppu;
use crate::Cycle;
use bitfield::bitfield;
use std::fmt::{Display, Formatter, Result as FmtResult};
@@ -133,7 +133,7 @@ impl Cpu {
self.bus.clock();
let elapsed = match kind {
ImeEnabled | NonePending => Cycle::new(4),
ImeEnabled | NonePending => 4,
SomePending => todo!("Implement HALT bug"),
};
@@ -146,11 +146,11 @@ impl Cpu {
self.handle_ei();
// For use in Blargg's Test ROMs
// if self.read_byte(0xFF02) == 0x81 {
// let c = self.read_byte(0xFF01) as char;
// self.write_byte(0xFF02, 0x00);
// eprint!("{}", c);
// }
if self.read_byte(0xFF02) == 0x81 {
let c = self.read_byte(0xFF01) as char;
self.write_byte(0xFF02, 0x00);
eprint!("{}", c);
}
elapsed
}