diff --git a/src/kernal/screen_m65/mega65_chrout_screen.s b/src/kernal/screen_m65/mega65_chrout_screen.s index 805aeb92..1bac3b86 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen.s +++ b/src/kernal/screen_m65/mega65_chrout_screen.s @@ -272,6 +272,8 @@ m65_chrout_fix_scroll_up_scroll: phz + ; XXX try to shorten code by using m65_screen_put_space + jsr m65_helper_scrlpnt_color lda COLOR and #$0F 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 96cb91b3..8ee46965 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control_2.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control_2.s @@ -150,7 +150,7 @@ m65_chrout_screen_INS: jsr m65_chrout_screen_INS_copy - ; Store space in the current character cell + ; Store space in the current character cell XXX try to shorten code using m65_screen_put_space lda #$20 sta [M65_LPNT_SCR], z diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control_del.s b/src/kernal/screen_m65/mega65_chrout_screen_control_del.s index b1baaaa9..37b40b66 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control_del.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control_del.s @@ -72,20 +72,12 @@ m65_chrout_screen_DEL_1stcol: lda M65__TXTCOL beq @3 - ; Deleta character under cursor + ; Delete character under cursor phz - jsr m65_helper_scrlpnt_color ldz M65__TXTCOL - - lda COLOR - and #$0F - sta [M65_LPNT_SCR], z - - jsr m65_helper_scrlpnt_to_screen - lda #$20 - sta [M65_LPNT_SCR], z + jsr m65_screen_put_space plz diff --git a/src/kernal/screen_m65/mega65_chrout_screen_control_escmode.s b/src/kernal/screen_m65/mega65_chrout_screen_control_escmode.s index f885c808..2a3bc47e 100644 --- a/src/kernal/screen_m65/mega65_chrout_screen_control_escmode.s +++ b/src/kernal/screen_m65/mega65_chrout_screen_control_escmode.s @@ -98,15 +98,7 @@ m65_chrout_esc_P: ; erase everything from start of the line to cursor XXX u ldz #$FF @1: inz - ; XXX common part - deduplicate, find other places - lda #$20 - sta [M65_LPNT_SCR], z - jsr m65_helper_scrlpnt_color - lda COLOR - and #$0F - sta [M65_LPNT_SCR], z - jsr m65_helper_scrlpnt_to_screen - ; XXX end common part + jsr m65_screen_put_space cpz M65__TXTCOL bne @1 @@ -121,15 +113,7 @@ m65_chrout_esc_Q: ; erase everything from cursor till the end of line XXX u taz @1: dez - ; XXX common part - deduplicate, find other places - lda #$20 - sta [M65_LPNT_SCR], z - jsr m65_helper_scrlpnt_color - lda COLOR - and #$0F - sta [M65_LPNT_SCR], z - jsr m65_helper_scrlpnt_to_screen - ; XXX end common part + jsr m65_screen_put_space cpz M65__TXTCOL bne @1 diff --git a/src/kernal/screen_m65/mega65_screen_helpers.s b/src/kernal/screen_m65/mega65_screen_helpers.s index 65db8b5f..a568815d 100644 --- a/src/kernal/screen_m65/mega65_screen_helpers.s +++ b/src/kernal/screen_m65/mega65_screen_helpers.s @@ -20,6 +20,19 @@ m65_screen_clear_special_modes: ; XXX consider integrating with 'm65_screen_clea rts +m65_screen_put_space: + + ; Puts space in current line, position .Z + + lda #$20 + sta [M65_LPNT_SCR], z + jsr m65_helper_scrlpnt_color + lda COLOR + and #$0F + sta [M65_LPNT_SCR], z + jmp m65_helper_scrlpnt_to_screen + + m65_screen_upd_txtrow_off: ldy M65__TXTROW