|  | Routines | 
| Prev: 40190 | Up: Map | Next: 40235 | 
| 
Used by the routine at 40190.
 | ||||
| 40201 | LD A,(23672) | Load A with LSB of frame counter... | ||
| 40204 | AND 3 | ...clear bits 2-7 to leave random number between 0 and 3... | ||
| 40206 | RET NZ | ...and if number is not zero then return | ||
| 40207 | LD A,(24768) | Load A with unused bit... | ||
| 40210 | AND 128 | ... | ||
| 40212 | LD (40223),A | ...and store as operand of instruction at 40222 | ||
| 40215 | LD A,(24768) | Load Magic Knight's current strength into A... | ||
| 40218 | AND 127 | ... | ||
| 40220 | DEC A | ...and decrease by one | ||
| 40221 | PUSH AF | Store AF (A = Magic Knight's new strength) | ||
| 
The operand of the instruction at 40222 represents the unused bit from Magic Knight's current strength. This is modified by the instruction at 40212.
 | ||||
| 40222 | ADD A,0 | Combine unused bit with new strength value in A... | ||
| 40224 | LD (24768),A | ...and store as Magic Knight's current strength | ||
| 40227 | CALL 46463 | Print Magic Knight's current strength at (6, 2) as text if he is carrying the Mirror | ||
| 40230 | POP AF | Restore AF (A = Magic Knight's new strength)... | ||
| 40231 | JP Z,38857 | ...and if zero then display "YOU DIED OF EXHAUSTION" game over window and return to control selection menu | ||
| 40234 | RET | Return | ||
| Prev: 40190 | Up: Map | Next: 40235 |