From a687a08b0bb412b336d26d1fad76ddaa28f17820 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Mon, 7 Feb 2022 10:34:10 -0500 Subject: [PATCH] add command-L to toggle local/online add command-Q to quit. Since ROM 1 doesn't have _RemoveCDA in ROM, the control panel is only installed in ROM 3. (TODO -- check at runtime in case launched from GS/OS) --- vt.equ.S | 1 - vt100.cda.S | 35 +++++++++++++++++++++++++- vt100.key.S | 70 +++++++++++++++++++++++++++++++++++++++++++-------- vt100.main.S | 65 +++++++++++++++++++++++++++++++++++++++++------ vt100.modem.S | 23 ++++++++++++++++- 5 files changed, 172 insertions(+), 22 deletions(-) diff --git a/vt.equ.S b/vt.equ.S index 3983dd6..374d32a 100644 --- a/vt.equ.S +++ b/vt.equ.S @@ -93,7 +93,6 @@ read_q_tail ds 2 write_q_head ds 2 write_q_tail ds 2 -master_id ds 2 do *>256 err "too big" diff --git a/vt100.cda.S b/vt100.cda.S index 374139d..bb00c4d 100644 --- a/vt100.cda.S +++ b/vt100.cda.S @@ -34,10 +34,19 @@ ptr ds 2 dend -init_cda ent +* +* rom 0/1 doesn't include _RemoveCDA in ROM so it can't be removed. +* additionally, _InstallCDA has bugs. +* so, for now, disable on ROM 1. + +cda_startup ent php rep #$30 + jsr $fe1f ; idroutine. y = rom + cpy #3 + bcc :nope + * * rom 1 IIgs InstallCDA clobbers $3c-$43 on the direct page * @@ -51,9 +60,31 @@ init_cda ent pld +:nope plp rts +cda_shutdown ent + mx %00 + + jsr $fe1f ; idroutine. y = rom + cpy #3 + bcc :nope + + phd + pea #0 + pld + + + psl #handle + _RemoveCDA + + pld + +:nope + rts + + handle adrl Header ; can use a fake handle for now, until we need to _RemoveCDA Header str 'Virtual Terminal' @@ -101,9 +132,11 @@ main :keyloop + sep #$30 lda KBD bpl :keyloop sta KEYSTROBE + rep #$30 and #$7f diff --git a/vt100.key.S b/vt100.key.S index 082d5e4..dff9915 100644 --- a/vt100.key.S +++ b/vt100.key.S @@ -4,6 +4,8 @@ xc xc + tbx on + use vt.equ use apple2gs.equ use debug @@ -74,7 +76,7 @@ keypress ent bne command bit #kmKeypad - bne keypad + jne keypad bit #kmControl bne :ctrl @@ -112,11 +114,15 @@ command ; or option beq :bs cmp #$0d beq :lf - cmp #'l' - beq :local - cmp #'L' - beq :local + cmp #'a' + bcc :0 + cmp #'z'+1 + bcs :0 + + and #$df ; ~ $20 + +:0 cmp #:MIN blt :rts cmp #:MAX+1 @@ -147,16 +153,58 @@ command ; or option stz LOCAL jmp enable_modem +:quit + ext quit + jmp quit + rts + +:reset +* TODO + rts + +:clear +* TODO + rts + :MIN equ 49 -:MAX equ 52 - +:MAX equ 82 :table - dw pf1 ; 1 - dw pf2 ; 2 - dw pf3 ; 3 - dw pf4 ; 4 + dw pf1 ; 1 + dw pf2 ; 2 + dw pf3 ; 3 + dw pf4 ; 4 + dw :rts ; 5 + dw :rts ; 6 + dw :rts ; 7 + dw :rts ; 8 + dw :rts ; 9 + dw :rts ; : + dw :rts ; ; + dw :rts ; < + dw :rts ; = + dw :rts ; > + dw :rts ; ? + dw :rts ; @ + dw :rts ; A + dw :rts ; B + dw :rts ; C + dw :rts ; D + dw :rts ; E + dw :rts ; F + dw :rts ; G + dw :rts ; H + dw :rts ; I + dw :rts ; J + dw :clear ; K + dw :local ; L + dw :rts ; M + dw :rts ; N + dw :rts ; O + dw :rts ; P + dw :quit ; Q + dw :reset ; R diff --git a/vt100.main.S b/vt100.main.S index 1888407..dab4df7 100644 --- a/vt100.main.S +++ b/vt100.main.S @@ -13,13 +13,14 @@ ext scroll_down ext recalc_cursor,recalc_cursor_x,recalc_cursor_y - ext modem_io,init_modem,modem_vector,reset_modem_buffer + ext modem_io,modem_vector,reset_modem_buffer + ext modem_startup,modem_shutdown ext keypress ext disable_cursor,enable_cursor,cursor_vector ext erase_screen,fill_screen ext init_tabs ext init_audio - ext init_cda + ext cda_startup,cda_shutdown main debug main @@ -119,12 +120,14 @@ init sta state * jsr erase_screen - jsr init_modem + jsr modem_startup jsr init_tabs jsr init_audio - jsr init_cda + jsr cda_startup rts + +MasterID dw 0 init_mem * * see prodos technote #27 @@ -135,7 +138,7 @@ init_mem mx %00 - stz master_id + stz MasterID _TLStartUp pha _MMStartUp @@ -148,14 +151,15 @@ init_mem pea #$1000 _GetNewID pla - sta master_id + sta MasterID * bank 0 pha pha pea #$0000 pea #$b800 - pei master_id + lda MasterID + pha pea #$c013 pea #0000 pea #0800 @@ -168,7 +172,8 @@ init_mem pha pea #$0000 pea #$b800 - pei master_id + lda MasterID + pha pea #$c013 pea #$0001 pea #$0800 @@ -243,6 +248,50 @@ reset ent rts +quit ent + +* need to disable modem interrupts + + + sep #$30 + lda #4 + trb VGCINT ; disable 1-sec interrupt. + stz SCANINT ; reset 1-sec interrupt + + jsr modem_shutdown + + rep #$30 + + jsr cda_shutdown + + lda MasterID + beq :e + + pha + pha + _DisposeAll + _DeleteID + +:e + pea #0 + pld + + sec + xce + mx %00 + inc $3f4 ; invalidate power-up bit + jsr $bf00 + db $65 + dw :parms + brk $ea + +:parms db 4 + db 0 + dw 0 + db 0 + dw 0 + + *dispatch ent * mx %11 ** a = character to xmit diff --git a/vt100.modem.S b/vt100.modem.S index 186e21a..4903ab7 100644 --- a/vt100.modem.S +++ b/vt100.modem.S @@ -30,7 +30,7 @@ SerFlag equ $e10104 ; * * see IIgs TN #18 - Do-It-Yourself SCC Access -init_modem ent +modem_startup ent enable_modem ent * sep #$30 @@ -112,6 +112,27 @@ disable_modem ent rts +modem_shutdown ent + + mx %11 + php + sei + + lda SCCBREG ; sync access + lda #9 + sta SCCBREG + lda #%01_0_1_0_0_0_1 ; reset channel B. + sta SCCBREG + + + lda >SerFlag + and #%11_111_000 ; channel B interrupts. + sta >SerFlag + + plp + rts + + write_modem_sync ent mx %11 * a: byte to send