chore(gui): implement basic disassembler
Also implement CPU and Interrupt debug information.
Of note:
1. IE and IRQ status boxes are slightly misaligned
2. Whenever the disassembler accidentally reads into game data rather
than executable code the emulator crashes
* Thus I should turn Instruction decoding into a Result<> rather than
panic on failure
This commit is contained in:
39
src/cpu.rs
39
src/cpu.rs
@@ -485,3 +485,42 @@ pub(crate) enum ImeState {
|
||||
Pending,
|
||||
Enabled,
|
||||
}
|
||||
|
||||
pub(crate) mod dbg {
|
||||
use super::{Cpu, ImeState, RegisterPair};
|
||||
|
||||
pub(crate) fn flags(cpu: &Cpu) -> u8 {
|
||||
cpu.flags.into()
|
||||
}
|
||||
|
||||
pub(crate) fn af(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::AF)
|
||||
}
|
||||
|
||||
pub(crate) fn bc(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::BC)
|
||||
}
|
||||
|
||||
pub(crate) fn de(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::DE)
|
||||
}
|
||||
|
||||
pub(crate) fn hl(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::HL)
|
||||
}
|
||||
|
||||
pub(crate) fn sp(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::SP)
|
||||
}
|
||||
|
||||
pub(crate) fn pc(cpu: &Cpu) -> u16 {
|
||||
cpu.register_pair(RegisterPair::PC)
|
||||
}
|
||||
|
||||
pub(crate) fn ime(cpu: &Cpu) -> bool {
|
||||
match cpu.ime {
|
||||
ImeState::Enabled => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user