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
x ds 2
y ds 2
DECTM ds 2 ; top margin
DECBM ds 2 ; bottom margin
@ -55,10 +56,18 @@ pcount ds 2
parms ds MAX_PCOUNT
pmod ds 2
; scratch registers
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
err "too big"

View File

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

View File

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

View File

@ -6,6 +6,9 @@
use vt.equ
mx %11
vt100_esc ent
* #[()=>cH78DEM
* 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]
ldx #st_vt100
stx state
@ -137,7 +139,9 @@ esc_gt ; exit alternate keypad mode
esc_H ; set tab stop
ext set_tab
ldx x
bmi :rts
jmp set_tab
:rts rts
esc_E ; next line
stz x

View File

@ -1,22 +1,25 @@
ovr all
* binary linker
lkv 0
org $6000
asm boot.S
asm vt100.ctrl.S
* asm boot.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
pos ; reset
* lnk boot.S
* pos ; reset
pos EMU_SIZE
EMU_SIZE ext
EMU_BLOCKS geq EMU_SIZE+511\512
* pos EMU_SIZE
*EMU_SIZE ext
*EMU_BLOCKS geq EMU_SIZE+511\512
sav vt100.bin
* sav vt100.bin

View File

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

View File

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

View File

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