diff --git a/STATUS.md b/STATUS.md index 3ba2e3d0..0768d8bb 100644 --- a/STATUS.md +++ b/STATUS.md @@ -245,7 +245,7 @@ Not all of them - only these we want to have implemented. | `$E8DA` | color code table | DONE | | | `$E8EA` | scroll line | NOT DONE | | | `$E96C` | insert line on top | NOT DONE | | -| `$E9FF` | clear line | NOT DONE | | +| `$E9FF` | clear line | DONE | | | `$EA31` | default IRQ | PARTIAL | | | `$EA7E` | ack CIA1 + below | DONE | | | `$EA81` | ret from IRQ/NMI | DONE | | diff --git a/c64/kernal/,stubs/e9ff.clear_line.s b/c64/kernal/,stubs/e9ff.clear_line.s deleted file mode 100644 index 4e5b7d5f..00000000 --- a/c64/kernal/,stubs/e9ff.clear_line.s +++ /dev/null @@ -1,4 +0,0 @@ - -// XXX provide documentation and implementation - - STUB_IMPLEMENTATION() diff --git a/c64/kernal/screen/chrout_screen_clr.s b/c64/kernal/screen/chrout_screen_clr.s index 1fb48047..ab9469dd 100644 --- a/c64/kernal/screen/chrout_screen_clr.s +++ b/c64/kernal/screen/chrout_screen_clr.s @@ -3,9 +3,7 @@ // CLR key handling within CHROUT // -chrout_screen_CLR: /* YYY disabled for rework +chrout_screen_CLR: jsr clear_screen jmp chrout_screen_done - -*/ diff --git a/c64/kernal/screen/chrout_screen_home.s b/c64/kernal/screen/chrout_screen_home.s index ef800ca9..77976bd0 100644 --- a/c64/kernal/screen/chrout_screen_home.s +++ b/c64/kernal/screen/chrout_screen_home.s @@ -4,12 +4,7 @@ // -chrout_screen_HOME: - rts - -/* YYY disabled for rework chrout_screen_HOME: jsr cursor_home jmp chrout_screen_done -*/ \ No newline at end of file diff --git a/c64/kernal/screen/chrout_screen_return.s b/c64/kernal/screen/chrout_screen_return.s index d8313f24..b870cd5b 100644 --- a/c64/kernal/screen/chrout_screen_return.s +++ b/c64/kernal/screen/chrout_screen_return.s @@ -4,13 +4,11 @@ // -chrout_screen_RETURN: /* YYY disabled for rework +chrout_screen_RETURN: // RETURN clears quote and insert modes, it also clears reverse flag lda #$00 sta QTSW sta INSRT sta RVS - jmp chrout_screen_advance_to_next_line - -*/ + jmp screen_advance_to_next_line diff --git a/c64/kernal/screen/clear_screen_real.s b/c64/kernal/screen/clear_screen_real.s index 5766dbf6..2094cb9a 100644 --- a/c64/kernal/screen/clear_screen_real.s +++ b/c64/kernal/screen/clear_screen_real.s @@ -19,7 +19,7 @@ clear_screen_real: dey bpl !- - // YYY flow can probably be size-optimized, by clearing a single row each time (we will need such a subroutine) + // YYY flow can probably be size-optimized by calling screen_clear_line in a loop // Clear screen character RAM. Unfortunately, the HIBASE value is not on the zero page, // we will reuse PNT (it will be overridden in a moment nevertheless) as the pointer diff --git a/c64/kernal/screen/e56c.screen_calculate_pnt_user.s b/c64/kernal/screen/e56c.screen_calculate_pnt_user.s index d1d247ce..bb24ddfc 100644 --- a/c64/kernal/screen/e56c.screen_calculate_pnt_user.s +++ b/c64/kernal/screen/e56c.screen_calculate_pnt_user.s @@ -9,7 +9,11 @@ screen_calculate_PNT_USER: - // YYY jsr screen_normalize_xy - do we need this? probably not + ldx TBLX + + // FALLTROUGH + +screen_calculate_PNT_USER_from_X: // entry point for screen_clear_line // Reset pointer to start of screen @@ -20,7 +24,7 @@ screen_calculate_PNT_USER: // Add 40 to PNT for every line - ldx TBLX + cpx #$00 beq screen_calculate_USER !: lda #40 diff --git a/c64/kernal/,stubs/e9ff.interop b/c64/kernal/screen/e9ff.interop similarity index 100% rename from c64/kernal/,stubs/e9ff.interop rename to c64/kernal/screen/e9ff.interop diff --git a/c64/kernal/screen/e9ff.screen_clear_line.s b/c64/kernal/screen/e9ff.screen_clear_line.s new file mode 100644 index 00000000..fc347e18 --- /dev/null +++ b/c64/kernal/screen/e9ff.screen_clear_line.s @@ -0,0 +1,34 @@ + +// +// Well-known routine, described in: +// +// - [CM64] Computes Mapping the Commodore 64 - page 219 +// - http://sta.c64.org/cbm64scrfunc.html +// +// input: .X - screen line to clear +// +// Checked that original routine preserves X (convenient for loops), +// and leaves space screen code in .A, so duplicate this behaviour +// + + +screen_clear_line: + + // First, calculate PNT and USER + phx_trash_a + jsr screen_calculate_PNT_USER_from_X + plx_trash_a + + // Now clear the line + ldy #39 +!: + lda COLOR + sta (USER), y + lda #$20 // space character screen code + sta (PNT), y + + dey + bpl !- + + // Done + rts diff --git a/c64/kernal/screen/screen_advance_to_next_line.s b/c64/kernal/screen/screen_advance_to_next_line.s index fce5a5a5..6c12dc63 100644 --- a/c64/kernal/screen/screen_advance_to_next_line.s +++ b/c64/kernal/screen/screen_advance_to_next_line.s @@ -1,8 +1,8 @@ screen_advance_to_next_line: -.break - rts + + jmp screen_advance_to_next_line /* YYY disabled for rework diff --git a/c64/kernal/screen/screen_grow_logical_line.s b/c64/kernal/screen/screen_grow_logical_line.s index 49546a66..9a1caa8b 100644 --- a/c64/kernal/screen/screen_grow_logical_line.s +++ b/c64/kernal/screen/screen_grow_logical_line.s @@ -6,8 +6,9 @@ screen_grow_logical_line_done: screen_grow_logical_line: -.break - rts + + jmp screen_grow_logical_line // YYY + /* YYY disabled for rework