| Chase H.Q. | Routines |
| Prev: ECDA | Up: Map | Next: ED4D |
|
Used by the routine at stt_wait_for_keypress_loop.
|
||||
| redefine_keys_48k | ECF3 | CALL clear_screen | Clear the screen | |
| ECF6 | LD HL,$EA52 | Draw all of the REDEFINE KEYS / GEAR / ACCELERATE / ... strings | ||
| ECF9 | CALL menu_draw_strings | |||
| ECFC | LD DE,$48D6 | Set the screen location (179,112) to where the first defined key is shown | ||
| ECFF | LD BC,$0801 | Loop counter B = 8 iterations, and index C = 1 | ||
| rdk_loop_1 | ED02 | PUSH HL | Preserve registers | |
| ED03 | PUSH DE | |||
| ED04 | PUSH BC | |||
| ED05 | CALL play_music_48k | Call play_music_48k -- does this define a *single* key? | ||
| ED08 | POP BC | Restore registers | ||
| ED09 | POP DE | |||
| ED0A | POP HL | |||
|
Wait for the keyboard to clear.
|
||||
| ED0B | XOR A | Read keyboard port $00FE | ||
| ED0C | IN A,($FE) | |||
| ED0E | CPL | Complement the value returned to change it from active-low to active-high | ||
| ED0F | AND $1F | Discard any non-key flags | ||
| ED11 | JR NZ,rdk_loop_1 | Jump if any keys are pressed | ||
|
Otherwise...
|
||||
| ED13 | CALL define_a_key | Call define_a_key (passing index in C) | ||
| ED16 | INC C | Increment index | ||
| ED17 | INC HL | HL++ -- what's in HL? | ||
| ED18 | DJNZ rdk_loop_1 | Loop rdk_loop_1 while B > 0 | ||
|
All keys are now defined.
|
||||
| ED1A | LD B,$14 | B = 20 | ||
| rdk_loop_2 | ED1C | PUSH BC | Preserve | |
| ED1D | CALL play_music_48k | Call play_music_48k | ||
| ED20 | POP BC | Restore | ||
| ED21 | DJNZ rdk_loop_2 | Loop rdk_loop_2 while B > 0 | ||
|
Test if keys are "SHOCKED<ENTER>".
|
||||
| ED23 | LD B,$08 | 8 iterations | ||
| ED25 | LD DE,$EE30 | Point DE at shocked bytes | ||
| ED28 | LD HL,$EE38 | Point HL at temp_keydefs | ||
| rdk_loop_3 | ED2B | LD A,(DE) | Matching byte? | |
| ED2C | CP (HL) | |||
| ED2D | INC HL | Advance | ||
| ED2E | INC DE | |||
| ED2F | RET NZ | Return if no match | ||
| ED30 | DJNZ rdk_loop_3 | Loop rdk_loop_3 while B > 0 | ||
|
Matched: Show the test mode screen.
|
||||
| ED32 | LD A,$01 | Set test mode fla | ||
| ED34 | LD ($8000),A | |||
| ED37 | CALL clear_screen | Call clear_screen | ||
| ED3A | LD HL,$EAE1 | Address of TEST MODE strings | ||
| ED3D | CALL menu_draw_strings | Call menu_draw_strings | ||
|
Wait for any key.
|
||||
| rdk_wait | ED40 | CALL play_music_48k | Call play_music_48k | |
| ED43 | XOR A | Read keyboard port $00FE | ||
| ED44 | IN A,($FE) | |||
| ED46 | CPL | Complement the value returned to change it from active-low to active-high | ||
| ED47 | AND $1F | Discard any non-key flags | ||
| ED49 | JR Z,rdk_wait | Loop while no keys are pressed | ||
| ED4B | JR redefine_keys_48k | Restart routine | ||
| Prev: ECDA | Up: Map | Next: ED4D |