Routines |
Prev: ECB8 | Up: Map | Next: F216 |
Used by the routine at F296.
|
||||
Called from F2F2 after code generated and message printed on screen.
Picks out the relevant code from the code table at ECB8 that the player needs to type in. The 2-byte code is returned in the DE registers.
|
||||
F1FA | LD A,($F260) | Second part of code from code sheet (number) - value = 0-41 | ||
F1FD | LD L,A | |||
F1FE | LD H,$00 | Store value in HL register pair | ||
Each set (0-41) in the code table at ECB8 is 32 bytes long, so need to multiply this by 32 bytes to get to the right set
|
||||
F200 | ADD HL,HL | x2 | ||
F201 | ADD HL,HL | x4 | ||
F202 | ADD HL,HL | x8 | ||
F203 | ADD HL,HL | x16 | ||
F204 | ADD HL,HL | x32 | ||
Next use the first part of the code to find the value within the set:
|
||||
F205 | LD A,($F261) | First part of code from code sheet (letter) - value = 0-16 (A-P) | ||
F208 | ADD A,A | x2 (as each 4-digit code is 2 bytes long) | ||
F209 | LD C,A | |||
F20A | LD B,$00 | Store value in BC register pair | ||
F20C | ADD HL,BC | Add to HL value | ||
F20D | LD BC,$ECB8 | |||
F210 | ADD HL,BC | ...and then add the start of the code sheet address location to get to the right place. | ||
The HL register pair is now pointing to relevant code (2 bytes) in table at ECB8.
Now put the 2 code bytes into the D & E registers
|
||||
F211 | INC HL | |||
F212 | LD D,(HL) | Second (high) byte stored in D register | ||
F213 | DEC HL | |||
F214 | LD E,(HL) | First (low) byte stored in E register | ||
F215 | RET |
Prev: ECB8 | Up: Map | Next: F216 |