Prev: E810 Up: Map Next: E9B4
E8FE: "Stop the tape" handler (48K mode only)
Used by the routine at entrypt_48k.
stop_the_tape_48k E8FE CALL setup_interrupts Call setup_interrupts
E901 CALL reset_music Call reset_music
E904 EI Enable interrupts
E905 HALT Wait for next interrupt
E906 CALL clear_screen Call clear_screen
E909 LD HL,$E9B4 -> "STOP THE TAPE" + "PRESS ANY KEY" message set
E90C CALL menu_draw_strings Call menu_draw_strings
Wait for a key down.
stt_wait_for_keypress_loop E90F CALL play_music_48k Call play_music_48k during the loop
E912 XOR A Was any key pressed?
E913 IN A,($FE)
E915 CPL
E916 AND $1F
E918 JR Z,stt_wait_for_keypress_loop Loop if not
Wait for key up.
stt_debounce_loop E91A CALL play_music_48k Call play_music_48k during the loop
E91D XOR A Was any key pressed?
E91E IN A,($FE)
E920 CPL
E921 AND $1F
E923 JR NZ,stt_debounce_loop Loop if it was
Draw the input selection menu.
stt_clear_screen E925 CALL clear_screen Call clear_screen
E928 LD HL,$E9E1 Point HL at input menu messages (NUL terminated)
E92B CALL menu_draw_strings Call menu_draw_strings
Wait for a choice.
stt_keyscan_choice E92E CALL play_music_48k Call play_music_48k during the loop
E931 LD A,$F7 Keyscan for 1, 2, 3, 4, 5
E933 IN A,($FE)
E935 CPL
E936 AND $1F
E938 JR Z,stt_keyscan_choice Loop while no selection
E93A RRA 1. SINCLAIR JOYSTICK selected
E93B JR C,stt_sinclair_joystick
E93D RRA 2. CURSOR JOYSTICK selected
E93E JR C,stt_cursor_joystick
E940 RRA 3. KEMPSTON JOYSTICK selected
E941 JR C,stt_kempston_joystick
E943 RRA 4. KEYBOARD selected
E944 JR C,stt_keyboard
E946 CALL redefine_keys_48k 5. DEFINE KEYS selected
E949 JR stt_clear_screen Loop
stt_sinclair_joystick E94B LD HL,$EE26 Point at Sinclair joystick keydefs
E94E JR stt_copy_keydefs Jump to copy keydefs
stt_cursor_joystick E950 LD HL,$EE2B Point at cursor joystick keydefs
stt_copy_keydefs E953 LD DE,$EE38 Copy the five keydefs at HL to $EE38
E956 LD BC,$0005
E959 LDIR
stt_keyboard E95B XOR A Clear Kempston joystick flag
stt_do_define E95C LD HL,$EE3D Point at final three bytes of temp_keydefs
E95F LD DE,$A0CC Assign Kempston joystick flag
E962 LD (DE),A
E963 INC DE Populate Quit/Pause/Turbo keys at $A0CD+
E964 LD BC,$0003
E967 LDIR
E969 LD HL,$EE38 Populate Gear/Accelerate/Brake/Left/Right keys at $A0D2+
E96C LD C,$05
E96E LDIR
Warn the player that they can't return to this screen.
E970 CALL clear_screen Call clear_screen
E973 LD HL,$EB78 Address of "control options cannot be remodified" text (NUL terminated)
E976 CALL menu_draw_strings Call menu_draw_strings
Wait for key up.
stt_debounce_loop2 E979 CALL play_music_48k Call play_music_48k
E97C XOR A Was a key pressed?
E97D IN A,($FE)
E97F CPL
E980 AND $1F
E982 JR NZ,stt_debounce_loop2 Loop if it was
stt_confirm E984 CALL play_music_48k Call play_music_48k
E987 LD A,$DF Was Y pressed?
E989 IN A,($FE)
E98B CPL
E98C AND $10
E98E JR NZ,stt_done Jump to done if so
E990 LD A,$7F Was N pressed?
E992 IN A,($FE)
E994 CPL
E995 AND $08
E997 JR NZ,stt_clear_screen Start over if so
E999 JR stt_confirm Loop
stt_done E99B DI Disable interrupts
E99C JP clear_screen Jump to clear_screen
Check for a stable reading from the Kempston joystick port before allowing the user to proceed.
stt_kempston_joystick E99F LD B,$0A 10 iterations
E9A1 IN A,($1F) Read the joystick port into C
E9A3 LD C,A
stt_kempston_loop E9A4 IN A,($1F) Read the same port again
E9A6 CP C If it doesn't match then jump back to menu
E9A7 JR NZ,stt_keyscan_choice
E9A9 PUSH BC Call play_music_48k
E9AA CALL play_music_48k
E9AD POP BC
E9AE DJNZ stt_kempston_loop Loop while B > 0
E9B0 LD A,$01 Set Kempston joystick flag
E9B2 JR stt_do_define Jump to do define
Prev: E810 Up: Map Next: E9B4