Prev: 43610 Up: Map Next: 44093
44041: KeyboardScanner — the (redefinable) keyboard input device
The keyboard entry of InputScannerTable. Each control is a self-modified (port, mask) pair patched by the redefinition flow at 43904. A match sets the AlienFlags bit HandleInput expects: UP = bit 2 (cursor up = retreat), DOWN = bit 3 (advance), FIRE = bit 4 (action), "Return to QUIT" = bit 1 (row jump).
44041 LD HL,33682 AlienFlags = no keys
44044 LD (HL),0
44046 LD BC,32766 the UP key's port and mask
44049 IN A,(C) (both operands are patched):
44051 AND 1 pressed?
44053 JR NZ,44058
44055 SET 2,(HL) yes: cursor up (retreat)
44057 RET
44058 LD BC,32766 the DOWN key
44061 IN A,(C)
44063 AND 2
44065 JR NZ,44070
44067 SET 3,(HL) cursor down (advance)
44069 RET
44070 LD BC,32766 the FIRE key
44073 IN A,(C)
44075 AND 4
44077 JR NZ,44082
44079 SET 4,(HL) action
44081 RET
44082 LD BC,32766 the "Return to QUIT" key
44085 IN A,(C)
44087 AND 8
44089 RET NZ
44090 SET 1,(HL) row jump
44092 RET
Prev: 43610 Up: Map Next: 44093