mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-21 05:24:15 +00:00
1177 lines
21 KiB
Plaintext
1177 lines
21 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
CURSOR.BLINK.SPEED .EQ 2
|
||
INBUF.MAXLEN .EQ 32
|
||
OUTBUF.MAXLEN .EQ 32
|
||
*--------------------------------------
|
||
ZPIOCTL .EQ ZPDRV
|
||
ZPTTYEnvPtr .EQ ZPDRV+2
|
||
ZPTTYBufPtr .EQ ZPDRV+4
|
||
ZPBufPtr .EQ ZPDRV+10
|
||
ZPCount .EQ ZPDRV+12
|
||
ZPBufBaseL1 .EQ ZPDRV+14
|
||
ZPBufBaseL2 .EQ ZPDRV+16
|
||
ZPScrBaseL1 .EQ ZPDRV+18
|
||
ZPScrBaseL2 .EQ ZPDRV+20
|
||
ZPTmpWord .EQ ZPDRV+22
|
||
ZPTmpBool .EQ ZPDRV+24
|
||
*--------------------------------------
|
||
DRV.TERM cld
|
||
>STYA pIOCTL
|
||
|
||
ldy #S.FD.DEV.BUFPTR
|
||
lda (pFD),y
|
||
sta ZPTTYEnvPtr
|
||
iny
|
||
lda (pFD),y
|
||
sta ZPTTYEnvPtr+1
|
||
|
||
ldy #S.TTY.DEVID
|
||
lda (ZPTTYEnvPtr),y
|
||
cmp A2osX.ASCREEN
|
||
beq .1 CS
|
||
|
||
clc
|
||
.1 ror bActive
|
||
|
||
jmp (.8,x)
|
||
.8 .DA DRV.TERM.STATUS
|
||
.DA A2osX.BADCALL
|
||
.DA A2osX.BADCALL
|
||
.DA A2osX.BADCALL
|
||
.DA DRV.TERM.CONTROL
|
||
.DA A2osX.BADCALL
|
||
.DA DRV.TERM.OPEN
|
||
.DA DRV.TERM.CLOSE
|
||
.DA DRV.TERM.READ
|
||
.DA DRV.TERM.WRITE
|
||
*--------------------------------------
|
||
DRV.TERM.STATUS ldy #S.IOCTL.BUFPTR
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr
|
||
iny
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr+1
|
||
|
||
ldy #S.IOCTL.STATCODE
|
||
lda (ZPIOCTL),y
|
||
beq .1
|
||
|
||
cmp #S.IOCTL.STATCODE.GETDIB
|
||
bne .9
|
||
|
||
ldy #S.DIB-1
|
||
.HS 2C bit abs
|
||
.1 ldy #3
|
||
|
||
.2 lda DRV.TERM.DIB,y
|
||
.3 sta (ZPBufPtr),y SELF MODIFIED
|
||
dey
|
||
bne .2
|
||
|
||
ldy #S.TTY.STATUS
|
||
lda (ZPTTYEnvPtr),y
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda #MLI.E.BADCTL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.OPEN ldx #0
|
||
|
||
.1 ldy A2osX.SCRNDEVS,x
|
||
beq .2
|
||
|
||
inx
|
||
cpx #K.SCR.MAX
|
||
bne .1
|
||
|
||
lda #E.OOH
|
||
sec
|
||
rts
|
||
|
||
.9 lda #MLI.E.OPEN
|
||
sec
|
||
rts
|
||
|
||
.2 sta A2osX.SCRNDEVS,x DEV.ID in A
|
||
ldy #S.TTY.DEVID
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
ldy #S.TTY.STATUS
|
||
|
||
lda (ZPTTYEnvPtr),y
|
||
bit #S.DIB.S.OPENED
|
||
bne .9
|
||
ora #S.DIB.S.OPENED
|
||
ora DRV.TERM.DIB+S.DIB.S
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
stz OutPtr
|
||
stz OutCnt
|
||
|
||
jsr RESET
|
||
*--------------------------------------
|
||
DRV.TERM.CONTROL
|
||
sta SETTEXT
|
||
sta SETALTCHAR
|
||
sta SET80DISP
|
||
sta CLR80STORE
|
||
sta CLRPAGE2
|
||
ldy #S.TTY.DEVID
|
||
lda (ZPTTYEnvPtr),y
|
||
sta A2osX.ASCREEN
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.CLOSE ldy #S.TTY.STATUS
|
||
lda (ZPTTYEnvPtr),y
|
||
bit #S.DIB.S.OPENED
|
||
beq .9
|
||
|
||
lda DRV.TERM.DIB+S.DIB.S
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
ldx #0
|
||
ldy #S.TTY.DEVID
|
||
|
||
.1 lda A2osX.SCRNDEVS,x
|
||
cmp (ZPTTYEnvPtr),y
|
||
bne .2
|
||
|
||
stz A2osX.SCRNDEVS,x
|
||
|
||
.2 inx
|
||
cpx #K.SCR.MAX
|
||
bne .1
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda MLI.E.IO
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.READ bit bActive is screen active?
|
||
bpl .6 no....go check flush...
|
||
|
||
lda A2osX.TIMER16
|
||
and #CURSOR.BLINK.SPEED
|
||
ldy #S.TTY.bCURON
|
||
eor (ZPTTYEnvPtr),y
|
||
beq .1
|
||
|
||
jsr CURBLNK
|
||
|
||
.1 lda OPENAPPLE
|
||
bmi .6 Open apple key, not for us...
|
||
|
||
lda KBD
|
||
bpl .6
|
||
sta KBDSTROBE
|
||
|
||
and #$7F
|
||
|
||
ldx KeyRemapped
|
||
.2 cmp KeyRemapped,x
|
||
beq .3
|
||
dex
|
||
bne .2
|
||
jsr Char.Out.Put no remap....send char....
|
||
bra .7 and flush
|
||
|
||
.3 lda KeyRemappedIdx,x
|
||
tay
|
||
|
||
.4 lda KeyRemappedTbl,y
|
||
beq .7 end of remap....flush
|
||
jsr Char.Out.Put
|
||
iny
|
||
bra .4
|
||
|
||
.6 lda OutCnt
|
||
beq .9 no char in output buffer...
|
||
|
||
.7 stz .8+1
|
||
jsr GetPtrsAndCnt
|
||
|
||
.70 inc ZPCount
|
||
bne .71
|
||
inc ZPCount+1
|
||
beq .8
|
||
|
||
.71 jsr Char.Out.Get
|
||
bcs .8
|
||
|
||
ldy .8+1
|
||
sta (ZPBufPtr),y
|
||
iny
|
||
sty .8+1
|
||
bra .70
|
||
|
||
.8 lda #$ff SELF MODIFIED
|
||
ldy #S.IOCTL.BYTECNT
|
||
sta (ZPIOCTL),y
|
||
iny
|
||
lda #0
|
||
sta (ZPIOCTL),y
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 lda #0 Error = char
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.WRITE jsr GetPtrsAndCnt
|
||
|
||
.1 inc ZPCount
|
||
bne .2
|
||
inc ZPCount+1
|
||
beq .8
|
||
|
||
.2 ldy #S.TTY.MODE
|
||
lda (ZPTTYEnvPtr),y
|
||
tax
|
||
|
||
jsr .3
|
||
|
||
inc ZPBufPtr
|
||
bne .1
|
||
inc ZPBufPtr+1
|
||
bra .1
|
||
|
||
.3 jmp (.4,x)
|
||
.4 .DA DRV.TERM.COUT
|
||
.DA DRV.TERM.ESC
|
||
.DA DRV.TERM.CSI
|
||
.DA DRV.TERM.IAC
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.COUT lda (ZPBufPtr)
|
||
|
||
cmp #IAC
|
||
bne .1
|
||
|
||
lda #S.TTY.MODE.IAC
|
||
sta (ZPTTYEnvPtr),y
|
||
stz InBuffer
|
||
clc
|
||
rts
|
||
|
||
.1 pha
|
||
jsr CUROFF
|
||
pla
|
||
cmp #C.DEL
|
||
beq DEL
|
||
cmp #C.SPACE
|
||
bcc COUT.Ctrl
|
||
|
||
ldy #S.TTY.bINVERSE
|
||
ora (ZPTTYEnvPtr),y
|
||
jsr SetCharAtCurPos
|
||
*--------------------------------------
|
||
FS ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y
|
||
cmp #79
|
||
bne .1
|
||
|
||
ldy #S.TTY.bLINEWRAP
|
||
lda (ZPTTYEnvPtr),y
|
||
bpl FS.8
|
||
|
||
ldy #S.TTY.CH
|
||
lda #0
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
jmp LF
|
||
|
||
.1 inc
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
FS.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
DEL ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y
|
||
beq .1
|
||
dec
|
||
sta (ZPTTYEnvPtr),y
|
||
bra .3
|
||
|
||
.1 iny S.TTY.CV
|
||
lda (ZPTTYEnvPtr),y
|
||
beq FS.8
|
||
|
||
dec
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
dey
|
||
lda #79
|
||
sta (ZPTTYEnvPtr),y S.TTY.CH
|
||
|
||
.3 lda #$20
|
||
ldy #S.TTY.bINVERSE
|
||
ora (ZPTTYEnvPtr),y
|
||
jmp SetCharAtCurPos
|
||
*--------------------------------------
|
||
COUT.Ctrl ldx #CtrlChars.Cnt-1
|
||
|
||
.1 cmp CtrlChars,x
|
||
beq .2
|
||
dex
|
||
bpl .1
|
||
clc
|
||
rts
|
||
|
||
.2 txa
|
||
asl
|
||
tax
|
||
jmp (J.CtrlChars,x)
|
||
*--------------------------------------
|
||
DRV.TERM.ESC lda (ZPBufPtr)
|
||
|
||
cmp #'['
|
||
bne .1
|
||
|
||
lda #S.TTY.MODE.CSI
|
||
sta (ZPTTYEnvPtr),y
|
||
stz InBuffer
|
||
clc
|
||
rts
|
||
|
||
.1 lda #0
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
ldx #EscCodes.Cnt-1
|
||
|
||
.2 cmp EscCodes,x
|
||
beq .3
|
||
dex
|
||
bpl .2
|
||
|
||
clc
|
||
rts
|
||
|
||
.3 txa
|
||
asl
|
||
tax
|
||
jmp (J.EscCodes,x)
|
||
*--------------------------------------
|
||
J.EscCodes .DA Scroll.Dn M
|
||
.DA Scroll.Up D
|
||
.DA RESET c
|
||
*--------------------------------------
|
||
DRV.TERM.CSI inc InBuffer
|
||
ldx InBuffer
|
||
|
||
lda (ZPBufPtr)
|
||
sta InBuffer,x
|
||
cmp #64 End of Seq ?
|
||
bcs COUT.ExecEscSeq
|
||
|
||
cpx #INBUF.MAXLEN too long?
|
||
bne .8
|
||
|
||
lda #0
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
COUT.ExecEscSeq stz EscSeqParamCnt
|
||
stz bEscSeqInNum
|
||
|
||
ldx #0 EscSeq Ptr
|
||
|
||
.10 stz ZPTmpWord
|
||
stz ZPTmpWord+1
|
||
|
||
.1 inx
|
||
lda InBuffer,x
|
||
|
||
cmp #'0'
|
||
bcc .2
|
||
cmp #'9'+1
|
||
bcs .2
|
||
|
||
dec bEscSeqInNum
|
||
and #$0F
|
||
pha
|
||
lda ZPTmpWord
|
||
ldy ZPTmpWord+1
|
||
asl ZPTmpWord param=param*10
|
||
rol ZPTmpWord+1
|
||
asl ZPTmpWord
|
||
rol ZPTmpWord+1
|
||
clc
|
||
adc ZPTmpWord
|
||
sta ZPTmpWord
|
||
tya
|
||
adc ZPTmpWord+1
|
||
sta ZPTmpWord+1
|
||
asl ZPTmpWord
|
||
rol ZPTmpWord+1
|
||
|
||
pla
|
||
clc
|
||
adc ZPTmpWord
|
||
sta ZPTmpWord
|
||
bcc .1
|
||
inc ZPTmpWord+1
|
||
bra .1
|
||
|
||
.2 bit bEscSeqInNum
|
||
bpl .3
|
||
|
||
stz bEscSeqInNum
|
||
lda #255
|
||
ldy ZPTmpWord+1
|
||
bne .21
|
||
|
||
lda ZPTmpWord
|
||
.21 ldy EscSeqParamCnt
|
||
sta EscSeqParam,y
|
||
inc EscSeqParamCnt
|
||
|
||
.3 lda InBuffer,x
|
||
cmp #';'
|
||
beq .10
|
||
|
||
lda #0
|
||
ldy #S.TTY.MODE
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
ldx #EscSeqCmds.Cnt-1
|
||
|
||
.4 cmp EscSeqCmds,x
|
||
beq .5
|
||
dex
|
||
bne .4
|
||
|
||
clc
|
||
rts
|
||
|
||
.5 txa
|
||
asl
|
||
tax
|
||
jmp (J.EscSequences,x)
|
||
*--------------------------------------
|
||
J.EscSequences .DA Esc.LWEnable h
|
||
.DA Esc.LWDisable l
|
||
.DA Esc.DispAttr m
|
||
.DA Esc.Query n
|
||
.DA Esc.Scroll r
|
||
.DA Esc.Erase K
|
||
.DA Esc.Home H
|
||
*--------------------------------------
|
||
DRV.TERM.IAC inc InBuffer
|
||
ldx InBuffer
|
||
cpx #INBUF.MAXLEN
|
||
beq *
|
||
|
||
lda (ZPBufPtr)
|
||
sta InBuffer,x
|
||
|
||
cpx #1 CMD ?
|
||
beq .8 yes, wait for additional bytes
|
||
|
||
ldy InBuffer+1 get back CMD
|
||
cpy #SB
|
||
bne .1 not a SB/SE....stop with CMD/SUBCMD
|
||
|
||
cmp #SE
|
||
bne .8 wait for ending SE....keep bIACMode
|
||
|
||
.1 cpy #IAC
|
||
beq .9
|
||
|
||
tya
|
||
sec
|
||
sbc #SB
|
||
bcc .9
|
||
asl
|
||
tax
|
||
lda InBuffer+2 Get SUBCMD in A
|
||
|
||
cpx #10
|
||
bcs *
|
||
jmp (J.COUT.IAC.CMDS,x)
|
||
|
||
.9 bra RESET.MODE
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
J.COUT.IAC.CMDS .DA COUT.IAC.SB
|
||
.DA COUT.IAC.WILL
|
||
.DA COUT.IAC.WONT
|
||
.DA COUT.IAC.DO
|
||
.DA COUT.IAC.DONT
|
||
.DA 0 end of relocation
|
||
*--------------------------------------
|
||
COUT.IAC.SB cmp #TELOPT.TTYPE
|
||
bne .9
|
||
|
||
lda InBuffer+3
|
||
cmp #SB.SEND
|
||
bne .9
|
||
|
||
ldy #0
|
||
|
||
.1 lda SB.IS.TTYPE,y
|
||
jsr Char.Out.Put
|
||
iny
|
||
cpy #SB.IS.TTYPE.LEN
|
||
bne .1
|
||
|
||
.9 bra RESET.MODE
|
||
*--------------------------------------
|
||
COUT.IAC.WILL ldx #WILLDO.CNT-1
|
||
|
||
.1 cmp WILLDO,x
|
||
beq .7
|
||
dex
|
||
bpl .1
|
||
|
||
ldx #WILLDONT.CNT-1
|
||
|
||
.2 cmp WILLDONT,x
|
||
beq .8
|
||
dex
|
||
bpl .2
|
||
|
||
bra .9
|
||
|
||
.7 ldx #DO
|
||
.HS 2C BIT ABS
|
||
|
||
.8 ldx #DONT
|
||
|
||
bra COUT.IAC.SendAX
|
||
|
||
.9 bra RESET.MODE
|
||
*--------------------------------------
|
||
COUT.IAC.WONT
|
||
bra RESET.MODE
|
||
*--------------------------------------
|
||
COUT.IAC.DO ldx #DOWILL.CNT-1
|
||
|
||
.1 cmp DOWILL,x
|
||
beq .7
|
||
dex
|
||
bpl .1
|
||
|
||
ldx #DOWONT.CNT-1
|
||
|
||
.2 cmp DOWONT,x
|
||
beq .8
|
||
dex
|
||
bpl .2
|
||
|
||
bra COUT.IAC.SendAX.9
|
||
|
||
.7 ldx #WILL
|
||
.HS 2C BIT ABS
|
||
|
||
.8 ldx #WONT
|
||
*--------------------------------------
|
||
COUT.IAC.SendAX
|
||
pha push CMD
|
||
phx
|
||
lda #IAC
|
||
jsr Char.Out.Put
|
||
pla
|
||
jsr Char.Out.Put
|
||
pla
|
||
jsr Char.Out.Put
|
||
|
||
COUT.IAC.SendAX.9
|
||
bra RESET.MODE
|
||
*--------------------------------------
|
||
COUT.IAC.DONT
|
||
bra RESET.MODE
|
||
*--------------------------------------
|
||
RESET.MODE lda #0
|
||
|
||
ldy #S.TTY.MODE
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RESET jsr RESET.MODE
|
||
|
||
ldy #S.TTY.bCURON
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
dec
|
||
ldy #S.TTY.bLINEWRAP
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
lda #0
|
||
ldy #S.TTY.SCROLLTOP
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
iny
|
||
lda #23
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
jsr CLRSCR
|
||
*--------------------------------------
|
||
RESETATTR lda #$80
|
||
ldy #S.TTY.bINVERSE
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
J.CtrlChars .DA ENQ 5
|
||
.DA BS 8
|
||
.DA LF 10
|
||
.DA CLRSCR 12
|
||
.DA CROUT 13
|
||
.DA FS 21
|
||
.DA ESC 27
|
||
*--------------------------------------
|
||
ENQ ldy #0
|
||
|
||
.1 lda ENQ.String,y
|
||
beq .8
|
||
jsr Char.Out.Put
|
||
iny
|
||
bne .1
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
BS ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y
|
||
beq .1
|
||
|
||
dec
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
|
||
.1 ldy #S.TTY.CV
|
||
lda (ZPTTYEnvPtr),y
|
||
beq .2
|
||
|
||
dec
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
lda #79
|
||
dey
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.2 clc
|
||
rts
|
||
*--------------------------------------
|
||
CROUT lda #0
|
||
ldy #S.TTY.CH
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
LF ldy #S.TTY.CV
|
||
lda (ZPTTYEnvPtr),y
|
||
ldy #S.TTY.SCROLLBOT
|
||
cmp (ZPTTYEnvPtr),y
|
||
beq SCROLL.UP
|
||
|
||
inc
|
||
ldy #S.TTY.CV
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
ESC lda #S.TTY.MODE.ESC
|
||
ldy #S.TTY.MODE
|
||
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
SCROLL.UP ldy #S.TTY.SCROLLTOP
|
||
lda (ZPTTYEnvPtr),y
|
||
|
||
tax
|
||
|
||
.1 jsr SETUP.L1X
|
||
|
||
inx
|
||
|
||
jsr COPY.XtoL1
|
||
|
||
txa
|
||
ldy #S.TTY.SCROLLBOT
|
||
cmp (ZPTTYEnvPtr),y
|
||
bne .1
|
||
*--------------------------------------
|
||
CLREOL ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y
|
||
tay Start
|
||
ldx #80 End
|
||
bra CLR
|
||
|
||
CLRLINE ldy #0 Start
|
||
ldx #80 End
|
||
bra CLR
|
||
|
||
CLRSOL ldy #0
|
||
ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y Start
|
||
tax End
|
||
|
||
CLR stx .3+1 Save End
|
||
phy
|
||
|
||
ldy #S.TTY.CV
|
||
lda (ZPTTYEnvPtr),y
|
||
tax
|
||
|
||
ply
|
||
|
||
.1 phy
|
||
|
||
lda #" "
|
||
jsr SetCharAtYX X unmodified
|
||
|
||
ply
|
||
iny
|
||
.3 cpy #$ff Self Modified
|
||
bne .1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
SCROLL.DN ldy #S.TTY.SCROLLBOT
|
||
lda (ZPTTYEnvPtr),y
|
||
|
||
tax
|
||
|
||
.1 jsr SETUP.L1X
|
||
|
||
dex
|
||
|
||
jsr COPY.XtoL1
|
||
|
||
txa
|
||
ldy #S.TTY.SCROLLTOP
|
||
cmp (ZPTTYEnvPtr),y
|
||
bne .1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.LWEnable sec
|
||
.HS 90 BCC
|
||
*--------------------------------------
|
||
Esc.LWDisable clc
|
||
ldx EscSeqParamCnt
|
||
beq .8
|
||
dex
|
||
bne .8
|
||
|
||
lda EscSeqParam
|
||
eor #7
|
||
bne .8
|
||
|
||
ror
|
||
ldy #S.TTY.bLINEWRAP
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.DispAttr ldx EscSeqParamCnt
|
||
beq .8
|
||
|
||
.1 lda EscSeqParam-1,x
|
||
bne .2
|
||
jsr RESETATTR
|
||
bra .7
|
||
|
||
.2 eor #7
|
||
bne .8
|
||
|
||
ldy #S.TTY.bINVERSE
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.7 dex
|
||
bne .1
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.Query ldx EscSeqParamCnt
|
||
beq .8
|
||
dex
|
||
bne .8
|
||
|
||
lda EscSeqParam
|
||
cmp #6
|
||
bne .8
|
||
|
||
lda #C.ESC
|
||
jsr Char.Out.Put
|
||
|
||
lda #'['
|
||
jsr Char.Out.Put
|
||
|
||
ldy #S.TTY.CV
|
||
lda (ZPTTYEnvPtr),y
|
||
inc
|
||
jsr Decimal.Out
|
||
|
||
lda #';'
|
||
jsr Char.Out.Put
|
||
|
||
ldy #S.TTY.CH
|
||
lda (ZPTTYEnvPtr),y
|
||
inc
|
||
jsr Decimal.Out
|
||
|
||
lda #'R'
|
||
jsr Char.Out.Put
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.Scroll ldy EscSeqParamCnt
|
||
bne .1
|
||
|
||
lda #0
|
||
ldx #23
|
||
bra .8
|
||
|
||
.1 cpy #2
|
||
bne .9
|
||
|
||
lda EscSeqParam
|
||
dec
|
||
ldx EscSeqParam+1
|
||
dex
|
||
|
||
.8 ldy #S.TTY.SCROLLTOP
|
||
sta (ZPTTYEnvPtr),y
|
||
iny S.TTY.SCROLLBOT
|
||
txa
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.9 clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.Erase ldx EscSeqParamCnt
|
||
|
||
bne .1
|
||
jmp CLREOL
|
||
|
||
.1 lda EscSeqParam
|
||
cmp #1
|
||
bne .2
|
||
jmp CLRSOL
|
||
|
||
.2 cmp #2
|
||
bne .9
|
||
jmp CLRLINE
|
||
|
||
.9 clc
|
||
rts
|
||
*--------------------------------------
|
||
Esc.Home lda EscSeqParamCnt
|
||
bne .1
|
||
|
||
ldy #S.TTY.CH
|
||
sta (ZPTTYEnvPtr),y
|
||
iny
|
||
sta (ZPTTYEnvPtr),y
|
||
clc
|
||
rts
|
||
|
||
.1 ldx #1
|
||
lda EscSeqParam
|
||
beq .2
|
||
|
||
ldx #24
|
||
cmp #24
|
||
bcs .2
|
||
|
||
tax
|
||
|
||
.2 dex
|
||
txa
|
||
ldy #S.TTY.CV
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
dec EscSeqParamCnt
|
||
beq .8
|
||
|
||
ldx #1
|
||
lda EscSeqParam+1
|
||
beq .3
|
||
|
||
ldx #80
|
||
cmp #80
|
||
|
||
bcs .3
|
||
|
||
tax
|
||
|
||
.3 dex
|
||
txa
|
||
ldy #S.TTY.CH
|
||
sta (ZPTTYEnvPtr),y
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CUROFF ldy #S.TTY.bCURON
|
||
lda (ZPTTYEnvPtr),y
|
||
|
||
beq CUREXIT.RTS
|
||
|
||
CURBLNK bit bActive
|
||
bpl CURBLNK1
|
||
|
||
ldy #S.TTY.bCURON
|
||
lda (ZPTTYEnvPtr),y
|
||
bne CURBLNK.OFF
|
||
rts do not Light if screen is not active
|
||
|
||
CURBLNK1 ldy #S.TTY.bCURON
|
||
lda (ZPTTYEnvPtr),y
|
||
bne CURBLNK.OFF
|
||
|
||
jsr GetCharAtCurPos
|
||
ldy #S.TTY.CURCHAR
|
||
sta (ZPTTYEnvPtr),y
|
||
and #$80
|
||
eor #" "
|
||
bra CUREXIT
|
||
|
||
CURBLNK.OFF ldy #S.TTY.CURCHAR
|
||
lda (ZPTTYEnvPtr),y
|
||
|
||
CUREXIT jsr SetCharAtCurPos
|
||
|
||
ldy #S.TTY.bCURON
|
||
lda (ZPTTYEnvPtr),y
|
||
eor #CURSOR.BLINK.SPEED
|
||
sta (ZPTTYEnvPtr),y
|
||
CUREXIT.RTS rts
|
||
*--------------------------------------
|
||
Decimal.Out stz ZPTmpWord
|
||
stz ZPTmpWord+1
|
||
|
||
ldx #8
|
||
sed
|
||
|
||
tay
|
||
|
||
.1 tya
|
||
asl
|
||
tay
|
||
lda ZPTmpWord
|
||
adc ZPTmpWord
|
||
sta ZPTmpWord
|
||
lda ZPTmpWord+1
|
||
adc ZPTmpWord+1
|
||
sta ZPTmpWord+1
|
||
dex
|
||
bne .1
|
||
|
||
cld
|
||
|
||
stz ZPTmpBool No leading 0
|
||
|
||
lda ZPTmpWord+1
|
||
and #$0f
|
||
beq .2
|
||
|
||
dec ZPTmpBool non zero, print everything
|
||
|
||
jsr Char.Out.Put30
|
||
|
||
.2 lda ZPTmpWord
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
bne .3
|
||
|
||
bit ZPTmpBool Print this digit ?
|
||
bpl .4
|
||
|
||
.3 jsr Char.Out.Put30
|
||
|
||
.4 lda ZPTmpWord
|
||
and #$0f
|
||
*--------------------------------------
|
||
Char.Out.Put30 ora #$30
|
||
Char.Out.Put pha
|
||
lda OutPtr
|
||
clc
|
||
adc OutCnt
|
||
and #OUTBUF.MAXLEN-1
|
||
tax
|
||
pla
|
||
sta OutBuffer,x
|
||
inc OutCnt
|
||
rts
|
||
*--------------------------------------
|
||
Char.Out.Get sec
|
||
lda OutCnt
|
||
beq .9
|
||
dec OutCnt
|
||
ldx OutPtr
|
||
lda OutBuffer,x
|
||
pha
|
||
txa
|
||
inc
|
||
and #OUTBUF.MAXLEN-1
|
||
sta OutPtr
|
||
pla
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
GetPtrsAndCnt ldy #S.IOCTL.BUFPTR
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr
|
||
iny
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr+1
|
||
|
||
* ldy #S.IOCTL.BYTECNT
|
||
iny
|
||
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount
|
||
iny
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount+1
|
||
rts
|
||
*--------------------------------------
|
||
DRV.CS.END
|
||
*--------------------------------------
|
||
SCR.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
|
||
SCR.BASEH .HS 04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07.04.04.05.05.06.06.07.07
|
||
*--------------------------------------
|
||
BUF.BASEL .DA #S.TTY.SCRBUF
|
||
.DA #S.TTY.SCRBUF+80
|
||
.DA #S.TTY.SCRBUF+160
|
||
.DA #S.TTY.SCRBUF+240
|
||
.DA #S.TTY.SCRBUF+320
|
||
.DA #S.TTY.SCRBUF+400
|
||
.DA #S.TTY.SCRBUF+480
|
||
.DA #S.TTY.SCRBUF+560
|
||
.DA #S.TTY.SCRBUF+640
|
||
.DA #S.TTY.SCRBUF+720
|
||
.DA #S.TTY.SCRBUF+800
|
||
.DA #S.TTY.SCRBUF+880
|
||
.DA #S.TTY.SCRBUF+960
|
||
.DA #S.TTY.SCRBUF+1040
|
||
.DA #S.TTY.SCRBUF+1120
|
||
.DA #S.TTY.SCRBUF+1200
|
||
.DA #S.TTY.SCRBUF+1280
|
||
.DA #S.TTY.SCRBUF+1360
|
||
.DA #S.TTY.SCRBUF+1440
|
||
.DA #S.TTY.SCRBUF+1520
|
||
.DA #S.TTY.SCRBUF+1600
|
||
.DA #S.TTY.SCRBUF+1680
|
||
.DA #S.TTY.SCRBUF+1760
|
||
.DA #S.TTY.SCRBUF+1840
|
||
BUF.BASEH .DA /S.TTY.SCRBUF
|
||
.DA /S.TTY.SCRBUF+80
|
||
.DA /S.TTY.SCRBUF+160
|
||
.DA /S.TTY.SCRBUF+240
|
||
.DA /S.TTY.SCRBUF+320
|
||
.DA /S.TTY.SCRBUF+400
|
||
.DA /S.TTY.SCRBUF+480
|
||
.DA /S.TTY.SCRBUF+560
|
||
.DA /S.TTY.SCRBUF+640
|
||
.DA /S.TTY.SCRBUF+720
|
||
.DA /S.TTY.SCRBUF+800
|
||
.DA /S.TTY.SCRBUF+880
|
||
.DA /S.TTY.SCRBUF+960
|
||
.DA /S.TTY.SCRBUF+1040
|
||
.DA /S.TTY.SCRBUF+1120
|
||
.DA /S.TTY.SCRBUF+1200
|
||
.DA /S.TTY.SCRBUF+1280
|
||
.DA /S.TTY.SCRBUF+1360
|
||
.DA /S.TTY.SCRBUF+1440
|
||
.DA /S.TTY.SCRBUF+1520
|
||
.DA /S.TTY.SCRBUF+1600
|
||
.DA /S.TTY.SCRBUF+1680
|
||
.DA /S.TTY.SCRBUF+1760
|
||
.DA /S.TTY.SCRBUF+1840
|
||
*--------------------------------------
|
||
CtrlChars .HS 05080A0C0D151B
|
||
CtrlChars.Cnt .EQ *-CtrlChars
|
||
*--------------------------------------
|
||
EscCodes .AZ "MDc"
|
||
EscCodes.Cnt .EQ *-EscCodes
|
||
EscSeqCmds .AS "hlmnrKH"
|
||
EscSeqCmds.Cnt .EQ *-EscSeqCmds
|
||
ENQ.String .AZ "XTERM"
|
||
*--------------------------------------
|
||
KeyRemapped .HS 05080A0B0D15 L,D,U,CR,R
|
||
KeyRemappedIdx .HS 050004080C0F
|
||
KeyRemappedTbl .EQ *
|
||
KeyRemappedLEFT .HS 1B5B4400 esc[D
|
||
KeyRemappedDOWN .HS 1B5B4200 esc[B
|
||
KeyRemappedUP .HS 1B5B4100 esc[A
|
||
KeyRemappedCR .HS 0D0A00 crlf
|
||
KeyRemappedRGHT .HS 1B5B4300 esc[C
|
||
*--------------------------------------
|
||
TELOPS.STATUS
|
||
*--------------------------------------
|
||
WILLDO .DA #TELOPT.BINARY,#TELOPT.SGA
|
||
WILLDO.CNT .EQ *-WILLDO
|
||
WILLDONT .DA #TELOPT.TSPEED,#TELOPT.LINEMODE,#TELOPT.STATUS
|
||
WILLDONT.CNT .EQ *-WILLDONT
|
||
DOWILL .DA #TELOPT.BINARY,#TELOPT.SGA,#TELOPT.TTYPE,#TELOPT.NAWS
|
||
DOWILL.CNT .EQ *-DOWILL
|
||
DOWONT .DA #TELOPT.ECHO,#TELOPT.NEWENVIRON,#TELOPT.XDISPLOC,#TELOPT.TSPEED,#TELOPT.LFLOW
|
||
DOWONT.CNT .EQ *-DOWONT
|
||
SB.IS.TTYPE .DA #IAC,#SB,#TELOPT.TTYPE,#SB.IS
|
||
.AS 'XTERM'
|
||
.DA #IAC,#SE
|
||
SB.IS.TTYPE.LEN .EQ *-SB.IS.TTYPE
|
||
SB.IS.NAWS .DA #IAC,#SB,#TELOPT.NAWS,#SB.IS
|
||
.DA 80
|
||
.DA 24
|
||
.DA #IAC,#SE
|
||
SB.IS.NAWS.LEN .EQ *-SB.IS.NAWS
|
||
*--------------------------------------
|
||
bActive .BS 1
|
||
bEscSeqInNum .BS 1
|
||
EscSeqParamCnt .BS 1
|
||
EscSeqParam .BS 4
|
||
*--------------------------------------
|
||
InBuffer .BS INBUF.MAXLEN+1
|
||
OutBuffer .BS OUTBUF.MAXLEN
|
||
OutPtr .BS 1
|
||
OutCnt .BS 1
|
||
*--------------------------------------
|
||
DRV.TERM.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ
|
||
.DA #0,#0,#0
|
||
>PSTR "A2osX VT100 TERM"
|
||
.DA #S.DIB.T.CHAR
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.TERM
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|