Kernel 0.92

This commit is contained in:
Rémy GIBERT 2018-12-13 17:39:24 +01:00
parent 883cbc6f55
commit 15942f7f07
10 changed files with 346 additions and 269 deletions

View File

@ -144,6 +144,7 @@ FD.DEV .DA #S.FD.T.CDEV
.DA #0 DEVID .DA #0 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.BS 2 DRVPTR .BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.DEV.NAME .AZ "ETH7" FD.DEV.NAME .AZ "ETH7"
*-------------------------------------- *--------------------------------------

View File

@ -163,6 +163,7 @@ FD.DEV .DA #S.FD.T.CDEV
.DA #0 DEVID .DA #0 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.BS 2 DRVPTR .BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.DEV.NAME .AZ "ETH7" FD.DEV.NAME .AZ "ETH7"
*-------------------------------------- *--------------------------------------

View File

@ -188,6 +188,7 @@ FD.DEV .DA #S.FD.T.CDEV
.DA #0 DEVID .DA #0 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.BS 2 DRVPTR .BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.DEV.NAME .AZ "COM1" FD.DEV.NAME .AZ "COM1"
*-------------------------------------- *--------------------------------------

View File

@ -168,6 +168,7 @@ FD.DEV .DA #S.FD.T.CDEV
.DA #0 DEVID .DA #0 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.BS 2 DRVPTR .BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.DEV.NAME .AZ "ETH7" FD.DEV.NAME .AZ "ETH7"
*-------------------------------------- *--------------------------------------

View File

@ -431,9 +431,10 @@ S.FD.DEV.BUSID .EQ 2
S.FD.DEV.DEVID .EQ 3 S.FD.DEV.DEVID .EQ 3
S.FD.DEV.BUSPTR .EQ 4 word S.FD.DEV.BUSPTR .EQ 4 word
S.FD.DEV.DRVPTR .EQ 6 word S.FD.DEV.DRVPTR .EQ 6 word
S.FD.DEV.BUFPTR .EQ 8 word S.FD.DEV.DCBPTR .EQ 8 word
S.FD.DEV.BUFPTR .EQ 10 word
* *
S.FD.DEV .EQ 10 S.FD.DEV .EQ 12
*-------------------------------------- *--------------------------------------
* S.FD.LNK * S.FD.LNK
*-------------------------------------- *--------------------------------------

View File

@ -140,25 +140,32 @@ H.BIN.EXE.REL.TABLE .EQ 16
* *
H.BIN.DRV.REL.TABLE .EQ 2 Including main jmp H.BIN.DRV.REL.TABLE .EQ 2 Including main jmp
*-------------------------------------- *--------------------------------------
S.TTY.DEVID .EQ 0 S.DCB.TTY.DEVID .EQ 0
S.TTY.STATUS .EQ 1 S.DCB.TTY.STATUS .EQ 1
S.TTY.MODE .EQ 2 S.DCB.TTY.MODE .EQ 2
S.TTY.MODE.ESC .EQ 2 S.DCB.TTY.MODE.ESC .EQ 2
S.TTY.MODE.CSI .EQ 4 S.DCB.TTY.MODE.CSI .EQ 4
S.TTY.MODE.IAC .EQ 6 S.DCB.TTY.MODE.IAC .EQ 6
S.TTY.CH .EQ 3 S.DCB.TTY.CH .EQ 3
S.TTY.CV .EQ 4 S.DCB.TTY.CV .EQ 4
S.TTY.SCROLLTOP .EQ 5 S.DCB.TTY.SCROLLTOP .EQ 5
S.TTY.SCROLLBOT .EQ 6 S.DCB.TTY.SCROLLBOT .EQ 6
S.TTY.bCURON .EQ 7 S.DCB.TTY.bCURON .EQ 7
S.TTY.CURCHAR .EQ 8 S.DCB.TTY.CURCHAR .EQ 8
S.TTY.bINVERSE .EQ 9 S.DCB.TTY.bINVERSE .EQ 9
S.TTY.bLINEWRAP .EQ 10 S.DCB.TTY.bLINEWRAP .EQ 10
S.TTY.TITLE .EQ 48 S.DCB.TTY.OUTTAIL .EQ 14
S.TTY.SCRBUF .EQ 128 24x80=1920 bytes S.DCB.TTY.OUTHEAD .EQ 15
S.DCB.TTY.INBUFFER .EQ 16
S.DCB.TTY.INBUFFER.MAX .EQ 40
S.DCB.TTY.OUTBUFFER .EQ 40
S.DCB.TTY.OUTBUFFER.MAX .EQ 64
* *
S.TTY .EQ 2048 S.DCB.TTY .EQ 64
*--------------------------------------
S.TTYBUF.TITLE .EQ 48
S.TTYBUF.SCRBUF .EQ 128 24x80=1920 bytes
*-------------------------------------- *--------------------------------------
MAN MAN
SAVE USR/SRC/SYS/KERNEL.S.DEF SAVE USR/SRC/SYS/KERNEL.S.DEF

