I wrote a Z80 disassembler that starts from ROM in my SBC. One of the last things I need to do (as yet unplanned errors aside) is to translate relative addresses and output them as absolute addresses, so when the disassembler falls into one of the five variants of the JR code, it displays the absolute address Code JR operation points to.
JR code variants use an 8-bit offset value to tell the Z80 where the memory needs to go to. The offset is a single, signed (-128 ↔ 127) byte, which I need to add to the current memory location in the HL register in order to get the absolute address.
My brain seems to be suffering from a serious syntax error, although maybe even dividing by zero, since I can't get my life working on how to add an 8-bit signed (or 2 padding) byte to a 16-bit register for getting an absolute address. They were looking for interruptions, and no answers were received.
Can someone suggest a solution or point me in the right direction?
source
share