Routines

24028: ENTER pressed after writing on board


Used by routine at 24175

H 127

24028 54 LD D,H
24029 2EFB LD L,251 HL=32763
24031 3600 LD (HL),0 Signal: ERIC's no longer writing on board
24033 2E9C LD L,156 HL=32668 (combinations)
24035 010408 LD BC,2052 B=8 (4 numbers, 4 letters), C=4
24038 CBBE RES 7,(HL) Reset bit 7 of each combination number/letter
24040 2C INC L
24041 10FB DJNZ 24038
24043 2ED8 LD L,216
24045 6E LD L,(HL) L=board identifier (84, 90, 96, 102 or 108)
24046 2C INC L
24047 41 LD B,C B=4
24048 2C INC L Return unless at least four letters were written on the board by ERIC
24049 CB7E BIT 7,(HL)
24051 C0 RET NZ
24052 10FA DJNZ 24048
24054 EB EX DE,HL
24055 2E9C LD L,156 HL=32668 (combinations)
24057 0608 LD B,8 4 numbers, 4 letters
24059 1A LD A,(DE) A=code of character written on board
24060 FE60 CP 96 Is it upper case?
24062 3802 JR C,24066 Jump if so
24064 D620 SUB 32 Make lower case characters upper case
24066 BE CP (HL) Does the character written on the board match the combination number/letter?
24067 2804 JR Z,24073 Jump if so
24069 2C INC L Point to next combination number/letter
24070 10FA DJNZ 24066
24072 C9 RET
24073 1D DEC E Point to next character written on board
24074 CBFE SET 7,(HL) Signal: matching character
24076 0D DEC C
24077 20E8 JR NZ,24055 Jump back to check remaining numbers/letters
24079 2E9C LD L,156 HL=32668 (combinations)
24081 0604 LD B,4 4 numbers in bike combination
24083 7E LD A,(HL)
24084 A6 AND (HL) Bit 7 of A will remain set if all four written characters matched up with the bike combination
24085 2C INC L
24086 10FC DJNZ 24084
24088 07 RLCA Was there a match?
24089 3017 JR NC,24114 Jump if not
24091 2101D3 LD HL,54017 H=211 (bike), L=1
24094 7E LD A,(HL) A=bike's x-coordinate
24095 FEE0 CP 224 Is the bike already free?
24097 C0 RET NZ Return if so
24098 3664 LD (HL),100 Place bike at x-coordinate 100
24100 2100E1 LD HL,57600
24103 CD186C CALL 27672 Alter UDG references in play area to release bike from tree
24106 3E64 LD A,100 Add 1000 to score and print it
24108 CDB573 CALL 29621
24111 C3C1F3 JP 62401 Print inventory and make sound effect
24114 7E LD A,(HL)
24115 0604 LD B,4 4 letters in storeroom combination
24117 A6 AND (HL) Bit 7 of A will remain set if all four written characters matched up with the storeroom combination
24118 2C INC L
24119 10FC DJNZ 24117
24121 07 RLCA Was there a match?
24122 D0 RET NC Return if not
24123 2EEB LD L,235 HL=32747
24125 CB4E BIT 1,(HL) Has ERIC already got the storeroom key?
24127 C0 RET NZ Return if so
24128 CBCE SET 1,(HL) Give ERIC the key to the storeroom
24130 18E6 JR 24106