From 73722a2c025b49521fb0c0fd0decae4c19fd8388 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 23 Sep 2021 23:43:25 -0400 Subject: [PATCH] enable cursor, some fixes --- apple2gs.equ.S | 22 ++++++++++++++++++++++ vt100.main.S | 22 +++++++++++++++------- vt100.screen.S | 42 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 apple2gs.equ.S diff --git a/apple2gs.equ.S b/apple2gs.equ.S new file mode 100644 index 0000000..842fabe --- /dev/null +++ b/apple2gs.equ.S @@ -0,0 +1,22 @@ +SET80VID equ $c00d +SETALTCHAR equ $c00f +TXTSET equ $c051 +KEYMOD equ $c025 +KEYSTROBE equ $c010 +KBD equ $c000 +VGCINT equ $c023 +SCANINT equ $c032 + + +* modem port / printer port + +SCCBREG equ $c038 +SCCAREG equ $c039 +SCCBDATA equ $c03a +SCCADATA equ $c03b + +* interrupt vectors. JMP ABSLONG. +IRQ1SEC equ $e10054 +IRQQTR equ $e10038 +IRQVBL equ $e10030 +IRQSND equ $e1002c diff --git a/vt100.main.S b/vt100.main.S index 9a3fb31..557b25f 100644 --- a/vt100.main.S +++ b/vt100.main.S @@ -6,21 +6,16 @@ mx %11 use vt.equ + use apple2gs.equ use debug ext scroll_down ext recalc_cursor,recalc_cursor_x,recalc_cursor_y ext write_modem,read_modem,init_modem,keypress - ext disable_cursor,enable_cursor + ext disable_cursor,enable_cursor,cursor_vector ext erase_screen ext init_tabs -SET80VID equ $c00d -SETALTCHAR equ $c00f -TXTSET equ $c051 -VGCINT equ $c023 -SCANINT equ $c032 - main debug main clc @@ -71,6 +66,19 @@ init lda #" " ; 16-bit sta erase_char + + + lda #$0080 + sta cursor_state + sei + lda cursor_vector + stal IRQ1SEC + lda cursor_vector+2 + stal IRQ1SEC+2 + cli + + lda #0 ; clear high byte + sep #$30 lda #"_" diff --git a/vt100.screen.S b/vt100.screen.S index 1b91168..80f0392 100644 --- a/vt100.screen.S +++ b/vt100.screen.S @@ -5,6 +5,7 @@ xc xc use vt.equ + use apple2gs.equ mx %11 @@ -76,8 +77,10 @@ enable_cursor ent bvc :80 * option for inverted cursor? - lda cursor_char ldy cursor_offset + lda [cursor_base],y + sta cursor_saved_char + lda cursor_char sta [cursor_base],y :80 lda #$80 @@ -86,6 +89,41 @@ enable_cursor ent :rts plp rts + +cursor_vector ent + jml cursor_int + +cursor_int +* cursor interrupt - blink the cursor. + + mx %11 + + ldy cursor_offset + + lda cursor_state + bmi :rts + eor #$40 + sta cursor_state + beq :off +:on + lda [cursor_base],y + sta cursor_saved_char + lda cursor_char + sta [cursor_base],y + + bra :rts + +:off + lda cursor_saved_char + sta [cursor_base],y + +:rts stz SCANINT ; reset 1-sec interrupt + clc + rtl + + + + recalc_cursor ent * recalculate the cursor pointer after x/y changed * assumes cursor is off so no saving/restoring the cursor char. @@ -190,7 +228,7 @@ draw_char ent :normal ora #$80 :draw - +* sta cursor_saved_char * with DECAWM, x = 79, will CR LF (with scroll) before drawing character.