FabGL icon indicating copy to clipboard operation
FabGL copied to clipboard

z80 IN and OUT instructions do not support the upper byte of the address

Open abelykh0 opened this issue 1 year ago • 1 comments

z80 port address is 16 bit, not 8

I was testing Sinclair emulator and realized that BREAK in BASIC didn't work. My changes fix this.

Their code for BREAK is like this:

1F54 BREAK-KEY
LD A,+7F Form the port address
IN A,(+FE) +7FFE and read in a byte.
RRA Examine only bit 0 by shifting it into the carry position.
RET C Return if the BREAK key is not being pressed.
LD A,+FE Form the port address
IN A,(+FE) +FEFE and read in a byte.
RRA Again examine bit 0.
RET Return with carry reset if both keys are being pressed.

abelykh0 avatar Mar 05 '23 04:03 abelykh0