Routines
| Prev: BFD9 | Up: Map | Next: C03B |
C00C: What part of the day is it? (A = 1-5)
|
1 night (8pm to 5:59am), 5 dawn (the 6am hour), 4 day (7am to 12:59pm), 3 afternoon (1pm to 6:59pm), 2 dusk (the 7pm hour).
The five parts, from the code: 1 night (8pm to 5:59am), 2 the 7pm hour, 3 afternoon (1pm to 6:59pm), 4 morning (7am to 12:59pm), 5 the 6am hour. The message codes $17, $16, $15, $14 and $0F show text only in parts 1-5 respectively (A68C).
How it works:
1. In the morning (am), 12 midnight to 5:59 is night (1), 6am is dawn (5) and 7 to 11am is morning (4).
2. In the afternoon (pm), 12 noon is morning (4), 1 to 6pm is afternoon (3), 7pm is evening (2) and 8pm onwards is night (1).
|
||||||||
| C00C | LD A,($9FE2) | Read 'a' or 'p' (9FE2) into A - am or pm? | ||||||
| C00F | CP $61 | Compare A with $61 | ||||||
| C011 | LD A,($9FE0) | Read the hour, 1-12 (9FE0) into A | ||||||
| C014 | JR Z,$C02B | If A equals $61, skip ahead to C02B | ||||||
| C016 | CP $0C | Compare A with $0C - pm: 12 noon to 12:59 counts as morning (4) | ||||||
| C018 | JR Z,$C035 | If A equals $0C, skip ahead to C035 | ||||||
| C01A | CP $08 | Compare A with $08 - 8pm or later: night (1) | ||||||
| C01C | JR C,$C021 | If A is below $08, skip ahead to C021 | ||||||
| C01E | LD A,$01 | Load A with $01 | ||||||
| C020 | RET | Return to the caller | ||||||
| C021 | CP $07 | Compare A with $07 - 7pm: evening (2) | ||||||
| C023 | JR NZ,$C028 | If A differs from $07, skip ahead to C028 | ||||||
| C025 | LD A,$02 | Load A with $02 | ||||||
| C027 | RET | Return to the caller | ||||||
| C028 | LD A,$03 | Load A with $03 - 1pm to 6pm: afternoon (3) | ||||||
| C02A | RET | Return to the caller | ||||||
| C02B | CP $0C | Compare A with $0C - am: midnight to 5am is night (1) | ||||||
| C02D | JR Z,$C01E | If A equals $0C, go back to C01E | ||||||
| C02F | CP $06 | Compare A with $06 | ||||||
| C031 | JR C,$C01E | If A is below $06, go back to C01E | ||||||
| C033 | JR Z,$C038 | 6am: dawn (5) | ||||||
| C035 | LD A,$04 | Load A with $04 - 7am to 11am: morning (4) | ||||||
| C037 | RET | Return to the caller | ||||||
| C038 | LD A,$05 | Load A with $05 | ||||||
| C03A | RET | Return to the caller | ||||||
| Prev: BFD9 | Up: Map | Next: C03B |