KERNEL : more terminal fixes

This commit is contained in:
burniouf 2023-04-29 13:47:59 +02:00
parent fa24e3665c
commit 77f6c2664a
4 changed files with 173 additions and 153 deletions

View File

@ -4,89 +4,89 @@
A2osX terminal capabilities are based off of the standard VT-100 Terminal. This applies to users connected via Super Serial Cards, Telnet (via TelnetD server daemon) and the Apple console (physical keyboard/screen). All programs can use this facility to create rich interactive text mode applications. This includes both programs written in Assembly or Scripts written for the Shell (SH). The table below lists the codes you can use in your applications and their function. Consult the A2osX Shell Developers Guide for information on using these codes in scripts. Note, the Apple Console implementation only supports a subset of the VT-100 codes, these are noted in the last column as OK.
| Esc Sequence | Description | DEC Code | A2osX TERM |
|---------------|-------------|----------|------------|
|Esc[20h |Set new line mode|LMN|OK|
|Esc[?1h |Set cursor key to application|DECCKM||
|Esc[?3h |Set number of columns to 132|DECCOLM||
|Esc[?4h |Set smooth scrolling|DECSCLM||
|Esc[?5h |Set reverse video on screen|DECSCNM|OK|
|Esc[?6h |Set origin to relative|DECOM||
|Esc[?7h |Set auto-wrap mode|DECAWM|OK|
|Esc[?8h |Set auto-repeat mode|DECARM||
|Esc[?9h |Set interlacing mode|DECINLM||
|Esc[20l |Set line feed mode|LMN|OK|
|Esc[?1l |Set cursor key to cursor|DECCKM||
|Esc[?2l |Set VT52 (versus ANSI) |DECANM||
|Esc[?3l |Set number of columns to 80|DECCOLM ||
|Esc[?4l |Set jump scrolling| DECSCLM ||
|Esc[?5l |Set normal video on screen| DECSCNM |OK|
|Esc[?6l |Set origin to absolute| DECOM ||
|Esc[?7l |Reset auto-wrap mode| DECAWM |OK|
|Esc[?8l |Reset auto-repeat mode| DECARM ||
|Esc[?9l |Reset interlacing mode| DECINLM ||
|Esc= |Set alternate keypad mode| DECKPAM ||
|Esc> |Set numeric keypad mode| DECKPNM ||
|Esc(A |Set United Kingdom G0 character set| setukg0 |OK|
|Esc)A |Set United Kingdom G1 character set| setukg1 |OK|
|Esc(B |Set United States G0 character set| setusg0 |OK|
|Esc)B |Set United States G1 character set| setusg1 |OK|
|Esc(0 |Set G0 special chars. & line set| setspecg0 |OK|
|Esc)0 |Set G1 special chars. & line set| setspecg1 |OK|
|Esc(1 |Set G0 alternate character ROM| setaltg0 |OK|
|Esc)1 |Set G1 alternate character ROM| setaltg1 |OK|
|Esc(2 |Set G0 alt char ROM and spec. graphics| setaltspecg0 |OK|
|Esc)2 |Set G1 alt char ROM and spec. graphics| setaltspecg1 |OK|
|EscN |Set single shift 2| SS2
|EscO |Set single shift 3| SS3
|Esc[m |Turn off character attributes| SGR0 |OK|
|Esc[0m |Turn off character attributes| SGR0 |OK|
|Esc[1m |Turn bold mode on| SGR1 ||
|Esc[2m |Turn low intensity mode on| SGR2 ||
|Esc[4m |Turn underline mode on| SGR4 ||
|Esc[5m |Turn blinking mode on| SGR5 ||
|Esc[7m |Turn reverse video on| SGR7 |OK|
|Esc[8m |Turn invisible text mode on| SGR8 ||
|Esc[FG;BGm |Set Text Color to FG and BG ||OK|
|Esc[Line;Liner |Set top and bottom lines of a window| DECSTBM |OK|
|Esc[ValueA |Move cursor up n lines| CUU |OK|
|Esc[ValueB |Move cursor down n lines| CUD |OK|
|Esc[ValueC |Move cursor right n lines| CUF |OK|
|Esc[ValueD |Move cursor left n lines| CUB |OK|
|Esc[H |Move cursor to upper left corner| CUP |OK|
|Esc[Line;ColH |Move cursor to screen location v,h| CUP |OK|
|Esc[f |Move cursor to upper left corner| HVP|OK|
|Esc[Line;Colf |Move cursor to screen location v,h| HVP|OK|
|EscD |Move/scroll window up one line| IND |OK|
|EscE |Move to next line| NEL |OK|
|EscM |Move/scroll window down one line| RI |OK|
|Esc7 |Save cursor position and attributes| DECSC | OK |
|Esc8 |Restore cursor position and attributes| DECSC | OK |
|EscH |Set a tab at the current column| HTS ||
|Esc[g |Clear a tab at the current column| TBC||
|Esc[0g |Clear a tab at the current column| TBC||
|Esc[3g |Clear all tabs| TBC||
|Esc#3 |Double-height letters, top half| DECDHL ||
|Esc#4 |Double-height letters, bottom half| DECDHL||
|Esc#5 |Single width, single height letters| DECSWL||
|Esc#6 |Double width, single height letters| DECDWL||
|Esc[K |Clear line from cursor right| EL0 |OK|
|Esc[0K |Clear line from cursor right| EL0 |OK|
|Esc[1K |Clear line from cursor left | EL1 |OK|
|Esc[2K |Clear entire line| EL2 |OK|
|Esc[J |Clear screen from cursor down| ED0 |OK|
|Esc[0J |Clear screen from cursor down | ED0 |OK|
|Esc[1J |Clear screen from cursor up | ED1 |OK|
|Esc[2J |Clear entire screen | ED2 |OK|
|Esc5n |Device status report | DSR ||
|Esc0n |Response: terminal is OK | DSR||
|Esc3n |Response: terminal is not OK | DSR||
|Esc6n |Get cursor position | DSR |OK|
|EscLine;ColR |Response: cursor is at v,h | CPR |OK|
|Esc[c |Identify what terminal type | DA ||
|Esc[0c |Identify what terminal type (another)| DA||
|Esc[?1;Value0c |Response: terminal type code n | DA ||
|Escc |Reset terminal to initial state| RIS |OK|
| Esc Sequence | Description | DEC Code | A2osX TERM | Comment |
|---------------|-------------|----------|------------|------------|
|Esc[20h |Set new line mode|LMN|OK||
|Esc[?1h |Set cursor key to application|DECCKM|| |
|Esc[?3h |Set number of columns to 132|DECCOLM|| |
|Esc[?4h |Set smooth scrolling|DECSCLM|| |
|Esc[?5h |Set reverse video on screen|DECSCNM|OK| |
|Esc[?6h |Set origin to relative|DECOM|| |
|Esc[?7h |Set auto-wrap mode|DECAWM|OK| |
|Esc[?8h |Set auto-repeat mode|DECARM|| |
|Esc[?9h |Set interlacing mode|DECINLM|| |
|Esc[20l |Reset line feed mode|LMN|OK| |
|Esc[?1l |Reset cursor key to cursor|DECCKM|| |
|Esc[?2l |Reset VT52 (versus ANSI) |DECANM|| |
|Esc[?3l |Reset number of columns to 80|DECCOLM || |
|Esc[?4l |Reset jump scrolling| DECSCLM || |
|Esc[?5l |Reset normal video on screen| DECSCNM |OK||
|Esc[?6l |Reset origin to absolute| DECOM || |
|Esc[?7l |Reset auto-wrap mode| DECAWM |OK||
|Esc[?8l |Reset auto-repeat mode| DECARM || |
|Esc[?9l |Reset interlacing mode| DECINLM |||
|Esc= |Set alternate keypad mode| DECKPAM |||
|Esc> |Set numeric keypad mode| DECKPNM |||
|Esc(A |Set United Kingdom G0 character set| setukg0 |OK||
|Esc)A |Set United Kingdom G1 character set| setukg1 |OK||
|Esc(B |Set United States G0 character set| setusg0 |OK||
|Esc)B |Set United States G1 character set| setusg1 |OK||
|Esc(0 |Set G0 special chars. & line set| setspecg0 |OK||
|Esc)0 |Set G1 special chars. & line set| setspecg1 |OK||
|Esc(1 |Set G0 alternate character ROM| setaltg0 |OK||
|Esc)1 |Set G1 alternate character ROM| setaltg1 |OK||
|Esc(2 |Set G0 alt char ROM and spec. graphics| setaltspecg0 |OK||
|Esc)2 |Set G1 alt char ROM and spec. graphics| setaltspecg1 |OK||
|EscN |Set single shift 2| SS2 |||
|EscO |Set single shift 3| SS3 |||
|Esc[m |Turn off character attributes| SGR0 |OK||
|Esc[0m |Turn off character attributes| SGR0 |OK||
|Esc[1m |Turn bold mode on| SGR1 || |
|Esc[2m |Turn low intensity mode on| SGR2 || |
|Esc[4m |Turn underline mode on| SGR4 || |
|Esc[5m |Turn blinking mode on| SGR5 || |
|Esc[7m |Turn reverse video on| SGR7 |OK||
|Esc[8m |Turn invisible text mode on| SGR8 |||
|Esc[FG;BGm |Set Text Color to FG and BG ||OK||
|Esc[Line;Liner |Set top and bottom lines of a window| DECSTBM |OK| |
|Esc[ValueA |Move cursor up n lines| CUU |OK||
|Esc[ValueB |Move cursor down n lines| CUD |OK||
|Esc[ValueC |Move cursor right n pos| CUF |OK| |
|Esc[ValueD |Move cursor left n pos| CUB |OK||
|Esc[H |Move cursor to upper left corner| CUP |OK| |
|Esc[Line;ColH |Move cursor to screen location v,h| CUP |OK||
|Esc[f |Move cursor to upper left corner| HVP|OK| |
|Esc[Line;Colf |Move cursor to screen location v,h| HVP|OK| |
|EscD |Move/scroll window up one line| IND |OK||
|EscE |Move to next line| NEL |OK||
|EscM |Move/scroll window down one line| RI |OK||
|Esc7 |Save cursor position and attributes| DECSC | OK ||
|Esc8 |Restore cursor position and attributes| DECRC | OK ||
|EscH |Set a tab at the current column| HTS |||
|Esc[g |Clear a tab at the current column| TBC|| |
|Esc[0g |Clear a tab at the current column| TBC|| |
|Esc[3g |Clear all tabs| TBC|||
|Esc#3 |Double-height letters, top half| DECDHL |||
|Esc#4 |Double-height letters, bottom half| DECDHL|| |
|Esc#5 |Single width, single height letters| DECSWL|| |
|Esc#6 |Double width, single height letters| DECDWL|| |
|Esc[K |Clear line from cursor right| EL0 |OK||
|Esc[0K |Clear line from cursor right| EL0 |OK||
|Esc[1K |Clear line from cursor left | EL1 |OK||
|Esc[2K |Clear entire line| EL2 |OK||
|Esc[J |Clear screen from cursor down| ED0 |OK||
|Esc[0J |Clear screen from cursor down | ED0 |OK||
|Esc[1J |Clear screen from cursor up | ED1 |OK||
|Esc[2J |Clear entire screen | ED2 |OK||
|Esc5n |Device status report | DSR |||
|Esc0n |Response: terminal is OK | DSR|| |
|Esc3n |Response: terminal is not OK | DSR|| |
|Esc6n |Get cursor position | DSR |OK||
|EscLine;ColR |Response: cursor is at v,h | CPR |OK||
|Esc[c |Identify what terminal type | DA |||
|Esc[0c |Identify what terminal type (another)| DA|| |
|Esc[?1;Value0c |Response: terminal type code n | DA |||
|Escc |Reset terminal to initial state| RIS |OK||
## License
A2osX is licensed under the GNU General Public License.

Binary file not shown.

Binary file not shown.

View File

@ -242,7 +242,7 @@ TERMX.READ bit bActive is screen active?
.72 ldy #S.DCB.TTY.OUTTAIL
sta (ZPDCBPtr),y
pla
ldy .8+1
sta CLRWRITEAUX
sta (ZPBufPtr),y
@ -339,42 +339,43 @@ TERMX.CIN jsr TERM.GetBufByte
*--------------------------------------
.8 jsr SetCharAtCurPos
*--------------------------------------
TERMX.FS ldy #S.DCB.TTY.CH
TERMX.FS ldy #S.DCB.TTY.bDECAWM
lda (ZPDCBPtr),y
asl
.HS 89 BIT IMM
TERMX.CUF clc
php
ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
inc
sta (ZPDCBPtr),y
cmp #80
bcc TERMX.BS.8
bcc .7
ldy #S.DCB.TTY.bDECAWM
lda (ZPDCBPtr),y
bpl TERMX.BS.8
plp
bcc .8
jmp TERMX.NEL
.7 plp
.8 clc
rts
*--------------------------------------
TERMX.BS ldy #S.DCB.TTY.CH
TERMX.BS
TERMX.CUB ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
beq TERMX.BS.1
beq TERMX.BS.8
dec
sta (ZPDCBPtr),y
TERMX.BS.8 clc
rts
TERMX.BS.1 ldy #S.DCB.TTY.CV
lda (ZPDCBPtr),y
beq .2
dec
sta (ZPDCBPtr),y
lda #79
ldy #S.DCB.TTY.CH
sta (ZPDCBPtr),y
.2 clc
rts
*--------------------------------------
TERMX.DEL ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
@ -453,9 +454,10 @@ TERMX.SETM.0 lda #0
TERMX.SETM ldy #S.DCB.TTY.M
sta (ZPDCBPtr),y
ldy #S.DCB.TTY.INBUF
lda #S.DCB.TTY.INBUF
tya
sta (ZPDCBPtr),y
clc
TERMX.SETM.8 clc
rts
*--------------------------------------
TERMX.CSI ldy #S.DCB.TTY.INBUF
@ -471,12 +473,9 @@ TERMX.CSI ldy #S.DCB.TTY.INBUF
bcs TERMX.CSI.Exec
cpy #S.DCB.TTY.INBUF.MAX-1 buffer full?
bne .8
bne TERMX.SETM.8
jsr TERMX.M0
.8 clc
rts
jmp TERMX.SETM.0
TERMX.CSI.Exec stz CsiH
stz CsiPCnt
@ -516,7 +515,7 @@ TERMX.CSI.Exec stz CsiH
cmp #';'
beq .1
.5 jsr TERMX.M0
.5 jsr TERMX.SETM.0
lda (ZPPtr2)
ldx #CsiCodes.Cnt-1
@ -589,7 +588,7 @@ TERMX.RM clc
ldy #S.DCB.TTY.bCURON
plp
lda #0
ror
sta (ZPDCBPtr),y
bmi .80
@ -610,7 +609,7 @@ TERMX.RM clc
.99 clc
rts
*--------------------------------------
TERMX.SGR ldx CsiPCnt
TERMX.SGR lda CsiPCnt
beq .10
ldx #0
@ -621,11 +620,10 @@ TERMX.SGR ldx CsiPCnt
jsr .10
bra .7
.2 eor #7
.2 cmp #7
bne .7
ldy #S.DCB.TTY.bNORMAL
sta (ZPDCBPtr),y
jsr .11
.7 inx
dec CsiPCnt
@ -634,10 +632,15 @@ TERMX.SGR ldx CsiPCnt
.8 clc
rts
.10 lda #$80
.10 sec
.HS 90 BCC
.11 clc
lda #0
ror
ldy #S.DCB.TTY.bNORMAL
sta (ZPDCBPtr),y
clc
rts
*--------------------------------------
TERMX.DSR ldx CsiPCnt
@ -679,7 +682,7 @@ TERMX.DECSTBM lda #0
ldy CsiP
beq .9
dey
cpy #24
bcs .9
@ -688,7 +691,7 @@ TERMX.DECSTBM lda #0
ldy CsiP+1
beq .9
dey
cpy #24
bcs .9
@ -732,10 +735,10 @@ TERMX.CUx ldy #1
.8 clc
rts
.80 .DA TERMX.IND
.DA TERMX.RI
.DA TERMX.FS
.DA TERMX.BS
.80 .DA TERMX.CUU
.DA TERMX.CUD
.DA TERMX.CUF
.DA TERMX.CUB
*--------------------------------------
TERMX.CUP
TERMX.HVP lda CsiPCnt
@ -854,7 +857,7 @@ TERMX.IAC ldy #S.DCB.TTY.INBUF
.DA TERMX.IAC.DO
.DA TERMX.IAC.DONT
*--------------------------------------
TERMX.IAC.SB ldy #S.DCB.TTY.INBUF+2
TERMX.IAC.SB ldy #S.DCB.TTY.INBUF+2
lda (ZPDCBPtr),y Get SUBCMD in A
cmp #TN.O.TTYPE
@ -873,7 +876,7 @@ TERMX.IAC.SB ldy #S.DCB.TTY.INBUF+2
cpx #SB.IS.TTYPE.LEN
bne .1
TERMX.IAC.SB.9 bra TERMX.M0
TERMX.IAC.SB.9 jmp TERMX.SETM.0
*--------------------------------------
TERMX.IAC.WILL ldx #WILLDO.CNT-1
@ -891,7 +894,7 @@ TERMX.IAC.WILL ldx #WILLDO.CNT-1
dex
bpl .2
bra TERMX.M0
jmp TERMX.SETM.0
.7 ldx #DO
bra TERMX.IAC.SendAX
@ -912,7 +915,7 @@ TERMX.IAC.DO ldx #DOWILL.CNT-1
dex
bpl .2
bra TERMX.M0
jmp TERMX.SETM.0
.7 ldx #WILL
.HS 2C BIT ABS
@ -931,11 +934,7 @@ TERMX.IAC.SendAX
jsr TERMX.COUT
pla
jsr TERMX.COUT
*--------------------------------------
TERMX.M0 lda #0
ldy #S.DCB.TTY.M
sta (ZPDCBPtr),y
rts
jmp TERMX.SETM.0
*--------------------------------------
TERMX.RIS ldy #S.DCB.TTY.M
@ -945,7 +944,7 @@ TERMX.RIS ldy #S.DCB.TTY.M
cpy #S.DCB.TTY.INBUF+1
bne .1
jmp TERMX.ED0 Erase Screen
jmp TERMX.ED2 Erase Screen
*--------------------------------------
TERMX.ENQ ldx #0
@ -965,7 +964,12 @@ TERMX.LF ldy #S.DCB.TTY.bLNM
TERMX.NEL jsr TERMX.CR
TERMX.IND ldy #S.DCB.TTY.CV
TERMX.IND sec scroll
.HS 90 BCC
TERMX.CUD clc no scroll
php
ldy #S.DCB.TTY.CV
lda (ZPDCBPtr),y
ldy #S.DCB.TTY.SCROLLBOT
cmp (ZPDCBPtr),y
@ -975,10 +979,15 @@ TERMX.IND ldy #S.DCB.TTY.CV
ldy #S.DCB.TTY.CV
sta (ZPDCBPtr),y
clc
plp
.8 clc
rts
.1 ldy #S.DCB.TTY.SCROLLTOP
.1 plp
bcc .8
ldy #S.DCB.TTY.SCROLLTOP
lda (ZPDCBPtr),y
tax
@ -1000,13 +1009,13 @@ TERMX.EL ldx CsiPCnt
lda CsiP
beq TERMX.EL0 Erase EOL
cmp #1
beq TERMX.EL1 Erase SOL
cmp #2 Erase Line
beq TERMX.EL2
TERMX.EL.8 clc
rts
*--------------------------------------
@ -1069,7 +1078,12 @@ TERMX.DECRC jsr TERMX.CUROFF
sta (ZPDCBPtr),y
rts
*--------------------------------------
TERMX.RI ldy #S.DCB.TTY.SCROLLTOP
TERMX.RI sec scroll
.HS 90 BCC
TERMX.CUU clc no scroll
php
ldy #S.DCB.TTY.SCROLLTOP
lda (ZPDCBPtr),y
ldy #S.DCB.TTY.CV
@ -1079,10 +1093,16 @@ TERMX.RI ldy #S.DCB.TTY.SCROLLTOP
lda (ZPDCBPtr),y
dec
sta (ZPDCBPtr),y
clc
plp
.8 clc
rts
.1 ldy #S.DCB.TTY.SCROLLBOT
.1 plp
bcc .8
ldy #S.DCB.TTY.SCROLLBOT
lda (ZPDCBPtr),y
tax
@ -1191,7 +1211,7 @@ TERMX.COUT pha save char
*--------------------------------------
TERMX.ED ldx CsiPCnt
beq TERMX.ED0
.1 lda CsiP
beq TERMX.ED0
@ -1204,24 +1224,24 @@ TERMX.ED ldx CsiPCnt
clc
rts
*--------------------------------------
TERMX.ED1 ldy #S.DCB.TTY.CV
TERMX.ED0 ldy #S.DCB.TTY.CV Erase Cursor -> Bottom
sta (ZPDCBPtr),y
tax
bra TERMX.ED0.1
bra TERMX.ED.1
TERMX.ED2 ldx #0
TERMX.ED1 ldx #0 Erase Top -> Cursor
ldy #S.DCB.TTY.CV
sta (ZPDCBPtr),y
tay
bra TERMX.ED0.2
bra TERMX.ED.2
TERMX.FF jsr TERMX.HOME
TERMX.ED0 ldx #0
TERMX.ED2 ldx #0 Erase Screen
TERMX.ED0.1 ldy #24
TERMX.ED.1 ldy #24
TERMX.ED0.2 sty .1+1
TERMX.ED.2 sty .1+1
.1 cpx #$ff SELF MODIFIED
beq .9
@ -1449,7 +1469,7 @@ SetCharAtYX sty ZPTmpX
bit bActive
bmi SetCharAtY.SCR1
rts
SetCharAtY.SCR sty ZPTmpX