View File

@ -151,6 +151,7 @@ K.MKDev jsr MEM.SPtr1PPtr2 ptr1=fd, ptr2=name
.8 >LDYA ZPPtr2 .8 >LDYA ZPPtr2
jsr K.NewStr jsr K.NewStr
bcs .99 bcs .99
>DEBUG
txa txa
ldx DevMgr.DevCnt ldx DevMgr.DevCnt

View File

@ -108,7 +108,7 @@ Kernel.Init3 sta SETALTZP
>SYSCALL MKDev >SYSCALL MKDev
jsr SysScrInit jsr SysScrInit
bcs *
jsr PS0.Init jsr PS0.Init
bcs * bcs *
@ -243,7 +243,7 @@ MemMgrInit >LDYAI Mem.MHiMem
>STYA Mem.LoMem >STYA Mem.LoMem
stz Mem.LastSlot Reserve Slot #0 stz Mem.LastSlot Reserve Slot #0
* reserve AUXmem for TTY Frame bufers * reserve AUXmem for TTY Frame buffers
lda A2osX.TTYDEVS lda A2osX.TTYDEVS
inc +1 for /DEV/CONSOLE inc +1 for /DEV/CONSOLE
@ -303,9 +303,12 @@ MemMgrInit >LDYAI Mem.MHiMem
rts rts
*-------------------------------------- *--------------------------------------
SysScrInit >PUSHWI FD.CONSOLE.NAME SysScrInit jsr SysScrInit.EnvBuf
>LDYAI FD.CONSOLE
>PUSHWI FD.CONSOLE.NAME
>LDYAI FD.TTY
>SYSCALL MKDev >SYSCALL MKDev
bcs .9
lda A2osX.TTYDEVS lda A2osX.TTYDEVS
@ -316,6 +319,9 @@ SysScrInit >PUSHWI FD.CONSOLE.NAME
sec sec
sbc /2048 sbc /2048
sta FD.TTY+S.FD.DEV.BUFPTR+1 sta FD.TTY+S.FD.DEV.BUFPTR+1
jsr SysScrInit.EnvBuf
>PUSHWI FD.TTY.NAME >PUSHWI FD.TTY.NAME
>LDYAI FD.TTY >LDYAI FD.TTY
>SYSCALL MKDev >SYSCALL MKDev
@ -324,6 +330,8 @@ SysScrInit >PUSHWI FD.CONSOLE.NAME
dec dec
bne .1 bne .1
clc
.9 rts
SysScrInit.OLD ldx #0 SysScrInit.OLD ldx #0
@ -373,6 +381,21 @@ SysScrInit.OLD ldx #0
bne .4 bne .4
rts rts
*-------------------------------------- *--------------------------------------
SysScrInit.EnvBuf
clc
lda DevMgr.Free
sta FD.TTY+S.FD.DEV.DCBPTR
adc #S.DCB.TTY
sta DevMgr.Free
lda DevMgr.Free+1
sta FD.TTY+S.FD.DEV.DCBPTR+1
adc /S.DCB.TTY
sta DevMgr.Free+1
rts
*--------------------------------------
PS0.Init >LDYAI CORE.S.PS0 Select Process 0 (Kernel) PS0.Init >LDYAI CORE.S.PS0 Select Process 0 (Kernel)
>STYA pPs >STYA pPs
@ -1138,25 +1161,20 @@ FD.NULL .DA #S.FD.T.CDEV
.DA #0 DEVID .DA #0 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.DA DRV.NULL .DA DRV.NULL
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.NULL.NAME .AZ "NULL" NAME FD.NULL.NAME .AZ "NULL" NAME
*-------------------------------------- *--------------------------------------
FD.CONSOLE .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #1 DEVID
.DA 0 BUSPTR
.DA DRV.SYS
.DA $B800 BUFPTR
FD.CONSOLE.NAME .AZ "CONSOLE"
*--------------------------------------
FD.TTY .DA #S.FD.T.CDEV FD.TTY .DA #S.FD.T.CDEV
.DA #0 HANDLER .DA #0 HANDLER
.DA #0 BUSID .DA #0 BUSID
.DA #1 DEVID .DA #1 DEVID
.DA 0 BUSPTR .DA 0 BUSPTR
.DA DRV.SYS .DA DRV.TERM
.BS 2 DCBPTR
.DA $B800 BUFPTR .DA $B800 BUFPTR
*--------------------------------------
FD.CONSOLE.NAME .AZ "CONSOLE"
FD.TTY.NAME .AZ "TTY0" FD.TTY.NAME .AZ "TTY0"
*-------------------------------------- *--------------------------------------
FD.BDEV .DA #S.FD.T.BDEV FD.BDEV .DA #S.FD.T.BDEV
@ -1165,6 +1183,7 @@ FD.BDEV .DA #S.FD.T.BDEV
.DA #0 DEVID .DA #0 DEVID
.BS 2 BUSPTR .BS 2 BUSPTR
.BS 2 DRVPTR .BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR .DA 0 BUFPTR
FD.BDEV.NAME .AZ "S1D1" FD.BDEV.NAME .AZ "S1D1"
*-------------------------------------- *--------------------------------------

