mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-28 14:29:20 +00:00
1310 lines
22 KiB
Plaintext
1310 lines
22 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
*--------------------------------------
|
||
CURSOR.BLINK.SPEED .EQ 2
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPDRV
|
||
ZPIOCTL .BS 2
|
||
ZPDCBPtr .BS 2
|
||
ZPBufPtr .BS 2
|
||
ZPCount .BS 2
|
||
ZPBufBaseL1 .BS 2
|
||
ZPBufBaseL2 .BS 2
|
||
ZPScrBaseL1 .BS 2
|
||
ZPScrBaseL2 .BS 2
|
||
ZPTmpWord .BS 2
|
||
ZPTmpBool .BS 1
|
||
*--------------------------------------
|
||
bActive .BS 1
|
||
bCsiInNum .BS 1
|
||
CsiParamCnt .BS 1
|
||
CsiParams .BS 4
|
||
.ED
|
||
*--------------------------------------
|
||
DRV.TERM cld
|
||
jmp (.1,x)
|
||
.1 .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 jsr DRV.TERM.GetIOCTLBufCntDCB
|
||
|
||
ldy #S.IOCTL.STATCODE
|
||
lda (ZPIOCTL),y
|
||
beq .1
|
||
|
||
cmp #S.IOCTL.STATCODE.GETDIB
|
||
bne .3
|
||
|
||
ldy #S.DIB-1
|
||
.HS 2C bit abs
|
||
.1 ldy #3
|
||
|
||
.2 lda DRV.TERM.DIB,y
|
||
sta (ZPBufPtr),y
|
||
dey
|
||
bne .2
|
||
|
||
ldy #S.DCB.TTY.STATUS
|
||
lda (ZPDCBPtr),y
|
||
sta (ZPBufPtr)
|
||
|
||
clc
|
||
rts
|
||
|
||
.3 cmp #S.IOCTL.STATCODE.GETRC
|
||
bne .9
|
||
|
||
ldy #S.DCB.TTY.STATUS
|
||
lda (ZPDCBPtr),y
|
||
and #S.DIB.S.OPENED
|
||
beq .8
|
||
|
||
jsr DRV.TERM.CURBLNK
|
||
|
||
ldy #S.DCB.TTY.OUTTAIL
|
||
lda (ZPDCBPtr),y
|
||
iny
|
||
sec
|
||
sbc (ZPDCBPtr),y OUTHEAD
|
||
|
||
and #$F
|
||
|
||
bit bActive
|
||
bpl .8
|
||
bit OPENAPPLE
|
||
bmi .8
|
||
|
||
bit KBD
|
||
bpl .8
|
||
|
||
inc
|
||
|
||
.8 sta (ZPBufPtr)
|
||
ldy #1
|
||
lda #0
|
||
sta (ZPBufPtr),y
|
||
clc
|
||
rts
|
||
|
||
.9 lda #MLI.E.BADCTL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.OPEN tax DEV.ID in A
|
||
|
||
jsr DRV.TERM.GetDCB
|
||
|
||
ldy #S.DCB.TTY.STATUS
|
||
lda (ZPDCBPtr),y
|
||
bit #S.DIB.S.OPENED
|
||
beq .1
|
||
|
||
lda #MLI.E.OPEN
|
||
sec
|
||
rts
|
||
|
||
.1 txa
|
||
|
||
ldx #0
|
||
.2 ldy A2osX.SCRNDEVS,x
|
||
beq .3
|
||
|
||
inx
|
||
cpx #K.SCR.MAX
|
||
bne .2
|
||
|
||
lda #E.OOH
|
||
sec
|
||
rts
|
||
|
||
.3 sta A2osX.SCRNDEVS,x
|
||
|
||
ldy #S.DCB.TTY.DEVID
|
||
sta (ZPDCBPtr),y
|
||
|
||
ldy #S.DCB.TTY.STATUS
|
||
lda (ZPDCBPtr),y
|
||
ora #S.DIB.S.OPENED
|
||
ora DRV.TERM.DIB+S.DIB.S
|
||
sta (ZPDCBPtr),y
|
||
|
||
jsr RESET
|
||
*--------------------------------------
|
||
DRV.TERM.CONTROL
|
||
jsr DRV.TERM.GetDCB
|
||
|
||
ldy #S.DCB.TTY.DEVID
|
||
lda (ZPDCBPtr),y
|
||
sta A2osX.ASCREEN
|
||
|
||
sta SETTEXT
|
||
|
||
jsr DRV.TERM.SCRCPY
|
||
|
||
lda #0
|
||
|
||
ldy #S.DCB.TTY.bCURON
|
||
sta (ZPDCBPtr),y
|
||
|
||
ldy #S.DCB.TTY.bTITLE
|
||
sta (ZPDCBPtr),y
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.CLOSE jsr DRV.TERM.GetDCB
|
||
|
||
ldy #S.DCB.TTY.STATUS
|
||
lda (ZPDCBPtr),y
|
||
bit #S.DIB.S.OPENED
|
||
beq .9
|
||
|
||
lda DRV.TERM.DIB+S.DIB.S
|
||
sta (ZPDCBPtr),y
|
||
|
||
ldx #0
|
||
ldy #S.DCB.TTY.DEVID
|
||
|
||
.1 lda A2osX.SCRNDEVS,x
|
||
cmp (ZPDCBPtr),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 jsr DRV.TERM.GetIOCTLBufCntDCB
|
||
|
||
bit bActive is screen active?
|
||
bpl .6 no....go check flush...
|
||
|
||
jsr DRV.TERM.CURBLNK
|
||
|
||
lda OPENAPPLE
|
||
bpl .1
|
||
|
||
lda KBD
|
||
bmi .6 Open apple key, not for us...
|
||
|
||
jsr DRV.TERM.Title.ON
|
||
bra .6
|
||
|
||
.1 jsr DRV.TERM.Title.OFF
|
||
|
||
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
|
||
tax
|
||
|
||
.4 lda KeyRemappedTbl,x
|
||
beq .7 end of remap....flush
|
||
jsr Char.Out.Put
|
||
inx
|
||
bra .4
|
||
|
||
.6 ldy #S.DCB.TTY.OUTTAIL
|
||
lda (ZPDCBPtr),y
|
||
iny
|
||
cmp (ZPDCBPtr),y OUTHEAD
|
||
|
||
beq .9 no char in output buffer...
|
||
|
||
.7 stz .8+1
|
||
|
||
.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 DRV.TERM.GetIOCTLBufCntDCB
|
||
|
||
jsr DRV.TERM.CUROFF
|
||
|
||
.1 inc ZPCount
|
||
bne .2
|
||
inc ZPCount+1
|
||
beq FS.8
|
||
|
||
.2 ldy #S.DCB.TTY.MODE
|
||
lda (ZPDCBPtr),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
|
||
*--------------------------------------
|
||
DRV.TERM.COUT lda (ZPBufPtr)
|
||
|
||
cmp #IAC
|
||
bne .1
|
||
|
||
lda #S.DCB.TTY.MODE.IAC
|
||
jmp DRV.TERM.SETMODE
|
||
|
||
.1 cmp #C.DEL
|
||
beq DRV.TERM.COUT.DEL
|
||
cmp #C.SPACE
|
||
bcs .8
|
||
|
||
ldx #CtrlChars.Cnt-1
|
||
|
||
.2 cmp CtrlChars,x
|
||
beq .3
|
||
dex
|
||
bpl .2
|
||
clc
|
||
rts
|
||
|
||
.3 txa
|
||
asl
|
||
tax
|
||
jmp (.4,x)
|
||
|
||
.4 .DA ENQ 5
|
||
.DA BS 8
|
||
.DA LF 10
|
||
.DA DRV.TERM.COUT.FF
|
||
.DA DRV.TERM.COUT.CR
|
||
.DA DRV.TERM.COUT.FS
|
||
.DA DRV.TERM.COUT.ESC
|
||
|
||
.8 ldy #S.DCB.TTY.bINVERSE
|
||
ora (ZPDCBPtr),y
|
||
jsr SetCharAtCurPos
|
||
*--------------------------------------
|
||
DRV.TERM.COUT.FS
|
||
ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
cmp #79
|
||
bne .1
|
||
|
||
ldy #S.DCB.TTY.bLINEWRAP
|
||
lda (ZPDCBPtr),y
|
||
bpl FS.8
|
||
|
||
ldy #S.DCB.TTY.CH
|
||
lda #0
|
||
sta (ZPDCBPtr),y
|
||
|
||
jmp LF
|
||
|
||
.1 inc
|
||
sta (ZPDCBPtr),y
|
||
|
||
FS.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.COUT.DEL
|
||
ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
beq .1
|
||
dec
|
||
sta (ZPDCBPtr),y
|
||
bra .3
|
||
|
||
.1 iny S.DCB.TTY.CV
|
||
lda (ZPDCBPtr),y
|
||
beq FS.8
|
||
|
||
dec
|
||
sta (ZPDCBPtr),y
|
||
|
||
dey
|
||
lda #79
|
||
sta (ZPDCBPtr),y S.DCB.TTY.CH
|
||
|
||
.3 lda #$20
|
||
ldy #S.DCB.TTY.bINVERSE
|
||
ora (ZPDCBPtr),y
|
||
jmp SetCharAtCurPos
|
||
*--------------------------------------
|
||
DRV.TERM.COUT.FF
|
||
lda #0
|
||
ldy #S.DCB.TTY.CV
|
||
sta (ZPDCBPtr),y
|
||
dey
|
||
sta (ZPDCBPtr),y
|
||
jmp DRV.TERM.CLRSCR
|
||
*--------------------------------------
|
||
DRV.TERM.COUT.CR
|
||
lda #0
|
||
ldy #S.DCB.TTY.CH
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.COUT.ESC
|
||
lda #S.DCB.TTY.MODE.ESC
|
||
bra DRV.TERM.SETMODE
|
||
*--------------------------------------
|
||
DRV.TERM.ESC lda (ZPBufPtr)
|
||
|
||
cmp #'['
|
||
bne DRV.TERM.ESC1
|
||
|
||
lda #S.DCB.TTY.MODE.CSI
|
||
|
||
DRV.TERM.SETMODE
|
||
sta (ZPDCBPtr),y
|
||
ldy #S.DCB.TTY.INBUFFER
|
||
lda #S.DCB.TTY.INBUFFER
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
|
||
DRV.TERM.ESC1 lda #0 y = #S.DCB.TTY.MODE
|
||
sta (ZPDCBPtr),y
|
||
|
||
ldx #EscCodes.Cnt-1
|
||
lda (ZPBufPtr)
|
||
|
||
.2 cmp EscCodes,x
|
||
beq .3
|
||
dex
|
||
bpl .2
|
||
|
||
clc
|
||
rts
|
||
|
||
.3 txa
|
||
asl
|
||
tax
|
||
jmp (.4,x)
|
||
|
||
.4 .DA Scroll.Dn M
|
||
.DA Scroll.Up D
|
||
.DA RESET c
|
||
*--------------------------------------
|
||
DRV.TERM.CSI ldy #S.DCB.TTY.INBUFFER
|
||
lda (ZPDCBPtr),y
|
||
inc
|
||
sta (ZPDCBPtr),y
|
||
tay
|
||
|
||
lda (ZPBufPtr)
|
||
sta (ZPDCBPtr),y
|
||
cmp #64 End of Seq ?
|
||
bcs DRV.TERM.CSI.Exec
|
||
|
||
cpy #S.DCB.TTY.INBUFFER.MAX-1 buffer full?
|
||
bne .8
|
||
|
||
lda #0
|
||
ldy #S.DCB.TTY.MODE
|
||
sta (ZPDCBPtr),y
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
DRV.TERM.CSI.Exec
|
||
stz CsiParamCnt
|
||
stz bCsiInNum
|
||
|
||
ldy #S.DCB.TTY.INBUFFER EscSeq Ptr
|
||
|
||
.10 stz ZPTmpWord
|
||
stz ZPTmpWord+1
|
||
|
||
.1 iny
|
||
lda (ZPDCBPtr),y
|
||
|
||
cmp #'0'
|
||
bcc .2
|
||
cmp #'9'+1
|
||
bcs .2
|
||
|
||
dec bCsiInNum
|
||
|
||
and #$0F
|
||
pha
|
||
|
||
lda ZPTmpWord
|
||
ldx ZPTmpWord+1
|
||
|
||
asl ZPTmpWord param=param*10
|
||
rol ZPTmpWord+1
|
||
asl ZPTmpWord
|
||
rol ZPTmpWord+1
|
||
|
||
clc
|
||
adc ZPTmpWord
|
||
sta ZPTmpWord
|
||
txa
|
||
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 bCsiInNum
|
||
bpl .3
|
||
|
||
stz bCsiInNum
|
||
lda #255
|
||
ldx ZPTmpWord+1
|
||
bne .21
|
||
|
||
lda ZPTmpWord
|
||
.21 ldx CsiParamCnt
|
||
sta CsiParams,x
|
||
inc CsiParamCnt
|
||
|
||
.3 lda (ZPDCBPtr),y
|
||
cmp #';'
|
||
beq .10
|
||
|
||
pha
|
||
|
||
lda #0
|
||
ldy #S.DCB.TTY.MODE
|
||
sta (ZPDCBPtr),y
|
||
|
||
pla
|
||
|
||
ldx #CsiCodes.Cnt-1
|
||
|
||
.4 cmp CsiCodes,x
|
||
beq .5
|
||
dex
|
||
bne .4
|
||
|
||
clc
|
||
rts
|
||
|
||
.5 txa
|
||
asl
|
||
tax
|
||
jmp (.8,x)
|
||
|
||
.8 .DA Csi.LWEnable h
|
||
.DA Csi.LWDisable l
|
||
.DA Csi.DispAttr m
|
||
.DA Csi.Query n
|
||
.DA Csi.Scroll r
|
||
.DA Csi.Erase K
|
||
.DA Csi.Home H
|
||
*--------------------------------------
|
||
Csi.LWEnable sec
|
||
.HS 90 BCC
|
||
*--------------------------------------
|
||
Csi.LWDisable clc
|
||
ldx CsiParamCnt
|
||
beq .8
|
||
dex
|
||
bne .8
|
||
|
||
lda CsiParams
|
||
eor #7
|
||
bne .8
|
||
|
||
ror
|
||
ldy #S.DCB.TTY.bLINEWRAP
|
||
sta (ZPDCBPtr),y
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Csi.DispAttr ldx CsiParamCnt
|
||
beq .8
|
||
|
||
.1 lda CsiParams-1,x
|
||
bne .2
|
||
|
||
jsr RESETATTR
|
||
bra .7
|
||
|
||
.2 eor #7
|
||
bne .8
|
||
|
||
ldy #S.DCB.TTY.bINVERSE
|
||
sta (ZPDCBPtr),y
|
||
|
||
.7 dex
|
||
bne .1
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Csi.Query ldx CsiParamCnt
|
||
beq .8
|
||
dex
|
||
bne .8
|
||
|
||
lda CsiParams
|
||
cmp #6
|
||
bne .8
|
||
|
||
lda #C.ESC
|
||
jsr Char.Out.Put
|
||
|
||
lda #'['
|
||
jsr Char.Out.Put
|
||
|
||
ldy #S.DCB.TTY.CV
|
||
lda (ZPDCBPtr),y
|
||
inc
|
||
jsr Decimal.Out
|
||
|
||
lda #';'
|
||
jsr Char.Out.Put
|
||
|
||
ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
inc
|
||
jsr Decimal.Out
|
||
|
||
lda #'R'
|
||
jsr Char.Out.Put
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
Csi.Scroll ldy CsiParamCnt
|
||
bne .1
|
||
|
||
lda #0
|
||
ldx #23
|
||
bra .8
|
||
|
||
.1 cpy #2
|
||
bne .9
|
||
|
||
lda CsiParams
|
||
dec
|
||
ldx CsiParams+1
|
||
dex
|
||
|
||
.8 ldy #S.DCB.TTY.SCROLLTOP
|
||
sta (ZPDCBPtr),y
|
||
iny S.DCB.TTY.SCROLLBOT
|
||
txa
|
||
sta (ZPDCBPtr),y
|
||
|
||
.9 clc
|
||
rts
|
||
*--------------------------------------
|
||
Csi.Erase ldx CsiParamCnt
|
||
|
||
bne .1
|
||
jmp CLREOL
|
||
|
||
.1 lda CsiParams
|
||
cmp #1
|
||
bne .2
|
||
jmp CLRSOL
|
||
|
||
.2 cmp #2
|
||
bne .9
|
||
jmp CLRLINE
|
||
|
||
.9 clc
|
||
rts
|
||
*--------------------------------------
|
||
Csi.Home lda CsiParamCnt
|
||
bne .1
|
||
|
||
ldy #S.DCB.TTY.CH
|
||
sta (ZPDCBPtr),y
|
||
iny
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
|
||
.1 ldx #1
|
||
lda CsiParams
|
||
beq .2
|
||
|
||
ldx #24
|
||
cmp #24
|
||
bcs .2
|
||
|
||
tax
|
||
|
||
.2 dex
|
||
txa
|
||
ldy #S.DCB.TTY.CV
|
||
sta (ZPDCBPtr),y
|
||
|
||
dec CsiParamCnt
|
||
beq Csi.Home.8
|
||
|
||
ldx #1
|
||
lda CsiParams+1
|
||
beq .3
|
||
|
||
ldx #80
|
||
cmp #80
|
||
|
||
bcs .3
|
||
|
||
tax
|
||
|
||
.3 dex
|
||
txa
|
||
ldy #S.DCB.TTY.CH
|
||
sta (ZPDCBPtr),y
|
||
|
||
Csi.Home.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.IAC ldy #S.DCB.TTY.INBUFFER
|
||
lda (ZPDCBPtr),y
|
||
inc
|
||
sta (ZPDCBPtr),y
|
||
tay
|
||
|
||
lda (ZPBufPtr)
|
||
sta (ZPDCBPtr),y
|
||
|
||
cpy #S.DCB.TTY.INBUFFER+1 CMD ?
|
||
beq Csi.Home.8 yes, wait for additional bytes
|
||
|
||
ldy #S.DCB.TTY.INBUFFER+1
|
||
lda (ZPDCBPtr),y get back CMD
|
||
cmp #SB
|
||
bne .1 not a SB/SE....stop with CMD/SUBCMD
|
||
|
||
lda (ZPBufPtr)
|
||
cmp #SE
|
||
bne Csi.Home.8 wait for ending SE....keep bIACMode
|
||
bra COUT.IAC.SB
|
||
|
||
ldy #S.DCB.TTY.INBUFFER+1
|
||
lda (ZPDCBPtr),y get back CMD
|
||
|
||
.1 cmp #IAC
|
||
beq COUT.IAC.SB.9
|
||
|
||
sec
|
||
sbc #WILL
|
||
bcc COUT.IAC.SB.9
|
||
asl
|
||
tax
|
||
|
||
ldy #S.DCB.TTY.INBUFFER+2
|
||
lda (ZPDCBPtr),y Get SUBCMD in A
|
||
|
||
jmp (.8,x)
|
||
|
||
.8 .DA COUT.IAC.WILL
|
||
.DA COUT.IAC.WONT
|
||
.DA COUT.IAC.DO
|
||
.DA COUT.IAC.DONT
|
||
*--------------------------------------
|
||
COUT.IAC.SB ldy #S.DCB.TTY.INBUFFER+2
|
||
lda (ZPDCBPtr),y Get SUBCMD in A
|
||
|
||
cmp #TELOPT.TTYPE
|
||
bne COUT.IAC.SB.9
|
||
|
||
iny
|
||
lda (ZPDCBPtr),y
|
||
cmp #SB.SEND
|
||
bne COUT.IAC.SB.9
|
||
|
||
ldx #0
|
||
|
||
.1 lda SB.IS.TTYPE,x
|
||
jsr Char.Out.Put
|
||
inx
|
||
cpx #SB.IS.TTYPE.LEN
|
||
bne .1
|
||
|
||
COUT.IAC.SB.9 bra COUT.IAC.EXIT
|
||
*--------------------------------------
|
||
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 COUT.IAC.EXIT
|
||
|
||
.7 ldx #DO
|
||
.HS 2C BIT ABS
|
||
|
||
.8 ldx #DONT
|
||
|
||
bra COUT.IAC.SendAX
|
||
*--------------------------------------
|
||
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.EXIT
|
||
|
||
.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.WONT
|
||
COUT.IAC.DONT
|
||
|
||
COUT.IAC.EXIT
|
||
*--------------------------------------
|
||
RESET.MODE lda #0
|
||
|
||
ldy #S.DCB.TTY.MODE
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RESET ldy #1
|
||
|
||
.1 iny
|
||
lda RESET.VALUES-2,y
|
||
sta (ZPDCBPtr),y
|
||
cpy #S.DCB.TTY.INBUFFER
|
||
bne .1
|
||
|
||
jmp DRV.TERM.CLRSCR
|
||
*--------------------------------------
|
||
RESETATTR lda #$80
|
||
ldy #S.DCB.TTY.bINVERSE
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
ENQ ldx #0
|
||
|
||
.1 lda ENQ.String,x
|
||
beq .8
|
||
jsr Char.Out.Put
|
||
inx
|
||
bne .1
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
BS ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
beq .1
|
||
|
||
dec
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
|
||
.1 ldy #S.DCB.TTY.CV
|
||
lda (ZPDCBPtr),y
|
||
beq .2
|
||
|
||
dec
|
||
sta (ZPDCBPtr),y
|
||
|
||
lda #79
|
||
dey
|
||
sta (ZPDCBPtr),y
|
||
|
||
.2 clc
|
||
rts
|
||
*--------------------------------------
|
||
LF ldy #S.DCB.TTY.CV
|
||
lda (ZPDCBPtr),y
|
||
ldy #S.DCB.TTY.SCROLLBOT
|
||
cmp (ZPDCBPtr),y
|
||
beq SCROLL.UP
|
||
|
||
inc
|
||
ldy #S.DCB.TTY.CV
|
||
sta (ZPDCBPtr),y
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
SCROLL.UP ldy #S.DCB.TTY.SCROLLTOP
|
||
lda (ZPDCBPtr),y
|
||
|
||
tax
|
||
|
||
.1 jsr DRV.TERM.SETUP.L1X
|
||
|
||
inx
|
||
|
||
jsr DRV.TERM.COPY.XtoL1
|
||
|
||
txa
|
||
ldy #S.DCB.TTY.SCROLLBOT
|
||
cmp (ZPDCBPtr),y
|
||
bne .1
|
||
*--------------------------------------
|
||
CLRLINE ldy #0 Start
|
||
ldx #80 End
|
||
bra CLR
|
||
|
||
CLRSOL ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
tax End
|
||
ldy #0 Start
|
||
|
||
bra CLR
|
||
|
||
CLREOL ldy #S.DCB.TTY.CH
|
||
lda (ZPDCBPtr),y
|
||
tay Start
|
||
ldx #80 End
|
||
|
||
CLR stx .3+1 Save End
|
||
phy
|
||
|
||
ldy #S.DCB.TTY.CV
|
||
lda (ZPDCBPtr),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.DCB.TTY.SCROLLBOT
|
||
lda (ZPDCBPtr),y
|
||
|
||
tax
|
||
|
||
.1 jsr DRV.TERM.SETUP.L1X
|
||
|
||
dex
|
||
|
||
jsr DRV.TERM.COPY.XtoL1
|
||
|
||
txa
|
||
ldy #S.DCB.TTY.SCROLLTOP
|
||
cmp (ZPDCBPtr),y
|
||
bne .1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.CURBLNK
|
||
bit bActive
|
||
bpl .9
|
||
|
||
lda A2osX.TIMER16
|
||
and #CURSOR.BLINK.SPEED
|
||
ldy #S.DCB.TTY.bCURON
|
||
eor (ZPDCBPtr),y
|
||
bne DRV.TERM.CURBLNK.1
|
||
|
||
.9 rts
|
||
|
||
DRV.TERM.CUROFF bit bActive
|
||
bpl DRV.TERM.CURBLNK.RTS
|
||
|
||
ldy #S.DCB.TTY.bCURON
|
||
lda (ZPDCBPtr),y
|
||
beq DRV.TERM.CURBLNK.RTS
|
||
|
||
DRV.TERM.CURBLNK.1
|
||
lda (ZPDCBPtr),y
|
||
bne DRV.TERM.CURBLNK.OFF
|
||
|
||
jsr GetCharAtCurPos
|
||
and #$80
|
||
eor #" "
|
||
bra DRV.TERM.CURBLNK.SET
|
||
|
||
DRV.TERM.CURBLNK.OFF
|
||
jsr GetCharAtCurPos
|
||
|
||
DRV.TERM.CURBLNK.SET
|
||
jsr SetCharAtCurPos.SCR
|
||
|
||
ldy #S.DCB.TTY.bCURON
|
||
lda (ZPDCBPtr),y
|
||
eor #CURSOR.BLINK.SPEED
|
||
sta (ZPDCBPtr),y
|
||
DRV.TERM.CURBLNK.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 save char
|
||
|
||
ldy #S.DCB.TTY.OUTHEAD
|
||
lda (ZPDCBPtr),y
|
||
|
||
pha save actual HEAD
|
||
inc
|
||
|
||
cmp #S.DCB.TTY.OUTBUFFER.MAX
|
||
bne .1
|
||
|
||
lda #S.DCB.TTY.OUTBUFFER
|
||
|
||
.1 dey OUTTAIL
|
||
|
||
cmp (ZPDCBPtr),y HEAD+1 = TAIL ?
|
||
beq .9 CS, full!
|
||
|
||
iny
|
||
sta (ZPDCBPtr),y new head
|
||
|
||
ply old head
|
||
pla
|
||
sta (ZPDCBPtr),y
|
||
clc
|
||
rts
|
||
|
||
.9 pla
|
||
pla
|
||
rts
|
||
*--------------------------------------
|
||
Char.Out.Get ldy #S.DCB.TTY.OUTTAIL
|
||
lda (ZPDCBPtr),y
|
||
iny OUTHEAD
|
||
cmp (ZPDCBPtr),y
|
||
beq .9 CS
|
||
|
||
tay
|
||
lda (ZPDCBPtr),y
|
||
pha
|
||
|
||
tya
|
||
inc
|
||
cmp #S.DCB.TTY.OUTBUFFER.MAX
|
||
bne .1
|
||
|
||
lda #S.DCB.TTY.OUTBUFFER
|
||
|
||
.1 ldy #S.DCB.TTY.OUTTAIL
|
||
sta (ZPDCBPtr),y
|
||
|
||
pla
|
||
clc
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DRV.TERM.GetIOCTLBufCntDCB
|
||
>STYA ZPIOCTL
|
||
|
||
ldy #S.IOCTL.BUFPTR
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr
|
||
iny
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr+1
|
||
|
||
iny #S.IOCTL.BYTECNT
|
||
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount
|
||
iny
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount+1
|
||
*--------------------------------------
|
||
DRV.TERM.GetDCB ldy #S.FD.DEV.DCBPTR
|
||
lda (pFD),y
|
||
sta ZPDCBPtr
|
||
iny
|
||
lda (pFD),y
|
||
sta ZPDCBPtr+1
|
||
|
||
ldy #S.DCB.TTY.DEVID
|
||
lda (ZPDCBPtr),y
|
||
cmp A2osX.ASCREEN
|
||
beq .1 CS
|
||
|
||
clc
|
||
.1 ror bActive
|
||
rts
|
||
*--------------------------------------
|
||
DRV.TERM.Title.ON
|
||
ldy #S.DCB.TTY.bTITLE
|
||
lda (ZPDCBPtr),y
|
||
bmi DRV.TERM.Title.RTS
|
||
|
||
lda #$ff
|
||
sta (ZPDCBPtr),y
|
||
|
||
ldy #S.DCB.TTY.DEVID
|
||
lda (ZPDCBPtr),y
|
||
tax
|
||
lda Dev.Table-1,x
|
||
clc
|
||
adc #S.FD.DEV
|
||
tay
|
||
lda Dev.Table,x
|
||
adc /S.FD.DEV
|
||
|
||
>STYA ZPTmpWord
|
||
|
||
ldx #0
|
||
jsr DRV.TERM.SETUP.L1X.SCR
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPTmpWord),y
|
||
beq .2
|
||
|
||
phy
|
||
jsr SetCharAtY.SCR
|
||
ply
|
||
iny
|
||
bne .1
|
||
|
||
.2 lda #C.SPACE
|
||
|
||
.3 phy
|
||
jsr SetCharAtY.SCR
|
||
ply
|
||
iny
|
||
cpy #80
|
||
bne .3
|
||
DRV.TERM.Title.RTS
|
||
rts
|
||
|
||
DRV.TERM.Title.OFF
|
||
ldy #S.DCB.TTY.bTITLE
|
||
lda (ZPDCBPtr),y
|
||
bpl DRV.TERM.Title.RTS
|
||
|
||
lda #$0
|
||
sta (ZPDCBPtr),y
|
||
jmp DRV.TERM.LINE0CPY
|
||
*--------------------------------------
|
||
DRV.TERM.SETUP.L1X
|
||
ldy #S.FD.DEV.BUFPTR
|
||
lda (pFD),y
|
||
clc
|
||
adc BUF.BASEL,x
|
||
sta ZPBufBaseL1
|
||
|
||
iny
|
||
lda (pFD),y
|
||
adc BUF.BASEH,x
|
||
sta ZPBufBaseL1+1
|
||
|
||
bit bActive
|
||
bpl DRV.TERM.SETUP.L1X.8
|
||
|
||
DRV.TERM.SETUP.L1X.SCR
|
||
lda SCR.BASEL,x
|
||
sta ZPScrBaseL1
|
||
lda SCR.BASEH,x
|
||
sta ZPScrBaseL1+1
|
||
DRV.TERM.SETUP.L1X.8
|
||
rts
|
||
*--------------------------------------
|
||
RESET.VALUES .DA #0 S.DCB.TTY.MODE
|
||
.DA #0 S.DCB.TTY.CH
|
||
.DA #0 S.DCB.TTY.CV
|
||
.DA #0 S.DCB.TTY.SCROLLTOP
|
||
.DA #23 S.DCB.TTY.SCROLLBOT
|
||
.DA #0 S.DCB.TTY.bCURON
|
||
.DA #$80 S.DCB.TTY.bINVERSE
|
||
.DA #$80 S.DCB.TTY.bLINEWRAP
|
||
.DA #0 S.DCB.TTY.bTITLE
|
||
.DA #0
|
||
.DA #0
|
||
.DA #0
|
||
.DA #S.DCB.TTY.OUTBUFFER S.DCB.TTY.OUTTAIL
|
||
.DA #S.DCB.TTY.OUTBUFFER S.DCB.TTY.OUTHEAD
|
||
.DA #S.DCB.TTY.INBUFFER S.DCB.TTY.INBUFFER
|
||
*--------------------------------------
|
||
CtrlChars .HS 05080A0C0D151B
|
||
CtrlChars.Cnt .EQ *-CtrlChars
|
||
*--------------------------------------
|
||
EscCodes .AZ "MDc"
|
||
EscCodes.Cnt .EQ *-EscCodes
|
||
CsiCodes .AS "hlmnrKH"
|
||
CsiCodes.Cnt .EQ *-CsiCodes
|
||
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
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
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
|