![]() |
Routines |
| H | 127 |
| 24028 | LD D,H | D=127 |
| 24029 | LD L,251 | Reset all of ERIC's status flags at 32763 now that he's no longer writing on the board |
| 24031 | LD (HL),0 | |
| 24033 | LD L,156 | HL=32668 (combinations) |
| 24035 | LD BC,2052 | B=8 (4 numbers, 4 letters), C=4 |
| 24038 | RES 7,(HL) | Reset bit 7 of each combination number/letter; bit 7 will be set later if there is a match with what ERIC wrote on the board |
| 24040 | INC L | |
| 24041 | DJNZ 24038 | |
| 24043 | LD L,216 | HL=32728 (which holds the identifier of the blackboard ERIC wrote on) |
| 24045 | LD L,(HL) | Point HL at byte 1 of the relevant blackboard buffer (bytes 2-5 hold the first 4 characters ERIC wrote) |
| 24046 | INC L | |
| 24047 | LD B,C | B=4 |
| 24048 | INC L | Return unless at least four letters were written on the board by ERIC |
| 24049 | BIT 7,(HL) | |
| 24051 | RET NZ | |
| 24052 | DJNZ 24048 | |
| 24054 | EX DE,HL | Point DE at the last byte of the blackboard buffer |
| 24055 | LD L,156 | HL=32668 (combinations) |
| 24057 | LD B,8 | 4 numbers, 4 letters |
| 24059 | LD A,(DE) | A=code of character written on board |
| 24060 | CP 96 | Is it upper case? |
| 24062 | JR C,24066 | Jump if so |
| 24064 | SUB 32 | Make lower case characters upper case |
| 24066 | CP (HL) | Does the character written on the board match the combination number/letter? |
| 24067 | JR Z,24073 | Jump if so |
| 24069 | INC L | Point to the next combination number/letter |
| 24070 | DJNZ 24066 | |
| 24072 | RET | |
| 24073 | DEC E | Point to the next character written on the board |
| 24074 | SET 7,(HL) | Signal: matching character |
| 24076 | DEC C | Next combination letter/number |
| 24077 | JR NZ,24055 | Jump back to check the remaining numbers/letters |
| 24079 | LD L,156 | HL=32668 (combinations) |
| 24081 | LD B,4 | There are 4 digits in the bike combination |
| 24083 | LD A,(HL) | Pick up the first digit |
| 24084 | AND (HL) | Bit 7 of A will remain set if all four written characters matched up with the bike combination digits |
| 24085 | INC L | |
| 24086 | DJNZ 24084 | |
| 24088 | RLCA | Was there a match? |
| 24089 | JR NC,24114 | Jump if not |
| 24091 | LD HL,54017 | H=211 (bike), L=1 |
| 24094 | LD A,(HL) | A=bike's x-coordinate |
| 24095 | CP 224 | Is the bike already free? |
| 24097 | RET NZ | Return if so |
| 24098 | LD (HL),100 | Place the bike at x-coordinate 100 |
| 24100 | LD HL,57600 | Alter UDG references in the play area to release the bike from the tree |
| 24103 | CALL 27672 | |
| 24106 | LD A,100 | Add 1000 to the score and print it |
| 24108 | CALL 29621 | |
| 24111 | JP 62401 | Print the inventory and make a sound effect |
| 24114 | LD A,(HL) | Pick up the first combination letter |
| 24115 | LD B,4 | There are 4 letters in the storeroom combination |
| 24117 | AND (HL) | Bit 7 of A will remain set if all four written characters matched up with the storeroom combination letters |
| 24118 | INC L | |
| 24119 | DJNZ 24117 | |
| 24121 | RLCA | Was there a match? |
| 24122 | RET NC | Return if not |
| 24123 | LD L,235 | HL=32747 (which holds the inventory flags) |
| 24125 | BIT 1,(HL) | Has ERIC already got the storeroom key? |
| 24127 | RET NZ | Return if so |
| 24128 | SET 1,(HL) | Otherwise give ERIC the key to the storeroom |
| 24130 | JR 24106 | Add 1000 to the score and make a sound effect |