2021-09-04 21:52:35 +00:00
|
|
|
|
2021-09-05 21:04:52 +00:00
|
|
|
lst off
|
2021-09-04 21:52:35 +00:00
|
|
|
rel
|
|
|
|
xc
|
|
|
|
xc
|
|
|
|
|
|
|
|
use vt.equ
|
|
|
|
|
2021-09-17 23:50:56 +00:00
|
|
|
mx %11
|
|
|
|
|
|
|
|
|
2021-09-25 15:05:06 +00:00
|
|
|
ext recalc_cursor,recalc_cursor_x,recalc_cursor_y
|
|
|
|
ext scroll_up,scroll_down
|
2021-10-25 17:17:47 +00:00
|
|
|
ext reset
|
2021-09-25 15:05:06 +00:00
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
vt100_esc ent
|
|
|
|
* #[()=>cH78DEM
|
2021-09-25 15:05:06 +00:00
|
|
|
* based on testing, unspecified chars in the 0x20-0x2f range cause it
|
|
|
|
* to gobble chars until 0x30- terminator (which ends the sequence but
|
|
|
|
* does not take an action)
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
* esc 1 -> hangs? [undocumented]
|
|
|
|
|
|
|
|
ldx #st_vt100
|
|
|
|
stx state
|
|
|
|
|
|
|
|
cmp #:MIN
|
|
|
|
blt :bad
|
|
|
|
cmp #:MAX+1
|
|
|
|
bge :rts
|
|
|
|
sec
|
|
|
|
sbc #:MIN
|
|
|
|
asl
|
|
|
|
tax
|
|
|
|
jmp (:table,x)
|
|
|
|
|
|
|
|
:bad
|
|
|
|
ldx #st_vt100_esc_bad
|
|
|
|
stx state
|
|
|
|
:rts
|
|
|
|
rts
|
|
|
|
|
|
|
|
:MIN equ 35
|
|
|
|
:MAX equ 99
|
|
|
|
|
|
|
|
:table
|
|
|
|
dw :pound ; #
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :bad ; $
|
|
|
|
dw :bad ; %
|
|
|
|
dw :bad ; &
|
|
|
|
dw :bad ; '
|
2021-09-04 21:52:35 +00:00
|
|
|
dw :lparen ; (
|
|
|
|
dw :rparen ; )
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :bad ; *
|
|
|
|
dw :bad ; +
|
|
|
|
dw :bad ; ,
|
|
|
|
dw :bad ; -
|
|
|
|
dw :bad ; .
|
|
|
|
dw :bad ; /
|
|
|
|
dw :rts ; 0
|
|
|
|
dw :rts ; 1
|
|
|
|
dw :rts ; 2
|
|
|
|
dw :rts ; 3
|
|
|
|
dw :rts ; 4
|
|
|
|
dw :rts ; 5
|
|
|
|
dw :rts ; 6
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_7 ; 7
|
|
|
|
dw esc_8 ; 8
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :rts ; 9
|
|
|
|
dw :rts ; :
|
|
|
|
dw :rts ; ;
|
|
|
|
dw :rts ; <
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_eq ; =
|
|
|
|
dw esc_gt ; >
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :rts ; ?
|
|
|
|
dw :rts ; @
|
|
|
|
dw :rts ; A
|
|
|
|
dw :rts ; B
|
|
|
|
dw :rts ; C
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_D ; D
|
2021-09-25 15:05:06 +00:00
|
|
|
dw esc_E ; E
|
|
|
|
dw :rts ; F
|
|
|
|
dw :rts ; G
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_H ; H
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :rts ; I
|
|
|
|
dw :rts ; J
|
|
|
|
dw :rts ; K
|
|
|
|
dw :rts ; L
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_M ; M
|
2021-09-25 15:05:06 +00:00
|
|
|
dw :rts ; N
|
|
|
|
dw :rts ; O
|
|
|
|
dw :rts ; P
|
|
|
|
dw :rts ; Q
|
|
|
|
dw :rts ; R
|
|
|
|
dw :rts ; S
|
|
|
|
dw :rts ; T
|
|
|
|
dw :rts ; U
|
|
|
|
dw :rts ; V
|
|
|
|
dw :rts ; W
|
|
|
|
dw :rts ; X
|
|
|
|
dw :rts ; Y
|
|
|
|
dw :rts ; Z
|
|
|
|
dw :csi ; [
|
|
|
|
dw :rts ; \
|
|
|
|
dw :rts ; ]
|
|
|
|
dw :rts ; ^
|
|
|
|
dw :rts ; _
|
|
|
|
dw :rts ; `
|
|
|
|
dw :rts ; a
|
|
|
|
dw :rts ; b
|
2021-09-04 21:52:35 +00:00
|
|
|
dw esc_c ; c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:lparen
|
|
|
|
ldx #st_vt100_esc_lparen
|
|
|
|
stx state
|
|
|
|
rts
|
|
|
|
|
|
|
|
:rparen
|
|
|
|
ldx #st_vt100_esc_rparen
|
|
|
|
stx state
|
|
|
|
rts
|
|
|
|
|
|
|
|
:pound
|
|
|
|
ldx #st_vt100_esc_pound
|
|
|
|
stx state
|
|
|
|
rts
|
|
|
|
|
2021-09-25 15:05:06 +00:00
|
|
|
:csi
|
|
|
|
ldx #st_vt100_csi
|
|
|
|
stx state
|
|
|
|
rts
|
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
esc_7 ; save cursor position, graphic rendition, and character set.
|
2021-11-28 20:46:29 +00:00
|
|
|
* based on testing, DECOM is also saved/restored.
|
2021-09-26 23:44:12 +00:00
|
|
|
lda x
|
|
|
|
sta saved_x
|
|
|
|
lda y
|
|
|
|
sta saved_y
|
2021-11-28 20:46:29 +00:00
|
|
|
lda DECOM
|
|
|
|
sta saved_decom
|
2021-09-26 23:44:12 +00:00
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
rts
|
|
|
|
esc_8 ; restore cursor position, graphic rendition, and character set.
|
2021-09-26 23:44:12 +00:00
|
|
|
|
|
|
|
lda saved_x
|
|
|
|
sta x
|
|
|
|
lda saved_y
|
|
|
|
sta y
|
2021-11-28 20:46:29 +00:00
|
|
|
lda saved_decom
|
|
|
|
sta DECOM
|
|
|
|
|
2021-09-26 23:44:12 +00:00
|
|
|
jmp recalc_cursor
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
esc_eq ; enter alternate keypad mode
|
|
|
|
lda #$80
|
|
|
|
sta DECKPAM
|
|
|
|
rts
|
|
|
|
esc_gt ; exit alternate keypad mode
|
|
|
|
stz DECKPAM
|
|
|
|
rts
|
|
|
|
|
|
|
|
esc_H ; set tab stop
|
|
|
|
ext set_tab
|
|
|
|
ldx x
|
2021-09-17 23:50:56 +00:00
|
|
|
bmi :rts
|
2021-09-04 21:52:35 +00:00
|
|
|
jmp set_tab
|
2021-09-17 23:50:56 +00:00
|
|
|
:rts rts
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
esc_E ; next line
|
2021-09-25 15:05:06 +00:00
|
|
|
* This sequence causes the active position to move to the first position
|
|
|
|
* on the next line downward. If the active position is at the bottom
|
|
|
|
* margin, a scroll up is performed.
|
2021-09-04 21:52:35 +00:00
|
|
|
stz x
|
2021-09-25 15:05:06 +00:00
|
|
|
jsr recalc_cursor_x
|
2021-09-04 21:52:35 +00:00
|
|
|
; drop through
|
|
|
|
esc_D ; index
|
2021-09-25 15:05:06 +00:00
|
|
|
* This sequence causes the active position to move downward one line
|
|
|
|
* without changing the column position. If the active position is at the
|
|
|
|
* bottom margin, a scroll up is performed.
|
|
|
|
|
|
|
|
lda y
|
|
|
|
cmp DECBM
|
|
|
|
beq :scroll
|
|
|
|
cmp #23
|
|
|
|
beq :rts
|
|
|
|
inc y
|
|
|
|
jmp recalc_cursor_y
|
|
|
|
|
|
|
|
:scroll jmp scroll_down
|
|
|
|
:rts rts
|
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
esc_M ; reverse index
|
2021-09-25 15:05:06 +00:00
|
|
|
* Move the active position to the same horizontal position on the
|
|
|
|
* preceding line. If the active position is at the top margin, a scroll
|
|
|
|
* down is performed.
|
|
|
|
|
|
|
|
lda y
|
|
|
|
cmp DECTM
|
|
|
|
beq :scroll
|
|
|
|
cmp #0
|
|
|
|
beq :rts
|
|
|
|
dec y
|
|
|
|
jmp recalc_cursor_y
|
|
|
|
|
|
|
|
:scroll jmp scroll_up
|
|
|
|
:rts rts
|
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
|
2021-10-25 17:17:47 +00:00
|
|
|
esc_c ; TODO - reset terminal.
|
|
|
|
jmp reset
|
2021-09-04 21:52:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
vt100_esc_bad ent
|
|
|
|
cmp #'0'
|
|
|
|
blt :rts
|
|
|
|
ldx #st_vt100
|
|
|
|
stx state
|
|
|
|
:rts
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
vt100_esc_pound ent
|
|
|
|
|
|
|
|
* esc # 3 - make line double height (top half)
|
|
|
|
* esc # 4 - make line double height (bottom half)
|
|
|
|
* esc # 5 - make line single width, single height
|
|
|
|
* esc # 6 - make line double width
|
|
|
|
|
|
|
|
* esc # 8 - screen alignment - fill screen with E (SGR not honored)
|
2021-09-25 15:05:06 +00:00
|
|
|
* based on testing, this also resets the scrolling region and homes
|
|
|
|
* the cursor.
|
2021-09-05 21:04:52 +00:00
|
|
|
|
2021-09-25 15:05:06 +00:00
|
|
|
* based on testing, 0+ are term characters, 0x20-0x2f puts it in
|
|
|
|
* esc_bad state
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
ldx #st_vt100
|
2021-09-25 15:05:06 +00:00
|
|
|
stx state
|
2021-09-05 21:04:52 +00:00
|
|
|
|
2021-09-25 15:05:06 +00:00
|
|
|
cmp #:MIN
|
2021-09-05 21:04:52 +00:00
|
|
|
blt :bad
|
|
|
|
cmp #:MAX+1
|
|
|
|
bge :rts
|
2021-09-25 15:05:06 +00:00
|
|
|
sec
|
|
|
|
sbc #:MIN
|
2021-09-05 21:04:52 +00:00
|
|
|
asl
|
|
|
|
tax
|
|
|
|
jmp (:table,x)
|
|
|
|
|
|
|
|
:bad ldx #st_vt100_esc_bad
|
2021-09-25 15:05:06 +00:00
|
|
|
stx state
|
2021-09-05 21:04:52 +00:00
|
|
|
:rts rts
|
|
|
|
|
|
|
|
:MIN equ 48
|
|
|
|
:MAX equ 57
|
|
|
|
|
|
|
|
:table
|
|
|
|
dw :rts ; 0
|
|
|
|
dw :rts ; 1
|
|
|
|
dw :rts ; 2
|
|
|
|
dw :rts ; 3
|
|
|
|
dw :rts ; 4
|
|
|
|
dw :rts ; 5
|
|
|
|
dw :rts ; 6
|
|
|
|
dw :rts ; 7
|
|
|
|
dw :e ; 8
|
|
|
|
dw :rts ; 9
|
|
|
|
|
2021-09-25 15:05:06 +00:00
|
|
|
:e
|
|
|
|
* TODO - does this reset DECOM?
|
|
|
|
ext fill_screen
|
|
|
|
stz x
|
|
|
|
stz y
|
|
|
|
stz DECTM
|
|
|
|
lda #23
|
|
|
|
sta DECBM
|
|
|
|
jsr recalc_cursor
|
|
|
|
|
|
|
|
lda #"E"
|
|
|
|
jmp fill_screen
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
vt100_esc_lparen ent
|
|
|
|
vt100_esc_rparen ent
|
|
|
|
|
|
|
|
* ( sets G0, ) sets G1
|
|
|
|
* A - UK set
|
|
|
|
* B - ASCII set
|
|
|
|
* 0 - Special Graphics
|
|
|
|
* 1 - Alternate Char ROM Standard Char Set
|
|
|
|
* 2 - Alternate Char ROM Special Graphics
|
|
|
|
|
|
|
|
* SO, aka Control-N aka 0x0e set the G1 char set
|
|
|
|
* SI, aka Control-O aka 0x0f set the G0 char set
|
|
|
|
|
|
|
|
* not currently supported.
|
2021-10-25 17:17:47 +00:00
|
|
|
* TODO - mouse text support?
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
ldx #st_vt100
|
2021-09-25 15:05:06 +00:00
|
|
|
stx state
|
2021-09-05 21:04:52 +00:00
|
|
|
|
|
|
|
cmp #'0'
|
|
|
|
blt :bad
|
|
|
|
rts
|
|
|
|
|
|
|
|
:bad ldx #st_vt100_esc_bad
|
2021-09-25 15:05:06 +00:00
|
|
|
stx state
|
2021-09-05 21:04:52 +00:00
|
|
|
:rts rts
|
|
|
|
|
2021-09-04 21:52:35 +00:00
|
|
|
sav vt100.esc.L
|