Prev: 6826 Up: Map Next: 687D
6828: Get Keyboard Input
KeyboardInput 6828 LD DE,$FE00 DE=FE00.
682B LD BC,$FEFE Read from the keyboard;
Port Number Bit
0 1 2 3 4
FE SHIFT Z X C V
KeyboardInput_0 682E IN A,(C)
6830 CPL Invert the bits in A.
6831 AND %00011111 Keep only bits 0-4.
6833 JR Z,KeyboardInput_1 Jump to KeyboardInput_1 if {} is zero.
6835 SCF Set the carry flag.
KeyboardInput_1 6836 RL E Rotate E left.
6838 RL D Rotate D left.
683A JR NC,KeyboardInput_2 Jump to KeyboardInput_2 if {} is higher.
683C RLC B Rotate B left (with carry).
683E JR KeyboardInput_0 Jump to KeyboardInput_0.
KeyboardInput_2 6840 LD A,E A=E.
6841 RRCA RRCA.
6842 JR NC,KeyboardInput_3 Jump to KeyboardInput_3 if {} is higher.
6844 SET 0,D Set bit 0 of D.
KeyboardInput_3 6846 RRCA RRCA.
6847 JR NC,KeyboardInput_4 Jump to KeyboardInput_4 if {} is higher.
6849 SET 2,D Set bit 2 of D.
KeyboardInput_4 684B RRCA RRCA.
684C JR NC,KeyboardInput_5 Jump to KeyboardInput_5 if {} is higher.
684E SET 3,D Set bit 3 of D.
KeyboardInput_5 6850 RRCA RRCA.
6851 JR NC,KeyboardInput_6 Jump to KeyboardInput_6 if {} is higher.
6853 SET 4,D Set bit 4 of D.
KeyboardInput_6 6855 RRCA RRCA.
6856 JR NC,KeyboardInput_7 Jump to KeyboardInput_7 if {} is higher.
6858 SET 4,D Set bit 4 of D.
KeyboardInput_7 685A RRCA RRCA.
685B JR NC,KeyboardInput_8 Jump to KeyboardInput_8 if {} is higher.
685D SET 3,D Set bit 3 of D.
KeyboardInput_8 685F RRCA RRCA.
6860 JR NC,KeyboardInput_9 Jump to KeyboardInput_9 if {} is higher.
6862 SET 2,D Set bit 2 of D.
KeyboardInput_9 6864 RRCA RRCA.
6865 JR NC,KeyboardInput_10 Jump to KeyboardInput_10 if {} is higher.
6867 SET 1,D Set bit 1 of D.
KeyboardInput_10 6869 LD A,D A=D.
686A AND %00000011 Keep only bits 0-1.
686C CP $03 Compare A with 03.
686E JR NZ,KeyboardInput_11 Jump to KeyboardInput_11 if {} is not zero.
6870 XOR D Flip the bits according to D.
6871 LD D,A D=A.
KeyboardInput_11 6872 LD A,D A=D.
6873 AND %00001100 Keep only bits 2-3.
6875 CP $0C Compare A with 0C.
6877 JR NZ,KeyboardInput_12 Jump to KeyboardInput_12 if {} is not zero.
6879 XOR D Flip the bits according to D.
687A LD D,A D=A.
KeyboardInput_12 687B LD A,D A=D.
687C RET Return.
Prev: 6826 Up: Map Next: 687D