chore: improve code quality

This commit is contained in:
2021-01-19 01:36:44 -06:00
parent 1da01a318d
commit 68c9557c43
9 changed files with 129 additions and 119 deletions

View File

@@ -14,12 +14,7 @@ pub struct Cpu {
impl Cpu {
pub fn new() -> Self {
Default::default()
}
pub fn new_without_boot() -> Self {
Self {
bus: Bus::without_boot(),
reg: Registers {
a: 0x01,
b: 0x00,
@@ -36,6 +31,13 @@ impl Cpu {
}
}
pub fn boot_new() -> Self {
Self {
bus: Bus::with_boot(),
..Default::default()
}
}
pub fn ime(&self) -> bool {
self.ime
}
@@ -74,10 +76,10 @@ impl Cpu {
let instr = self.decode(opcode);
let cycles = self.execute(instr);
println!(
"Addr: {:#06X} | Opcode: {:#04X} | Instr: {:X?}",
self.reg.pc, opcode, instr
);
// println!(
// "Addr: {:#06X} | Opcode: {:#04X} | Instr: {:X?}",
// self.reg.pc, opcode, instr
// );
self.bus.step(cycles);