more vt100 code

to handle DECAWM mode, bit 7 of x ($80 + 79) indicates a wrap is imminent, as opposed to just being in column 79. backspace, etc will drop back to column 78 (based on testing).
This commit is contained in:
Kelvin Sherlock 2021-09-17 19:50:56 -04:00
parent 42bef68d80
commit 6e0de284e0
8 changed files with 77 additions and 44 deletions

View File

@ -20,6 +20,7 @@ ESC equ $1b
state ds 2 state ds 2
x ds 2 x ds 2
y ds 2 y ds 2
DECTM ds 2 ; top margin DECTM ds 2 ; top margin
DECBM ds 2 ; bottom margin DECBM ds 2 ; bottom margin
@ -55,10 +56,18 @@ pcount ds 2
parms ds MAX_PCOUNT parms ds MAX_PCOUNT
pmod ds 2 pmod ds 2
; scratch registers
r0 ds 2 r0 ds 2
* saved character for cursor
cursor_saved_char ds 2 cursor_saved_char ds 2 ; saved char under the cursor
cursor_base ds 4
cursor_offset ds 2
cursor_char ds 2 ; cursor character
cursor_state ds 2 ; on/off/disabled.
draw_inverse ds 2 ; flag to draw inverse
erase_char ds 2 ; clear character
do *>256 do *>256
err "too big" err "too big"

View File

@ -9,6 +9,8 @@
use vt.equ use vt.equ
mx %11
ext update_cursor,reset_tab,reset_all_tabs ext update_cursor,reset_tab,reset_all_tabs
vt100_csi ent vt100_csi ent

View File

@ -67,12 +67,15 @@ bs
* backspace, no wrap * backspace, no wrap
lda x lda x
beq :rts beq :rts
dec x and #$7f
dec
sta x
jmp update_cursor jmp update_cursor
:rts rts :rts rts
tab tab
* go to next tab stop * go to next tab stop
* tab at 80 does not reset overflow.
rts rts
lf lf

View File

@ -6,6 +6,9 @@
use vt.equ use vt.equ
mx %11
vt100_esc ent vt100_esc ent
* #[()=>cH78DEM * #[()=>cH78DEM
* based on testing, unspecified chars in the 0x20-0x2f range cause it to gobble * based on testing, unspecified chars in the 0x20-0x2f range cause it to gobble
@ -13,7 +16,6 @@ vt100_esc ent
* esc 1 -> hangs? [undocumented] * esc 1 -> hangs? [undocumented]
ldx #st_vt100 ldx #st_vt100
stx state stx state
@ -137,7 +139,9 @@ esc_gt ; exit alternate keypad mode
esc_H ; set tab stop esc_H ; set tab stop
ext set_tab ext set_tab
ldx x ldx x
bmi :rts
jmp set_tab jmp set_tab
:rts rts
esc_E ; next line esc_E ; next line
stz x stz x

View File

@ -1,22 +1,25 @@
ovr all ovr all
* binary linker * binary linker
lkv 0 lkv 0
org $6000 org $6000
asm boot.S * asm boot.S
asm vt100.ctrl.S * asm vt100.ctrl.S
asm vt100.esc.S
asm vt100.tabs.S
asm vt100.vt52.S
asm vt100.csi.S
asm vt100.screen.S
* lnk boot.S
lnk boot.S * pos ; reset
pos ; reset
pos EMU_SIZE * pos EMU_SIZE
EMU_SIZE ext *EMU_SIZE ext
EMU_BLOCKS geq EMU_SIZE+511\512 *EMU_BLOCKS geq EMU_SIZE+511\512
sav vt100.bin * sav vt100.bin

View File

@ -104,6 +104,7 @@ ctrl_18
ctrl_1a ctrl_1a
* vt100 - abort current escape sequence * vt100 - abort current escape sequence
* and display error character. * and display error character.
* TODO - display error character (mouse text)
lda DECANM lda DECANM
bne :vt52 bne :vt52
lda #st_vt100 lda #st_vt100
@ -116,9 +117,11 @@ ctrl_1a
rts rts
ctrl_08 ; back space ctrl_08 ; back space
ldx x lda x
beq :rts beq :rts
dec x and #$7f
dec
sta x
jmp update_cursor jmp update_cursor
:rts :rts
@ -126,9 +129,11 @@ ctrl_09 ; tab
* vt100 has adjustable tabs. * vt100 has adjustable tabs.
ext next_tab_stop ext next_tab_stop
ldx x ldx x
bmi :rts
jsr next_tab_stop jsr next_tab_stop
stx x stx x
jmp update_cursor jmp update_cursor
:rts rts
ctrl_0a ; line feed - cursor down w/ scroll ctrl_0a ; line feed - cursor down w/ scroll
ctrl_0b ; vertical tab ctrl_0b ; vertical tab
@ -136,18 +141,19 @@ ctrl_0c ; form feed.
* if LNM is active, equivalent to CR, LF * if LNM is active, equivalent to CR, LF
lda #LNM bit #LNM
bne :lnm bpl :lf
stz x stz x
:lnm
:lf
lda y lda y
cmp #23 cmp #DECBM
blt :simple blt :simple
lda #" " lda #" " ; needs to factor in reverse video
sta cursor_saved_char sta cursor_saved_char
jmp scroll_down jmp scroll_down
* if LNM mode, need to update cursor as well.
:simple :simple
inc y inc y

View File

@ -1,30 +1,29 @@
lst off
rel rel
xc xc
xc xc
use vt.equ use vt.equ
mx %11
init_tabs ent init_tabs ent
ldx #80-1
ldx #80 :zloop stz tabs,x
:loop stz tabs,x
dex dex
bpl :zloop
lda #$80
ldy #8
:loop ldx :table,y
sta tabs,x
dey
bpl :loop bpl :loop
lda #72
ldy #$80
:tloop tax
sty tabs,x
sec
sbc #8
bne :tloop
rts rts
*:table db 8*1,8*2,8*3,8*4,8*5,8*6,8*7,8*8*,8*9 :table db 8*1,8*2,8*3,8*4,8*5,8*6,8*7,8*8*,8*9
set_tab ent set_tab ent
* input x = x * input x = x
@ -58,8 +57,9 @@ next_tab_stop ent
* input x = x * input x = x
* ldx x * ldx x
cpx 79 inx
bge :80 cpx #79
bge :79
:loop bit tabs,x :loop bit tabs,x
bmi :rts bmi :rts
@ -68,7 +68,7 @@ next_tab_stop ent
bcc :loop bcc :loop
:80 ldx #80 :79 ldx #79
:rts rts :rts rts

View File

@ -1,16 +1,20 @@
*
* vt52 emulation for the vt100
*
* ESC < exits
lst off lst off
rel rel
xc xc
xc xc
use vt.equ use vt.equ
mx %11
*
* vt52 emulation for the vt100
*
* ESC < exits
ext update_cursor,write_modem,draw_char ext update_cursor,write_modem,draw_char
@ -129,7 +133,9 @@ esc_D ; cursor left
lda x lda x
beq :rts beq :rts
dec x and #$7f
dec
sta x
jmp update_cursor jmp update_cursor
:rts rts :rts rts