work on INS support for MEGA65 mode

This commit is contained in:
FeralChild64 committed 2020-08-29 21:08:34 +02:00
1 parent db08fd1574
commit 2c5e181457
9 files changed
+126 -33

No files matched your search

+10 -10
View File
@@ -41,16 +41,6 @@ chrout_screen_literal: // entry point for chrout_screen_quote
tax // store screen code, we need .A for calculations
// First we need offset from PNT in .Y, we can take it from PNTR
jsr screen_get_clipped_PNTR
// Put the character on the screen
txa
ora RVS // Computes Mapping the 64, page 38
sta (PNT),y
// Decrement number of chars waiting to be inserted
lda INSRT
@@ -62,6 +52,16 @@ chrout_screen_literal: // entry point for chrout_screen_quote
txa
jsr screen_check_toggle_quote
// First we need offset from PNT in .Y, we can take it from PNTR
jsr screen_get_clipped_PNTR
// Put the character on the screen
txa
ora RVS // Computes Mapping the 64, page 38
sta (PNT),y
// Set colour of the newly printed character
lda COLOR
@@ -23,10 +23,10 @@ chrout_screen_jumptable_codes:
.byte KEY_CRSR_LEFT
.byte KEY_CRSR_DOWN
.byte KEY_CRSR_UP
.byte KEY_INS
__chrout_screen_jumptable_quote_guard:
.byte KEY_INS
#if CONFIG_EDIT_STOPQUOTE
.byte KEY_STOP
#endif
+12 -1
View File
@@ -38,12 +38,13 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
phz
// Prepare .Z and M65_LPNT_SCR for colour memory manipulation
// Prepare M65_LPNT_SCR for colour memory manipulation
jsr m65_helper_scrlpnt_color
// Store the new color in screen memory
ldz M65__TXTCOL
lda COLOR
sta_lp (M65_LPNT_SCR),z
@@ -51,6 +52,16 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
jsr m65_helper_scrlpnt_to_screen
// Decrement number of chars waiting to be inserted
lda INSRT
beq !+
dec INSRT
!:
// Toggle quote flag if required
txa
jsr screen_check_toggle_quote
// Store the new character in screen memory, restore .Z
txa
@@ -75,14 +75,10 @@ m65_chrout_try_color_loop:
// XXX: implement screen routines below:
m65_chrout_screen_quote:
nop
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:
@@ -101,7 +97,9 @@ m65_chrout_screen_ESC:
nop
m65_chrout_screen_BELL:
nop
m65_chrout_screen_STOP:
m65_chrout_screen_GFX:
nop
m65_chrout_screen_TXT:
nop
m65_chrout_screen_DEL:
nop
@@ -40,19 +40,84 @@ m65_chrout_screen_SHIFT_OFF:
sta MODE
jmp_8 m65_chrout_screen_ctrl2_end
// STOP key
// GFX/TXT switching support
m65_chrout_screen_STOP:
m65_chrout_screen_GFX:
lda VIC_YMCSB
and #$02 // to upper case
!:
sta VIC_YMCSB
lda #$00
sta QTSW
sta INSRT
jmp_8 m65_chrout_screen_ctrl2_end
m65_chrout_screen_TXT:
// INS key
lda VIC_YMCSB
ora #$02 // to lower case
bne !- // branch always
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
@@ -0,0 +1,22 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support, control codes in quote mode, MEGA65 native mode version
//
m65_chrout_screen_quote:
// Low control codes are just +$80
clc
adc #$80
// If it overflowed, then it is a high control code,
// so we need to make it be $80 + $40 + char
// as we will have flipped back to just $00 + char, we should
// now add $c0 if C is set from overflow
bcc !+
adc #$BF // C=1, so adding $BF + C = add $C0
!:
jmp m65_chrout_screen_literal
+1
View File
@@ -39,6 +39,7 @@ m65_cursor_undraw:
// Cursor undraw - color
jsr m65_helper_scrlpnt_color
ldz M65__TXTCOL
lda GDCOL
sta_lp (M65_LPNT_SCR),z
@@ -4,10 +4,6 @@
m65_helper_scrlpnt_color:
// Set .Z to the current column
ldz M65__TXTCOL // XXX probably not the best place for this
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
lda #$0F
@@ -59,7 +59,6 @@ m65_chrout_screen_jumptable_codes:
.byte KEY_CRSR_LEFT
.byte KEY_CRSR_DOWN
.byte KEY_CRSR_UP
.byte KEY_INS
.byte KEY_TAB
.byte KEY_LINE_FEED
.byte KEY_UNDERLINE_ON
@@ -72,6 +71,7 @@ m65_chrout_screen_jumptable_codes:
__m65_chrout_screen_jumptable_quote_guard:
.byte KEY_INS
.byte KEY_STOP
.byte KEY_DEL
.byte KEY_RETURN