work towards INS key support in MEGA65 mode

This commit is contained in:
FeralChild64 committed 2020-08-29 21:40:53 +02:00
1 parent 3fc9f6fb29
commit c5f195fcdc
2 files changed
+74 -2

No files matched your search

@@ -79,8 +79,6 @@ m65_chrout_screen_CLR:
nop
m65_chrout_screen_HOME:
nop
m65_chrout_screen_INS:
nop
m65_chrout_screen_TAB:
nop
m65_chrout_screen_LINE_FEED:
@@ -49,3 +49,77 @@ m65_chrout_screen_STOP:
sta QTSW
sta INSRT
jmp_8 m65_chrout_screen_ctrl2_end
// INS key
m65_chrout_screen_INS:
// First prepare the pointer to the current row
jsr m65_helper_scrlpnt_color
jsr m65_helper_scrlpnt_to_screen
// Check for windowed mode
lda M65_SCRWINMODE
bmi_16 m65_chrout_screen_INS_winmode
// Check if last character of the line is space
ldy M65_SCRMODE
lda m65_scrtab_txtwidth,y
dec_a
taz
lda_lp (M65_LPNT_SCR), z
cmp #$20
bne_16 m65_chrout_screen_ctrl2_end
phz
// Last character is space - move the characters
jsr m65_chrout_screen_INS_copy
// Store space in the current character cell
lda #$20
sta_lp (M65_LPNT_SCR), z
// Move the color memory
jsr m65_helper_scrlpnt_color
plz
jsr m65_chrout_screen_INS_copy
// Store current colour in the current character cell
lda COLOR
and #$0F
sta_lp (M65_LPNT_SCR), z
// Increase insert mode count (which causes quote-mode like behaviour) and quit
inc INSRT
jmp_8 m65_chrout_screen_ctrl2_end
m65_chrout_screen_INS_winmode:
// Check if last character of the line within window is space
// XXX provide implementation
jmp_8 m65_chrout_screen_ctrl2_end
m65_chrout_screen_INS_copy:
dez
lda_lp (M65_LPNT_SCR), z
inz
sta_lp (M65_LPNT_SCR), z
dez
cpz M65__TXTCOL
bne m65_chrout_screen_INS_copy
rts