diff --git a/DRV/LANCEGS.DRV.S.txt b/DRV/LANCEGS.DRV.S.txt index 90ebaec2..a88b4e1b 100644 --- a/DRV/LANCEGS.DRV.S.txt +++ b/DRV/LANCEGS.DRV.S.txt @@ -144,6 +144,7 @@ FD.DEV .DA #S.FD.T.CDEV .DA #0 DEVID .DA 0 BUSPTR .BS 2 DRVPTR + .DA 0 DCBPTR .DA 0 BUFPTR FD.DEV.NAME .AZ "ETH7" *-------------------------------------- diff --git a/DRV/UTHERNET.DRV.S.txt b/DRV/UTHERNET.DRV.S.txt index dc06a6a5..25c4e43c 100644 --- a/DRV/UTHERNET.DRV.S.txt +++ b/DRV/UTHERNET.DRV.S.txt @@ -163,6 +163,7 @@ FD.DEV .DA #S.FD.T.CDEV .DA #0 DEVID .DA 0 BUSPTR .BS 2 DRVPTR + .DA 0 DCBPTR .DA 0 BUFPTR FD.DEV.NAME .AZ "ETH7" *-------------------------------------- diff --git a/DRV/X.SSC.DRV.S.txt b/DRV/X.SSC.DRV.S.txt index d33e2834..72ca67b3 100644 --- a/DRV/X.SSC.DRV.S.txt +++ b/DRV/X.SSC.DRV.S.txt @@ -188,6 +188,7 @@ FD.DEV .DA #S.FD.T.CDEV .DA #0 DEVID .DA 0 BUSPTR .BS 2 DRVPTR + .DA 0 DCBPTR .DA 0 BUFPTR FD.DEV.NAME .AZ "COM1" *-------------------------------------- diff --git a/DRV/X.U2.DRV.S.txt b/DRV/X.U2.DRV.S.txt index e877c6dc..76ede59e 100644 --- a/DRV/X.U2.DRV.S.txt +++ b/DRV/X.U2.DRV.S.txt @@ -168,6 +168,7 @@ FD.DEV .DA #S.FD.T.CDEV .DA #0 DEVID .DA 0 BUSPTR .BS 2 DRVPTR + .DA 0 DCBPTR .DA 0 BUFPTR FD.DEV.NAME .AZ "ETH7" *-------------------------------------- diff --git a/INC/A2osX.I.txt b/INC/A2osX.I.txt index dff4c1d2..e2a58198 100644 --- a/INC/A2osX.I.txt +++ b/INC/A2osX.I.txt @@ -431,9 +431,10 @@ S.FD.DEV.BUSID .EQ 2 S.FD.DEV.DEVID .EQ 3 S.FD.DEV.BUSPTR .EQ 4 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 *-------------------------------------- diff --git a/SYS/KERNEL.S.DEF.txt b/SYS/KERNEL.S.DEF.txt index 1058ddf8..12e1464c 100644 --- a/SYS/KERNEL.S.DEF.txt +++ b/SYS/KERNEL.S.DEF.txt @@ -140,25 +140,32 @@ H.BIN.EXE.REL.TABLE .EQ 16 * H.BIN.DRV.REL.TABLE .EQ 2 Including main jmp *-------------------------------------- -S.TTY.DEVID .EQ 0 -S.TTY.STATUS .EQ 1 -S.TTY.MODE .EQ 2 -S.TTY.MODE.ESC .EQ 2 -S.TTY.MODE.CSI .EQ 4 -S.TTY.MODE.IAC .EQ 6 -S.TTY.CH .EQ 3 -S.TTY.CV .EQ 4 -S.TTY.SCROLLTOP .EQ 5 -S.TTY.SCROLLBOT .EQ 6 -S.TTY.bCURON .EQ 7 -S.TTY.CURCHAR .EQ 8 -S.TTY.bINVERSE .EQ 9 -S.TTY.bLINEWRAP .EQ 10 +S.DCB.TTY.DEVID .EQ 0 +S.DCB.TTY.STATUS .EQ 1 +S.DCB.TTY.MODE .EQ 2 +S.DCB.TTY.MODE.ESC .EQ 2 +S.DCB.TTY.MODE.CSI .EQ 4 +S.DCB.TTY.MODE.IAC .EQ 6 +S.DCB.TTY.CH .EQ 3 +S.DCB.TTY.CV .EQ 4 +S.DCB.TTY.SCROLLTOP .EQ 5 +S.DCB.TTY.SCROLLBOT .EQ 6 +S.DCB.TTY.bCURON .EQ 7 +S.DCB.TTY.CURCHAR .EQ 8 +S.DCB.TTY.bINVERSE .EQ 9 +S.DCB.TTY.bLINEWRAP .EQ 10 -S.TTY.TITLE .EQ 48 -S.TTY.SCRBUF .EQ 128 24x80=1920 bytes +S.DCB.TTY.OUTTAIL .EQ 14 +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 SAVE USR/SRC/SYS/KERNEL.S.DEF diff --git a/SYS/KERNEL.S.DEV.txt b/SYS/KERNEL.S.DEV.txt index 3ef1b62f..ef3af3d4 100644 --- a/SYS/KERNEL.S.DEV.txt +++ b/SYS/KERNEL.S.DEV.txt @@ -30,7 +30,7 @@ K.GetDevByID cmp DevMgr.DevCnt K.GetDevByName >STYA ZPPtr1 ldx #0 - + .1 lda Dev.Table.hPath,x beq K.GetDev.NODEV jsr K.GetMemPtr @@ -151,6 +151,7 @@ K.MKDev jsr MEM.SPtr1PPtr2 ptr1=fd, ptr2=name .8 >LDYA ZPPtr2 jsr K.NewStr bcs .99 + >DEBUG txa ldx DevMgr.DevCnt diff --git a/SYS/KERNEL.S.INIT.txt b/SYS/KERNEL.S.INIT.txt index a365f98c..fd80f261 100644 --- a/SYS/KERNEL.S.INIT.txt +++ b/SYS/KERNEL.S.INIT.txt @@ -108,7 +108,7 @@ Kernel.Init3 sta SETALTZP >SYSCALL MKDev jsr SysScrInit - + bcs * jsr PS0.Init bcs * @@ -243,7 +243,7 @@ MemMgrInit >LDYAI Mem.MHiMem >STYA Mem.LoMem stz Mem.LastSlot Reserve Slot #0 -* reserve AUXmem for TTY Frame bufers +* reserve AUXmem for TTY Frame buffers lda A2osX.TTYDEVS inc +1 for /DEV/CONSOLE @@ -303,10 +303,13 @@ MemMgrInit >LDYAI Mem.MHiMem rts *-------------------------------------- -SysScrInit >PUSHWI FD.CONSOLE.NAME - >LDYAI FD.CONSOLE - >SYSCALL MKDev +SysScrInit jsr SysScrInit.EnvBuf + >PUSHWI FD.CONSOLE.NAME + >LDYAI FD.TTY + >SYSCALL MKDev + bcs .9 + lda A2osX.TTYDEVS .1 pha @@ -316,6 +319,9 @@ SysScrInit >PUSHWI FD.CONSOLE.NAME sec sbc /2048 sta FD.TTY+S.FD.DEV.BUFPTR+1 + + jsr SysScrInit.EnvBuf + >PUSHWI FD.TTY.NAME >LDYAI FD.TTY >SYSCALL MKDev @@ -324,6 +330,8 @@ SysScrInit >PUSHWI FD.CONSOLE.NAME dec bne .1 + clc +.9 rts SysScrInit.OLD ldx #0 @@ -373,6 +381,21 @@ SysScrInit.OLD ldx #0 bne .4 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) >STYA pPs @@ -1138,25 +1161,20 @@ FD.NULL .DA #S.FD.T.CDEV .DA #0 DEVID .DA 0 BUSPTR .DA DRV.NULL + .DA 0 DCBPTR .DA 0 BUFPTR 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 .DA #0 HANDLER .DA #0 BUSID .DA #1 DEVID .DA 0 BUSPTR - .DA DRV.SYS + .DA DRV.TERM + .BS 2 DCBPTR .DA $B800 BUFPTR +*-------------------------------------- +FD.CONSOLE.NAME .AZ "CONSOLE" FD.TTY.NAME .AZ "TTY0" *-------------------------------------- FD.BDEV .DA #S.FD.T.BDEV @@ -1165,6 +1183,7 @@ FD.BDEV .DA #S.FD.T.BDEV .DA #0 DEVID .BS 2 BUSPTR .BS 2 DRVPTR + .DA 0 DCBPTR .DA 0 BUFPTR FD.BDEV.NAME .AZ "S1D1" *-------------------------------------- diff --git a/SYS/KERNEL.S.TERM.txt b/SYS/KERNEL.S.TERM.txt index df8cd803..db88dec6 100644 --- a/SYS/KERNEL.S.TERM.txt +++ b/SYS/KERNEL.S.TERM.txt @@ -3,11 +3,9 @@ PREFIX AUTO 4,1 *-------------------------------------- CURSOR.BLINK.SPEED .EQ 2 -INBUF.MAXLEN .EQ 32 -OUTBUF.MAXLEN .EQ 32 *-------------------------------------- ZPIOCTL .EQ ZPDRV -ZPTTYEnvPtr .EQ ZPDRV+2 +ZPDCBPtr .EQ ZPDRV+2 ZPTTYBufPtr .EQ ZPDRV+4 ZPBufPtr .EQ ZPDRV+10 ZPCount .EQ ZPDRV+12 @@ -23,13 +21,13 @@ DRV.TERM cld ldy #S.FD.DEV.BUFPTR lda (pFD),y - sta ZPTTYEnvPtr + sta ZPDCBPtr iny lda (pFD),y - sta ZPTTYEnvPtr+1 + sta ZPDCBPtr+1 - ldy #S.TTY.DEVID - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.DEVID + lda (ZPDCBPtr),y cmp A2osX.ASCREEN beq .1 CS @@ -71,8 +69,8 @@ DRV.TERM.STATUS ldy #S.IOCTL.BUFPTR dey bne .2 - ldy #S.TTY.STATUS - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.STATUS + lda (ZPDCBPtr),y clc rts @@ -99,21 +97,18 @@ DRV.TERM.OPEN ldx #0 rts .2 sta A2osX.SCRNDEVS,x DEV.ID in A - ldy #S.TTY.DEVID - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.DEVID + sta (ZPDCBPtr),y - ldy #S.TTY.STATUS + ldy #S.DCB.TTY.STATUS - lda (ZPTTYEnvPtr),y + lda (ZPDCBPtr),y bit #S.DIB.S.OPENED bne .9 ora #S.DIB.S.OPENED ora DRV.TERM.DIB+S.DIB.S - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y - stz OutPtr - stz OutCnt - jsr RESET *-------------------------------------- DRV.TERM.CONTROL @@ -122,26 +117,26 @@ DRV.TERM.CONTROL sta SET80DISP sta CLR80STORE sta CLRPAGE2 - ldy #S.TTY.DEVID - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.DEVID + lda (ZPDCBPtr),y sta A2osX.ASCREEN clc rts *-------------------------------------- -DRV.TERM.CLOSE ldy #S.TTY.STATUS - lda (ZPTTYEnvPtr),y +DRV.TERM.CLOSE ldy #S.DCB.TTY.STATUS + lda (ZPDCBPtr),y bit #S.DIB.S.OPENED beq .9 lda DRV.TERM.DIB+S.DIB.S - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y ldx #0 - ldy #S.TTY.DEVID + ldy #S.DCB.TTY.DEVID .1 lda A2osX.SCRNDEVS,x - cmp (ZPTTYEnvPtr),y + cmp (ZPDCBPtr),y bne .2 stz A2osX.SCRNDEVS,x @@ -162,8 +157,8 @@ DRV.TERM.READ bit bActive is screen active? lda A2osX.TIMER16 and #CURSOR.BLINK.SPEED - ldy #S.TTY.bCURON - eor (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bCURON + eor (ZPDCBPtr),y beq .1 jsr CURBLNK @@ -194,7 +189,11 @@ DRV.TERM.READ bit bActive is screen active? iny 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... .7 stz .8+1 @@ -235,8 +234,8 @@ DRV.TERM.WRITE jsr GetPtrsAndCnt inc ZPCount+1 beq .8 -.2 ldy #S.TTY.MODE - lda (ZPTTYEnvPtr),y +.2 ldy #S.DCB.TTY.MODE + lda (ZPDCBPtr),y tax jsr .3 @@ -260,9 +259,12 @@ DRV.TERM.COUT lda (ZPBufPtr) cmp #IAC bne .1 - lda #S.TTY.MODE.IAC - sta (ZPTTYEnvPtr),y - stz InBuffer + lda #S.DCB.TTY.MODE.IAC + sta (ZPDCBPtr),y + + ldy #S.DCB.TTY.INBUFFER + lda #S.DCB.TTY.INBUFFER + sta (ZPDCBPtr),y clc rts @@ -274,52 +276,52 @@ DRV.TERM.COUT lda (ZPBufPtr) cmp #C.SPACE bcc COUT.Ctrl - ldy #S.TTY.bINVERSE - ora (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bINVERSE + ora (ZPDCBPtr),y jsr SetCharAtCurPos *-------------------------------------- -FS ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y +FS ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y cmp #79 bne .1 - ldy #S.TTY.bLINEWRAP - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bLINEWRAP + lda (ZPDCBPtr),y bpl FS.8 - ldy #S.TTY.CH + ldy #S.DCB.TTY.CH lda #0 - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y jmp LF .1 inc - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y FS.8 clc rts *-------------------------------------- -DEL ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y +DEL ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y beq .1 dec - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y bra .3 -.1 iny S.TTY.CV - lda (ZPTTYEnvPtr),y +.1 iny S.DCB.TTY.CV + lda (ZPDCBPtr),y beq FS.8 dec - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y dey lda #79 - sta (ZPTTYEnvPtr),y S.TTY.CH + sta (ZPDCBPtr),y S.DCB.TTY.CH .3 lda #$20 - ldy #S.TTY.bINVERSE - ora (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bINVERSE + ora (ZPDCBPtr),y jmp SetCharAtCurPos *-------------------------------------- COUT.Ctrl ldx #CtrlChars.Cnt-1 @@ -341,14 +343,16 @@ DRV.TERM.ESC lda (ZPBufPtr) cmp #'[' bne .1 - lda #S.TTY.MODE.CSI - sta (ZPTTYEnvPtr),y - stz InBuffer + lda #S.DCB.TTY.MODE.CSI + sta (ZPDCBPtr),y + ldy #S.DCB.TTY.INBUFFER + lda #S.DCB.TTY.INBUFFER + sta (ZPDCBPtr),y clc rts .1 lda #0 - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y ldx #EscCodes.Cnt-1 @@ -369,19 +373,23 @@ J.EscCodes .DA Scroll.Dn M .DA Scroll.Up D .DA RESET c *-------------------------------------- -DRV.TERM.CSI inc InBuffer - ldx InBuffer +DRV.TERM.CSI ldy #S.DCB.TTY.INBUFFER + lda (ZPDCBPtr),y + inc + sta (ZPDCBPtr),y + tay lda (ZPBufPtr) - sta InBuffer,x + sta (ZPDCBPtr),y cmp #64 End of Seq ? bcs COUT.ExecEscSeq - cpx #INBUF.MAXLEN too long? + cpy #S.DCB.TTY.INBUFFER.MAX-1 buffer full? bne .8 lda #0 - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.MODE + sta (ZPDCBPtr),y .8 clc rts @@ -389,13 +397,15 @@ DRV.TERM.CSI inc InBuffer COUT.ExecEscSeq stz EscSeqParamCnt stz bEscSeqInNum - ldx #0 EscSeq Ptr - + ldy #S.DCB.TTY.INBUFFER EscSeq Ptr + lda (ZPDCBPtr),y + tay + .10 stz ZPTmpWord stz ZPTmpWord+1 -.1 inx - lda InBuffer,x +.1 iny + lda (ZPDCBPtr),y cmp #'0' bcc .2 @@ -433,21 +443,21 @@ COUT.ExecEscSeq stz EscSeqParamCnt stz bEscSeqInNum lda #255 - ldy ZPTmpWord+1 + ldx ZPTmpWord+1 bne .21 lda ZPTmpWord -.21 ldy EscSeqParamCnt - sta EscSeqParam,y +.21 ldx EscSeqParamCnt + sta EscSeqParam,x inc EscSeqParamCnt -.3 lda InBuffer,x +.3 lda (ZPDCBPtr),y cmp #';' beq .10 lda #0 - ldy #S.TTY.MODE - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.MODE + sta (ZPDCBPtr),y ldx #EscSeqCmds.Cnt-1 @@ -472,34 +482,37 @@ J.EscSequences .DA Esc.LWEnable h .DA Esc.Erase K .DA Esc.Home H *-------------------------------------- -DRV.TERM.IAC inc InBuffer - ldx InBuffer - cpx #INBUF.MAXLEN - beq * +DRV.TERM.IAC ldy #S.DCB.TTY.INBUFFER + lda (ZPDCBPtr),y + inc + sta (ZPDCBPtr),y + tay 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 - ldy InBuffer+1 get back CMD - cpy #SB + 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 .8 wait for ending SE....keep bIACMode -.1 cpy #IAC +.1 cmp #IAC beq .9 - tya sec sbc #SB bcc .9 asl tax - lda InBuffer+2 Get SUBCMD in A + ldy #S.DCB.TTY.INBUFFER+2 + lda (ZPDCBPtr),y Get SUBCMD in A cpx #10 bcs * @@ -520,7 +533,8 @@ J.COUT.IAC.CMDS .DA COUT.IAC.SB COUT.IAC.SB cmp #TELOPT.TTYPE bne .9 - lda InBuffer+3 + ldy #S.DCB.TTY.INBUFFER+2 + lda (ZPDCBPtr),y cmp #SB.SEND bne .9 @@ -601,33 +615,38 @@ COUT.IAC.DONT *-------------------------------------- RESET.MODE lda #0 - ldy #S.TTY.MODE - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.MODE + sta (ZPDCBPtr),y clc rts *-------------------------------------- RESET jsr RESET.MODE - ldy #S.TTY.bCURON - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.OUTTAIL + sta (ZPDCBPtr),y + iny + sta (ZPDCBPtr),y + + ldy #S.DCB.TTY.bCURON + sta (ZPDCBPtr),y dec - ldy #S.TTY.bLINEWRAP - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bLINEWRAP + sta (ZPDCBPtr),y lda #0 - ldy #S.TTY.SCROLLTOP - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.SCROLLTOP + sta (ZPDCBPtr),y iny lda #23 - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y jsr CLRSCR *-------------------------------------- RESETATTR lda #$80 - ldy #S.TTY.bINVERSE - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bINVERSE + sta (ZPDCBPtr),y clc rts *-------------------------------------- @@ -650,57 +669,57 @@ ENQ ldy #0 .8 clc rts *-------------------------------------- -BS ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y +BS ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y beq .1 dec - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y clc rts -.1 ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y +.1 ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y beq .2 dec - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y lda #79 dey - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y .2 clc rts *-------------------------------------- CROUT lda #0 - ldy #S.TTY.CH - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CH + sta (ZPDCBPtr),y clc rts *-------------------------------------- -LF ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y - ldy #S.TTY.SCROLLBOT - cmp (ZPTTYEnvPtr),y +LF ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y + ldy #S.DCB.TTY.SCROLLBOT + cmp (ZPDCBPtr),y beq SCROLL.UP inc - ldy #S.TTY.CV - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + sta (ZPDCBPtr),y clc rts *-------------------------------------- -ESC lda #S.TTY.MODE.ESC - ldy #S.TTY.MODE +ESC lda #S.DCB.TTY.MODE.ESC + ldy #S.DCB.TTY.MODE - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y clc rts *-------------------------------------- -SCROLL.UP ldy #S.TTY.SCROLLTOP - lda (ZPTTYEnvPtr),y +SCROLL.UP ldy #S.DCB.TTY.SCROLLTOP + lda (ZPDCBPtr),y tax @@ -711,12 +730,12 @@ SCROLL.UP ldy #S.TTY.SCROLLTOP jsr COPY.XtoL1 txa - ldy #S.TTY.SCROLLBOT - cmp (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.SCROLLBOT + cmp (ZPDCBPtr),y bne .1 *-------------------------------------- -CLREOL ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y +CLREOL ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y tay Start ldx #80 End bra CLR @@ -726,15 +745,15 @@ CLRLINE ldy #0 Start bra CLR CLRSOL ldy #0 - ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y Start + ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y Start tax End CLR stx .3+1 Save End phy - ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y tax ply @@ -752,8 +771,8 @@ CLR stx .3+1 Save End clc rts *-------------------------------------- -SCROLL.DN ldy #S.TTY.SCROLLBOT - lda (ZPTTYEnvPtr),y +SCROLL.DN ldy #S.DCB.TTY.SCROLLBOT + lda (ZPDCBPtr),y tax @@ -764,8 +783,8 @@ SCROLL.DN ldy #S.TTY.SCROLLBOT jsr COPY.XtoL1 txa - ldy #S.TTY.SCROLLTOP - cmp (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.SCROLLTOP + cmp (ZPDCBPtr),y bne .1 clc @@ -785,8 +804,8 @@ Esc.LWDisable clc bne .8 ror - ldy #S.TTY.bLINEWRAP - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bLINEWRAP + sta (ZPDCBPtr),y .8 clc rts @@ -802,8 +821,8 @@ Esc.DispAttr ldx EscSeqParamCnt .2 eor #7 bne .8 - ldy #S.TTY.bINVERSE - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bINVERSE + sta (ZPDCBPtr),y .7 dex bne .1 @@ -826,16 +845,16 @@ Esc.Query ldx EscSeqParamCnt lda #'[' jsr Char.Out.Put - ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y inc jsr Decimal.Out lda #';' jsr Char.Out.Put - ldy #S.TTY.CH - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CH + lda (ZPDCBPtr),y inc jsr Decimal.Out @@ -860,11 +879,11 @@ Esc.Scroll ldy EscSeqParamCnt ldx EscSeqParam+1 dex -.8 ldy #S.TTY.SCROLLTOP - sta (ZPTTYEnvPtr),y - iny S.TTY.SCROLLBOT +.8 ldy #S.DCB.TTY.SCROLLTOP + sta (ZPDCBPtr),y + iny S.DCB.TTY.SCROLLBOT txa - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y .9 clc rts @@ -889,10 +908,10 @@ Esc.Erase ldx EscSeqParamCnt Esc.Home lda EscSeqParamCnt bne .1 - ldy #S.TTY.CH - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CH + sta (ZPDCBPtr),y iny - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y clc rts @@ -908,8 +927,8 @@ Esc.Home lda EscSeqParamCnt .2 dex txa - ldy #S.TTY.CV - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + sta (ZPDCBPtr),y dec EscSeqParamCnt beq .8 @@ -927,45 +946,45 @@ Esc.Home lda EscSeqParamCnt .3 dex txa - ldy #S.TTY.CH - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CH + sta (ZPDCBPtr),y .8 clc rts *-------------------------------------- -CUROFF ldy #S.TTY.bCURON - lda (ZPTTYEnvPtr),y +CUROFF ldy #S.DCB.TTY.bCURON + lda (ZPDCBPtr),y beq CUREXIT.RTS CURBLNK bit bActive bpl CURBLNK1 - ldy #S.TTY.bCURON - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bCURON + lda (ZPDCBPtr),y bne CURBLNK.OFF rts do not Light if screen is not active -CURBLNK1 ldy #S.TTY.bCURON - lda (ZPTTYEnvPtr),y +CURBLNK1 ldy #S.DCB.TTY.bCURON + lda (ZPDCBPtr),y bne CURBLNK.OFF jsr GetCharAtCurPos - ldy #S.TTY.CURCHAR - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CURCHAR + sta (ZPDCBPtr),y and #$80 eor #" " bra CUREXIT -CURBLNK.OFF ldy #S.TTY.CURCHAR - lda (ZPTTYEnvPtr),y +CURBLNK.OFF ldy #S.DCB.TTY.CURCHAR + lda (ZPDCBPtr),y CUREXIT jsr SetCharAtCurPos - ldy #S.TTY.bCURON - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.bCURON + lda (ZPDCBPtr),y eor #CURSOR.BLINK.SPEED - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y CUREXIT.RTS rts *-------------------------------------- Decimal.Out stz ZPTmpWord @@ -1016,30 +1035,61 @@ Decimal.Out stz ZPTmpWord and #$0f *-------------------------------------- Char.Out.Put30 ora #$30 + Char.Out.Put pha - lda OutPtr - clc - adc OutCnt - and #OUTBUF.MAXLEN-1 - tax + + ldy #S.DCB.TTY.OUTHEAD + lda (ZPDCBPtr),y + + 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 - sta OutBuffer,x - inc OutCnt rts *-------------------------------------- -Char.Out.Get sec - lda OutCnt - beq .9 - dec OutCnt - ldx OutPtr - lda OutBuffer,x +Char.Out.Get ldy #S.DCB.TTY.OUTHEAD + lda (ZPDCBPtr),y + dey OUTTAIL + cmp (ZPDCBPtr),y + beq .9 CS + + tay + lda (ZPDCBPtr),y pha - txa + + tya inc - and #OUTBUF.MAXLEN-1 - sta OutPtr + 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 *-------------------------------------- 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.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 +BUF.BASEL .DA #S.TTYBUF.SCRBUF + .DA #S.TTYBUF.SCRBUF+80 + .DA #S.TTYBUF.SCRBUF+160 + .DA #S.TTYBUF.SCRBUF+240 + .DA #S.TTYBUF.SCRBUF+320 + .DA #S.TTYBUF.SCRBUF+400 + .DA #S.TTYBUF.SCRBUF+480 + .DA #S.TTYBUF.SCRBUF+560 + .DA #S.TTYBUF.SCRBUF+640 + .DA #S.TTYBUF.SCRBUF+720 + .DA #S.TTYBUF.SCRBUF+800 + .DA #S.TTYBUF.SCRBUF+880 + .DA #S.TTYBUF.SCRBUF+960 + .DA #S.TTYBUF.SCRBUF+1040 + .DA #S.TTYBUF.SCRBUF+1120 + .DA #S.TTYBUF.SCRBUF+1200 + .DA #S.TTYBUF.SCRBUF+1280 + .DA #S.TTYBUF.SCRBUF+1360 + .DA #S.TTYBUF.SCRBUF+1440 + .DA #S.TTYBUF.SCRBUF+1520 + .DA #S.TTYBUF.SCRBUF+1600 + .DA #S.TTYBUF.SCRBUF+1680 + .DA #S.TTYBUF.SCRBUF+1760 + .DA #S.TTYBUF.SCRBUF+1840 +BUF.BASEH .DA /S.TTYBUF.SCRBUF + .DA /S.TTYBUF.SCRBUF+80 + .DA /S.TTYBUF.SCRBUF+160 + .DA /S.TTYBUF.SCRBUF+240 + .DA /S.TTYBUF.SCRBUF+320 + .DA /S.TTYBUF.SCRBUF+400 + .DA /S.TTYBUF.SCRBUF+480 + .DA /S.TTYBUF.SCRBUF+560 + .DA /S.TTYBUF.SCRBUF+640 + .DA /S.TTYBUF.SCRBUF+720 + .DA /S.TTYBUF.SCRBUF+800 + .DA /S.TTYBUF.SCRBUF+880 + .DA /S.TTYBUF.SCRBUF+960 + .DA /S.TTYBUF.SCRBUF+1040 + .DA /S.TTYBUF.SCRBUF+1120 + .DA /S.TTYBUF.SCRBUF+1200 + .DA /S.TTYBUF.SCRBUF+1280 + .DA /S.TTYBUF.SCRBUF+1360 + .DA /S.TTYBUF.SCRBUF+1440 + .DA /S.TTYBUF.SCRBUF+1520 + .DA /S.TTYBUF.SCRBUF+1600 + .DA /S.TTYBUF.SCRBUF+1680 + .DA /S.TTYBUF.SCRBUF+1760 + .DA /S.TTYBUF.SCRBUF+1840 *-------------------------------------- CtrlChars .HS 05080A0C0D151B CtrlChars.Cnt .EQ *-CtrlChars @@ -1158,11 +1208,6 @@ 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" diff --git a/SYS/KERNEL.S.TERMLC.txt b/SYS/KERNEL.S.TERMLC.txt index 5cef3a31..cbe1d340 100644 --- a/SYS/KERNEL.S.TERMLC.txt +++ b/SYS/KERNEL.S.TERMLC.txt @@ -39,18 +39,18 @@ ClrScr ldx #23 bpl .1 lda #0 - ldy #S.TTY.CV - sta (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + sta (ZPDCBPtr),y dey - sta (ZPTTYEnvPtr),y + sta (ZPDCBPtr),y rts *-------------------------------------- SetCharAtCurPos pha - ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y + ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y tax dey - lda (ZPTTYEnvPtr),y + lda (ZPDCBPtr),y tay pla *-------------------------------------- @@ -76,11 +76,11 @@ SetCharAtYX cmp #$40 sta CLRWRITEAUX rts *-------------------------------------- -GetCharAtCurPos ldy #S.TTY.CV - lda (ZPTTYEnvPtr),y +GetCharAtCurPos ldy #S.DCB.TTY.CV + lda (ZPDCBPtr),y tax dey - lda (ZPTTYEnvPtr),y + lda (ZPDCBPtr),y tay jsr SETUP.L1X