Prev: 56727 Up: Map Next: 56832
56768: Choose Control Type
Used by the routines at SelectionScreen, ChangeControls and UserDefinedKeys.
ChooseControlType 56768 LD DE,65327 DE=65327.
56771 LD BC,65278 BC=65278.
ReadKeyboard_Loop 56774 IN A,(C) Read from the keyboard.
56776 CPL Invert the bits in A.
56777 AND %00011111 Keep only bits 0-4.
56779 JR Z,ChooseControlType_1 Jump to ChooseControlType_1 if there's no match.
56781 INC D Increment D by one.
56782 RET NZ Return if D is not zero.
56783 LD H,A H=A.
56784 LD A,E A=E.
ChooseControlType_0 56785 SUB 8 A-=8.
56787 SRL H Shift H right.
56789 JR NC,ChooseControlType_0 Jump to ChooseControlType_0 if {} is higher.
56791 RET NZ Return if {} is not zero.
56792 LD D,A D=A.
56793 LD L,B L=B.
ChooseControlType_1 56794 DEC E Decrease E by one.
56795 RLC B Rotate B left (with carry).
56797 JR C,ReadKeyboard_Loop Jump to ReadKeyboard_Loop if {} is lower.
56799 LD A,D A=D.
56800 AND %00111000 Keep only bits 3-5.
56802 RRCA Rotate A right three positions (bits 3 to 5 are now in positions 0 to 2).
56803 RRCA
56804 RRCA
56805 PUSH HL Stash HL on the stack.
56806 LD HL,56818 HL=56818.
56809 LD B,0 B=0.
56811 LD C,A C=A.
56812 ADD HL,BC HL+=BC.
56813 LD B,(HL) B=*HL.
56814 POP HL Restore HL from the stack.
56815 LD H,B H=B.
56816 XOR A A=0.
56817 RET Return.
56818 DEFB 16,8,4,2,1,0,0,0
56826 DEFB 0,0,0,0,0,0
Prev: 56727 Up: Map Next: 56832