fdivitto / FabGL

ESP32 Display Controller (VGA, PAL/NTSC Color Composite, SSD1306, ST7789, ILI9341), PS/2 Mouse and Keyboard Controller, Graphics Library, Sound Engine, Game Engine and ANSI/VT Terminal
http://www.fabglib.org
Other
1.42k stars 209 forks source link

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

Open abelykh0 opened 1 year ago

abelykh0 commented 1 year ago

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 commented 1 year ago

https://github.com/fdivitto/FabGL/pull/326