Prev: 36763 Up: Map Next: 36852
36767: Controls: Keyboard
Used by the routine at HandlerControls.
Output
A Controls
ReadKeyboard 36767 LD C,255 C=255.
36769 LD A,231 Read from the keyboard;
Port Number Bit
0 1 2 3 4
231 0 1 2 3 4 5 6 7 8 9
36771 OUT (253),A
36773 IN A,(254)
36775 CPL Flip the bits.
36776 AND %00011111 Keep only bits 0-4.
36778 JR Z,ReadKeyboard_0
36780 RES 2,C
ReadKeyboard_0 36782 LD A,219 Read from the keyboard;
Port Number Bit
0 1 2 3 4
219 Q W E R T Y U I O P
36784 OUT (253),A
36786 IN A,(254)
36788 CPL Flip the bits.
36789 AND %00011111 Keep only bits 0-4.
36791 JR Z,ReadKeyboard_1
36793 RES 3,C
ReadKeyboard_1 36795 LD A,189 Read from the keyboard;
Port Number Bit
0 1 2 3 4
189 A S D F G H J K L ENTER
36797 OUT (253),A
36799 IN A,(254)
36801 CPL Flip the bits.
36802 AND %00011111 Keep only bits 0-4.
36804 JR Z,ReadKeyboard_2
36806 RES 4,C
ReadKeyboard_2 36808 LD A,254 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 SHIFT Z X C V
36810 OUT (253),A
36812 IN A,(254)
36814 CPL Flip the bits.
36815 LD B,A
36816 AND %00010100 Keep only bits 2 and 4.
36818 JR Z,ReadKeyboard_3
36820 RES 1,C
ReadKeyboard_3 36822 LD A,B
36823 AND %00001000 Keep only bit 3.
36825 JR Z,ReadKeyboard_4
36827 RES 0,C
ReadKeyboard_4 36829 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE FULL-STOP M N B
36831 OUT (253),A
36833 IN A,(254)
36835 CPL Flip the bits.
36836 LD B,A
36837 AND %00001000 Keep only bit 3.
36839 JR Z,ReadKeyboard_5
36841 RES 1,C
ReadKeyboard_5 36843 LD A,B
36844 AND %00010100 Keep only bits 2 and 4.
36846 JR Z,ReadKeyboard_6
36848 RES 0,C
ReadKeyboard_6 36850 LD A,C
36851 RET Return.
View the equivalent code in;
Prev: 36763 Up: Map Next: 36852