diff --git a/src/disassembler/main.rs b/src/disassembler/main.rs index 6544d47..aa3a6c8 100644 --- a/src/disassembler/main.rs +++ b/src/disassembler/main.rs @@ -36,56 +36,56 @@ fn main() { 0x03 => format!("INX B"), 0x04 => format!("INR B"), 0x05 => format!("DCR B"), - 0x06 => format!("MVI B,#0x{}", next(&mut data, 1)), + 0x06 => format!("MVI B,#${}", next(&mut data, 1)), 0x07 => format!("RLC"), 0x09 => format!("DAD B"), 0x0a => format!("LDAX B"), 0x0b => format!("DCX B"), 0x0c => format!("INR C"), 0x0d => format!("DCR C"), - 0x0e => format!("MVI C,#0x{}", next(&mut data, 1)), + 0x0e => format!("MVI C,#${}", next(&mut data, 1)), 0x0f => format!("RRC"), - 0x11 => format!("LXI D,#0x{}", next(&mut data, 2)), + 0x11 => format!("LXI D,#${}", next(&mut data, 2)), 0x12 => format!("STAX D"), 0x13 => format!("INX D"), 0x14 => format!("INR D"), 0x15 => format!("DCR D"), - 0x16 => format!("MVI D,#0x{}", next(&mut data, 1)), + 0x16 => format!("MVI D,#${}", next(&mut data, 1)), 0x17 => format!("RAL"), 0x19 => format!("DAD D"), 0x1a => format!("LDAX D"), 0x1b => format!("DCX D"), 0x1c => format!("INR E"), 0x1d => format!("DCR E"), - 0x1e => format!("MVI E,#0x{}", next(&mut data, 1)), + 0x1e => format!("MVI E,#${}", next(&mut data, 1)), 0x1f => format!("RAR"), - 0x21 => format!("LXI H,#0x{}", next(&mut data, 2)), - 0x22 => format!("SLHD #0x{}", next(&mut data, 2)), + 0x21 => format!("LXI H,#${}", next(&mut data, 2)), + 0x22 => format!("SLHD #${}", next(&mut data, 2)), 0x23 => format!("INX H"), 0x24 => format!("INR H"), 0x25 => format!("DCR H"), - 0x26 => format!("MVI H,#0x{}", next(&mut data, 1)), + 0x26 => format!("MVI H,#${}", next(&mut data, 1)), 0x27 => format!("DAA"), 0x29 => format!("DAD H"), 0x2a => format!("LHLD ${}", next(&mut data, 2)), 0x2b => format!("DCX H"), 0x2c => format!("INR L"), 0x2d => format!("DCR L"), - 0x2e => format!("MVI L,#0x{}", next(&mut data, 1)), + 0x2e => format!("MVI L,#${}", next(&mut data, 1)), 0x2f => format!("CMA"), - 0x31 => format!("LXI SP,#0x{}", next(&mut data, 2)), + 0x31 => format!("LXI SP,#${}", next(&mut data, 2)), 0x32 => format!("STA ${}", next(&mut data, 2)), 0x33 => format!("INX SP"), 0x34 => format!("INR M"), 0x35 => format!("DCR M"), - 0x36 => format!("MVI M,#0x{}", next(&mut data, 1)), + 0x36 => format!("MVI M,#${}", next(&mut data, 1)), 0x37 => format!("STC"), 0x39 => format!("DAD SP"), 0x3a => format!("LDA ${}", next(&mut data, 2)), 0x3b => format!("DCX SP"), 0x3c => format!("INR A"), 0x3d => format!("DCR A"), - 0x3e => format!("MVI A,#0x{}", next(&mut data, 1)), + 0x3e => format!("MVI A,#${}", next(&mut data, 1)), 0x3f => format!("CMC"), 0x76 => format!("HLT ; Trigger interrupt"), 0x40..=0x7f // Test this! @@ -112,28 +112,28 @@ fn main() { 0xc3 => format!("JMP ${}", next(&mut data, 2)), 0xc4 => format!("CNZ ${}", next(&mut data, 2)), 0xc5 => format!("PUSH B"), - 0xc6 => format!("ADI #0x{}", next(&mut data, 1)), + 0xc6 => format!("ADI #${}", next(&mut data, 1)), 0xc7 => format!("RST 0 ; CALL $0"), 0xc8 => format!("RZ"), 0xc9 => format!("RET"), 0xca => format!("JZ ${}", next(&mut data, 2)), 0xcc => format!("CZ ${}", next(&mut data, 2)), 0xcd => format!("CALL ${}", next(&mut data, 2)), - 0xce => format!("ACI #0x{}", next(&mut data, 1)), + 0xce => format!("ACI #${}", next(&mut data, 1)), 0xcf => format!("RST 1 ; CALL $8"), 0xd0 => format!("RNC"), 0xd1 => format!("POP D"), 0xd2 => format!("JNC ${}", next(&mut data, 2)), - 0xd3 => format!("OUT #0x{}", next(&mut data, 1)), + 0xd3 => format!("OUT #${}", next(&mut data, 1)), 0xd4 => format!("CNC ${}", next(&mut data, 2)), 0xd5 => format!("PUSH D"), - 0xd6 => format!("SUI #0x{}", next(&mut data, 1)), + 0xd6 => format!("SUI #${}", next(&mut data, 1)), 0xd7 => format!("RST 2 ; CALL $10"), 0xd8 => format!("RC"), 0xda => format!("JC ${}", next(&mut data, 2)), - 0xdb => format!("IN #0x{}", next(&mut data, 1)), + 0xdb => format!("IN #${}", next(&mut data, 1)), 0xdc => format!("CC ${}", next(&mut data, 2)), - 0xde => format!("SBI #0x{}", next(&mut data, 1)), + 0xde => format!("SBI #${}", next(&mut data, 1)), 0xdf => format!("RST 3 ; $CALL 18"), 0xe0 => format!("RPO"), 0xe1 => format!("POP H"), @@ -141,14 +141,14 @@ fn main() { 0xe3 => format!("XTHL"), 0xe4 => format!("CPO ${}", next(&mut data, 2)), 0xe5 => format!("PUSH H"), - 0xe6 => format!("ANI #0x{}", next(&mut data, 1)), + 0xe6 => format!("ANI #${}", next(&mut data, 1)), 0xe7 => format!("RST 4 ; CALL $20"), 0xe8 => format!("RPE"), 0xe9 => format!("PCHL"), 0xea => format!("JPE ${}", next(&mut data, 2)), 0xeb => format!("XCHG"), 0xec => format!("CPE ${}", next(&mut data, 2)), - 0xee => format!("XRI #0x{}", next(&mut data, 1)), + 0xee => format!("XRI #${}", next(&mut data, 1)), 0xef => format!("RST 5 ; CALL $28"), 0xf0 => format!("RP"), 0xf1 => format!("POP PSW"), @@ -156,14 +156,14 @@ fn main() { 0xf3 => format!("DI"), 0xf4 => format!("CP ${}", next(&mut data, 2)), 0xf5 => format!("PUSH PSW"), - 0xf6 => format!("ORI #0x{}", next(&mut data, 1)), + 0xf6 => format!("ORI #${}", next(&mut data, 1)), 0xf7 => format!("RST 6 ; CALL $30"), 0xf8 => format!("RM"), 0xf9 => format!("SPHL"), 0xfa => format!("JM ${}", next(&mut data, 2)), 0xfb => format!("EI"), 0xfc => format!("CM ${}", next(&mut data, 2)), - 0xfe => format!("CPI #0x{}", next(&mut data, 1)), + 0xfe => format!("CPI #${}", next(&mut data, 1)), 0xff => format!("RST 7 ; CALL $38"), _ => panic!("Unimplemented instruction {byte:#x}"), };