screen editor is now easier to extend

This commit is contained in:
FeralChild64 committed 2019-10-30 18:12:04 +01:00
1 parent c3383b9e8f
commit ec98861613
17 files changed
+280 -174

No files matched your search

+32 -128
View File
@@ -15,7 +15,7 @@ chrout_screen_control:
chrout_try_RETURN:
cmp #$0D
cmp #KEY_RETURN
bne !+
// RETURN clears quote and insert modes, it also clears reverse flag
@@ -27,156 +27,60 @@ chrout_try_RETURN:
!:
chrout_try_DEL:
cmp #$14
cmp #KEY_DEL
bne !+
jmp chrout_screen_del
jmp chrout_screen_DEL
!:
#if CONFIG_EDIT_STOPQUOTE
chrout_try_STOP:
cmp #KEY_STOP
bne !+
lda #$00
sta QTSW
sta INSRT
// Let it run, we are saving 3 bytes on JMP this way
// and the performance hit is not going to be visible nevertheless
!:
#endif
chrout_try_quote:
lda QTSW
ora INSRT
beq !+
txa
jmp chrout_screen_quote
!:
txa
chrout_try_CRSR_UP:
chrout_try_jumptable:
cmp #$91
ldx #(__chrout_screen_jumptable_codes_end - chrout_screen_jumptable_codes - 1)
chrout_try_jumptable_loop:
cmp chrout_screen_jumptable_codes, x
bne !+
lda PNTR
sec
sbc #40
sta PNTR
jmp chrout_screen_calc_lptr_done
// Found, perform a jump to subroutine
lda chrout_screen_jumptable_hi, x
pha
lda chrout_screen_jumptable_lo, x
pha
rts
!:
chrout_try_CRSR_DOWN:
dex
bpl chrout_try_jumptable_loop
cmp #$11
bne !+
lda PNTR
clc
adc #40
sta PNTR
// We need to advance the pointer manually, as normalising
// now will break things. The pointer update is required
// so that we can tell if we really are on the bottom phys
// screen line or not
jsr screen_scroll_up_if_on_last_line
jmp chrout_screen_calc_lptr_done
!:
chrout_try_CRSR_LEFT:
cmp #$9D
bne !+
lda TBLX
ora PNTR
beq crsr_l1 // recalculating pointer is not really necessary, but this is a very rare case nevertheless
dec PNTR
crsr_l1:
jmp chrout_screen_calc_lptr_done
!:
chrout_try_CRSR_RIGHT:
cmp #$1D
bne !+
inc PNTR
jmp chrout_screen_calc_lptr_done
!:
chrout_try_RVS_ON:
cmp #$12
bne !+
lda #$80
bne rvs_l1
!:
chrout_try_RVS_OFF:
cmp #$92
bne !+
lda #$00
rvs_l1:
sta RVS
jmp chrout_screen_done
!:
chrout_try_MODE_GFX:
cmp #$8E
bne !+
lda VIC_YMCSB
and #$02 // to upper case
mode_l1:
sta VIC_YMCSB
jmp chrout_screen_done
!:
chrout_try_MODE_TXT:
cmp #$0E
bne !+
lda VIC_YMCSB
ora #$02 // to lower case
bne mode_l1 // branch always
!:
chrout_try_COLOR:
ldx #$0F
colour_check_loop:
chrout_try_color_loop:
cmp colour_codes,x
bne !+
stx COLOR
jmp chrout_screen_done
!:
dex
bpl colour_check_loop
chrout_try_SHIFT_ENABLE:
cmp #$09
bne !+
lda #$00 // enable SHIFT+VENDOR combination
sta MODE
bpl chrout_try_color_loop
// Unknown code, or key not requiring any handling
jmp chrout_screen_done
!:
chrout_try_SHIFT_DISABLE:
cmp #$08
bne !+
lda #$80 // disable SHIFT+VENDOR combination
sta MODE
jmp chrout_screen_done
!:
chrout_try_HOME:
cmp #$13
bne !+
jsr cursor_home
jmp chrout_screen_done
!:
chrout_try_CLR:
cmp #$93
bne !+
jsr clear_screen
clr_l1:
jmp chrout_screen_done
!:
chrout_try_INS:
cmp #$94
bne clr_l1 // unknown code or key does not need handling
jmp chrout_screen_ins