From c23f8cef4f5cb9169b41d548291769988f4f3f43 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Sun, 21 Apr 2019 21:59:06 +0930 Subject: [PATCH] implement core of delete char in chrout --- c64/kernal/,aliases.s | 2 +- c64/kernal/chrout.s | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index 33ca4fd0..49441bdb 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -35,7 +35,7 @@ .alias current_screen_line_ptr $D1 .alias current_screen_x $D3 .alias quote_mode_flag $D4 - .alias max_logical_line_length $D5 + .alias logical_line_length $D5 .alias current_screen_y $D6 .alias last_printed_character_ascii $D7 .alias insert_mode $D8 diff --git a/c64/kernal/chrout.s b/c64/kernal/chrout.s index 2e1855c8..ca412d81 100644 --- a/c64/kernal/chrout.s +++ b/c64/kernal/chrout.s @@ -88,17 +88,31 @@ delete_at_column_0: jmp chrout_done not_row_0: dec current_screen_y - lda screen_line_link_table,y - bpl line_not_linked_del - lda #79 - .byte $2c ; BIT absolute mode, which we use to skip the next two instruction bytes -line_not_linked_del: - lda #39 + jsr get_current_line_logical_length + sta current_screen_x jsr calculate_screen_line_pointer jmp chrout_done -delete_non_zero_column: +delete_non_zero_column: + ;; Copy rest of line down + jsr get_current_line_logical_length + ldy current_screen_x +* + lda (current_screen_line_ptr),y + dey + sta (current_screen_line_ptr),y + iny + lda (current_screen_line_colour_ptr),y + dey + sta (current_screen_line_colour_ptr),y + iny + iny + cpy logical_line_length + bne - + + dec current_screen_x + jmp chrout_done not_14: @@ -167,6 +181,16 @@ screen_grow_logical_line: ;; XXX - Scroll screen down to make space rts + +get_current_line_logical_length: + ldy current_screen_y + lda screen_line_link_table,y + bpl line_not_linked_del + lda #79 + .byte $2c ; BIT absolute mode, which we use to skip the next two instruction bytes +line_not_linked_del: + lda #39 + rts screen_advance_to_next_line: ;; Go to start of line