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
|
2021-09-21 02:45:02 +00:00
|
|
|
ext write_modem,read_modem,init_modem,keypress
|
2021-09-24 03:43:25 +00:00
|
|
|
ext disable_cursor,enable_cursor,cursor_vector
|
2021-09-21 02:45:02 +00:00
|
|
|
ext erase_screen
|
2021-09-22 03:40:22 +00:00
|
|
|
ext init_tabs
|
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
|
|
|
|
|
|
|
|
jsr init
|
|
|
|
jsr enable_cursor
|
|
|
|
|
|
|
|
|
|
|
|
lda #4
|
|
|
|
tsb VGCINT ; enable 1-sec interrupt.
|
|
|
|
stz SCANINT ; reset 1-sec interrupt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loop
|
|
|
|
bit LOCAL
|
|
|
|
bmi :kb
|
|
|
|
jsr read_modem
|
|
|
|
bcc :kb
|
|
|
|
pha
|
|
|
|
jsr disable_cursor
|
|
|
|
pla
|
|
|
|
jsr vt100
|
|
|
|
:kb
|
|
|
|
jsr keypress
|
|
|
|
jsr enable_cursor
|
|
|
|
bra loop
|
|
|
|
|
|
|
|
init
|
|
|
|
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
|
|
|
|
sei
|
|
|
|
lda cursor_vector
|
|
|
|
stal IRQ1SEC
|
|
|
|
lda cursor_vector+2
|
|
|
|
stal IRQ1SEC+2
|
|
|
|
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
|
|
|
|
sta LOCAL
|
|
|
|
|
|
|
|
lda #st_vt52
|
|
|
|
sta state
|
2021-09-21 02:45:02 +00:00
|
|
|
|
|
|
|
jsr erase_screen
|
|
|
|
jsr init_modem
|
2021-09-22 03:40:22 +00:00
|
|
|
jsr init_tabs
|
2021-09-21 02:45:02 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
dispatch ent
|
|
|
|
mx %11
|
|
|
|
* a = character to xmit
|
|
|
|
bit LOCAL
|
|
|
|
bmi :local
|
|
|
|
jmp write_modem
|
|
|
|
:local
|
|
|
|
pha
|
|
|
|
jsr disable_cursor
|
|
|
|
pla
|
|
|
|
|
|
|
|
* 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
|
2021-09-19 22:49:29 +00:00
|
|
|
ext draw_char
|
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.
|
|
|
|
rts
|
|
|
|
|
|
|
|
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.
|
2021-09-17 23:50:56 +00:00
|
|
|
* TODO - display error character (mouse text)
|
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-09-05 21:04:52 +00:00
|
|
|
: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
|