Jupiter Ace - i/o Ports ----------------------- 2005-11-14 Kio 2008-06-03 Kio There is only one io port: $FE. Only address bit A0 is decoded. The beeper is set by out($FE) and reset by in($FE). out(FE) data bit D3 sets the MIC-OUT line. in(FE) data bit 5 reads the EAR-IN line. Reading the keyboard: This is identical to the ZX Spectrum design. The 8 bits of the high byte of the io address select the row to scan. The row bits are active low. Then D0 to D4 return the state of the 5 keys of this matrix row. The returned key bits are active low. The high byte of the io address can be set with register A for in A,(NN) or with register B for in REG,(C): 1) ld a,$FE ; e.g. keyboard row 0 in a,($FE) ; read keys from row 0 and a,01Fh ; mask the unset bits 2) ld bc,$FEFE ; e.g. keyboard row 0 in a,(c) ; read keys from row 0 and a,01Fh ; mask the unset bits In the ACE Rom, the address popped off the data stack is 16 bit, so with 16 BASE C! 0FEFE IN . will display the key depressions. The keyboard layout is nearly identical to the ZX Spectrum, only the bottom rows are shifted and cursor up and down are swapped. Bit 0 = 0 Bit 1 = 0 Bit 2 = 0 Bit 3 = 0 Bit 4 = 0 Bit 0 (0xFE) Shift SymbolShift Z X C Bit 1 (0xFD) A S D F G Bit 2 (0xFB) Q W E R T Bit 3 (0xF7) 1 2 3 4 5 Bit 4 (0xEF) 0 9 8 7 6 Bit 5 (0xDF) P O I U Y Bit 6 (0xBF) Enter L K J H Bit 7 (0x7F) Space M N B V