8080
8080 copied to clipboard
Added display of immediate operands to disassembly
This is for issue #5. I replaced all the placeholders in the disassembly table with either %hhu
for 8-bit immediates or %hu
for 16-bit immediates. These are formats that printf
understands. When disassembling an instruction, the code then looks for these substrings in the instruction's assembly representation and, if needed, passes the value of the immediate from memory as an argument to printf
so that it can be displayed.
Hello, thank you for the contribution!
Can you use %02X
and %04X
instead of %hu
and % hhu
? It would be more consistent with the rest of the project, and more useful (I think?) to display those values as hexadecimal.
Should be fixed now.
On a somewhat related note: the disassembly could be made more readable if some more spaces were added, e.g.
... cpo 06A0H
... cm 06A0H
... cnz 06A0H
... cpi 00H
as opposed to
... cpo 06A0H
... cm 06A0H
... cnz 06A0H
... cpi 00H
I could make a separate PR if needed, since it's not strictly related to immediate operands.