Prev: 35704 Up: Map Next: 35915
35713: Get Key
35713 DEFB 1,0,0,13,2,0,0,2
35721 DEFW 0
35723 DEFB 0,0,0,0,0,0,0,0
This entry point is used by the routine at 28915.
GetKey 35731 PUSH HL Stash HL, IX and BC on the stack.
35732 PUSH IX
35734 PUSH BC
35735 CALL Pause Call Pause.
35738 LD (35721),BC Write $0000 to 35721.
35742 LD HL,35723 HL=$8B8B.
35745 LD IX,35713 IX=35713.
35749 LD BC,65278 BC=$FEFE.
GetKey_Loop 35752 IN A,(C) Read from the keyboard port.
35754 AND %00011111 Keep only bits 0-4.
35756 OR (IX+0) OR against what IX is pointing to.
35759 PUSH AF Stash AF on the stack.
35760 CPL Invert the bits (1's complement on A).
35761 AND (HL) Keep bits based on what HL is pointing to.
35762 CPL Invert the bits back (1's complement on A).
35763 JR Z,GetKey_ If it is zero, jump to GetKey_.
35765 LD (35721),BC Stash BC at 35721.
35769 LD (35721),A Stash A at 35721.
GetKey_ 35772 POP AF Restore AF from the stack.
35773 LD (HL),A Stash A at HL.
35774 INC HL Increase HL by one.
35775 INC IX Increase IX by one.
35777 RLC B Rotate B left.
35779 JR C,GetKey_Loop If there is carry then this is not a match, jump back to GetKey_Loop to try again.
35781 LD BC,(35721) BC=35721.
If no key match was found, end...
35785 LD A,B If BC is $0000, jump to GetKey_Return.
35786 OR C
35787 JR Z,GetKey_Return
35789 LD A,251 A=$FB.
35791 ADD A,5 A=A + 5.
35793 RRC B Rotate B right once.
35795 JR C,35791 If there is any carry, jump to 35791.
35797 DEC A Decrease A by one, ready for the following loop to begin in the same place.
35798 INC A Increment A by one.
35799 RRC C Rotate C right once.
35801 JR C,35798 If there is any carry, jump to 35798.
35803 LD C,A Create an offset in BC.
35804 LD B,0
35806 LD HL,35835 HL=KeyboardMap1.
35809 LD A,254 Read from the keyboard port.
Port Number Bit
0 1 2 3 4
$FE SHIFT Z X C V
35811 IN A,(254)
35813 AND %00000001 Keep only bit 0 (SHIFT).
35815 JR Z,GetKey_UseMap2 If it is zero, jump to GetKey_UseMap2.
35817 LD A,127 Read from the keyboard port.
Port Number Bit
0 1 2 3 4
$7F SPACE FULL-STOP M N B
35819 IN A,(254)
35821 AND %00000010 Keep only bit 1 (FULL-STOP).
35823 JR NZ,GetKey_GetByte If it is not zero, jump to GetKey_GetByte.
GetKey_UseMap2 35825 LD HL,35875 HL=KeyboardMap2.
GetKey_GetByte 35828 ADD HL,BC HL=HL + keyboard map offset.
35829 LD A,(HL) A=HL (fetched byte from keyboard map).
GetKey_Return 35830 POP BC Restore BC, IX and HL from the stack.
35831 POP IX
35833 POP HL
35834 RET Return.
KeyboardMap1 35835 DEFB 0,90,88,67,86 --, Z, X, C, V
35840 DEFB 65,83,68,70,71 A, S, D, F, G
35845 DEFB 81,87,69,82,84 Q, W, E, R, T
35850 DEFB 0,0,0,0,8 --, --, --, --, 
35855 DEFB 8,0,9,91,10 , --, , [,
35860 DEFB 80,79,73,85,89 P, O, I, U, Y
35865 DEFB 13,76,75,74,72 , L, K, J, H
35870 DEFB 32,0,77,78,66 , --, M, N, B
KeyboardMap2 35875 DEFB 0,90,88,67,86 --, Z, X, C, V
35880 DEFB 65,83,68,70,71 A, S, D, F, G
35885 DEFB 81,87,69,82,84 Q, W, E, R, T
35890 DEFB 0,64,0,0,8 --, @, --, --, 
35895 DEFB 24,0,9,91,10 , --, , [,
35900 DEFB 34,79,73,85,89 ", O, I, U, Y
35905 DEFB 13,76,75,74,72 , L, K, J, H
35910 DEFB 2,0,46,44,66 , --, ., ,, B
Prev: 35704 Up: Map Next: 35915