feat: reimplement cycles newtype

This commit is contained in:
2021-01-18 22:54:38 -06:00
parent 2fc7ac3833
commit 9b4c95ce4c
8 changed files with 273 additions and 143 deletions

View File

@@ -68,6 +68,21 @@ impl Cpu {
pub fn execute(&mut self, instruction: Instruction) -> Cycles {
Instruction::execute(self, instruction)
}
pub fn step(&mut self) -> Cycles {
let opcode = self.fetch();
let instr = self.decode(opcode);
let cycles = self.execute(instr);
println!(
"Addr: {:#06X} | Opcode: {:#04X} | Instr: {:X?}",
self.reg.pc, opcode, instr
);
self.bus.step(cycles);
cycles
}
}
impl Cpu {