2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
lst off
|
|
|
|
rel
|
|
|
|
xc
|
|
|
|
xc
|
|
|
|
|
2021-09-19 22:49:29 +00:00
|
|
|
mx %11
|
2021-09-05 21:04:52 +00:00
|
|
|
use vt.equ
|
2021-09-24 03:43:25 +00:00
|
|
|
use apple2gs.equ
|
2021-09-22 02:35:33 +00:00
|
|
|
use debug
|
2021-09-05 21:04:52 +00:00
|
|
|
|
2021-09-19 22:49:29 +00:00
|
|
|
ext scroll_down
|
|
|
|
ext recalc_cursor,recalc_cursor_x,recalc_cursor_y
|
2022-01-15 20:59:29 +00:00
|
|
|
ext modem_io,init_modem,modem_vector,reset_modem_buffer
|
2021-10-25 00:13:06 +00:00
|
|
|
ext keypress
|
2021-09-24 03:43:25 +00:00
|
|
|
ext disable_cursor,enable_cursor,cursor_vector
|
2021-10-25 00:13:06 +00:00
|
|
|
ext erase_screen,fill_screen
|
2021-09-22 03:40:22 +00:00
|
|
|
ext init_tabs
|
2021-10-03 20:09:20 +00:00
|
|
|
ext init_audio
|
2021-10-23 16:25:20 +00:00
|
|
|
ext init_cda
|
2021-09-21 02:45:02 +00:00
|
|
|
|
2021-09-22 02:35:33 +00:00
|
|
|
main debug main
|
2021-09-21 02:45:02 +00:00
|
|
|
|
|
|
|
clc
|
|
|
|
xce
|
|
|
|
cli
|
|
|
|
|
2021-10-25 17:17:47 +00:00
|
|
|
pea DPAGE
|
|
|
|
pld
|
|
|
|
|
2021-09-21 02:45:02 +00:00
|
|
|
jsr init
|
|
|
|
jsr enable_cursor
|
|
|
|
|
|
|
|
|
|
|
|
lda #4
|
|
|
|
tsb VGCINT ; enable 1-sec interrupt.
|
|
|
|
stz SCANINT ; reset 1-sec interrupt
|
|
|
|
|
|
|
|
|
|
|
|
loop
|
2022-01-15 20:59:29 +00:00
|
|
|
jsr keypress ; check for a keypress, write data to out buffer.
|
|
|
|
jsr modem_io ;
|
|
|
|
bcc :nope
|
2021-09-21 02:45:02 +00:00
|
|
|
pha
|
|
|
|
jsr disable_cursor
|
|
|
|
pla
|
|
|
|
jsr vt100
|
2022-01-15 20:59:29 +00:00
|
|
|
bra loop
|
|
|
|
|
|
|
|
:nope ; no modem data, re-enable the cursor.
|
2021-09-21 02:45:02 +00:00
|
|
|
jsr enable_cursor
|
|
|
|
bra loop
|
|
|
|
|
|
|
|
init
|
2021-10-25 00:13:06 +00:00
|
|
|
mx %11
|
2021-10-25 17:17:47 +00:00
|
|
|
|
2021-10-25 00:13:06 +00:00
|
|
|
lda #" "
|
|
|
|
jsr fill_screen ; erase first to prevent flash if going 40->80 columns.
|
|
|
|
|
2021-09-21 02:45:02 +00:00
|
|
|
sta TXTSET
|
|
|
|
sta SET80VID
|
|
|
|
sta SETALTCHAR
|
|
|
|
rep #$30
|
|
|
|
|
|
|
|
ldx #254
|
|
|
|
:zloop stz 0,x
|
|
|
|
dex
|
|
|
|
dex
|
|
|
|
bpl :zloop
|
|
|
|
|
|
|
|
lda #$0400
|
|
|
|
sta cursor_base
|
|
|
|
lda #$01
|
|
|
|
sta cursor_base+2
|
|
|
|
|
2021-09-23 21:16:10 +00:00
|
|
|
lda #" " ; 16-bit
|
|
|
|
sta erase_char
|
|
|
|
|
2021-09-24 03:43:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
lda #$0080
|
|
|
|
sta cursor_state
|
2021-10-25 00:13:06 +00:00
|
|
|
|
2021-09-24 03:43:25 +00:00
|
|
|
sei
|
|
|
|
lda cursor_vector
|
|
|
|
stal IRQ1SEC
|
|
|
|
lda cursor_vector+2
|
|
|
|
stal IRQ1SEC+2
|
2021-10-25 00:13:06 +00:00
|
|
|
|
|
|
|
lda modem_vector
|
|
|
|
stal IRQSERIAL
|
|
|
|
lda modem_vector+2
|
|
|
|
stal IRQSERIAL+2
|
|
|
|
|
2021-09-24 03:43:25 +00:00
|
|
|
cli
|
|
|
|
|
|
|
|
lda #0 ; clear high byte
|
|
|
|
|
2021-09-21 02:45:02 +00:00
|
|
|
sep #$30
|
|
|
|
|
|
|
|
lda #"_"
|
|
|
|
sta cursor_char
|
|
|
|
|
|
|
|
|
|
|
|
lda #23
|
|
|
|
sta DECBM
|
2021-09-22 02:35:33 +00:00
|
|
|
lda #$80
|
2021-10-25 00:13:06 +00:00
|
|
|
* sta LOCAL
|
|
|
|
sta DECANM
|
2021-09-22 02:35:33 +00:00
|
|
|
|
2021-10-25 00:13:06 +00:00
|
|
|
* lda #st_vt52
|
|
|
|
lda #st_vt100
|
2021-09-22 02:35:33 +00:00
|
|
|
sta state
|
2021-09-21 02:45:02 +00:00
|
|
|
|
2021-10-25 00:13:06 +00:00
|
|
|
* jsr erase_screen
|
2021-09-21 02:45:02 +00:00
|
|
|
jsr init_modem
|
2021-09-22 03:40:22 +00:00
|
|
|
jsr init_tabs
|
2021-10-03 20:09:20 +00:00
|
|
|
jsr init_audio
|
2021-10-23 16:25:20 +00:00
|
|
|
jsr init_cda
|
2021-09-21 02:45:02 +00:00
|
|
|
rts
|
|
|
|
|
2021-10-25 17:17:47 +00:00
|
|
|
reset ent
|
|
|
|
mx %11
|
|
|
|
php
|
|
|
|
|
|
|
|
* disable 1-sec interrupt...
|
|
|
|
|
|
|
|
lda #4
|
|
|
|
trb VGCINT ; disable 1-sec interrupt.
|
|
|
|
stz SCANINT ; reset 1-sec interrupt
|
|
|
|
|
|
|
|
|
|
|
|
lda #" "
|
|
|
|
jsr fill_screen ; erase first to prevent flash if going 40->80 columns.
|
|
|
|
|
|
|
|
rep #$30
|
|
|
|
|
|
|
|
ldx #254
|
|
|
|
:zloop stz 0,x
|
|
|
|
dex
|
|
|
|
dex
|
|
|
|
bpl :zloop
|
|
|
|
|
|
|
|
lda #$0400
|
|
|
|
sta cursor_base
|
|
|
|
lda #$01
|
|
|
|
sta cursor_base+2
|
|
|
|
|
|
|
|
lda #" " ; 16-bit
|
|
|
|
sta erase_char
|
|
|
|
|
|
|
|
|
|
|
|
lda #$0080
|
|
|
|
sta cursor_state
|
|
|
|
|
|
|
|
lda #0 ; clear high byte
|
|
|
|
|
|
|
|
sep #$30
|
|
|
|
|
|
|
|
lda #"_"
|
|
|
|
sta cursor_char
|
|
|
|
|
|
|
|
|
|
|
|
lda #23
|
|
|
|
sta DECBM
|
|
|
|
lda #$80
|
|
|
|
sta DECANM
|
|
|
|
|
|
|
|
lda #st_vt100
|
|
|
|
sta state
|
|
|
|
|
|
|
|
jsr init_tabs
|
|
|
|
* jsr enable_cursor
|
|
|
|
|
|
|
|
jsr reset_modem_buffer
|
|
|
|
|
|
|
|
lda #4
|
|
|
|
tsb VGCINT ; enable 1-sec interrupt.
|
|
|
|
stz SCANINT ; reset 1-sec interrupt
|
|
|
|
|
|
|
|
plp
|
|
|
|
rts
|
|
|
|
|
2021-09-21 02:45:02 +00:00
|
|
|
|
2022-01-15 20:59:29 +00:00
|
|
|
*dispatch ent
|
|
|
|
* mx %11
|
|
|
|
** a = character to xmit
|
|
|
|
* bit LOCAL
|
|
|
|
* bmi :local
|
|
|
|
* jmp write_modem
|
|
|
|
*:local
|
|
|
|
* pha
|
|
|
|
* jsr disable_cursor
|
|
|
|
* pla
|
2021-09-21 02:45:02 +00:00
|
|
|
|
|
|
|
* fall through
|
2021-09-05 21:04:52 +00:00
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
vt100
|
|
|
|
mx %11
|
|
|
|
and #$7f
|
|
|
|
cmp #' '
|
|
|
|
bcs :notctrl
|
|
|
|
asl
|
|
|
|
tax
|
|
|
|
jmp (:ctrl_table,x)
|
|
|
|
:notctrl
|
|
|
|
ldx state
|
|
|
|
jmp (:state_table,x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:state_table
|
2021-09-19 22:49:29 +00:00
|
|
|
ext vt52_esc,vt52_dca
|
2021-09-04 21:52:35 +00:00
|
|
|
ext vt100_esc,vt100_csi,vt100_csi_2
|
|
|
|
ext vt100_esc_pound,vt100_esc_lparen,vt100_esc_rparen
|
2021-09-05 21:04:52 +00:00
|
|
|
ext vt100_esc_bad,vt100_csi_bad
|
2022-01-17 18:13:07 +00:00
|
|
|
ext draw_char,draw_char_raw
|
2021-09-04 21:52:35 +00:00
|
|
|
|
2021-09-19 22:49:29 +00:00
|
|
|
dw draw_char
|
2021-09-04 21:52:35 +00:00
|
|
|
dw vt52_esc
|
2021-09-19 22:49:29 +00:00
|
|
|
dw vt52_dca
|
|
|
|
dw draw_char
|
2021-09-04 21:52:35 +00:00
|
|
|
dw vt100_esc
|
|
|
|
dw vt100_csi
|
|
|
|
dw vt100_csi_2
|
|
|
|
dw vt100_esc_pound
|
|
|
|
dw vt100_esc_lparen
|
|
|
|
dw vt100_esc_rparen
|
2021-09-05 21:04:52 +00:00
|
|
|
dw vt100_esc_bad
|
|
|
|
dw vt100_csi_bad
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
:ctrl_table
|
|
|
|
dw ctrl_00,ctrl_01,ctrl_02,ctrl_03
|
|
|
|
dw ctrl_04,ctrl_05,ctrl_06,ctrl_07
|
|
|
|
dw ctrl_08,ctrl_09,ctrl_0a,ctrl_0b
|
|
|
|
dw ctrl_0c,ctrl_0d,ctrl_0e,ctrl_0f
|
|
|
|
dw ctrl_10,ctrl_11,ctrl_12,ctrl_13
|
|
|
|
dw ctrl_14,ctrl_15,ctrl_16,ctrl_17
|
|
|
|
dw ctrl_18,ctrl_19,ctrl_1a,ctrl_1b
|
|
|
|
dw ctrl_1c,ctrl_1d,ctrl_1e,ctrl_1f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctrl_00
|
|
|
|
ctrl_01
|
|
|
|
ctrl_02
|
|
|
|
ctrl_03
|
|
|
|
ctrl_04
|
|
|
|
ctrl_05 ; answer ENQ
|
|
|
|
ctrl_06
|
|
|
|
ctrl_0e ; G1 character set
|
|
|
|
ctrl_0f ; G0 character set
|
|
|
|
ctrl_10
|
|
|
|
ctrl_11 ; XON
|
|
|
|
ctrl_12
|
|
|
|
ctrl_13 ; XOFF
|
|
|
|
ctrl_14
|
|
|
|
ctrl_15
|
|
|
|
ctrl_16
|
|
|
|
ctrl_17
|
|
|
|
ctrl_19
|
|
|
|
ctrl_1c
|
|
|
|
ctrl_1d
|
|
|
|
ctrl_1e
|
|
|
|
ctrl_1f
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
ctrl_07 ; ring the bell.
|
2021-10-03 20:09:20 +00:00
|
|
|
ext beep
|
|
|
|
jmp beep
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
ctrl_1b ; escape -
|
|
|
|
* vt100 - aborts current escape sequence and starts a new one.
|
|
|
|
* vt52 - esc esc aborts and starts new
|
|
|
|
* vt50 - esc esc aborts
|
2021-09-22 02:35:33 +00:00
|
|
|
bit DECANM
|
|
|
|
bpl :vt52
|
2021-09-04 21:52:35 +00:00
|
|
|
lda #st_vt100_esc
|
|
|
|
sta state
|
|
|
|
rts
|
|
|
|
|
|
|
|
:vt52
|
|
|
|
lda #st_vt52_esc
|
|
|
|
sta state
|
|
|
|
rts
|
|
|
|
|
|
|
|
ctrl_18
|
|
|
|
ctrl_1a
|
|
|
|
* vt100 - abort current escape sequence
|
|
|
|
* and display error character.
|
2022-01-17 18:13:07 +00:00
|
|
|
*
|
|
|
|
* based on testing, this applies to vt52 and vt100;
|
|
|
|
* cancel character is drawn regardless of current state.
|
|
|
|
|
|
|
|
lda x
|
|
|
|
and #$1
|
|
|
|
ora #$56 ; $56 or $57
|
|
|
|
* lda #$57
|
|
|
|
jsr draw_char_raw
|
|
|
|
|
2021-09-22 02:35:33 +00:00
|
|
|
bit DECANM
|
|
|
|
bpl :vt52
|
2021-09-04 21:52:35 +00:00
|
|
|
lda #st_vt100
|
|
|
|
sta state
|
|
|
|
rts
|
|
|
|
|
|
|
|
:vt52
|
|
|
|
lda #st_vt52
|
|
|
|
sta state
|
|
|
|
rts
|
|
|
|
|
2021-09-05 21:04:52 +00:00
|
|
|
ctrl_08 ; back space
|
2021-09-17 23:50:56 +00:00
|
|
|
lda x
|
2021-09-05 21:04:52 +00:00
|
|
|
beq :rts
|
2021-09-17 23:50:56 +00:00
|
|
|
and #$7f
|
|
|
|
dec
|
|
|
|
sta x
|
2021-09-19 22:49:29 +00:00
|
|
|
jmp recalc_cursor_x
|
2021-10-03 20:09:39 +00:00
|
|
|
:rts rts
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
ctrl_09 ; tab
|
|
|
|
* vt100 has adjustable tabs.
|
2021-09-05 21:04:52 +00:00
|
|
|
ext next_tab_stop
|
2021-09-04 21:52:35 +00:00
|
|
|
ldx x
|
2021-09-17 23:50:56 +00:00
|
|
|
bmi :rts
|
2021-09-05 21:04:52 +00:00
|
|
|
jsr next_tab_stop
|
2021-09-04 21:52:35 +00:00
|
|
|
stx x
|
2021-09-19 22:49:29 +00:00
|
|
|
jmp recalc_cursor_x
|
2021-09-17 23:50:56 +00:00
|
|
|
:rts rts
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
ctrl_0a ; line feed - cursor down w/ scroll
|
|
|
|
ctrl_0b ; vertical tab
|
|
|
|
ctrl_0c ; form feed.
|
|
|
|
|
|
|
|
* if LNM is active, equivalent to CR, LF
|
|
|
|
|
2021-09-17 23:50:56 +00:00
|
|
|
bit #LNM
|
|
|
|
bpl :lf
|
2021-09-04 21:52:35 +00:00
|
|
|
stz x
|
2021-09-19 22:49:29 +00:00
|
|
|
jsr recalc_cursor_x
|
2021-09-04 21:52:35 +00:00
|
|
|
|
2021-09-17 23:50:56 +00:00
|
|
|
:lf
|
2021-09-04 21:52:35 +00:00
|
|
|
lda y
|
2021-09-23 21:16:10 +00:00
|
|
|
cmp DECBM
|
2021-09-22 03:40:22 +00:00
|
|
|
bne :simple
|
2021-09-04 21:52:35 +00:00
|
|
|
|
2021-09-19 22:49:29 +00:00
|
|
|
* lda #" " ; needs to factor in reverse video
|
|
|
|
* sta cursor_saved_char
|
2021-09-04 21:52:35 +00:00
|
|
|
jmp scroll_down
|
2021-09-17 23:50:56 +00:00
|
|
|
* if LNM mode, need to update cursor as well.
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
:simple
|
2021-09-25 01:52:42 +00:00
|
|
|
cmp #23
|
|
|
|
beq :rts
|
2021-09-04 21:52:35 +00:00
|
|
|
inc y
|
2021-09-19 22:49:29 +00:00
|
|
|
jmp recalc_cursor_y
|
2021-09-04 21:52:35 +00:00
|
|
|
|
2021-09-25 01:52:42 +00:00
|
|
|
:rts rts
|
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
ctrl_0d ; carriage return - cursor to column 0.
|
|
|
|
stz x
|
2021-09-19 22:49:29 +00:00
|
|
|
jmp recalc_cursor_x
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
sav vt100.main.L
|