diff --git a/src/kernal/screen/chrout_screen.s b/src/kernal/screen/chrout_screen.s index e306fdcb..596a3ce9 100644 --- a/src/kernal/screen/chrout_screen.s +++ b/src/kernal/screen/chrout_screen.s @@ -41,6 +41,16 @@ 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 @@ -52,16 +62,6 @@ 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 diff --git a/src/kernal/screen/chrout_screen_jumptable_codes.s b/src/kernal/screen/chrout_screen_jumptable_codes.s index 000284bd..4299d42a 100644 --- a/src/kernal/screen/chrout_screen_jumptable_codes.s +++ b/src/kernal/screen/chrout_screen_jumptable_codes.s @@ -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 diff --git a/src/kernal/screen_m65/mega65_chrout_screen.s b/src/kernal/screen_m65/mega65_chrout_screen.s index 9f444318..9251532d 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen.s +++ b/src/kernal/screen_m65/mega65_chrout_screen.s @@ -38,13 +38,12 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote phz - // Prepare M65_LPNT_SCR for colour memory manipulation + // Prepare .Z and 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 @@ -52,16 +51,6 @@ 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 diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control.s b/src/kernal/screen_m65/mega65_chrout_screen_control.s index 1fef3924..55cf1b07 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control.s @@ -75,10 +75,14 @@ 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: @@ -97,9 +101,7 @@ m65_chrout_screen_ESC: nop m65_chrout_screen_BELL: nop -m65_chrout_screen_GFX: - nop -m65_chrout_screen_TXT: +m65_chrout_screen_STOP: nop m65_chrout_screen_DEL: nop diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control_2.s b/src/kernal/screen_m65/mega65_chrout_screen_control_2.s index d6bca52c..8ebfcfa2 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control_2.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control_2.s @@ -40,84 +40,19 @@ m65_chrout_screen_SHIFT_OFF: sta MODE jmp_8 m65_chrout_screen_ctrl2_end -// STOP key -m65_chrout_screen_STOP: +// GFX/TXT switching support - lda #$00 - sta QTSW - sta INSRT +m65_chrout_screen_GFX: + + lda VIC_YMCSB + and #$02 // to upper case +!: + sta VIC_YMCSB jmp_8 m65_chrout_screen_ctrl2_end -// INS key +m65_chrout_screen_TXT: -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 + lda VIC_YMCSB + ora #$02 // to lower case + bne !- // branch always diff --git a/src/kernal/screen_m65/mega65_chrout_screen_quote.s b/src/kernal/screen_m65/mega65_chrout_screen_quote.s deleted file mode 100644 index 16f0668a..00000000 --- a/src/kernal/screen_m65/mega65_chrout_screen_quote.s +++ /dev/null @@ -1,22 +0,0 @@ -// #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 diff --git a/src/kernal/screen_m65/mega65_cursor.s b/src/kernal/screen_m65/mega65_cursor.s index 3df29bf2..54d0ec36 100644 --- a/src/kernal/screen_m65/mega65_cursor.s +++ b/src/kernal/screen_m65/mega65_cursor.s @@ -39,7 +39,6 @@ m65_cursor_undraw: // Cursor undraw - color jsr m65_helper_scrlpnt_color - ldz M65__TXTCOL lda GDCOL sta_lp (M65_LPNT_SCR),z diff --git a/src/kernal/screen_m65/mega65_screen_helpers_scrlpnt.s b/src/kernal/screen_m65/mega65_screen_helpers_scrlpnt.s index 31630d11..f9b91ccf 100644 --- a/src/kernal/screen_m65/mega65_screen_helpers_scrlpnt.s +++ b/src/kernal/screen_m65/mega65_screen_helpers_scrlpnt.s @@ -4,6 +4,10 @@ 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 diff --git a/src/kernal/screen_m65/mega65_screen_tables_misc.s b/src/kernal/screen_m65/mega65_screen_tables_misc.s index 578f19c5..579d8b64 100644 --- a/src/kernal/screen_m65/mega65_screen_tables_misc.s +++ b/src/kernal/screen_m65/mega65_screen_tables_misc.s @@ -59,6 +59,7 @@ 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 @@ -71,7 +72,6 @@ m65_chrout_screen_jumptable_codes: __m65_chrout_screen_jumptable_quote_guard: - .byte KEY_INS .byte KEY_STOP .byte KEY_DEL .byte KEY_RETURN