Prev: 8F9B Up: Map Next: 8FF4
8F9F: Controls: Keyboard
Used by the routine at HandlerControls.
Output
A Controls
ReadKeyboard 8F9F LD C,$FF C=FF.
8FA1 LD A,$E7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
E7 0 1 2 3 4 5 6 7 8 9
8FA3 OUT ($FD),A
8FA5 IN A,($FE)
8FA7 CPL Flip the bits.
8FA8 AND %00011111 Keep only bits 0-4.
8FAA JR Z,ReadKeyboard_0
8FAC RES 2,C
ReadKeyboard_0 8FAE LD A,$DB Read from the keyboard;
Port Number Bit
0 1 2 3 4
DB Q W E R T Y U I O P
8FB0 OUT ($FD),A
8FB2 IN A,($FE)
8FB4 CPL Flip the bits.
8FB5 AND %00011111 Keep only bits 0-4.
8FB7 JR Z,ReadKeyboard_1
8FB9 RES 3,C
ReadKeyboard_1 8FBB LD A,$BD Read from the keyboard;
Port Number Bit
0 1 2 3 4
BD A S D F G H J K L ENTER
8FBD OUT ($FD),A
8FBF IN A,($FE)
8FC1 CPL Flip the bits.
8FC2 AND %00011111 Keep only bits 0-4.
8FC4 JR Z,ReadKeyboard_2
8FC6 RES 4,C
ReadKeyboard_2 8FC8 LD A,$FE Read from the keyboard;
Port Number Bit
0 1 2 3 4
FE SHIFT Z X C V
8FCA OUT ($FD),A
8FCC IN A,($FE)
8FCE CPL Flip the bits.
8FCF LD B,A
8FD0 AND %00010100 Keep only bits 2 and 4.
8FD2 JR Z,ReadKeyboard_3
8FD4 RES 1,C
ReadKeyboard_3 8FD6 LD A,B
8FD7 AND %00001000 Keep only bit 3.
8FD9 JR Z,ReadKeyboard_4
8FDB RES 0,C
ReadKeyboard_4 8FDD LD A,$7F Read from the keyboard;
Port Number Bit
0 1 2 3 4
7F SPACE FULL-STOP M N B
8FDF OUT ($FD),A
8FE1 IN A,($FE)
8FE3 CPL Flip the bits.
8FE4 LD B,A
8FE5 AND %00001000 Keep only bit 3.
8FE7 JR Z,ReadKeyboard_5
8FE9 RES 1,C
ReadKeyboard_5 8FEB LD A,B
8FEC AND %00010100 Keep only bits 2 and 4.
8FEE JR Z,ReadKeyboard_6
8FF0 RES 0,C
ReadKeyboard_6 8FF2 LD A,C
8FF3 RET Return.
View the equivalent code in;
Prev: 8F9B Up: Map Next: 8FF4