New Key Code Values

The Spectrum regularly monitors the keyboard and generates a unique code to describe the key currently being pressed. Multiple key presses yield key codes that in a standard Spectrum have no meaning and hence are filtered out and ignored. For valid key presses the generated key code is stored in a System Variable named LAST_K at memory location 5C08h. The range of key codes supported has been extended within the Spectrum 128 due to the new editing functions provided by the keypad. The standard editing functions available via the keypad yield the same key codes as those from the keyboard but the new editing functions yield completely new values. These new key codes are listed below:

SYMBOL KEY CODE EDITING FUNCTION
Legend CMND 07h Invoke the Options Menu (same as standard EDIT key code)
Legend DEL above a left arrow
0Ch Delete character to the left (same as standard DELETE key code)
Legend DEL above a right arrow
AAh Delete character to the right
Legend TOGGLE
A9h Toggle between upper and lower screens
Double left arrow AFh Move cursor to the beginning of the current word
Double right arrow AEh Move cursor to the end of the current word
Ended double left arrow A8h Move cursor to the beginning of the current line
Ended double right arrow A7h Move cursor to the end of the current line
Double up arrow ADh Move cursor up ten program lines
Double down arrow ACh Move cursor down ten program lines
Ended double up arrow A6h Move cursor to the first program line
Ended double down arrow A5h Move cursor to the last program line
Legend DEL next to ended double left arrow B1h Delete to the beginning of the current line
Legend DEL next to ended double right arrow B0h Delete to the end of the current line
Legend DEL next to double left arrow B4h Delete to the beginning of the current word
Legend DEL next to double right arrow B3h Delete to the end of the current word

Note that whilst SHIFT TOGGLE has no function it does cause a LAST_K value of B2h to be returned. This is then simply ignored. Use the Spectrum 128 style menu below to nagivate to other related sections.

Editing Functions Menu Title
Views New Keypad Editing Functions
Views Editing Functions Available Via The Keyboard
Views New Key Codes Generated By The Keypad
Returns To Editing Functions Section
Returns To Method Of Operation Section