diff --git a/src/aliases/,aliases_ram_lowmem_m65.s b/src/aliases/,aliases_ram_lowmem_m65.s index 62e1fc2b..767d124d 100644 --- a/src/aliases/,aliases_ram_lowmem_m65.s +++ b/src/aliases/,aliases_ram_lowmem_m65.s @@ -52,7 +52,8 @@ .label M65_TXTWIN_X1 = $590 // text window - bottom-right X coordinate + 1 .label M65_TXTWIN_Y1 = $591 // text window - bottom-right Y coordinate + 1 .label M65_TXTROW_OFF = $592 // $592-$593 offset to the current text row from the viewport start - // $594-$5EB -- UNUSED -- + .label M65_SCRCOLMAX = $594 // maximum allowed column + // $595-$5EB -- UNUSED -- .label M65_DMAGIC_LIST = $5EF // $5EF-$5FF reserved for DMAgic list, 17 bytes .label M65_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer -- .label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer -- diff --git a/src/kernal/keyboard/chrin_keyboard.s b/src/kernal/screen/chrin_keyboard.s similarity index 100% rename from src/kernal/keyboard/chrin_keyboard.s rename to src/kernal/screen/chrin_keyboard.s diff --git a/src/kernal/keyboard/chrin_programmable_keys.s b/src/kernal/screen/chrin_programmable_keys.s similarity index 100% rename from src/kernal/keyboard/chrin_programmable_keys.s rename to src/kernal/screen/chrin_programmable_keys.s diff --git a/src/kernal/screen_m65/mega65_chrout_screen.s b/src/kernal/screen_m65/mega65_chrout_screen.s index 7a16eaea..c2533579 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen.s +++ b/src/kernal/screen_m65/mega65_chrout_screen.s @@ -270,7 +270,7 @@ m65_chrout_fix_scroll_up_scroll: jsr m65_helper_scrlpnt_color lda COLOR and #$0F - ldz #$4F + ldz M65_SCRCOLMAX !: sta_lp (M65_LPNT_SCR), z dez @@ -278,7 +278,7 @@ m65_chrout_fix_scroll_up_scroll: jsr m65_helper_scrlpnt_to_screen lda #$20 - ldz #$4F + ldz M65_SCRCOLMAX !: sta_lp (M65_LPNT_SCR), z dez diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control.s b/src/kernal/screen_m65/mega65_chrout_screen_control.s index 1bad4541..5773ac94 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control.s @@ -93,8 +93,6 @@ m65_chrout_screen_ESC: nop m65_chrout_screen_BELL: nop -m65_chrout_screen_DEL: - nop m65_chrout_screen_GFX: nop m65_chrout_screen_TXT: diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control_del.s b/src/kernal/screen_m65/mega65_chrout_screen_control_del.s new file mode 100644 index 00000000..54462dd6 --- /dev/null +++ b/src/kernal/screen_m65/mega65_chrout_screen_control_del.s @@ -0,0 +1,102 @@ +// #LAYOUT# M65 KERNAL_1 #TAKE +// #LAYOUT# * * #IGNORE + + +// 'DEL' key support + +m65_chrout_screen_DEL: + + // First check for window mode + + lda M65_SCRWINMODE + bmi m65_chrout_screen_DEL_winmode + + // Not a window mode; check if we are in the first column + + lda M65__TXTCOL + beq m65_chrout_screen_DEL_1stcol + + // Not a window mode, not a first column - we can safely + // delete the character and sroll back the rest of the row + + phz + + jsr m65_helper_scrlpnt_color + jsr m65_chrout_screen_DEL_copy + + ldz M65_SCRCOLMAX + lda COLOR + and #$0F + sta_lp (M65_LPNT_SCR), z + + jsr m65_helper_scrlpnt_to_screen + jsr m65_chrout_screen_DEL_copy + + ldz M65_SCRCOLMAX + lda #$20 + sta_lp (M65_LPNT_SCR), z + + plz + + // End by moving cursor one position left + + jmp m65_chrout_screen_CRSR_LEFT + +m65_chrout_screen_DEL_copy: + + ldz M65__TXTCOL + dez +!: + cpz M65_SCRCOLMAX + beq !+ + + inz + lda_lp (M65_LPNT_SCR), z + dez + sta_lp (M65_LPNT_SCR), z + + inz + jmp_8 !- +!: + rts + + +m65_chrout_screen_DEL_1stcol: + + // Start by moving one position left + + jsr m65_chrout_screen_CRSR_LEFT + + // If we are still in the first column - nothing to do + + lda M65__TXTCOL + beq !+ + + // Deleta character under cursor + + phz + + jsr m65_helper_scrlpnt_color + ldz M65__TXTCOL + + lda COLOR + and #$0F + sta_lp (M65_LPNT_SCR), z + + jsr m65_helper_scrlpnt_to_screen + lda #$20 + sta_lp (M65_LPNT_SCR), z + + plz + + // End of character deletion +!: + jmp m65_chrout_screen_done + + +m65_chrout_screen_DEL_winmode: + + // XXX provide implementation for window mode + + jmp m65_chrout_screen_done + diff --git a/src/kernal/screen_m65/mega65_scrmodeset.s b/src/kernal/screen_m65/mega65_scrmodeset.s index d5eeb887..cf940e6b 100644 --- a/src/kernal/screen_m65/mega65_scrmodeset.s +++ b/src/kernal/screen_m65/mega65_scrmodeset.s @@ -88,8 +88,9 @@ m65_scrmodeset_internal: // entry point for M65_MODE65 stx VIC_COLPTR+1 // Set the following locations: - // - M65_SCRGUARD, M65_COLGUARD - for max lines of virtual screen - // - M65_COLVIEWMAX - as above, but depending on the mode + // - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end + // - M65_COLVIEWMAX - guard for viewport start + // - M65_SCRCOLMAX - maximum allowed column ldx #<(MEMCONF_SCRBASE + 80 * MEMCONF_SCRROWS) stx M65_SCRGUARD+0 @@ -106,5 +107,8 @@ m65_scrmodeset_internal: // entry point for M65_MODE65 sta M65_COLVIEWMAX+0 lda m65_scrtab_colviewmax_hi, x sta M65_COLVIEWMAX+1 + lda m65_scrtab_txtwidth,x + dec_a + sta M65_SCRCOLMAX rts