View File

@ -3,11 +3,9 @@ PREFIX
AUTO 4,1 AUTO 4,1
*-------------------------------------- *--------------------------------------
CURSOR.BLINK.SPEED .EQ 2 CURSOR.BLINK.SPEED .EQ 2
INBUF.MAXLEN .EQ 32
OUTBUF.MAXLEN .EQ 32
*-------------------------------------- *--------------------------------------
ZPIOCTL .EQ ZPDRV ZPIOCTL .EQ ZPDRV
ZPTTYEnvPtr .EQ ZPDRV+2 ZPDCBPtr .EQ ZPDRV+2
ZPTTYBufPtr .EQ ZPDRV+4 ZPTTYBufPtr .EQ ZPDRV+4
ZPBufPtr .EQ ZPDRV+10 ZPBufPtr .EQ ZPDRV+10
ZPCount .EQ ZPDRV+12 ZPCount .EQ ZPDRV+12
@ -23,13 +21,13 @@ DRV.TERM cld
ldy #S.FD.DEV.BUFPTR ldy #S.FD.DEV.BUFPTR
lda (pFD),y lda (pFD),y
sta ZPTTYEnvPtr sta ZPDCBPtr
iny iny
lda (pFD),y lda (pFD),y
sta ZPTTYEnvPtr+1 sta ZPDCBPtr+1
ldy #S.TTY.DEVID ldy #S.DCB.TTY.DEVID
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
cmp A2osX.ASCREEN cmp A2osX.ASCREEN
beq .1 CS beq .1 CS
@ -71,8 +69,8 @@ DRV.TERM.STATUS ldy #S.IOCTL.BUFPTR
dey dey
bne .2 bne .2
ldy #S.TTY.STATUS ldy #S.DCB.TTY.STATUS
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
clc clc
rts rts
@ -99,20 +97,17 @@ DRV.TERM.OPEN ldx #0
rts rts
.2 sta A2osX.SCRNDEVS,x DEV.ID in A .2 sta A2osX.SCRNDEVS,x DEV.ID in A
ldy #S.TTY.DEVID ldy #S.DCB.TTY.DEVID
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
ldy #S.TTY.STATUS ldy #S.DCB.TTY.STATUS
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
bit #S.DIB.S.OPENED bit #S.DIB.S.OPENED
bne .9 bne .9
ora #S.DIB.S.OPENED ora #S.DIB.S.OPENED
ora DRV.TERM.DIB+S.DIB.S ora DRV.TERM.DIB+S.DIB.S
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
stz OutPtr
stz OutCnt
jsr RESET jsr RESET
*-------------------------------------- *--------------------------------------
@ -122,26 +117,26 @@ DRV.TERM.CONTROL
sta SET80DISP sta SET80DISP
sta CLR80STORE sta CLR80STORE
sta CLRPAGE2 sta CLRPAGE2
ldy #S.TTY.DEVID ldy #S.DCB.TTY.DEVID
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
sta A2osX.ASCREEN sta A2osX.ASCREEN
clc clc
rts rts
*-------------------------------------- *--------------------------------------
DRV.TERM.CLOSE ldy #S.TTY.STATUS DRV.TERM.CLOSE ldy #S.DCB.TTY.STATUS
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
bit #S.DIB.S.OPENED bit #S.DIB.S.OPENED
beq .9 beq .9
lda DRV.TERM.DIB+S.DIB.S lda DRV.TERM.DIB+S.DIB.S
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
ldx #0 ldx #0
ldy #S.TTY.DEVID ldy #S.DCB.TTY.DEVID
.1 lda A2osX.SCRNDEVS,x .1 lda A2osX.SCRNDEVS,x
cmp (ZPTTYEnvPtr),y cmp (ZPDCBPtr),y
bne .2 bne .2
stz A2osX.SCRNDEVS,x stz A2osX.SCRNDEVS,x
@ -162,8 +157,8 @@ DRV.TERM.READ bit bActive is screen active?
lda A2osX.TIMER16 lda A2osX.TIMER16
and #CURSOR.BLINK.SPEED and #CURSOR.BLINK.SPEED
ldy #S.TTY.bCURON ldy #S.DCB.TTY.bCURON
eor (ZPTTYEnvPtr),y eor (ZPDCBPtr),y
beq .1 beq .1
jsr CURBLNK jsr CURBLNK
@ -194,7 +189,11 @@ DRV.TERM.READ bit bActive is screen active?
iny iny
bra .4 bra .4
.6 lda OutCnt .6 ldy #S.DCB.TTY.OUTHEAD
lda (ZPDCBPtr),y
dey OUTTAIL
cmp (ZPDCBPtr),y
beq .9 no char in output buffer... beq .9 no char in output buffer...
.7 stz .8+1 .7 stz .8+1
@ -235,8 +234,8 @@ DRV.TERM.WRITE jsr GetPtrsAndCnt
inc ZPCount+1 inc ZPCount+1
beq .8 beq .8
.2 ldy #S.TTY.MODE .2 ldy #S.DCB.TTY.MODE
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
jsr .3 jsr .3
@ -260,9 +259,12 @@ DRV.TERM.COUT lda (ZPBufPtr)
cmp #IAC cmp #IAC
bne .1 bne .1
lda #S.TTY.MODE.IAC lda #S.DCB.TTY.MODE.IAC
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
stz InBuffer
ldy #S.DCB.TTY.INBUFFER
lda #S.DCB.TTY.INBUFFER
sta (ZPDCBPtr),y
clc clc
rts rts
@ -274,52 +276,52 @@ DRV.TERM.COUT lda (ZPBufPtr)
cmp #C.SPACE cmp #C.SPACE
bcc COUT.Ctrl bcc COUT.Ctrl
ldy #S.TTY.bINVERSE ldy #S.DCB.TTY.bINVERSE
ora (ZPTTYEnvPtr),y ora (ZPDCBPtr),y
jsr SetCharAtCurPos jsr SetCharAtCurPos
*-------------------------------------- *--------------------------------------
FS ldy #S.TTY.CH FS ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
cmp #79 cmp #79
bne .1 bne .1
ldy #S.TTY.bLINEWRAP ldy #S.DCB.TTY.bLINEWRAP
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
bpl FS.8 bpl FS.8
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
lda #0 lda #0
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
jmp LF jmp LF
.1 inc .1 inc
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
FS.8 clc FS.8 clc
rts rts
*-------------------------------------- *--------------------------------------
DEL ldy #S.TTY.CH DEL ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
beq .1 beq .1
dec dec
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
bra .3 bra .3
.1 iny S.TTY.CV .1 iny S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
beq FS.8 beq FS.8
dec dec
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
dey dey
lda #79 lda #79
sta (ZPTTYEnvPtr),y S.TTY.CH sta (ZPDCBPtr),y S.DCB.TTY.CH
.3 lda #$20 .3 lda #$20
ldy #S.TTY.bINVERSE ldy #S.DCB.TTY.bINVERSE
ora (ZPTTYEnvPtr),y ora (ZPDCBPtr),y
jmp SetCharAtCurPos jmp SetCharAtCurPos
*-------------------------------------- *--------------------------------------
COUT.Ctrl ldx #CtrlChars.Cnt-1 COUT.Ctrl ldx #CtrlChars.Cnt-1
@ -341,14 +343,16 @@ DRV.TERM.ESC lda (ZPBufPtr)
cmp #'[' cmp #'['
bne .1 bne .1
lda #S.TTY.MODE.CSI lda #S.DCB.TTY.MODE.CSI
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
stz InBuffer ldy #S.DCB.TTY.INBUFFER
lda #S.DCB.TTY.INBUFFER
sta (ZPDCBPtr),y
clc clc
rts rts
.1 lda #0 .1 lda #0
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
ldx #EscCodes.Cnt-1 ldx #EscCodes.Cnt-1
@ -369,19 +373,23 @@ J.EscCodes .DA Scroll.Dn M
.DA Scroll.Up D .DA Scroll.Up D
.DA RESET c .DA RESET c
*-------------------------------------- *--------------------------------------
DRV.TERM.CSI inc InBuffer DRV.TERM.CSI ldy #S.DCB.TTY.INBUFFER
ldx InBuffer lda (ZPDCBPtr),y
inc
sta (ZPDCBPtr),y
tay
lda (ZPBufPtr) lda (ZPBufPtr)
sta InBuffer,x sta (ZPDCBPtr),y
cmp #64 End of Seq ? cmp #64 End of Seq ?
bcs COUT.ExecEscSeq bcs COUT.ExecEscSeq
cpx #INBUF.MAXLEN too long? cpy #S.DCB.TTY.INBUFFER.MAX-1 buffer full?
bne .8 bne .8
lda #0 lda #0
sta (ZPTTYEnvPtr),y ldy #S.DCB.TTY.MODE
sta (ZPDCBPtr),y
.8 clc .8 clc
rts rts
@ -389,13 +397,15 @@ DRV.TERM.CSI inc InBuffer
COUT.ExecEscSeq stz EscSeqParamCnt COUT.ExecEscSeq stz EscSeqParamCnt
stz bEscSeqInNum stz bEscSeqInNum
ldx #0 EscSeq Ptr ldy #S.DCB.TTY.INBUFFER EscSeq Ptr
lda (ZPDCBPtr),y
tay
.10 stz ZPTmpWord .10 stz ZPTmpWord
stz ZPTmpWord+1 stz ZPTmpWord+1
.1 inx .1 iny
lda InBuffer,x lda (ZPDCBPtr),y
cmp #'0' cmp #'0'
bcc .2 bcc .2
@ -433,21 +443,21 @@ COUT.ExecEscSeq stz EscSeqParamCnt
stz bEscSeqInNum stz bEscSeqInNum
lda #255 lda #255
ldy ZPTmpWord+1 ldx ZPTmpWord+1
bne .21 bne .21
lda ZPTmpWord lda ZPTmpWord
.21 ldy EscSeqParamCnt .21 ldx EscSeqParamCnt
sta EscSeqParam,y sta EscSeqParam,x
inc EscSeqParamCnt inc EscSeqParamCnt
.3 lda InBuffer,x .3 lda (ZPDCBPtr),y
cmp #';' cmp #';'
beq .10 beq .10
lda #0 lda #0
ldy #S.TTY.MODE ldy #S.DCB.TTY.MODE
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
ldx #EscSeqCmds.Cnt-1 ldx #EscSeqCmds.Cnt-1
@ -472,34 +482,37 @@ J.EscSequences .DA Esc.LWEnable h
.DA Esc.Erase K .DA Esc.Erase K
.DA Esc.Home H .DA Esc.Home H
*-------------------------------------- *--------------------------------------
DRV.TERM.IAC inc InBuffer DRV.TERM.IAC ldy #S.DCB.TTY.INBUFFER
ldx InBuffer lda (ZPDCBPtr),y
cpx #INBUF.MAXLEN inc
beq * sta (ZPDCBPtr),y
tay
lda (ZPBufPtr) lda (ZPBufPtr)
sta InBuffer,x sta (ZPDCBPtr),y
cpx #1 CMD ? cpy #S.DCB.TTY.INBUFFER+1 CMD ?
beq .8 yes, wait for additional bytes beq .8 yes, wait for additional bytes
ldy InBuffer+1 get back CMD ldy #S.DCB.TTY.INBUFFER+1
cpy #SB lda (ZPDCBPtr),y get back CMD
cmp #SB
bne .1 not a SB/SE....stop with CMD/SUBCMD bne .1 not a SB/SE....stop with CMD/SUBCMD
lda (ZPBufPtr)
cmp #SE cmp #SE
bne .8 wait for ending SE....keep bIACMode bne .8 wait for ending SE....keep bIACMode
.1 cpy #IAC .1 cmp #IAC
beq .9 beq .9
tya
sec sec
sbc #SB sbc #SB
bcc .9 bcc .9
asl asl
tax tax
lda InBuffer+2 Get SUBCMD in A ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y Get SUBCMD in A
cpx #10 cpx #10
bcs * bcs *
@ -520,7 +533,8 @@ J.COUT.IAC.CMDS .DA COUT.IAC.SB
COUT.IAC.SB cmp #TELOPT.TTYPE COUT.IAC.SB cmp #TELOPT.TTYPE
bne .9 bne .9
lda InBuffer+3 ldy #S.DCB.TTY.INBUFFER+2
lda (ZPDCBPtr),y
cmp #SB.SEND cmp #SB.SEND
bne .9 bne .9
@ -601,33 +615,38 @@ COUT.IAC.DONT
*-------------------------------------- *--------------------------------------
RESET.MODE lda #0 RESET.MODE lda #0
ldy #S.TTY.MODE ldy #S.DCB.TTY.MODE
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
*-------------------------------------- *--------------------------------------
RESET jsr RESET.MODE RESET jsr RESET.MODE
ldy #S.TTY.bCURON ldy #S.DCB.TTY.OUTTAIL
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
iny
sta (ZPDCBPtr),y
ldy #S.DCB.TTY.bCURON
sta (ZPDCBPtr),y
dec dec
ldy #S.TTY.bLINEWRAP ldy #S.DCB.TTY.bLINEWRAP
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
lda #0 lda #0
ldy #S.TTY.SCROLLTOP ldy #S.DCB.TTY.SCROLLTOP
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
iny iny
lda #23 lda #23
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
jsr CLRSCR jsr CLRSCR
*-------------------------------------- *--------------------------------------
RESETATTR lda #$80 RESETATTR lda #$80
ldy #S.TTY.bINVERSE ldy #S.DCB.TTY.bINVERSE
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
*-------------------------------------- *--------------------------------------
@ -650,57 +669,57 @@ ENQ ldy #0
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
BS ldy #S.TTY.CH BS ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
beq .1 beq .1
dec dec
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
.1 ldy #S.TTY.CV .1 ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
beq .2 beq .2
dec dec
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
lda #79 lda #79
dey dey
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
.2 clc .2 clc
rts rts
*-------------------------------------- *--------------------------------------
CROUT lda #0 CROUT lda #0
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
*-------------------------------------- *--------------------------------------
LF ldy #S.TTY.CV LF ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
ldy #S.TTY.SCROLLBOT ldy #S.DCB.TTY.SCROLLBOT
cmp (ZPTTYEnvPtr),y cmp (ZPDCBPtr),y
beq SCROLL.UP beq SCROLL.UP
inc inc
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
*-------------------------------------- *--------------------------------------
ESC lda #S.TTY.MODE.ESC ESC lda #S.DCB.TTY.MODE.ESC
ldy #S.TTY.MODE ldy #S.DCB.TTY.MODE
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
*-------------------------------------- *--------------------------------------
SCROLL.UP ldy #S.TTY.SCROLLTOP SCROLL.UP ldy #S.DCB.TTY.SCROLLTOP
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
@ -711,12 +730,12 @@ SCROLL.UP ldy #S.TTY.SCROLLTOP
jsr COPY.XtoL1 jsr COPY.XtoL1
txa txa
ldy #S.TTY.SCROLLBOT ldy #S.DCB.TTY.SCROLLBOT
cmp (ZPTTYEnvPtr),y cmp (ZPDCBPtr),y
bne .1 bne .1
*-------------------------------------- *--------------------------------------
CLREOL ldy #S.TTY.CH CLREOL ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tay Start tay Start
ldx #80 End ldx #80 End
bra CLR bra CLR
@ -726,15 +745,15 @@ CLRLINE ldy #0 Start
bra CLR bra CLR
CLRSOL ldy #0 CLRSOL ldy #0
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y Start lda (ZPDCBPtr),y Start
tax End tax End
CLR stx .3+1 Save End CLR stx .3+1 Save End
phy phy
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
ply ply
@ -752,8 +771,8 @@ CLR stx .3+1 Save End
clc clc
rts rts
*-------------------------------------- *--------------------------------------
SCROLL.DN ldy #S.TTY.SCROLLBOT SCROLL.DN ldy #S.DCB.TTY.SCROLLBOT
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
@ -764,8 +783,8 @@ SCROLL.DN ldy #S.TTY.SCROLLBOT
jsr COPY.XtoL1 jsr COPY.XtoL1
txa txa
ldy #S.TTY.SCROLLTOP ldy #S.DCB.TTY.SCROLLTOP
cmp (ZPTTYEnvPtr),y cmp (ZPDCBPtr),y
bne .1 bne .1
clc clc
@ -785,8 +804,8 @@ Esc.LWDisable clc
bne .8 bne .8
ror ror
ldy #S.TTY.bLINEWRAP ldy #S.DCB.TTY.bLINEWRAP
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
.8 clc .8 clc
rts rts
@ -802,8 +821,8 @@ Esc.DispAttr ldx EscSeqParamCnt
.2 eor #7 .2 eor #7
bne .8 bne .8
ldy #S.TTY.bINVERSE ldy #S.DCB.TTY.bINVERSE
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
.7 dex .7 dex
bne .1 bne .1
@ -826,16 +845,16 @@ Esc.Query ldx EscSeqParamCnt
lda #'[' lda #'['
jsr Char.Out.Put jsr Char.Out.Put
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
inc inc
jsr Decimal.Out jsr Decimal.Out
lda #';' lda #';'
jsr Char.Out.Put jsr Char.Out.Put
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
inc inc
jsr Decimal.Out jsr Decimal.Out
@ -860,11 +879,11 @@ Esc.Scroll ldy EscSeqParamCnt
ldx EscSeqParam+1 ldx EscSeqParam+1
dex dex
.8 ldy #S.TTY.SCROLLTOP .8 ldy #S.DCB.TTY.SCROLLTOP
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
iny S.TTY.SCROLLBOT iny S.DCB.TTY.SCROLLBOT
txa txa
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
.9 clc .9 clc
rts rts
@ -889,10 +908,10 @@ Esc.Erase ldx EscSeqParamCnt
Esc.Home lda EscSeqParamCnt Esc.Home lda EscSeqParamCnt
bne .1 bne .1
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
iny iny
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
clc clc
rts rts
@ -908,8 +927,8 @@ Esc.Home lda EscSeqParamCnt
.2 dex .2 dex
txa txa
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
dec EscSeqParamCnt dec EscSeqParamCnt
beq .8 beq .8
@ -927,45 +946,45 @@ Esc.Home lda EscSeqParamCnt
.3 dex .3 dex
txa txa
ldy #S.TTY.CH ldy #S.DCB.TTY.CH
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
CUROFF ldy #S.TTY.bCURON CUROFF ldy #S.DCB.TTY.bCURON
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
beq CUREXIT.RTS beq CUREXIT.RTS
CURBLNK bit bActive CURBLNK bit bActive
bpl CURBLNK1 bpl CURBLNK1
ldy #S.TTY.bCURON ldy #S.DCB.TTY.bCURON
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
bne CURBLNK.OFF bne CURBLNK.OFF
rts do not Light if screen is not active rts do not Light if screen is not active
CURBLNK1 ldy #S.TTY.bCURON CURBLNK1 ldy #S.DCB.TTY.bCURON
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
bne CURBLNK.OFF bne CURBLNK.OFF
jsr GetCharAtCurPos jsr GetCharAtCurPos
ldy #S.TTY.CURCHAR ldy #S.DCB.TTY.CURCHAR
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
and #$80 and #$80
eor #" " eor #" "
bra CUREXIT bra CUREXIT
CURBLNK.OFF ldy #S.TTY.CURCHAR CURBLNK.OFF ldy #S.DCB.TTY.CURCHAR
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
CUREXIT jsr SetCharAtCurPos CUREXIT jsr SetCharAtCurPos
ldy #S.TTY.bCURON ldy #S.DCB.TTY.bCURON
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
eor #CURSOR.BLINK.SPEED eor #CURSOR.BLINK.SPEED
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
CUREXIT.RTS rts CUREXIT.RTS rts
*-------------------------------------- *--------------------------------------
Decimal.Out stz ZPTmpWord Decimal.Out stz ZPTmpWord
@ -1016,30 +1035,61 @@ Decimal.Out stz ZPTmpWord
and #$0f and #$0f
*-------------------------------------- *--------------------------------------
Char.Out.Put30 ora #$30 Char.Out.Put30 ora #$30
Char.Out.Put pha Char.Out.Put pha
lda OutPtr
clc ldy #S.DCB.TTY.OUTHEAD
adc OutCnt lda (ZPDCBPtr),y
and #OUTBUF.MAXLEN-1
tax pha
inc
cmp #S.DCB.TTY.OUTBUFFER.MAX
bne .1
lda #S.DCB.TTY.OUTBUFFER
.1 dey
cmp (ZPDCBPtr),y
beq .9 CS, full!
iny
sta (ZPDCBPtr),y new head
ply old head
pla
sta (ZPDCBPtr),y
clc
rts
.9 pla
pla pla
sta OutBuffer,x
inc OutCnt
rts rts
*-------------------------------------- *--------------------------------------
Char.Out.Get sec Char.Out.Get ldy #S.DCB.TTY.OUTHEAD
lda OutCnt lda (ZPDCBPtr),y
beq .9 dey OUTTAIL
dec OutCnt cmp (ZPDCBPtr),y
ldx OutPtr beq .9 CS
lda OutBuffer,x
tay
lda (ZPDCBPtr),y
pha pha
txa
tya
inc inc
and #OUTBUF.MAXLEN-1 cmp #S.DCB.TTY.OUTBUFFER.MAX
sta OutPtr bne .1
lda #S.DCB.TTY.OUTBUFFER
.1 ldy #S.DCB.TTY.OUTTAIL
sta (ZPDCBPtr),y
pla pla
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
GetPtrsAndCnt ldy #S.IOCTL.BUFPTR GetPtrsAndCnt ldy #S.IOCTL.BUFPTR
@ -1066,54 +1116,54 @@ 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.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 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 BUF.BASEL .DA #S.TTYBUF.SCRBUF
.DA #S.TTY.SCRBUF+80 .DA #S.TTYBUF.SCRBUF+80
.DA #S.TTY.SCRBUF+160 .DA #S.TTYBUF.SCRBUF+160
.DA #S.TTY.SCRBUF+240 .DA #S.TTYBUF.SCRBUF+240
.DA #S.TTY.SCRBUF+320 .DA #S.TTYBUF.SCRBUF+320
.DA #S.TTY.SCRBUF+400 .DA #S.TTYBUF.SCRBUF+400
.DA #S.TTY.SCRBUF+480 .DA #S.TTYBUF.SCRBUF+480
.DA #S.TTY.SCRBUF+560 .DA #S.TTYBUF.SCRBUF+560
.DA #S.TTY.SCRBUF+640 .DA #S.TTYBUF.SCRBUF+640
.DA #S.TTY.SCRBUF+720 .DA #S.TTYBUF.SCRBUF+720
.DA #S.TTY.SCRBUF+800 .DA #S.TTYBUF.SCRBUF+800
.DA #S.TTY.SCRBUF+880 .DA #S.TTYBUF.SCRBUF+880
.DA #S.TTY.SCRBUF+960 .DA #S.TTYBUF.SCRBUF+960
.DA #S.TTY.SCRBUF+1040 .DA #S.TTYBUF.SCRBUF+1040
.DA #S.TTY.SCRBUF+1120 .DA #S.TTYBUF.SCRBUF+1120
.DA #S.TTY.SCRBUF+1200 .DA #S.TTYBUF.SCRBUF+1200
.DA #S.TTY.SCRBUF+1280 .DA #S.TTYBUF.SCRBUF+1280
.DA #S.TTY.SCRBUF+1360 .DA #S.TTYBUF.SCRBUF+1360
.DA #S.TTY.SCRBUF+1440 .DA #S.TTYBUF.SCRBUF+1440
.DA #S.TTY.SCRBUF+1520 .DA #S.TTYBUF.SCRBUF+1520
.DA #S.TTY.SCRBUF+1600 .DA #S.TTYBUF.SCRBUF+1600
.DA #S.TTY.SCRBUF+1680 .DA #S.TTYBUF.SCRBUF+1680
.DA #S.TTY.SCRBUF+1760 .DA #S.TTYBUF.SCRBUF+1760
.DA #S.TTY.SCRBUF+1840 .DA #S.TTYBUF.SCRBUF+1840
BUF.BASEH .DA /S.TTY.SCRBUF BUF.BASEH .DA /S.TTYBUF.SCRBUF
.DA /S.TTY.SCRBUF+80 .DA /S.TTYBUF.SCRBUF+80
.DA /S.TTY.SCRBUF+160 .DA /S.TTYBUF.SCRBUF+160
.DA /S.TTY.SCRBUF+240 .DA /S.TTYBUF.SCRBUF+240
.DA /S.TTY.SCRBUF+320 .DA /S.TTYBUF.SCRBUF+320
.DA /S.TTY.SCRBUF+400 .DA /S.TTYBUF.SCRBUF+400
.DA /S.TTY.SCRBUF+480 .DA /S.TTYBUF.SCRBUF+480
.DA /S.TTY.SCRBUF+560 .DA /S.TTYBUF.SCRBUF+560
.DA /S.TTY.SCRBUF+640 .DA /S.TTYBUF.SCRBUF+640
.DA /S.TTY.SCRBUF+720 .DA /S.TTYBUF.SCRBUF+720
.DA /S.TTY.SCRBUF+800 .DA /S.TTYBUF.SCRBUF+800
.DA /S.TTY.SCRBUF+880 .DA /S.TTYBUF.SCRBUF+880
.DA /S.TTY.SCRBUF+960 .DA /S.TTYBUF.SCRBUF+960
.DA /S.TTY.SCRBUF+1040 .DA /S.TTYBUF.SCRBUF+1040
.DA /S.TTY.SCRBUF+1120 .DA /S.TTYBUF.SCRBUF+1120
.DA /S.TTY.SCRBUF+1200 .DA /S.TTYBUF.SCRBUF+1200
.DA /S.TTY.SCRBUF+1280 .DA /S.TTYBUF.SCRBUF+1280
.DA /S.TTY.SCRBUF+1360 .DA /S.TTYBUF.SCRBUF+1360
.DA /S.TTY.SCRBUF+1440 .DA /S.TTYBUF.SCRBUF+1440
.DA /S.TTY.SCRBUF+1520 .DA /S.TTYBUF.SCRBUF+1520
.DA /S.TTY.SCRBUF+1600 .DA /S.TTYBUF.SCRBUF+1600
.DA /S.TTY.SCRBUF+1680 .DA /S.TTYBUF.SCRBUF+1680
.DA /S.TTY.SCRBUF+1760 .DA /S.TTYBUF.SCRBUF+1760
.DA /S.TTY.SCRBUF+1840 .DA /S.TTYBUF.SCRBUF+1840
*-------------------------------------- *--------------------------------------
CtrlChars .HS 05080A0C0D151B CtrlChars .HS 05080A0C0D151B
CtrlChars.Cnt .EQ *-CtrlChars CtrlChars.Cnt .EQ *-CtrlChars
@ -1158,11 +1208,6 @@ bEscSeqInNum .BS 1
EscSeqParamCnt .BS 1 EscSeqParamCnt .BS 1
EscSeqParam .BS 4 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 DRV.TERM.DIB .DA #S.DIB.S.WRITE+S.DIB.S.READ
.DA #0,#0,#0 .DA #0,#0,#0
>PSTR "A2osX VT100 TERM" >PSTR "A2osX VT100 TERM"

View File

@ -39,18 +39,18 @@ ClrScr ldx #23
bpl .1 bpl .1
lda #0 lda #0
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
dey dey
sta (ZPTTYEnvPtr),y sta (ZPDCBPtr),y
rts rts
*-------------------------------------- *--------------------------------------
SetCharAtCurPos pha SetCharAtCurPos pha
ldy #S.TTY.CV ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
dey dey
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tay tay
pla pla
*-------------------------------------- *--------------------------------------
@ -76,11 +76,11 @@ SetCharAtYX cmp #$40
sta CLRWRITEAUX sta CLRWRITEAUX
rts rts
*-------------------------------------- *--------------------------------------
GetCharAtCurPos ldy #S.TTY.CV GetCharAtCurPos ldy #S.DCB.TTY.CV
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tax tax
dey dey
lda (ZPTTYEnvPtr),y lda (ZPDCBPtr),y
tay tay
jsr SETUP.L1X jsr SETUP.L1X