8080 icon indicating copy to clipboard operation
8080 copied to clipboard

Added display of immediate operands to disassembly

Open weijuwang opened this issue 1 year ago • 3 comments

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.

weijuwang avatar Jul 21 '22 23:07 weijuwang

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.

superzazu avatar Jul 27 '22 12:07 superzazu

Should be fixed now.

weijuwang avatar Jul 27 '22 18:07 weijuwang

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.

weijuwang avatar Jul 27 '22 18:07 weijuwang