A2osX/SYS/KERNEL.S.TERM.txt

1308 lines
22 KiB
Plaintext
Raw Normal View History

2018-12-11 16:41:25 +00:00
NEW
PREFIX
AUTO 4,1
*--------------------------------------
CURSOR.BLINK.SPEED .EQ 2
*--------------------------------------
2018-12-14 16:19:05 +00:00
.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
2018-12-15 20:34:55 +00:00
*--------------------------------------
bActive .BS 1
bCsiInNum .BS 1
CsiParamCnt .BS 1
CsiParams .BS 4
2018-12-14 16:19:05 +00:00
.ED
2018-12-11 16:41:25 +00:00
*--------------------------------------
DRV.TERM cld
2018-12-14 16:19:05 +00:00
jmp (.1,x)
.1 .DA DRV.TERM.STATUS
2018-12-11 16:41:25 +00:00
.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
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.STATUS jsr DRV.TERM.GetIOCTLBufCntDCB
2018-12-12 16:32:33 +00:00
ldy #S.IOCTL.STATCODE
2018-12-11 16:41:25 +00:00
lda (ZPIOCTL),y
beq .1
cmp #S.IOCTL.STATCODE.GETDIB
2019-02-20 16:07:43 +00:00
bne .3
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
ldy #S.DIB-1
2018-12-11 16:41:25 +00:00
.HS 2C bit abs
2018-12-12 16:32:33 +00:00
.1 ldy #3
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
.2 lda DRV.TERM.DIB,y
2018-12-17 14:24:39 +00:00
sta (ZPBufPtr),y
2018-12-12 16:32:33 +00:00
dey
bne .2
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.STATUS
lda (ZPDCBPtr),y
2018-12-14 07:32:20 +00:00
sta (ZPBufPtr)
2018-12-11 16:41:25 +00:00
clc
rts
2019-02-20 16:07:43 +00:00
.3 cmp #S.IOCTL.STATCODE.GETRC
bne .9
2019-02-23 22:01:58 +00:00
ldy #S.DCB.TTY.STATUS
lda (ZPDCBPtr),y
and #S.DIB.S.OPENED
beq .8
jsr DRV.TERM.CURBLNK
2019-02-20 16:07:43 +00:00
ldy #S.DCB.TTY.OUTTAIL
lda (ZPDCBPtr),y
2019-02-21 06:29:41 +00:00
iny
sec
2019-02-20 16:07:43 +00:00
sbc (ZPDCBPtr),y OUTHEAD
and #$F
2018-12-11 16:41:25 +00:00
2019-02-20 16:07:43 +00:00
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
2018-12-11 16:41:25 +00:00
.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
2018-12-14 16:19:05 +00:00
DRV.TERM.OPEN ldx #0 DEV.ID in A
2018-12-11 16:41:25 +00:00
.1 ldy A2osX.SCRNDEVS,x
beq .2
inx
cpx #K.SCR.MAX
bne .1
lda #E.OOH
sec
rts
2018-12-20 16:23:43 +00:00
.9 lda #MLI.E.OPEN
2018-12-11 16:41:25 +00:00
sec
rts
2018-12-15 20:34:55 +00:00
.2 sta A2osX.SCRNDEVS,x
pha
2018-12-14 16:19:05 +00:00
jsr DRV.TERM.GetDCB
pla
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.DEVID
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.STATUS
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bit #S.DIB.S.OPENED
bne .9
ora #S.DIB.S.OPENED
ora DRV.TERM.DIB+S.DIB.S
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
jsr RESET
*--------------------------------------
DRV.TERM.CONTROL
2018-12-14 16:19:05 +00:00
jsr DRV.TERM.GetDCB
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.DEVID
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
sta A2osX.ASCREEN
2018-12-17 14:24:39 +00:00
sta SETTEXT
2018-12-14 16:19:05 +00:00
jsr DRV.TERM.SCRCPY
2018-12-17 07:02:03 +00:00
lda #0
ldy #S.DCB.TTY.bCURON
sta (ZPDCBPtr),y
ldy #S.DCB.TTY.bTITLE
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
rts
*--------------------------------------
2018-12-14 16:19:05 +00:00
DRV.TERM.CLOSE jsr DRV.TERM.GetDCB
ldy #S.DCB.TTY.STATUS
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bit #S.DIB.S.OPENED
beq .9
lda DRV.TERM.DIB+S.DIB.S
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
ldx #0
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.DEVID
2018-12-12 16:32:33 +00:00
2018-12-11 16:41:25 +00:00
.1 lda A2osX.SCRNDEVS,x
2018-12-13 16:39:24 +00:00
cmp (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bne .2
stz A2osX.SCRNDEVS,x
.2 inx
cpx #K.SCR.MAX
bne .1
clc
rts
2018-12-14 16:19:05 +00:00
.9 lda #MLI.E.IO
2018-12-11 16:41:25 +00:00
sec
rts
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.READ jsr DRV.TERM.GetIOCTLBufCntDCB
2018-12-14 16:19:05 +00:00
bit bActive is screen active?
bpl .6 no....go check flush...
2019-02-23 22:01:58 +00:00
2018-12-17 07:02:03 +00:00
jsr DRV.TERM.CURBLNK
2018-12-11 16:41:25 +00:00
2019-02-23 22:01:58 +00:00
lda OPENAPPLE
bpl .1
2018-12-17 07:02:03 +00:00
lda KBD
2018-12-11 16:41:25 +00:00
bmi .6 Open apple key, not for us...
2018-12-17 07:02:03 +00:00
jsr DRV.TERM.Title.ON
bra .6
2019-02-23 22:01:58 +00:00
.1 jsr DRV.TERM.Title.OFF
2018-12-17 07:02:03 +00:00
2018-12-11 16:41:25 +00:00
lda KBD
bpl .6
sta KBDSTROBE
and #$7F
2018-12-15 20:34:55 +00:00
2018-12-11 16:41:25 +00:00
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
2018-12-15 20:34:55 +00:00
tax
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
.4 lda KeyRemappedTbl,x
2018-12-11 16:41:25 +00:00
beq .7 end of remap....flush
jsr Char.Out.Put
2018-12-15 20:34:55 +00:00
inx
2018-12-11 16:41:25 +00:00
bra .4
2018-12-15 20:34:55 +00:00
.6 ldy #S.DCB.TTY.OUTTAIL
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-15 20:34:55 +00:00
iny
cmp (ZPDCBPtr),y OUTHEAD
2018-12-13 16:39:24 +00:00
2018-12-11 16:41:25 +00:00
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
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.WRITE jsr DRV.TERM.GetIOCTLBufCntDCB
jsr DRV.TERM.CUROFF
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
.1 inc ZPCount
bne .2
2018-12-11 16:41:25 +00:00
inc ZPCount+1
2018-12-17 07:02:03 +00:00
beq FS.8
2018-12-17 14:24:39 +00:00
.2 ldy #S.DCB.TTY.MODE
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
tax
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
jsr .3
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
inc ZPBufPtr
bne .1
inc ZPBufPtr+1
bra .1
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
.3 jmp (.4,x)
2018-12-17 07:02:03 +00:00
2018-12-12 16:32:33 +00:00
.4 .DA DRV.TERM.COUT
.DA DRV.TERM.ESC
.DA DRV.TERM.CSI
.DA DRV.TERM.IAC
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-12 16:32:33 +00:00
DRV.TERM.COUT lda (ZPBufPtr)
cmp #IAC
2018-12-11 16:41:25 +00:00
bne .1
2018-12-12 16:32:33 +00:00
2018-12-13 16:39:24 +00:00
lda #S.DCB.TTY.MODE.IAC
2018-12-17 14:24:39 +00:00
jmp DRV.TERM.SETMODE
2018-12-13 16:39:24 +00:00
2018-12-17 07:02:03 +00:00
.1 cmp #C.DEL
beq DRV.TERM.COUT.DEL
2018-12-11 16:41:25 +00:00
cmp #C.SPACE
2018-12-17 14:24:39 +00:00
bcs .8
ldx #CtrlChars.Cnt-1
2018-12-11 16:41:25 +00:00
2018-12-17 14:24:39 +00:00
.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
2018-12-13 16:39:24 +00:00
ora (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
jsr SetCharAtCurPos
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.COUT.FS
ldy #S.DCB.TTY.CH
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
cmp #79
2018-12-11 16:41:25 +00:00
bne .1
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.bLINEWRAP
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bpl FS.8
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.CH
2018-12-12 16:32:33 +00:00
lda #0
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
2018-12-11 16:41:25 +00:00
jmp LF
2018-12-12 16:32:33 +00:00
.1 inc
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
FS.8 clc
rts
*--------------------------------------
2018-12-17 07:02:03 +00:00
DRV.TERM.COUT.DEL
ldy #S.DCB.TTY.CH
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
beq .1
2018-12-12 16:32:33 +00:00
dec
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bra .3
2018-12-13 16:39:24 +00:00
.1 iny S.DCB.TTY.CV
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
beq FS.8
2018-12-12 16:32:33 +00:00
dec
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
dey
2018-12-11 16:41:25 +00:00
lda #79
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y S.DCB.TTY.CH
2018-12-11 16:41:25 +00:00
.3 lda #$20
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.bINVERSE
ora (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
jmp SetCharAtCurPos
*--------------------------------------
2018-12-17 14:24:39 +00:00
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
2018-12-11 16:41:25 +00:00
clc
rts
2018-12-17 07:02:03 +00:00
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.COUT.ESC
lda #S.DCB.TTY.MODE.ESC
2018-12-17 07:02:03 +00:00
bra DRV.TERM.SETMODE
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-12 16:32:33 +00:00
DRV.TERM.ESC lda (ZPBufPtr)
2018-12-11 16:41:25 +00:00
cmp #'['
2018-12-17 07:02:03 +00:00
bne DRV.TERM.ESC1
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
lda #S.DCB.TTY.MODE.CSI
2018-12-17 07:02:03 +00:00
DRV.TERM.SETMODE
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
ldy #S.DCB.TTY.INBUFFER
lda #S.DCB.TTY.INBUFFER
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
rts
2018-12-17 07:02:03 +00:00
DRV.TERM.ESC1 lda #0 y = #S.DCB.TTY.MODE
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
ldx #EscCodes.Cnt-1
2018-12-15 20:34:55 +00:00
lda (ZPBufPtr)
2018-12-11 16:41:25 +00:00
.2 cmp EscCodes,x
beq .3
dex
bpl .2
clc
rts
.3 txa
asl
tax
2018-12-15 20:34:55 +00:00
jmp (.4,x)
.4 .DA Scroll.Dn M
2018-12-11 16:41:25 +00:00
.DA Scroll.Up D
.DA RESET c
*--------------------------------------
2018-12-13 16:39:24 +00:00
DRV.TERM.CSI ldy #S.DCB.TTY.INBUFFER
lda (ZPDCBPtr),y
inc
sta (ZPDCBPtr),y
tay
2018-12-12 16:32:33 +00:00
lda (ZPBufPtr)
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
cmp #64 End of Seq ?
2018-12-15 20:34:55 +00:00
bcs DRV.TERM.CSI.Exec
2018-12-12 16:32:33 +00:00
2018-12-13 16:39:24 +00:00
cpy #S.DCB.TTY.INBUFFER.MAX-1 buffer full?
2018-12-12 16:32:33 +00:00
bne .8
lda #0
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.MODE
sta (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
.8 clc
2018-12-11 16:41:25 +00:00
rts
2018-12-15 20:34:55 +00:00
DRV.TERM.CSI.Exec
stz CsiParamCnt
stz bCsiInNum
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.INBUFFER EscSeq Ptr
2018-12-11 16:41:25 +00:00
.10 stz ZPTmpWord
stz ZPTmpWord+1
2018-12-13 16:39:24 +00:00
.1 iny
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
cmp #'0'
bcc .2
cmp #'9'+1
bcs .2
2018-12-15 20:34:55 +00:00
dec bCsiInNum
2018-12-11 16:41:25 +00:00
and #$0F
pha
2018-12-15 20:34:55 +00:00
2018-12-11 16:41:25 +00:00
lda ZPTmpWord
2018-12-15 20:34:55 +00:00
ldx ZPTmpWord+1
2018-12-11 16:41:25 +00:00
asl ZPTmpWord param=param*10
rol ZPTmpWord+1
asl ZPTmpWord
rol ZPTmpWord+1
2018-12-15 20:34:55 +00:00
2018-12-11 16:41:25 +00:00
clc
adc ZPTmpWord
sta ZPTmpWord
2018-12-15 20:34:55 +00:00
txa
2018-12-11 16:41:25 +00:00
adc ZPTmpWord+1
sta ZPTmpWord+1
asl ZPTmpWord
rol ZPTmpWord+1
pla
clc
adc ZPTmpWord
sta ZPTmpWord
bcc .1
inc ZPTmpWord+1
bra .1
2018-12-15 20:34:55 +00:00
.2 bit bCsiInNum
2018-12-11 16:41:25 +00:00
bpl .3
2018-12-15 20:34:55 +00:00
stz bCsiInNum
2018-12-11 16:41:25 +00:00
lda #255
2018-12-13 16:39:24 +00:00
ldx ZPTmpWord+1
2018-12-11 16:41:25 +00:00
bne .21
lda ZPTmpWord
2018-12-15 20:34:55 +00:00
.21 ldx CsiParamCnt
sta CsiParams,x
inc CsiParamCnt
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
.3 lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
cmp #';'
beq .10
2018-12-15 20:34:55 +00:00
pha
2018-12-12 16:32:33 +00:00
lda #0
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.MODE
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
pla
ldx #CsiCodes.Cnt-1
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
.4 cmp CsiCodes,x
2018-12-11 16:41:25 +00:00
beq .5
dex
bne .4
clc
rts
.5 txa
asl
tax
2018-12-15 20:34:55 +00:00
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
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-15 20:34:55 +00:00
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
2018-12-17 10:40:00 +00:00
beq Csi.Home.8
2018-12-15 20:34:55 +00:00
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
2018-12-17 10:40:00 +00:00
Csi.Home.8 clc
2018-12-15 20:34:55 +00:00
rts
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-13 16:39:24 +00:00
DRV.TERM.IAC ldy #S.DCB.TTY.INBUFFER
lda (ZPDCBPtr),y
inc
sta (ZPDCBPtr),y
tay
2018-12-12 16:32:33 +00:00
lda (ZPBufPtr)
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
cpy #S.DCB.TTY.INBUFFER+1 CMD ?
2018-12-17 10:40:00 +00:00
beq Csi.Home.8 yes, wait for additional bytes
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.INBUFFER+1
lda (ZPDCBPtr),y get back CMD
cmp #SB
2018-12-11 16:41:25 +00:00
bne .1 not a SB/SE....stop with CMD/SUBCMD
2018-12-13 16:39:24 +00:00
lda (ZPBufPtr)
2018-12-11 16:41:25 +00:00
cmp #SE
2018-12-17 10:40:00 +00:00
bne Csi.Home.8 wait for ending SE....keep bIACMode
2019-01-07 15:48:25 +00:00
bra COUT.IAC.SB
ldy #S.DCB.TTY.INBUFFER+1
lda (ZPDCBPtr),y get back CMD
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
.1 cmp #IAC
2018-12-18 14:37:07 +00:00
beq COUT.IAC.SB.9
2018-12-11 16:41:25 +00:00
sec
2019-01-07 15:48:25 +00:00
sbc #WILL
2018-12-18 14:37:07 +00:00
bcc COUT.IAC.SB.9
2018-12-11 16:41:25 +00:00
asl
tax
2019-01-07 15:48:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y Get SUBCMD in A
2018-12-11 16:41:25 +00:00
2018-12-18 14:37:07 +00:00
jmp (.8,x)
2018-12-17 10:40:00 +00:00
2019-01-07 15:48:25 +00:00
.8 .DA COUT.IAC.WILL
2018-12-11 16:41:25 +00:00
.DA COUT.IAC.WONT
.DA COUT.IAC.DO
.DA COUT.IAC.DONT
*--------------------------------------
2019-01-07 15:48:25 +00:00
COUT.IAC.SB ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y Get SUBCMD in A
cmp #TELOPT.TTYPE
2018-12-18 14:37:07 +00:00
bne COUT.IAC.SB.9
2018-12-11 16:41:25 +00:00
2019-01-07 15:48:25 +00:00
iny
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
cmp #SB.SEND
2018-12-18 14:37:07 +00:00
bne COUT.IAC.SB.9
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
ldx #0
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
.1 lda SB.IS.TTYPE,x
2018-12-11 16:41:25 +00:00
jsr Char.Out.Put
2018-12-15 20:34:55 +00:00
inx
cpx #SB.IS.TTYPE.LEN
2018-12-11 16:41:25 +00:00
bne .1
2018-12-18 14:37:07 +00:00
COUT.IAC.SB.9 bra COUT.IAC.EXIT
2018-12-11 16:41:25 +00:00
*--------------------------------------
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
2018-12-18 14:37:07 +00:00
bra COUT.IAC.EXIT
2018-12-11 16:41:25 +00:00
.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
2018-12-18 14:37:07 +00:00
bra COUT.IAC.EXIT
2018-12-11 16:41:25 +00:00
.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
2018-12-18 14:37:07 +00:00
COUT.IAC.WONT
2018-12-11 16:41:25 +00:00
COUT.IAC.DONT
2018-12-18 14:37:07 +00:00
COUT.IAC.EXIT
2018-12-12 16:32:33 +00:00
*--------------------------------------
RESET.MODE lda #0
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.MODE
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
rts
*--------------------------------------
2018-12-17 07:02:03 +00:00
RESET ldy #1
2018-12-15 20:34:55 +00:00
2018-12-17 07:02:03 +00:00
.1 iny
lda RESET.VALUES-2,y
2018-12-15 20:34:55 +00:00
sta (ZPDCBPtr),y
2018-12-17 07:02:03 +00:00
cpy #S.DCB.TTY.INBUFFER
bne .1
2018-12-15 20:34:55 +00:00
2018-12-17 07:02:03 +00:00
jmp DRV.TERM.CLRSCR
2018-12-11 16:41:25 +00:00
*--------------------------------------
RESETATTR lda #$80
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.bINVERSE
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
rts
*--------------------------------------
2018-12-15 20:34:55 +00:00
ENQ ldx #0
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
.1 lda ENQ.String,x
2018-12-11 16:41:25 +00:00
beq .8
jsr Char.Out.Put
2018-12-15 20:34:55 +00:00
inx
2018-12-11 16:41:25 +00:00
bne .1
.8 clc
rts
*--------------------------------------
2018-12-13 16:39:24 +00:00
BS ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
beq .1
2018-12-12 16:32:33 +00:00
dec
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
rts
2018-12-13 16:39:24 +00:00
.1 ldy #S.DCB.TTY.CV
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
beq .2
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
dec
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-12 07:05:29 +00:00
2018-12-12 16:32:33 +00:00
lda #79
2018-12-12 07:05:29 +00:00
dey
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-12 07:05:29 +00:00
2018-12-12 16:32:33 +00:00
.2 clc
rts
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-13 16:39:24 +00:00
LF ldy #S.DCB.TTY.CV
lda (ZPDCBPtr),y
ldy #S.DCB.TTY.SCROLLBOT
cmp (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
beq SCROLL.UP
2018-12-12 16:32:33 +00:00
inc
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.CV
sta (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
clc
rts
*--------------------------------------
2018-12-13 16:39:24 +00:00
SCROLL.UP ldy #S.DCB.TTY.SCROLLTOP
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
tax
2018-12-11 16:41:25 +00:00
2018-12-15 20:34:55 +00:00
.1 jsr DRV.TERM.SETUP.L1X
2018-12-11 16:41:25 +00:00
inx
2018-12-17 07:02:03 +00:00
jsr DRV.TERM.COPY.XtoL1
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
txa
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.SCROLLBOT
cmp (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bne .1
*--------------------------------------
CLRLINE ldy #0 Start
ldx #80 End
bra CLR
2019-03-11 15:43:33 +00:00
CLRSOL ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
tax End
2019-03-11 15:43:33 +00:00
ldy #0 Start
2019-01-16 14:37:21 +00:00
bra CLR
CLREOL ldy #S.DCB.TTY.CH
lda (ZPDCBPtr),y
tay Start
ldx #80 End
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
CLR stx .3+1 Save End
2018-12-11 16:41:25 +00:00
phy
2018-12-12 16:32:33 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.CV
lda (ZPDCBPtr),y
2018-12-12 16:32:33 +00:00
tax
ply
.1 phy
lda #" "
2018-12-11 16:41:25 +00:00
jsr SetCharAtYX X unmodified
2018-12-12 16:32:33 +00:00
2018-12-11 16:41:25 +00:00
ply
iny
2018-12-12 16:32:33 +00:00
.3 cpy #$ff Self Modified
2018-12-11 16:41:25 +00:00
bne .1
clc
rts
*--------------------------------------
2018-12-13 16:39:24 +00:00
SCROLL.DN ldy #S.DCB.TTY.SCROLLBOT
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
tax
2018-12-15 20:34:55 +00:00
.1 jsr DRV.TERM.SETUP.L1X
2018-12-11 16:41:25 +00:00
dex
2018-12-17 07:02:03 +00:00
jsr DRV.TERM.COPY.XtoL1
2018-12-11 16:41:25 +00:00
2018-12-12 16:32:33 +00:00
txa
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.SCROLLTOP
cmp (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
bne .1
clc
rts
*--------------------------------------
2018-12-17 07:02:03 +00:00
DRV.TERM.CURBLNK
bit bActive
2019-02-23 22:01:58 +00:00
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
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.bCURON
2019-02-23 22:01:58 +00:00
lda (ZPDCBPtr),y
beq DRV.TERM.CURBLNK.RTS
DRV.TERM.CURBLNK.1
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-17 07:02:03 +00:00
bne DRV.TERM.CURBLNK.OFF
2018-12-11 16:41:25 +00:00
jsr GetCharAtCurPos
and #$80
eor #" "
2018-12-17 07:02:03 +00:00
bra DRV.TERM.CURBLNK.SET
2018-12-11 16:41:25 +00:00
2018-12-17 07:02:03 +00:00
DRV.TERM.CURBLNK.OFF
2018-12-17 10:40:00 +00:00
jsr GetCharAtCurPos
2018-12-11 16:41:25 +00:00
2018-12-17 07:02:03 +00:00
DRV.TERM.CURBLNK.SET
2018-12-17 10:40:00 +00:00
jsr SetCharAtCurPos.SCR
2018-12-11 16:41:25 +00:00
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.bCURON
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
eor #CURSOR.BLINK.SPEED
2018-12-13 16:39:24 +00:00
sta (ZPDCBPtr),y
2018-12-17 07:02:03 +00:00
DRV.TERM.CURBLNK.RTS
rts
2018-12-11 16:41:25 +00:00
*--------------------------------------
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
2018-12-13 16:39:24 +00:00
2018-12-15 20:34:55 +00:00
Char.Out.Put pha save char
2018-12-13 16:39:24 +00:00
ldy #S.DCB.TTY.OUTHEAD
lda (ZPDCBPtr),y
2018-12-15 20:34:55 +00:00
pha save actual HEAD
2018-12-13 16:39:24 +00:00
inc
cmp #S.DCB.TTY.OUTBUFFER.MAX
bne .1
lda #S.DCB.TTY.OUTBUFFER
2018-12-15 20:34:55 +00:00
.1 dey OUTTAIL
2018-12-13 16:39:24 +00:00
2018-12-15 20:34:55 +00:00
cmp (ZPDCBPtr),y HEAD+1 = TAIL ?
2018-12-13 16:39:24 +00:00
beq .9 CS, full!
iny
sta (ZPDCBPtr),y new head
ply old head
pla
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
clc
2018-12-13 16:39:24 +00:00
rts
.9 pla
2018-12-11 16:41:25 +00:00
pla
rts
*--------------------------------------
2018-12-15 20:34:55 +00:00
Char.Out.Get ldy #S.DCB.TTY.OUTTAIL
2018-12-13 16:39:24 +00:00
lda (ZPDCBPtr),y
2018-12-15 20:34:55 +00:00
iny OUTHEAD
2018-12-13 16:39:24 +00:00
cmp (ZPDCBPtr),y
beq .9 CS
tay
lda (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
pha
2018-12-13 16:39:24 +00:00
tya
2018-12-11 16:41:25 +00:00
inc
2018-12-13 16:39:24 +00:00
cmp #S.DCB.TTY.OUTBUFFER.MAX
bne .1
lda #S.DCB.TTY.OUTBUFFER
.1 ldy #S.DCB.TTY.OUTTAIL
sta (ZPDCBPtr),y
2018-12-11 16:41:25 +00:00
pla
clc
2018-12-13 16:39:24 +00:00
2018-12-11 16:41:25 +00:00
.9 rts
*--------------------------------------
2018-12-17 14:24:39 +00:00
DRV.TERM.GetIOCTLBufCntDCB
2018-12-17 07:02:03 +00:00
>STYA ZPIOCTL
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
iny #S.IOCTL.BYTECNT
2018-12-11 16:41:25 +00:00
lda (ZPIOCTL),y
eor #$ff
sta ZPCount
iny
lda (ZPIOCTL),y
eor #$ff
sta ZPCount+1
2018-12-17 14:24:39 +00:00
*--------------------------------------
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
2018-12-14 16:19:05 +00:00
2018-12-17 14:24:39 +00:00
clc
.1 ror bActive
2018-12-11 16:41:25 +00:00
rts
2018-12-17 07:02:03 +00:00
*--------------------------------------
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
2019-02-27 15:00:56 +00:00
lda Dev.Table-1,x
2019-01-13 13:10:14 +00:00
clc
adc #S.FD.DEV
tay
2019-02-27 15:00:56 +00:00
lda Dev.Table,x
2019-01-13 13:10:14 +00:00
adc /S.FD.DEV
2018-12-17 07:02:03 +00:00
>STYA ZPTmpWord
ldx #0
jsr DRV.TERM.SETUP.L1X.SCR
2018-12-14 07:32:20 +00:00
2018-12-17 07:02:03 +00:00
ldy #0
.1 lda (ZPTmpWord),y
beq .2
2018-12-17 14:24:39 +00:00
phy
2018-12-17 07:02:03 +00:00
jsr SetCharAtY.SCR
ply
2018-12-14 07:32:20 +00:00
iny
2018-12-17 07:02:03 +00:00
bne .1
2018-12-14 07:32:20 +00:00
2018-12-17 07:02:03 +00:00
.2 lda #C.SPACE
2018-12-14 07:32:20 +00:00
2018-12-17 07:02:03 +00:00
.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
2018-12-11 16:41:25 +00:00
*--------------------------------------
2018-12-17 14:24:39 +00:00
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
*--------------------------------------
2018-12-17 10:40:00 +00:00
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
*--------------------------------------
2018-12-11 16:41:25 +00:00
CtrlChars .HS 05080A0C0D151B
CtrlChars.Cnt .EQ *-CtrlChars
*--------------------------------------
EscCodes .AZ "MDc"
EscCodes.Cnt .EQ *-EscCodes
2018-12-15 20:34:55 +00:00
CsiCodes .AS "hlmnrKH"
CsiCodes.Cnt .EQ *-CsiCodes
2018-12-11 16:41:25 +00:00
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