add esc and free cursor movement

esc exits notes mode;
added missing arrow keys;
left/right wraps line;
up/down wraps screen
This commit is contained in:
Peter Ferrie 2016-10-28 09:09:53 -07:00
parent 0d1b8d8980
commit 19665e2cfc

View File

@ -4,7 +4,7 @@
; ;
!cpu 6502 !cpu 6502
*=$8000 *=$8000
!to "_4live#068000", plain
; ;
!addr WNDLFT = $20 !addr WNDLFT = $20
!addr WNDWDTH = $21 !addr WNDWDTH = $21
@ -56,7 +56,11 @@
SAVEKEY = $93 ; CTRL-S SAVEKEY = $93 ; CTRL-S
;constants ;constants
LTARROW = $88
UPARROW = $8B
RETURN = $8D RETURN = $8D
RTARROW = $95
ESC = $9B
WIDTH = 40 WIDTH = 40
HEIGHT = 24 HEIGHT = 24
IOBSLOT = 1 IOBSLOT = 1
@ -308,18 +312,55 @@ EditorMode
jsr KEYIN jsr KEYIN
cmp #HOTKEY cmp #HOTKEY
beq KeyRet beq KeyRet
cmp #ESC
beq KeyRet
cmp #SAVEKEY cmp #SAVEKEY
beq SaveFile beq SaveFile
cmp #IMPORTKEY cmp #IMPORTKEY
beq ImportScreen beq ImportScreen
cmp #LTARROW
beq LineLeft
cmp #UPARROW
beq LineUp
cmp #RTARROW
beq LineRight
OutChar
jsr COUT jsr COUT
lda CV lda CV
eor #(HEIGHT - 1) ;zero on match eor #(HEIGHT - 1) ;zero on match
bne EditorMode bne EditorMode
SetRow
sta CV sta CV
SetRow1
lda CV
jsr BASCALC jsr BASCALC
bcc EditorMode ;always bcc EditorMode ;always
LineLeft
dec CH
bpl SetRow1
lda #(WIDTH - 1)
SetColumn
sta CH
bpl SetRow1 ;always
LineUp
dec CV
bpl SetRow1
lda #(HEIGHT - 2)
bne SetRow ;always
LineRight
inc CH
lda CH
eor #WIDTH ;zero on match
bne SetRow1
beq SetColumn ;always
ImportScreen ImportScreen
lda #<(FirstLine + WIDTH) lda #<(FirstLine + WIDTH)
sta OPSRCL sta OPSRCL