all screen control codes are now handled via jumptable
This commit is contained in:
1 parent
1682587d12
commit
01024278f4
5 files changed
+77
-54
No files matched your search
@@ -178,7 +178,6 @@ Not all of them - only these we want to have implemented.
|
||||
| `$F646` | IEC close | NOT DONE | |
|
||||
| `$FD30` | default vectors | DONE | |
|
||||
| `$FD90` | (unknown) | NOT DONE | |
|
||||
| `$FD90` | (unknown) | NOT DONE | |
|
||||
| `$FE2D` | memtop set part | DONE | |
|
||||
| `$FE47` | default NMI | PARTIAL | |
|
||||
| `$FE66` | default BRK | DONE | |
|
||||
|
||||
@@ -7,62 +7,32 @@ chrout_screen_control:
|
||||
|
||||
txa
|
||||
|
||||
// Order here is not random
|
||||
// 1. First handle the ones that do not depend on quote mode
|
||||
// 2. Handle remaining control codes starting from the most commonly used
|
||||
// We want to be as snappy as possible
|
||||
|
||||
chrout_try_RETURN:
|
||||
|
||||
cmp #KEY_RETURN
|
||||
bne !+
|
||||
|
||||
// RETURN clears quote and insert modes, it also clears reverse flag
|
||||
lda #$00
|
||||
sta QTSW
|
||||
sta INSRT
|
||||
sta RVS
|
||||
jmp chrout_screen_advance_to_next_line
|
||||
!:
|
||||
chrout_try_DEL:
|
||||
|
||||
cmp #KEY_DEL
|
||||
beq_far chrout_screen_DEL
|
||||
|
||||
chrout_try_INS:
|
||||
|
||||
cmp #KEY_INS
|
||||
beq_far chrout_screen_INS
|
||||
|
||||
#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_jumptable:
|
||||
|
||||
ldx #(__chrout_screen_jumptable_codes_end - chrout_screen_jumptable_codes - 1)
|
||||
|
||||
chrout_try_jumptable_loop:
|
||||
|
||||
cpx #(__chrout_screen_jumptable_quote_guard - chrout_screen_jumptable_codes - 1)
|
||||
bne chrout_try_jumptable_loop_noquote
|
||||
|
||||
// Is this insert/quote mode?
|
||||
tay
|
||||
lda QTSW
|
||||
ora INSRT
|
||||
beq !+
|
||||
tya
|
||||
jmp chrout_screen_quote
|
||||
!:
|
||||
tya
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
chrout_try_jumptable_loop_noquote:
|
||||
|
||||
cmp chrout_screen_jumptable_codes, x
|
||||
bne !+
|
||||
|
||||
// Found, perform a jump to subroutine
|
||||
lda chrout_screen_jumptable_hi, x
|
||||
pha
|
||||
@@ -76,7 +46,9 @@ chrout_try_jumptable_loop:
|
||||
chrout_try_COLOR:
|
||||
|
||||
ldx #$0F
|
||||
chrout_try_color_loop:
|
||||
|
||||
chrout_try_color_loop:
|
||||
|
||||
cmp colour_codes,x
|
||||
bne !+
|
||||
stx COLOR
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
//
|
||||
// Jumptable for screen control coldes support. To improve performance, should be sorted
|
||||
// starting from the least probable routine
|
||||
// starting from the least probable routine.
|
||||
//
|
||||
|
||||
|
||||
@@ -20,6 +20,15 @@ chrout_screen_jumptable_codes:
|
||||
.byte KEY_CRSR_DOWN
|
||||
.byte KEY_CRSR_UP
|
||||
|
||||
__chrout_screen_jumptable_quote_guard:
|
||||
|
||||
#if CONFIG_EDIT_STOPQUOTE
|
||||
.byte KEY_STOP
|
||||
#endif
|
||||
.byte KEY_INS
|
||||
.byte KEY_DEL
|
||||
.byte KEY_RETURN
|
||||
|
||||
__chrout_screen_jumptable_codes_end:
|
||||
|
||||
|
||||
@@ -37,7 +46,12 @@ chrout_screen_jumptable_lo:
|
||||
.byte <(chrout_screen_CRSR_LEFT - 1)
|
||||
.byte <(chrout_screen_CRSR_DOWN - 1)
|
||||
.byte <(chrout_screen_CRSR_UP - 1)
|
||||
|
||||
#if CONFIG_EDIT_STOPQUOTE
|
||||
.byte <(chrout_screen_STOP - 1)
|
||||
#endif
|
||||
.byte <(chrout_screen_INS - 1)
|
||||
.byte <(chrout_screen_DEL - 1)
|
||||
.byte <(chrout_screen_RETURN - 1)
|
||||
|
||||
chrout_screen_jumptable_hi:
|
||||
|
||||
@@ -53,3 +67,9 @@ chrout_screen_jumptable_hi:
|
||||
.byte >(chrout_screen_CRSR_LEFT - 1)
|
||||
.byte >(chrout_screen_CRSR_DOWN - 1)
|
||||
.byte >(chrout_screen_CRSR_UP - 1)
|
||||
#if CONFIG_EDIT_STOPQUOTE
|
||||
.byte >(chrout_screen_STOP - 1)
|
||||
#endif
|
||||
.byte >(chrout_screen_INS - 1)
|
||||
.byte >(chrout_screen_DEL - 1)
|
||||
.byte >(chrout_screen_RETURN - 1)
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
//
|
||||
// RETURN key handling within CHROUT
|
||||
//
|
||||
|
||||
|
||||
chrout_screen_RETURN:
|
||||
|
||||
// RETURN clears quote and insert modes, it also clears reverse flag
|
||||
lda #$00
|
||||
sta QTSW
|
||||
sta INSRT
|
||||
sta RVS
|
||||
jmp chrout_screen_advance_to_next_line
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
//
|
||||
// STOP key handling within CHROUT
|
||||
//
|
||||
|
||||
|
||||
#if CONFIG_EDIT_STOPQUOTE
|
||||
|
||||
|
||||
chrout_screen_STOP:
|
||||
|
||||
lda #$00
|
||||
sta QTSW
|
||||
sta INSRT
|
||||
jmp chrout_screen_done
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user