2020-12-23 09:25:16 +00:00
|
|
|
use gb::cpu::Cpu as LR35902;
|
|
|
|
|
2020-08-29 23:38:27 +00:00
|
|
|
fn main() {
|
2021-01-03 08:05:46 +00:00
|
|
|
let mut game_boy = LR35902::new();
|
2020-12-23 09:25:16 +00:00
|
|
|
|
2020-12-24 01:39:37 +00:00
|
|
|
game_boy.load_cartridge("bin/cpu_instrs.gb");
|
|
|
|
|
2020-12-23 09:25:16 +00:00
|
|
|
loop {
|
|
|
|
let pc = game_boy.register_pair(gb::cpu::RegisterPair::PC);
|
|
|
|
let opcode = game_boy.fetch();
|
|
|
|
let instruction = game_boy.decode(opcode);
|
|
|
|
|
|
|
|
println!(
|
2020-12-24 01:39:37 +00:00
|
|
|
"Addr: {:#06X} | Opcode: {:#04X} | Instr: {:X?}",
|
2020-12-23 09:25:16 +00:00
|
|
|
pc, opcode, instruction
|
|
|
|
);
|
|
|
|
|
|
|
|
game_boy.execute(instruction);
|
|
|
|
}
|
2020-08-29 23:38:27 +00:00
|
|
|
}
|