|  | Routines | 
| Prev: EDC5 | Up: Map | Next: EDF7 | 
|  | ||||
| EDC6 | PUSH HL | Remember HL. | ||
| EDC7 | LD HL,$EDBE | Point HL at the list of which order to bring letters. (EDBE) | ||
| EDCA | LD A,($EDC5) | Put the number of safe letters already used in A. (EDC5) | ||
| EDCD | LD E,A | Put in this in DE. | ||
| EDCE | LD D,$00 | |||
| EDD0 | ADD HL,DE | Add the base address of the letters to give an offset from EDBE. | ||
| EDD1 | LD A,(HL) | Get the next character ID. | ||
| EDD2 | CP $FF | Is it an end marker (FF)? | ||
| EDD4 | JR Z,$EDE5 | Jump forward if it is. | ||
| EDD6 | CP (IY-$28) | Is the character ID the current player? | ||
| EDD9 | JR NZ,$EDE9 | Jump forward if it isn't. | ||
| 
The right character is at the safe.
 | ||||
| EDDB | INC E | Move to the next position in the buffer. | ||
| EDDC | LD A,E | Store this as the number of safe letters used. | ||
| EDDD | LD ($EDC5),A | |||
| EDE0 | CP $06 | Have all safe letters been used? | ||
| EDE2 | JP Z,$B3C3 | If so, the safe is cracked and the game is won! Display the final sequence. | ||
| EDE5 | POP HL | Otherwise, restore HL and process more actions. | ||
| EDE6 | JP $EAEB | |||
| 
The wrong character is at the safe.
 | ||||
| EDE9 | DEC HL | Move back in the list. | ||
| EDEA | LD A,(HL) | Get the character ID from here. | ||
| EDEB | CP (IY-$28) | Does it equal the current character? | ||
| EDEE | JR Z,$EDE5 | If so, leave here. | ||
| EDF0 | LD A,$01 | Otherwise, reset the number of letters completed back to 1. | ||
| EDF2 | LD ($EDC5),A | |||
| EDF5 | JR $EDE5 | Jump back to return and process more actions. | ||
| Prev: EDC5 | Up: Map | Next: EDF7 |