A2osX-1.00 PREVIEW : major code factorization & bugfixes in BIN/cmds

This commit is contained in:
burniouf 2025-02-14 23:23:00 +01:00
parent 5e025faeec
commit 59d383b6e0
41 changed files with 1087 additions and 1122 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -7,7 +7,6 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.e.i
.INB inc/arc.i
*--------------------------------------
@ -151,30 +150,12 @@ CS.RUN.START >PUSHW L.MSG.SRCFILE
CS.RUN.RTS rts
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs CS.RUN.RTS
tay
bne .1
>LIBC GetChar
bcs CS.RUN.RTS
cmp #$03 Ctrl-C
beq CS.RUN.RTS Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr CS.RUN.GetChunk
bcs CS.RUN.RTS
@ -548,6 +529,7 @@ CS.QUIT.BUF lda hDstBuf
.8 clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.arc.s
*--------------------------------------
MSG.USAGE .CZ "Usage : ARCME SourceBIN PackedBIN\r\n"

View File

@ -30,7 +30,7 @@ ArgIndex .BS 1
pFile .BS 2
LineNum .BS 2
bPrintedBlankLine .BS 1
ZS.END .ED
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -50,7 +50,7 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.CRLF .DA MSG.CRLF
@ -74,12 +74,12 @@ CS.RUN inc ArgCount
cmp #'-'
bne .4
ldy #1
ldy #1
lda (ZPPtr1),y
beq .99
.1 ldx #OptionVars-OptionList-1
.2 cmp OptionList,x
beq .3
@ -94,12 +94,12 @@ CS.RUN inc ArgCount
.3 lda OptionVars,x
tax
* sec
* sec
ror 0,x
iny
lda (ZPPtr1),y
bne .1
bra CS.RUN
.4 inc FileCount
@ -113,13 +113,13 @@ CS.RUN inc ArgCount
bcs .9
>STYA ZPBufPtr
ldy #S.PS.pStdOut
jsr X.IsPipeY
bcs .9
bvs CS.RUN.LOOP
bcs CS.RUN.LOOP Unkown output ... file ?
bvs CS.RUN.LOOP PIPE...no TTY linewrap
>SS
>PUSHW L.MSG.INIT
>PUSHBI 0
@ -127,7 +127,7 @@ CS.RUN inc ArgCount
>SR
*--------------------------------------
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
@ -162,7 +162,7 @@ CS.RUN.LOOP >SLEEP
jsr CS.RUN.PRINT
bcs .99
jmp CS.RUN.LOOP
.7 cmp #MLI.E.EOF
@ -177,7 +177,7 @@ CS.RUN.LOOP >SLEEP
.99 rts
*--------------------------------------
CS.RUN.OPEN stz bPrintedBlankLine Reset this flag for the new file
>SS
>PUSHYA
>PUSHBI O.RDONLY+O.TEXT
@ -212,7 +212,7 @@ CS.RUN.PRINT inc LineNum
lda bPrintAll
bmi .3
ldy #$ff
.20 iny
@ -225,7 +225,7 @@ CS.RUN.PRINT inc LineNum
lda #C.SPACE
sta (ZPBufPtr),y
bra .20
.21 >LDYA ZPBufPtr
>LIBC PutS
rts
@ -273,7 +273,7 @@ CS.RUN.PRINT inc LineNum
.62 inc ByteIndex
bne .4
.7 >SS
>PUSHW L.MSG.CRLF
>PUSHBI 0
@ -295,7 +295,7 @@ CS.RUN.PRINTNUM clc
*--------------------------------------
CS.QUIT >LDYA ZPBufPtr
beq CS.RUN.CLOSE
>LIBC Free
CS.RUN.CLOSE >LDYA pFile

View File

@ -32,9 +32,7 @@ ArgIndex .BS 1
bAuxFileType .BS 1
AuxFileType .BS 2
hSrcFullPath .BS 1
bPause .BS 1
bContinue .BS 1
bRecurse .BS 1
@ -100,7 +98,7 @@ CS.RUN inc ArgIndex
.3 ldy OptionVars,x
lda #$80
sta $0,y
sta 0,y
bra CS.RUN
*--------------------------------------
.4 bit bAuxFileType
@ -131,34 +129,12 @@ CS.RUN inc ArgIndex
>STYA ZPFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 bit bPause
bmi CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -339,6 +315,7 @@ GetAuxType lda (ZPPtr1)
.9 sec
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -25,6 +25,10 @@ ZPFileStat .BS 2
ZPFullPath .BS 2
ArgIndex .BS 1
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -86,7 +90,7 @@ CS.RUN inc ArgIndex
.3 ldy OptionVars,x
lda #$80
sta (pData),y
sta 0,y
bra CS.RUN
*--------------------------------------
.4 >LDA.G GID
@ -119,34 +123,12 @@ CS.RUN inc ArgIndex
>STYA ZPFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
>LDA.G bPause
eor #$ff
sta (pData),y
bne CS.RUN.LOOP
.1 >LDA.G bPause
bne CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -285,6 +267,7 @@ CS.QUIT jsr X.Quit
.8 clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *
@ -305,12 +288,7 @@ ID.END .EQ *
.DUMMY
.OR 0
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
GID .BS 1
hSrcFullPath .BS 1
GID .BS 2
.INB usr/src/shared/x.fileenum.g

View File

@ -27,6 +27,10 @@ ZPMode .BS 2
ArgIndex .BS 1
StrMode .BS 1
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -76,6 +80,7 @@ CS.RUN inc ArgIndex
.2 cmp OptionList,x
beq .3
dex
bpl .2
@ -87,7 +92,7 @@ CS.RUN inc ArgIndex
.3 ldy OptionVars,x
lda #$80
sta (pData),y
sta 0,y
bra CS.RUN
*--------------------------------------
.4 lda StrMode
@ -121,34 +126,12 @@ CS.RUN inc ArgIndex
>STYA ZPFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
>LDA.G bPause
eor #$ff
sta (pData),y
bne CS.RUN.LOOP
.1 >LDA.G bPause
bne CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -323,6 +306,7 @@ CS.QUIT jsr X.Quit
.8 clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *
@ -343,11 +327,6 @@ ID.END .EQ *
.DUMMY
.OR 0
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
.INB usr/src/shared/x.fileenum.g
DS.END .ED

View File

@ -25,6 +25,10 @@ ZPFileStat .BS 2
ZPFullPath .BS 2
ArgIndex .BS 1
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -74,6 +78,7 @@ CS.RUN inc ArgIndex
.2 cmp OptionList,x
beq .3
dex
bpl .2
@ -85,7 +90,7 @@ CS.RUN inc ArgIndex
.3 ldy OptionVars,x
lda #$80
sta (pData),y
sta 0,y
bra CS.RUN
*--------------------------------------
.4 >LDA.G UID
@ -118,34 +123,12 @@ CS.RUN inc ArgIndex
>STYA ZPFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
>LDA.G bPause
eor #$ff
sta (pData),y
bne CS.RUN.LOOP
.1 >LDA.G bPause
bne CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -220,7 +203,7 @@ CS.RUN.DIR lda (ZPFileName)
jsr CS.RUN.CheckErr
bcs .9
>LDA.G bRecurse
bit bRecurse
bpl .8
>LDYA ZPFileName
@ -244,20 +227,25 @@ CS.RUN.GetUID >LIBC ArgV
.9 rts
*--------------------------------------
CS.RUN.CheckErr bcs .1
>LDYA L.MSG.OK
>LIBC PutS
rts
.1 pha
.1 >SS
pha
>PUSHW L.MSG.ERR
pla
pha
>PUSHA
>PUSHBI 1
>LIBC PrintF
>LDA.G bContinue
>SR
lda bContinue
eor #$80
asl
pla
rts
*--------------------------------------
@ -284,6 +272,7 @@ CS.QUIT jsr X.Quit
.8 clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *
@ -304,12 +293,7 @@ ID.END .EQ *
.DUMMY
.OR 0
bContinue .BS 1
bRecurse .BS 1
bPause .BS 1
UID .BS 1
hSrcFullPath .BS 1
UID .BS 2
.INB usr/src/shared/x.fileenum.g

View File

@ -126,35 +126,13 @@ CS.RUN inc ArgIndex
bcs .99
>STYA ZPFullPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP Pause...
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 bit bPause
bmi CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -398,6 +376,7 @@ IsDigit16 cmp #'0'
.9 sec
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -140,34 +140,10 @@ CS.RUN
>STYA ZPBufPtr2
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcs .9 IO error
tay
bne .1 no char
>LIBC GetChar
bcs .9 IO error
cmp #$03 Ctrl-C
beq .9 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP Pause...
CS.RUN.LOOP jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP Pause...
jsr CS.RUN.READ1
bcc .2
@ -184,7 +160,7 @@ CS.RUN.LOOP ldy #S.PS.pStdIn
cmp #MLI.E.EOF
bne .9
bra .99
bra .98
.20 cpy BufCnt
pha
@ -210,7 +186,7 @@ CS.RUN.LOOP ldy #S.PS.pStdIn
bcs .9
.5 bit bAll
bpl .99
bpl .98
.8 iny
cpy BufCnt
@ -222,16 +198,16 @@ CS.RUN.LOOP ldy #S.PS.pStdIn
inc Offset+1
bra CS.RUN.LOOP
.99 lda bDiff
.98 lda bDiff
.9 sec
rts
.99 rts
*--------------------------------------
CS.RUN.OPEN >SS
>PUSHW ZPPtr1
>PUSHBI O.RDONLY
>PUSHBI 0 Type
>PUSHWZ Aux type
>PUSHBI 0 Type
>PUSHWZ Aux type
>LIBC FOpen
>SR
rts
@ -339,6 +315,8 @@ CS.RUN.CheckOpt ldy #1
sta 0,x
clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
*--------------------------------------
CS.END .EQ *
*--------------------------------------

View File

@ -16,6 +16,7 @@ X.DELETE.SOURCE .EQ 0
*--------------------------------------
.INB usr/src/shared/x.cpmvrm.s
.INB usr/src/shared/x.fileenum.s
.INB usr/src/shared/x.checkctrl.s
*--------------------------------------
CS.END .EQ *
*--------------------------------------

View File

@ -1,105 +1,105 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/du
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/du
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
X.ENTER.SUBDIR .EQ 1
X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 0
X.ENTER.SUBDIR .EQ 1
X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 0
X.RESET.SRC.DIR .EQ 1
*--------------------------------------
.DUMMY
.OR ZPBIN
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
bPass2 .BS 1
bPass2 .BS 1
bDirLevel .BS 1
bDirLevel .BS 1
bCRLF .BS 1
bPause .BS 1
bSummary .BS 1
bAllFiles .BS 1
bPause .BS 1
bSummary .BS 1
bAllFiles .BS 1
ArgCount .BS 1
ArgCount .BS 1
ArgDir .BS 1
ZS.END .ED
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #2 BIN Layout Version 2
.DA #0
.DA #0
.DA CS.END
.DA ID.END
.DA DS.END
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.SIG
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.REG1 .DA MSG.REG1
L.MSG.REG2 .DA MSG.REG2
L.MSG.DIRSUMM .DA MSG.DIRSUMM
L.MSG.BDEV .DA MSG.BDEV
L.MSG.BDEVEXT .DA MSG.BDEVEXT
L.MSG.CWD .DA MSG.CWD
J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG
.DA CS.RUN.PRINT.DIR
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.BDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA 0
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.SIG
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.REG1 .DA MSG.REG1
L.MSG.REG2 .DA MSG.REG2
L.MSG.DIRSUMM .DA MSG.DIRSUMM
L.MSG.BDEV .DA MSG.BDEV
L.MSG.BDEVEXT .DA MSG.BDEVEXT
L.MSG.CWD .DA MSG.CWD
J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG
.DA CS.RUN.PRINT.DIR
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.BDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA CS.RUN.PRINT.CDEV
.DA 0
*--------------------------------------
CS.INIT clc
rts
CS.INIT clc
rts
*--------------------------------------
CS.RUN jsr CS.RUN.SetCRLF
CS.RUN jsr CS.RUN.SetCRLF
.1 inc ArgCount
.1 inc ArgCount
lda ArgCount
>LIBC ArgV
bcs .6
>LIBC ArgV
bcs .6
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
lda (ZPPtr1)
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
lda (ZPPtr1),y
beq .9
ldy #OptionVars-OptionList-1
ldy #OptionVars-OptionList-1
.2 cmp OptionList,y
beq .3
.2 cmp OptionList,y
beq .3
dey
bpl .2
bpl .2
.9 >LDYA L.MSG.USAGE
>LIBC PutS
@ -108,130 +108,108 @@ CS.RUN jsr CS.RUN.SetCRLF
sec
.99 rts
.3 ldx OptionVars,y
.3 ldx OptionVars,y
sec
ror $0,x
bra .1
bra .1
.4 lda ArgDir
.4 lda ArgDir
bne .9
lda ArgCount
sta ArgDir
>LDYA ZPPtr1
jsr X.InitSrcDirYA
bcc .1 scan for any other args
jsr X.InitSrcDirYA
bcc .1 scan for any other args
rts
*--------------------------------------
.6 lda ArgDir do we have a Source dir ?
bne CS.RUN.LOOP
.6 lda ArgDir do we have a Source dir ?
bne CS.RUN.LOOP
ldy #S.PS.pCWD
ldy #S.PS.pCWD
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
jsr X.InitSrcDirYA
bcs .99
jsr X.InitSrcDirYA
bcs .99
*--------------------------------------
CS.RUN.LOOP stz bPass2
CS.RUN.LOOP stz bPass2
.1 ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcc .2
.1 >SLEEP
rts I/O error
jsr X.CheckCtrl
bcs .99
bvs .1
.2 tay
bne .3 no char
jsr X.GetEntry First entry
bcs .9
>LIBC GetChar
cmp #$03 Ctrl-C
beq .99 Abort....
jsr X.IncludeMatch Filter filename
bcs .8 no match, skip....
cmp #$13 Ctrl-S
bne .3
lda (ZPFileName)
cmp #'.'
beq .8
lda bPause
eor #$ff
sta bPause
bne .1
.4 ldy #S.STAT.MODE+1
lda (ZPFileStat),y
.3 bit bPause
bmi .1
and #$70
lsr
lsr
lsr
tax
jsr CS.RUN.PRINT.JMP
bcs .99
.8 jsr X.GetNextEntry Next entry
bcc .1 If there is one, go again
bit bPass2
bmi .9
jsr X.ResetSrcDir
bcs .99
dec bPass2
bra .1
*--------------------------------------
jsr X.GetEntry First entry
bcs .9
.9 bit bSummary
bmi .91
jsr X.IncludeMatch Filter filename
bcs .8 no match, skip....
jsr CS.RUN.PrintDirSumm
jsr CS.RUN.PrintCwd
jsr CS.RUN.NewLine
lda (ZPFileName)
cmp #'.'
beq .8
.91 dec bDirLevel
jsr X.LeaveSubDir "cd .."
bcs .97 This means we are done
.4 ldy #S.STAT.MODE+1
lda (ZPFileStat),y
jsr X.BasePath.. Prune pathname
and #$70
lsr
lsr
lsr
tax
jsr CS.RUN.PRINT.JMP
bcs .99
.8 jsr X.GetNextEntry Next entry
bcc .1 If there is one, go again
bit bPass2
bmi .9
jsr X.ResetSrcDir
bcs .99
dec bPass2
bra .1
*--------------------------------------
.9 bit bSummary
bmi .91
jsr CS.RUN.PrintDirSumm
jsr CS.RUN.PrintCwd
jsr CS.RUN.NewLine
.91 dec bDirLevel
jsr X.LeaveSubDir "cd .."
bcs .97 This means we are done
jsr X.BasePath.. Prune pathname
jsr X.GetNextEntry Get next entry
jmp CS.RUN.LOOP Go again
jsr X.GetNextEntry Get next entry
jmp CS.RUN.LOOP Go again
.97 bit bSummary
bpl .98
bpl .98
inc bDirLevel
jsr CS.RUN.PrintDirSumm
jsr CS.RUN.PrintBaseDir
jsr CS.RUN.NewLine
inc bDirLevel
jsr CS.RUN.PrintDirSumm
jsr CS.RUN.PrintBaseDir
jsr CS.RUN.NewLine
.98 lda #0
sec
.99 rts
.98 lda #0
sec
.99 rts
*--------------------------------------
CS.RUN.PRINT.JMP
jmp (J.CS.RUN.PRINT,x)
jmp (J.CS.RUN.PRINT,x)
*--------------------------------------
CS.RUN.PRINT.REG
bit bPass2
@ -449,35 +427,36 @@ CS.RUN.SetCRLF ldy #S.PS.pStdOut
.9 rts
*--------------------------------------
CS.SIG sec
rts
rts
*--------------------------------------
CS.QUIT jmp X.Quit
CS.QUIT jmp X.Quit
*--------------------------------------
.INB usr/src/shared/x.fileenum.s
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *
*--------------------------------------
OptionList .AS "SAsa"
OptionVars .DA #bSummary,#bAllFiles,#bSummary,#bAllFiles
OptionList .AS "SAsa"
OptionVars .DA #bSummary,#bAllFiles,#bSummary,#bAllFiles
*--------------------------------------
MSG.USAGE .CS "Usage : DU [-A] [-S] [filespec]\r\n"
.CS " -A : Show all files (not only directories)\r\n"
.CZ " -S : Show only summary\r\n"
MSG.REG1 .CZ "%5u "
MSG.REG2 .CZ "%s"
MSG.CWD .CZ "%s"
MSG.DIRSUMM .CZ "%5u "
MSG.BDEVEXT .CZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .CZ "\e[32m%s/\e[0m"
MSG.USAGE .CS "Usage : DU [-A] [-S] [filespec]\r\n"
.CS " -A : Show all files (not only directories)\r\n"
.CZ " -S : Show only summary\r\n"
MSG.REG1 .CZ "%5u "
MSG.REG2 .CZ "%s"
MSG.CWD .CZ "%s"
MSG.DIRSUMM .CZ "%5u "
MSG.BDEVEXT .CZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .CZ "\e[32m%s/\e[0m"
*--------------------------------------
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
.DUMMY
.OR 0
BlkCounters .BS 64 Array of 32 bit integers, size 16
.INB usr/src/shared/x.fileenum.g
DS.END .ED
BlkCounters .BS 64 Array of 32 bit integers, size 16
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/du.s

View File

@ -544,7 +544,7 @@ BUF.BufPtrSetup >STYA TmpLen
bcc .8
jsr BUF.BufPtr.Realloc
jsr BUF.Realloc
bcs .9
jsr BUF.ComputeCOffset
@ -570,11 +570,10 @@ BUF.BufPtrSetup >STYA TmpLen
clc
.9 rts
*--------------------------------------
BUF.BufPtr.Realloc
>SS
BUF.Realloc >SS
>PUSHW.G pBuf
lda FileLen+1
lda BufLen+1
inc
inc
sta BufLen+1

View File

@ -227,6 +227,7 @@ Ctrl.LF jsr BUF.GetNextLine
Ctrl.VT >LDA.G FileY+1
tax
dey
>DEBUG
ora (pData),y
beq .8

View File

@ -133,7 +133,7 @@ FILE.Load.ASM.Decode
.9 rts
.2 cmp #$C0 REPEAT char?
.2 cmp #$C0 REPEAT char?
bne .5
lda (LineBufPtr),y Get Repeat Count
@ -148,10 +148,10 @@ FILE.Load.ASM.Decode
dex
bne .4
iny Skip Repeat char
iny Skip Repeat char
bra .1
.5 and #$3F Compute blank count
.5 and #$3F Compute blank count
tax
.6 lda #C.SPACE
@ -166,10 +166,7 @@ FILE.Load.ASM.Decode
.8 lda #C.CR
*--------------------------------------
FILE.Load.2Buf phy
phx
sta (BufPtr)
FILE.Load.2Buf sta (BufPtr)
inc BufPtr
bne .1
@ -182,9 +179,15 @@ FILE.Load.2Buf phy
lda FileLen+1
cmp BufLen+1
bne .8
beq .2
.8 clc
rts
jsr BUF.BufPtr.Realloc
.2 phy
phx
jsr BUF.Realloc
bcs .9
>LDA.G pBuf
@ -196,10 +199,11 @@ FILE.Load.2Buf phy
adc FileLen+1
sta BufPtr+1
.8 clc
* clc
.9 plx
ply
FILE.Save.9 rts
*--------------------------------------
FILE.Save >LDYA.G pLineBuf

View File

@ -36,13 +36,12 @@ ZPPtr1 .BS 2
ZPPatternPtr .BS 2
ZPBufPtr .BS 2
ArgIndex .BS 1
ArgPattern .BS 1
pFILE .BS 2
LineNum .BS 2
char .BS 1
ArgIndex .BS 1
bIgnoreCase .BS 1
bLineNum .BS 1
@ -137,11 +136,9 @@ CS.RUN.CheckArgs
cmp #'-'
beq .1
lda ArgPattern
lda ZPPatternPtr+1
bne .11
lda ArgIndex
sta ArgPattern
>LDYA ZPPtr1
>STYA ZPPatternPtr
bra CS.RUN.CheckArgs
@ -186,8 +183,10 @@ CS.RUN.CheckArgs
.7 lda pFILE+1
bne .8
jsr CS.RUN.CheckPipe
bcs .98
jsr X.IsPipeIn
bcs .9
bvc .97
>STYA pFILE
@ -295,41 +294,6 @@ CS.RUN.PRINT >LDYA ZPBufPtr
.8 clc
.9 rts
*--------------------------------------
CS.RUN.CheckPipe
ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>STYA ZPPtr1
>LIBC FileNo
bcs .99
>SS
>PUSHYA
>PUSHEA.G STATBUF
>LIBC FStat
>SR
bcs .99
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
cmp /S.STAT.MODE.FIFO
bne .98
>LDYA ZPPtr1
clc
rts
.98 lda #E.SYN
sec
.99 rts
*--------------------------------------
CS.RUN.toUpper bit bIgnoreCase
bpl .9
@ -358,6 +322,8 @@ CS.QUIT >LDYA pFILE
*--------------------------------------
CS.SIG sec
rts
*--------------------------------------
.INB usr/src/shared/x.ispipein.s
*--------------------------------------
CS.END .EQ *
*--------------------------------------

View File

@ -105,34 +105,12 @@ CS.RUN inc ArgIndex
>STYA ZPNewPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP Pause...
bvs CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -338,6 +316,7 @@ CS.RUN.CheckOpt ldy #1
clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -104,18 +104,22 @@ CS.RUN ldy #S.PS.pStdOut
>LIBC FileNo
bcs .99
>PUSHYA
>PUSHEA.G STATBUF
>LIBC FStat
>KAPI GetFDByID
bcs .99
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
* cmp /S.STAT.MODE.REG
>STYA ZPPtr1
lda (ZPPtr1)
pha
>LDYA ZPPtr1
>LIBC Free
pla
* cmp #S.FD.T.REG
beq .10
cmp /S.STAT.MODE.FIFO
cmp #S.FD.T.PIPE
bne .1
.10 dec bToFile
@ -127,7 +131,7 @@ CS.RUN ldy #S.PS.pStdOut
bcs .6
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
@ -149,7 +153,7 @@ CS.RUN ldy #S.PS.pStdOut
>PUSHBI 0
>LIBC PrintF
>SR
lda #E.SYN
sec
rts
@ -158,11 +162,11 @@ CS.RUN ldy #S.PS.pStdOut
tax
* sec
ror $0,x
iny
lda (ZPPtr1),y
bne .20
bra .1
*--------------------------------------
.4 >LDYA ZPPtr1
@ -180,7 +184,7 @@ CS.RUN ldy #S.PS.pStdOut
iny
jsr A2osX.GetPSy
ply
jsr X.InitSrcDirYA
bcs .9
@ -204,32 +208,10 @@ CS.RUN.LOOP stz bPass2
.1 >SLEEP
ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcs .99 I/O error
tay
bne .2 no char
>LIBC GetChar
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .2
lda bPause
eor #$ff
sta bPause
bne .1
.2 bit bPause
bmi .1
jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP
*--------------------------------------
jsr X.GetEntry
bcs .6
@ -246,7 +228,7 @@ CS.RUN.LOOP stz bPass2
.4 ldy #S.STAT.MODE+1
lda (ZPFileStat),y
and #$70
lsr
lsr
@ -430,7 +412,7 @@ CS.RUN.PRINT.CDEV
bit bColumn
bpl .1
jmp CS.RUN.PRINT.CDEV1
.1 bit bFullPath
@ -444,7 +426,7 @@ CS.RUN.PRINT.CDEV
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.IncColCnt
bcs .9
jmp CS.RUN.PRINT.CDEVEND
.9 rts
@ -462,7 +444,7 @@ CS.RUN.PRINT.CDEVEXT
>SR
jsr CS.RUN.PrintDates
ldy #COLOR.CDEV
jsr CS.RUN.SetColorY
@ -472,10 +454,10 @@ CS.RUN.PRINT.CDEV1
jsr CS.RUN.FN2LineBuf
jsr CS.RUN.LineBufOut
bcs .9
jmp CS.RUN.PRINT.CDEVEND
.9 rts
.9 rts
*--------------------------------------
CS.RUN.PRINT.BDEV
clc
@ -593,7 +575,7 @@ CS.RUN.ENTER.MSG
jsr CS.RUN.LineBufYAOut
>LDYA.G pSrcBasePath
jsr CS.RUN.LineBufYAOut
ldy #0
@ -706,7 +688,7 @@ CS.RUN.PrintDates
lda #0
adc ZPFileStat+1
sta ZPPtr1+1
>SS
>PUSHW ZPLineBufPtr
@ -871,6 +853,7 @@ CS.RUN.LineBufFlush1
CS.RUN.LineBufOut
lda #C.CR
jsr CS.RUN.LineBufCOut
bit bToFile
bmi .1
@ -881,7 +864,7 @@ CS.RUN.LineBufOut
sta (ZPLineBufPtr)
>SS
>LDYA ZPLineBuf
>STYA ZPLineBufPtr
>PUSHYA
@ -892,7 +875,7 @@ CS.RUN.LineBufOut
dey
jsr A2osX.GetPSy
>PUSHA
>LIBC FPutS
>SR
rts
@ -967,6 +950,8 @@ CS.QUIT jsr X.LeaveSubDir
.8 clc
rts
*--------------------------------------
.INB usr/src/shared/x.ispipein.s
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -7,7 +7,6 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
@ -99,9 +98,12 @@ CS.RUN inc ArgIndex
.5 >LDA.G hSrcBasePath
bne .6
ldy #S.PS.hCWD
lda (pPS),y
>SYSCALL GetMemPtr
ldy #S.PS.pCWD
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>STYA ZPPtr1
.6 >LDYAI 256
@ -134,8 +136,12 @@ CS.RUN inc ArgIndex
>STYA ZPFileBuf
*--------------------------------------
CS.RUN.LOOP jsr CS.RUN.CheckSTDIN
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP
jsr X.GetEntry
bcs .9
@ -176,39 +182,6 @@ CS.RUN.LOOP jsr CS.RUN.CheckSTDIN
sec
.99 rts
*--------------------------------------
CS.RUN.CheckSTDIN
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
bcs .9
tay
bne .1
>SYSCALL GetChar
bcs .9
cmp #$03 Ctrl-C
beq .9 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.CheckSTDIN
clc
rts
.1 lda bPause
bne CS.RUN.CheckSTDIN Pause...
* clc
.9 rts
*--------------------------------------
CS.RUN.DIR lda bRecurse
bpl .8
@ -407,9 +380,10 @@ CS.RUN.CheckOpt ldy #1
clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END
CS.END .EQ *
*--------------------------------------
OptionList .AS "CRcr"
OptionVars .DA #bContinue,#bRecurse

View File

@ -277,11 +277,9 @@ CS.RUN.CHECKPS lda (ZPPTR1) Get flags
*--------------------------------------
CS.RUN.CheckStop
lda bSTOP
beq .2
beq .8
.1 >SLEEP
>LIBC GetChar
.1 >LIBC GetChar
bcs .9
cmp #3 Ctrl-C
@ -289,32 +287,6 @@ CS.RUN.CheckStop
stz bSTOP
clc
rts
.2 ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcs .9
tay
bne .8 no char
>LIBC GetChar
bcs .9
cmp #3 Ctrl-C
beq .9 CS
cmp #$13 Ctrl-S
bne .8
dec bSTOP
.8 clc
.9 rts
*--------------------------------------

View File

@ -14,6 +14,7 @@ X.ENTER.SUBDIR .EQ 0
X.COPY.TO.DEST .EQ 1
X.DELETE.SOURCE .EQ 1
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.cpmvrm.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------

View File

@ -7,7 +7,6 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
@ -18,15 +17,15 @@ ArgIndex .BS 1
ArgPattern .BS 1
ZPPtr1 .BS 2
ZPBufPtr .BS 2
hFile .BS 1
hBuf .BS 1
pFile .BS 2
char .BS 1
LineCount .BS 2
bPause .BS 1
bPipe .BS 1
bIsTTY .BS 1
bNewLine .BS 1
bDummy .BS 1
ZS.END .ED
*--------------------------------------
@ -34,21 +33,21 @@ ZS.END .ED
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
.DA #$61 6502,Level 1 (65c02)
.DA #2 BIN Layout Version 2
.DA #0
.DA #0
.DA CS.END
.DA ID.END
.DA DS.END
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.SIG
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.CRLF .DA MSG.CRLF
@ -58,11 +57,9 @@ L.MSG.LINENUM .DA MSG.LINENUM
CS.INIT clc
rts
*--------------------------------------
CS.RUN stz bPipe
stz bIsTTY
stz bNewLine
inc bNewLine
jsr CS.RUN.ISATTY
CS.RUN inc bNewLine
jsr CS.RUN.ISATTY
jsr CS.RUN.CheckArgs
bcs CS.RUN.LOOP.RTS
@ -70,37 +67,14 @@ CS.RUN stz bPipe
stz LineCount+1
inc LineCount
CS.RUN.LOOP lda bPipe If reading from pipe
bne .2 No ^C/^S handling
CS.RUN.LOOP >SLEEP
ldy #S.PS.hStdIn
lda (pPS),y
>LIBC FEOF
bcs .9 I/O Error
jsr X.CheckCtrl
bcs .9
bvs CS.RUN.LOOP
tay
bne .1 No char
>LIBC GetChar
bcs .9 I/O error
cmp #$03 Ctrl-C
beq .9
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP
.2 >SLEEP
lda hFile
>LDYA pFile
>LIBC GetC
bcs .7
@ -154,32 +128,22 @@ CS.RUN.CheckArgs
lda #$80
sta bDummy-1,x
bra CS.RUN.CheckArgs
.4 lda hFile
*--------------------------------------
.4 lda pFile+1
bne .80
ldy #S.PS.hStdIn
lda (pPS),y
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
jsr X.IsPipeIn
bcs .99
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
sty hFile
inc bPipe
bvc .97
>STYA pFile
.80 >LDYAI 256
>LIBC GetMem
>LIBC Malloc
bcs .9
>STYA ZPBufPtr
stx hBuf
* clc
@ -193,7 +157,7 @@ CS.RUN.CheckArgs
>LIBC PrintF
pla
sec
rts
.99 rts
*--------------------------------------
CS.RUN.NextArg inc ArgIndex
lda ArgIndex
@ -204,14 +168,16 @@ CS.RUN.NextArg inc ArgIndex
.9 rts
*--------------------------------------
CS.RUN.OPEN >PUSHYA
CS.RUN.OPEN >SS
>PUSHYA
>PUSHBI O.RDONLY+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>LIBC FOpen
bcs .9
>SR
bcs .9
sta hFile
>STYA pFile
.9 rts
*--------------------------------------
@ -274,21 +240,26 @@ CS.RUN.PRINTBYTE
inc LineCount+1
.9 rts
*--------------------------------------
CS.DOEVENT sec
CS.SIG sec
rts
*--------------------------------------
CS.END
.INB usr/src/shared/x.ispipein.s
.INB usr/src/shared/x.checkctrl.s
*--------------------------------------
OptionList .AS "x"
CS.END .EQ *
*--------------------------------------
OptionList .AS "Xx"
OptionList.Cnt .EQ *-OptionList
*--------------------------------------
MSG.USAGE .CS "Usage : NL <File> or CMD|NL"
MSG.CRLF .CZ "\r\n"
MSG.LINENUM .CZ "%5D "
*--------------------------------------
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
DS.START
STATBUF .BS S.STAT
DS.END .ED
*--------------------------------------
MAN

View File

@ -28,20 +28,20 @@ ZS.END .ED
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #2 BIN Layout Version 2
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data Segment Size
.DA #16 Stack Size
.DA CS.END
.DA ID.END
.DA DS.END
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.SIG
.DA CS.QUIT
L.MSG.READ.KO .DA MSG.READ.KO
L.MSG.READ.OK1 .DA MSG.READ.OK1
@ -55,10 +55,9 @@ L.MSG.CRLF .DA MSG.CRLF
CS.INIT clc
rts
*--------------------------------------
CS.RUN ldy #S.PS.ARGC
lda (pPS),y
cmp #1
bcs CS.RUN.SET
CS.RUN lda #1
>LIBC ArgV
bcc CS.RUN.SET
CS.RUN.READ jsr NSC.Init
jsr NSC.Read
@ -71,25 +70,22 @@ CS.RUN.READ jsr NSC.Init
dex
bpl .1
>PUSHW L.MSG.READ.KO
>PUSHBI 0
>LIBC PrintF
>LDYA L.MSG.READ.KO
>LIBC PutS
lda #MLI.E.NODEV
sec
rts
.8 jsr NSC.Dump
>PUSHW L.MSG.USAGE
>PUSHBI 0
>LIBC PrintF
>LDYA L.MSG.USAGE
>LIBC PutS
lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
rts
CS.RUN.SET lda #1
>LIBC ArgV
>STYA ZPPtr1
*--------------------------------------
CS.RUN.SET >STYA ZPPtr1
>LIBC StrLen
cpy #17
bne .9
@ -164,7 +160,7 @@ CS.RUN.SET lda #1
sec
rts
*--------------------------------------
CS.DOEVENT sec
CS.SIG sec
rts
*--------------------------------------
CS.QUIT clc
@ -300,7 +296,8 @@ NSC.Select sta NSC.IOBASE
rts
*--------------------------------------
NSC.Dump >PUSHW L.MSG.READ.OK1
NSC.Dump >SS
>PUSHW L.MSG.READ.OK1
ldx #1
ldy #1
lda DS121x.DATA1+3
@ -320,6 +317,7 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
>PUSHBI 2
>LIBC PrintF
>SR
>LDYA L.MSG.READ.OK2.24
bit DS121x.DATA1+4
@ -329,9 +327,11 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
.3 >LIBC PutS
>SS
>PUSHW L.MSG.READ.OK3
>PUSHBI 0
>LIBC PrintF
>SR
lda DS121x.DATA1
jsr PrintBCD
@ -375,9 +375,11 @@ NSC.Dump >PUSHW L.MSG.READ.OK1
lda DS121x.DATA1+7
jsr PrintBCD
>SS
>PUSHW L.MSG.CRLF
>PUSHBI 0
>LIBC PrintF
>SR
rts
*--------------------------------------
PrintBCD pha
@ -424,18 +426,23 @@ IsDigit cmp #'0'
.9 sec
rts
*--------------------------------------
CS.END
CS.END .EQ *
*--------------------------------------
MSG.READ.KO .CZ "DS1216E Not Detected.\r\n"
MSG.READ.OK1 .CZ "DS1216E Detected : /OSC=%d, /RST=%d, mode="
MSG.READ.OK2.12 .CZ "am/pm"
MSG.READ.OK2.24 .CZ "24h"
MSG.READ.OK3 .CZ "\r\nCurrent Date/Time : "
MSG.USAGE .CS "\r\nTo Reset the chip and set clock, type:\r\nNSCUTIL YY/MM/DD,hh:mm:ss"
MSG.USAGE .CS "\r\nTo Reset the chip and set clock, type:\r\n"
.CS " nscutil YY/MM/DD,hh:mm:ss"
MSG.CRLF .CZ "\r\n"
DS121x.SIG .HS 5CA33AC55CA33AC5 Reverted 7->0
*--------------------------------------
DS.START
DS.END
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/nscutil.s

View File

@ -62,42 +62,18 @@ CS.RUN jsr CS.RUN.ISATTY
jsr CS.RUN.CheckArgs
bcs CS.RUN.LOOP.RTS
*--------------------------------------
CS.RUN.LOOP bit bIsPipe If reading from pipe
bpl .2 No ^C/^S handling
ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcs .9 I/O Error
.1 >SLEEP
tay
bne .1 No char
jsr X.CheckCtrl
bcs .99
bvs .1
>LIBC GetChar
bcs .9 I/O error
cmp #$03 Ctrl-C
beq .9
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP
.2 >SLEEP
>LDYA pFile
.2 >LDYA pFile
>LIBC GetC
bcs .7
@ -112,6 +88,8 @@ CS.RUN.LOOP bit bIsPipe If reading from pipe
.8 lda #0 Exit with no Error
.9 sec
.99
CS.RUN.LOOP.RTS rts
*--------------------------------------
CS.RUN.CheckArgs
@ -131,7 +109,7 @@ CS.RUN.CheckArgs
>STYA pFile
bra CS.RUN.CheckArgs
*--------------------------------------
.1 ldy #1
lda (ZPPtr1),y
@ -153,7 +131,7 @@ CS.RUN.CheckArgs
lda #$80
sta bDummy-1,x
bra CS.RUN.CheckArgs
*--------------------------------------
.4 lda pFile+1
beq .98
@ -198,43 +176,6 @@ CS.RUN.OPEN >SS
.9 rts
*--------------------------------------
CS.RUN.IsPipe ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FileNo
bcs .9
>SS
>PUSHYA
>PUSHEA.G STATBUF
>LIBC FStat
>SR
bcs .9
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
cmp /S.STAT.MODE.FIFO
bne .8
ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>STYA pFile
dec bIsPipe
.8 clc
.9 rts
*--------------------------------------
CS.RUN.ISATTY ldy #S.PS.pStdOut
jsr A2osX.GetPSy
pha
@ -374,6 +315,9 @@ CS.RUN.FINISHUP
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
.INB usr/src/shared/x.ispipein.s
.INB usr/src/shared/x.checkctrl.s
*--------------------------------------
CS.END .EQ *
*--------------------------------------

View File

@ -14,6 +14,7 @@ X.ENTER.SUBDIR .EQ 0
X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 1
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.cpmvrm.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------

View File

@ -105,35 +105,13 @@ CS.RUN inc ArgIndex
>STYA ZPNewPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP Pause...
tay
bne .1
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs CS.RUN.LEAVE
@ -355,6 +333,7 @@ CS.RUN.CheckOpt ldy #1
clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -7,7 +7,6 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
@ -29,7 +28,7 @@ ZPRelPath .BS 2
ZPFileBuf .BS 2
ArgIndex .BS 1
hFile .BS 1
pFile .BS 2
FilePos .BS 4
@ -46,19 +45,20 @@ ZS.END .ED
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #2 BIN Layout Version 2
.DA #0
.DA #0
.DA CS.END
.DA ID.END
.DA DS.END
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.SIG
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.CRLF .DA MSG.CRLF
@ -70,7 +70,7 @@ CS.INIT clc
*--------------------------------------
CS.RUN inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
>LIBC ArgV
bcs .5
>STYA ZPPtr1
@ -82,12 +82,13 @@ CS.RUN inc ArgIndex
bcc CS.RUN
.9 >LDYA L.MSG.USAGE
>SYSCALL PutS
>LIBC PutS
lda #E.SYN
sec
rts
.4 >LDA.G hSrcBasePath
.4 >LDYA.G pSrcBasePath
cmp #0
bne .9
>LDYA ZPPtr1
@ -96,22 +97,24 @@ CS.RUN inc ArgIndex
.99 rts
*--------------------------------------
.5 >LDA.G hSrcBasePath
.5 >LDA.G pSrcBasePath+1
bne .6
ldy #S.PS.hCWD
lda (pPS),y
>SYSCALL GetMemPtr
ldy #S.PS.pCWD
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>STYA ZPPtr1
.6 >LDYAI 256
>SYSCALL Malloc
>LIBC Malloc
bcs .99
>STYA ZPFullPath
>LDA.G hSrcBasePath
>SYSCALL GetMemPtr
>LDYA.G pSrcBasePath
>STYA ZPPtr1
ldy #$ff
@ -129,13 +132,17 @@ CS.RUN inc ArgIndex
sta ZPRelPath+1
>LDYAI 256
>SYSCALL Malloc
>LIBC Malloc
bcs .99
>STYA ZPFileBuf
*--------------------------------------
CS.RUN.LOOP jsr CS.RUN.CheckSTDIN
CS.RUN.LOOP >SLEEP
jsr X.CheckCtrl
bcs .99
bvs CS.RUN.LOOP
jsr X.GetEntry
bcs .9
@ -176,39 +183,6 @@ CS.RUN.LOOP jsr CS.RUN.CheckSTDIN
sec
.99 rts
*--------------------------------------
CS.RUN.CheckSTDIN
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
bcs .9
tay
bne .1
>SYSCALL GetChar
bcs .9
cmp #$03 Ctrl-C
beq .9 Abort....
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.CheckSTDIN
clc
rts
.1 lda bPause
bne CS.RUN.CheckSTDIN Pause...
* clc
.9 rts
*--------------------------------------
CS.RUN.DIR lda bRecurse
bpl .8
@ -255,10 +229,10 @@ CS.RUN.FILE jsr X.IncludeMatch
.99 rts
*--------------------------------------
CS.RUN.FILE.LOOP
.1 >PUSHB hFile
.1 >PUSHW pFile
>PUSHW ZPFileBuf
>PUSHWI 256
>SYSCALL FRead
>LIBC FRead
bcs .8
>STYA ByteCnt
@ -268,10 +242,10 @@ CS.RUN.FILE.LOOP
jsr CS.RUN.FSeek
bcs .99
>PUSHB hFile
>PUSHW pFile
>PUSHW ZPFileBuf
>PUSHW ByteCnt
>SYSCALL FWrite
>LIBC FWrite
bcs .99
lda ByteCnt
@ -317,7 +291,7 @@ CS.RUN.CheckErr bcc .9
>PUSHW L.MSG.ERR
>PUSHA
>PUSHBI 1
>SYSCALL PrintF
>LIBC PrintF
lda bContinue
eor #$80
asl
@ -327,62 +301,51 @@ CS.RUN.CheckErr bcc .9
*--------------------------------------
CS.RUN.GetFilePath
>PUSHW ZPFullPath
>LDA.G hSrcBasePath
>SYSCALL GetMemPtr
>PUSHYA
>SYSCALL StrCpy
>PUSHW.G pSrcBasePath
>LIBC StrCpy
>PUSHW ZPFullPath
>PUSHW ZPFileName
>SYSCALL StrCat
>LIBC StrCat
rts
*--------------------------------------
CS.RUN.OpenFile >PUSHW ZPFullPath
>PUSHBI O.RDWR+O.APPEND
>PUSHBI 0 Type
>PUSHWZ Aux type
>SYSCALL FOpen
>LIBC FOpen
bcs CS.RUN.FSeek.9
sta hFile
>STYA pFile
stz FilePos
stz FilePos+1
stz FilePos+2
stz FilePos+3
CS.RUN.FSeek >PUSHB hFile
CS.RUN.FSeek >PUSHW pFile
>PUSHL FilePos
>PUSHBI SEEK.SET
>SYSCALL fseek
>LIBC fseek
CS.RUN.FSeek.9 rts
*--------------------------------------
CS.RUN.CloseFile
lda hFile
>SYSCALL FClose
>LDYA pFile
>LIBC FClose
bcs .9
stz hFile
stz pFile+1
.9 rts
*--------------------------------------
CS.DOEVENT sec
CS.SIG sec
rts
*--------------------------------------
CS.QUIT jsr X.LeaveSubDir
bcc CS.QUIT
>LDA.G hInclude
beq .1
>SYSCALL FreeMem
.1 >LDYA ZPFileBuf
>SYSCALL Free
CS.QUIT jsr X.Quit
.2 >LDYA ZPFullPath
>SYSCALL Free
>LIBC Free
.8 clc
rts
@ -407,9 +370,10 @@ CS.RUN.CheckOpt ldy #1
clc
rts
*--------------------------------------
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END
CS.END .EQ *
*--------------------------------------
OptionList .AS "CRcr"
OptionVars .DA #bContinue,#bRecurse
@ -420,12 +384,12 @@ MSG.USAGE .CS "Usage : UNIX2MAC File(s) (*,? wildcards allowed)\r\n"
.CS " -R : Recurse subdirectories\r\n"
MSG.CRLF .CZ "\r\n"
MSG.ERR .CZ "[%h]\r\n"
*--------------------------------------
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
DS.START
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------
MAN

View File

@ -122,32 +122,11 @@ CS.RUN inc ArgIndex
>LDA.G pSrcBasePath+1
bne .6
ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>STYA ZPPtr1
>LIBC FileNo
bcs .99
>SS
>PUSHYA
>PUSHEA.G STATBUF
>LIBC FStat
>SR
jsr X.IsPipeIn
bcs .99
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
cmp /S.STAT.MODE.FIFO
bne .98
bvc .98
>LDYA ZPPtr1
>STYA pFile
jmp CS.RUN.PIPE
@ -175,35 +154,11 @@ CS.RUN inc ArgIndex
adc #0
sta ZPRelPath+1
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
CS.RUN.LOOP jsr X.CheckCtrl
bcs .99
tay
bne .10
bvs CS.RUN.LOOP Pause...
>LIBC GetChar
bcs .99
cmp #$03 Ctrl-C
beq .99 Abort....
cmp #$13 Ctrl-S
bne .10
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.10 lda bPause
bne CS.RUN.LOOP Pause...
*--------------------------------------
jsr X.GetEntry
bcs .9
@ -648,6 +603,8 @@ CS.RUN.CheckOpt ldy #1
clc
rts
*--------------------------------------
.INB usr/src/shared/x.ispipein.s
.INB usr/src/shared/x.checkctrl.s
.INB usr/src/shared/x.fileenum.s
*--------------------------------------
CS.END .EQ *

View File

@ -40,11 +40,6 @@ NEW
.MA SLEEP
jsr A2osX.SLEEP
.EM
*--------------------------------------
.MA LIBC2
ldx #_]1
jsr A2osX.LIBC2
.EM
*--------------------------------------
.MA KAPI2
ldx #]1_

View File

@ -262,7 +262,7 @@ D2.TrkFmt16s >GETSTKB 3
lda D2.TrkNum
sta X.TRKFMT.TrkNum
ldy #D2.TrkFormat.Size
ldy #X.TrkFmt.Size
.1 lda D2.TrkFormat-1,y
sta $1ff,y
@ -289,22 +289,38 @@ D2.TrkFmt16s >GETSTKB 3
* # D2TrkRead16s
* Write a track (16 sectors)
* PUSHB DSSS0000
* PUSHB HeadNum (0,1)
* PUSHB TrackNum
* PUSHW Ptr to 16*256 buffer
* PUSHW Ptr to 16b buffer
* PUSHW Ptr to 16*256b buffer
* ## RETURN VALUE
* CC : success, A = VolNum
* CS : A = Error
*\--------------------------------------
D2.TrkRead16s >GETSTKB 3
D2.TrkRead16s >GETSTKB 6
sta D2.DrvSlt
>GETSTKB 2
>GETSTKB 5
sta D2.HeadNum
>GETSTKB 4
sta D2.TrkNum
>GETSTKW 2
>STAX ZPPtr2
>GETSTKW
>STAX ZPPtr1
jsr D2.CheckDiskII
bcs .9
lda D2.VolNum
clc
.9
@ -478,8 +494,7 @@ D2.CheckDiskII lda D2.DrvSlt
clc
rts
.9 pla
lda #MLI.E.NODEV
.9 lda #MLI.E.NODEV
sec
rts
*--------------------------------------
@ -685,7 +700,7 @@ D2.WriteTrackPtr2
php
sei
ldy #D2.TrkWriter.Size
ldy #X.TrkW.Size
.1 lda D2.TrkWriter-1,y
sta $1ff,y

View File

@ -41,6 +41,7 @@ ZPPtr2 .EQ ZPLIB+2
ZPPtr3 .EQ ZPLIB+4
ZPPtr4 .EQ ZPLIB+6
X.TRkFMT.Z .EQ ZPLIB+8
X.TRkREAD.Z .EQ ZPLIB+8
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -375,92 +376,15 @@ CS.END .EQ *
* X = Slot Cn
*--------------------------------------
D2.TrkFormat .PH $200
D2.TrkFormat.Start
.INB usr/src/shared/x.trkfmt.s
D2.TrkFormat.Size .EQ *-D2.TrkFormat.Start
.EP
*--------------------------------------
* TrkWriter
* X = Slot Cn
* ZPPtr1 = Ptr To NibbleBuf
D2.TrkReader .PH $200
.INB usr/src/shared/x.trkr.s
.EP
*--------------------------------------
D2.TrkWriter .PH $200
D2.TrkWriter.Start
lda IO.D2.ReadProt,x
lda IO.D2.ReadMode,x
bmi .9 Write protected
ldy ZPPtr1
stz ZPPtr1
lda (ZPPtr1),y
iny
* bne .10 no chance this happens because mem blocks are $FFF0 aligned....
* inc ZPPtr1+1
*.10
cmp #$80 if CC, it is a sync byte
ora #$80 make sure Bit7 high
sta IO.D2.WriteMode,x (5) goto write mode
ora IO.D2.WShift,x (4)
nop (2)
bra .2 (3)
.1 lda (ZPPtr1),y (5) as NibbleBuf is page aligned, no page crossing
beq .8 (2)(3 if Z) END OF TRACK
* nobody will never try to write 00000000, right?
cmp #$80 (2) if CC, it is a sync byte
ora #$80 (2) make sure Bit7 high
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4) keep C unmodified
iny (2)
bne .2 (2)(3 if nz)
* 32us Byte,next page : 2 (beq failed)+5 +2+2+5+4+2+2 (bne failed) + 5 + 3 (bcs succeeded) = 32
inc ZPPtr1+1 (5)
bcs .1 (2)(3 if cs) regular 32us byte
* 40us Byte,next page : 2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
nop (2) Sync 40us byte : add 8 cycles
nop (2)
nop (2)
bra .1 (3)
* 32us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+3 (bne succeeded) + 2 +2 + 3 (bcs succeeded) = 32
.2 nop (2)
nop (2)
bcs .1 (2)(3 if cs) regular 32us byte
* 40us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
nop (2) Sync 40us byte : add 8 cycles
nop (2)
nop (2)
bra .1 (3)
.8 pha (3) make sure 32us elapsed before switching to read mode (beq(3)+pha(3)=beq(2)+cmp(2)+ora(2))
lda IO.D2.ReadMode,x close write mode
lda IO.D2.RData,x
pla from pha (3)
clc
rts
.9 lda #MLI.E.WRTPROT
sec
rts
D2.TrkWriter.Size .EQ *-D2.TrkWriter.Start
.INB usr/src/shared/x.trkw.s
.EP
*--------------------------------------
ADDR.Head .HS 96AAD5

View File

@ -38,7 +38,7 @@ CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #2 BIN Layout Version 2
.DA #S.PS.SIG.T1SEC
.DA #S.PS.SIG.T10TH
.DA #0
.DA CS.END
.DA ID.END

View File

@ -90,11 +90,12 @@ CS.RUN jsr CS.RUN.CheckOpt
>STYA pDstFullPath
.FIN
*--------------------------------------
CS.RUN.Loop jsr CS.RUN.CheckKey
CS.RUN.Loop >SLEEP
jsr X.CheckCtrl
bcs .99
bit bPause
bmi CS.RUN.Loop
bvs CS.RUN.Loop
jsr X.GetEntry
bcs .80
@ -375,8 +376,10 @@ CS.RUN.Copy >SS
lda #'.'
>LIBC PutChar
.2 jsr CS.RUN.CheckKey
.2 jsr X.CheckCtrl
bcs CS.RUN.CopyEnd
bvs .2
lda ZPPtr2+1
cmp PageCount
@ -561,35 +564,6 @@ CS.RUN.CheckOverwrite
.99 rts
.FIN
*--------------------------------------
CS.RUN.CheckKey ldy #S.PS.pStdIn
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>LIBC FEOF
bcs .9 I/O error
tay
bne .8
>LIBC GetChar
bcs .9 I/O error
cmp #$03 Ctrl-C
beq .9
cmp #$13 Ctrl-S
bne .8
lda bPause
eor #$ff
sta bPause
.8 clc
.9 rts
*--------------------------------------
CS.RUN.CheckOpt jsr CS.RUN.NextOpt
bcs .7

View File

@ -43,7 +43,7 @@ X.IsPipeY jsr A2osX.GetPSy
.8 clc
rts
.98 sec
sec
.99 rts
*--------------------------------------
MAN

View File

@ -1,50 +1,50 @@
NEW
AUTO 3,1
*--------------------------------------
X.TRKFMT.VolNum .EQ X.TRKFMT.Z
X.TRKFMT.TrkNum .EQ X.TRKFMT.Z+1
X.TRKFMT.SectNum .EQ X.TRKFMT.Z+2
X.TRKFMT.CheckSum .EQ X.TRKFMT.Z+3
X.TrkFmt.VolNum .EQ X.TrkFmt.Z
X.TrkFmt.TrkNum .EQ X.TrkFmt.Z+1
X.TrkFmt.SectNum .EQ X.TrkFmt.Z+2
X.TrkFmt.CheckSum .EQ X.TrkFmt.Z+3
*--------------------------------------
X.TRKFMT lda #$ff
X.TrkFmt lda #$ff
sta IO.D2.WriteMode,x goto write mode
ora IO.D2.WShift,x (4)
jsr X.TRKFMT.W14 (14)
jsr X.TrkFmt.W14 (14)
lda #0 (2)
sta X.TRKFMT.SectNum (3)
sta X.TrkFmt.SectNum (3)
ldy #0 (2) 256 SyncBytes
jsr X.TRKFMT.SyncBytes (15..15)
jsr X.TrkFmt.SyncBytes (15..15)
nop (2)
nop (2)
nop (2)
nop (2)
.1 jsr X.TRKFMT.AddrField (17..15)
.1 jsr X.TrkFmt.AddrField (17..15)
ldy #6 (2)
jsr X.TRKFMT.SyncBytes (15..15)
jsr X.TrkFmt.SyncBytes (15..15)
jsr X.TRKFMT.W14 (14)
jsr X.TrkFmt.W14 (14)
ldy #2 (2)
.2 lda X.TRKFMT.DATA,y (4)
.2 lda X.TrkFmt.DATA,y (4)
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4)
dey (2)
bmi .22 (3-)
jsr X.TRKFMT.W12 (12)
jsr X.TrkFmt.W12 (12)
bra .2 (3)
.22 jsr X.TRKFMT.W14 (14)
.22 jsr X.TrkFmt.W14 (14)
ldy #86 (2) 256+86...
lda #$96 (2)
@ -55,7 +55,7 @@ X.TRKFMT lda #$ff
nop (2)
bra .3 (3)
.3 jsr X.TRKFMT.W14 (14)
.3 jsr X.TrkFmt.W14 (14)
nop (2)
@ -70,7 +70,7 @@ X.TRKFMT lda #$ff
.4 nop (2)
.5 jsr X.TRKFMT.W14 (14)
.5 jsr X.TrkFmt.W14 (14)
lda #$96 (2)
sta IO.D2.WLoad,x (5)
@ -79,15 +79,15 @@ X.TRKFMT lda #$ff
dey (2)
bne .4 (3)-
inc X.TRKFMT.SectNum (5)
inc X.TrkFmt.SectNum (5)
jsr X.TRKFMT.EndMark (19..15)
jsr X.TrkFmt.EndMark (19..15)
ldy #16 (2)
jsr X.TRKFMT.SyncBytes (15..15)
jsr X.TrkFmt.SyncBytes (15..15)
lda X.TRKFMT.SectNum (3)
lda X.TrkFmt.SectNum (3)
cmp #16 (2)
bne .1 (3-)
@ -96,7 +96,7 @@ X.TRKFMT lda #$ff
rts
*--------------------------------------
X.TRKFMT.SyncBytes
X.TrkFmt.SyncBytes
nop (2)
lda #$ff (2)
@ -106,67 +106,67 @@ X.TRKFMT.SyncBytes
dey (2)
beq .8 (3-)
jsr X.TRKFMT.W12 (12)
jsr X.TRKFMT.W12 (12)
jsr X.TrkFmt.W12 (12)
jsr X.TrkFmt.W12 (12)
bra .1 (3)
.8 rts (6)
*--------------------------------------
X.TRKFMT.AddrField
X.TrkFmt.AddrField
ldy #2 (2)
.1 lda X.TRKFMT.ADDR,y (4)
.1 lda X.TrkFmt.ADDR,y (4)
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4)
dey (2)
bmi .2 (3-)
lda X.TRKFMT.VolNum (3)
eor X.TRKFMT.TrkNum (3)
eor X.TRKFMT.SectNum (3)
sta X.TRKFMT.Checksum (3)
lda X.TrkFmt.VolNum (3)
eor X.TrkFmt.TrkNum (3)
eor X.TrkFmt.SectNum (3)
sta X.TrkFmt.Checksum (3)
bra .1 (3)
.2 lda X.TRKFMT.VolNum (3)
lda X.TRKFMT.VolNum (3)
jsr X.TRKFMT.W4x4 (17..12)
.2 lda X.TrkFmt.VolNum (3)
lda X.TrkFmt.VolNum (3)
jsr X.TrkFmt.W4x4 (17..12)
lda X.TRKFMT.TrkNum (3)
jsr X.TRKFMT.W4x4 (17..12)
lda X.TrkFmt.TrkNum (3)
jsr X.TrkFmt.W4x4 (17..12)
lda X.TRKFMT.SectNum (3)
jsr X.TRKFMT.W4x4 (17..12)
lda X.TrkFmt.SectNum (3)
jsr X.TrkFmt.W4x4 (17..12)
lda X.TRKFMT.Checksum (3)
jsr X.TRKFMT.W4x4 (17..12)
lda X.TrkFmt.Checksum (3)
jsr X.TrkFmt.W4x4 (17..12)
pha (3)
pla (4)
*--------------------------------------
X.TRKFMT.EndMark
X.TrkFmt.EndMark
ldy #2 (2)
nop (2)
.1 lda X.TRKFMT.END,y (4)
.1 lda X.TrkFmt.END,y (4)
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4)
dey (2)
bmi .8 (3-)
jsr X.TRKFMT.W12 (12)
jsr X.TrkFmt.W12 (12)
bra .1 (3)
.8 rts (6)
*--------------------------------------
X.TRKFMT.W4x4 tay (2)
X.TrkFmt.W4x4 tay (2)
lsr (2)
ora #$AA (2)
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4)
jsr X.TRKFMT.W12 (12)
jsr X.TrkFmt.W12 (12)
pha (3)
pla (4)
@ -177,17 +177,18 @@ X.TRKFMT.W4x4 tay (2)
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4)
X.TRKFMT.W14 nop (2)
X.TrkFmt.W14 nop (2)
X.TRKFMT.W12 rts (6)
X.TrkFmt.W12 rts (6)
*--------------------------------------
.LIST ON
X.TRKFMT.ADDR .HS 96AAD5
X.TRKFMT.DATA .HS ADAAD5
X.TRKFMT.END .HS EBAADE
X.TrkFmt.ADDR .HS 96AAD5
X.TrkFmt.DATA .HS ADAAD5
X.TrkFmt.END .HS EBAADE
X.TrkFmt.Size .EQ *-X.TrkFmt
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/shared/x.trkfmt.s
LOAD usr/src/basic.fx/basic.s
LOAD usr/src/lib/libblkdev.s
ASM

349
SHARED/X.TRKREAD.S.txt Normal file
View File

@ -0,0 +1,349 @@
NEW
AUTO 3,1
*--------------------------------------
X.TRKREAD.VolNum .EQ X.TRKREAD.Z
X.TRKREAD.SectNum .EQ X.TRKREAD.Z+1
X.TRKREAD.TrkNum .EQ X.TRKREAD.Z+3
X.TRKREAD.CheckSum .EQ X.TRKREAD.Z+3
X.TRKREAD.Cnt .EQ X.TRKREAD.Z+4
X.TRKREAD.SectCnt .EQ X.TRKREAD.Z+6
X.TRKREAD.TmpByte .EQ X.TRKREAD.Z+7
*--------------------------------------
* ZPPtr1 = DstSectBuf (4096)
* ZPPtr2 = DstOrderBuf (16)
* X = SlotN0
*--------------------------------------
X.TRKREAD stz X.TRKREAD.SectCnt
.1 jsr X.TRKREAD.A
bne .9
lda X.TRKREAD.SectNum
ldy X.TRKREAD.SectCnt
sta (ZPPtr2),y
jsr X.TRKREAD.D
bcs .9
inc ZPPtr1+1
inc X.TRKREAD.SectCnt
lda X.TRKREAD.SectCnt
cmp #16
bcc .1
lda X.TRKREAD.VolNum
clc
rts
.9 lda #MLI.E.IO
sec
rts
*--------------------------------------
X.TRKREAD.A stz X.TRKREAD.Cnt
lda #$F8 read up to 8192 nibbles
sta X.TRKREAD.Cnt+1
.1 inc X.TRKREAD.Cnt
bne .2
inc X.TRKREAD.Cnt+1
beq .9
.2 lda IO.D2.RData,x
bpl .1
.3 cmp #$D5
bne .1
nop
.4 lda IO.D2.RData,x
bpl .4
cmp #$AA
bne .3
ldy #3
.5 lda IO.D2.RData,x
bpl .5
cmp #$96
bne .3
lda #0
.6 sta X.TRKREAD.CheckSum
.7 lda IO.D2.RData,x
bpl .7
rol
sta X.TRKREAD.TmpByte
.8 lda IO.D2.RData,x
bpl .8
and X.TRKREAD.TmpByte
sta X.TRKREAD.VolNum,y
eor X.TRKREAD.CheckSum
dey
bpl .6
tay
bne .9
clc
rts
.9 sec
rts
*--------------------------------------
X.TRKREAD.D txa
ora #$8C
sta rd4+1
sta rd5+1
sta rd6+1
sta rd7+1
sta rd8+1
lda ZPPtr1
ldy ZPPtr1+1
sta ref3+1
sty ref3+2
sec
sbc #$54
bcs L571F
dey
L571F sta ref2+1
sty ref2+2
sec
sbc #$57
bcs L572B
dey
L572B sta ref1+1
sty ref1+2
ldy #$20
L5733 dey
beq L576D
L5736 lda IO.D2.RData,x
bpl L5736
L573B eor #$D5
bne L5733
nop
L5740 lda IO.D2.RData,x
bpl L5740
cmp #$AA
bne L573B
nop
L574A lda IO.D2.RData,x
bpl L574A
cmp #$AD
bne L573B
*--------------------------------------
ldy #$AA
lda #$00
L5757 sta X.TRKREAD.TmpByte
rd4 ldx IO.D2.RData+$60 SELF MODIFIED
bpl rd4
lda X.Nib2FC-$96,x
sta X.Buf86-$AA,y
eor X.TRKREAD.TmpByte
iny
bne L5757
ldy #$AA
bne rd5
L576D sec
rts
*--------------------------------------
ref1 sta $1000,y SELF MODIFIED
rd5 ldx IO.D2.RData+$60 SELF MODIFIED
bpl rd5
eor X.Nib2FC-$96,x
ldx X.Buf86-$AA,y
eor X.dnibl2,x
iny
bne ref1
pha
and #$FC
ldy #$AA
rd6 ldx IO.D2.RData+$60 SELF MODIFIED
bpl rd6
eor X.Nib2FC-$96,x
ldx X.Buf86-$AA,y
eor X.dnibl3,x
ref2 sta $1000,y SELF MODIFIED
iny
bne rd6
rd7 ldx IO.D2.RData+$60 SELF MODIFIED
bpl rd7
and #$FC
ldy #$AC
L57A5 eor X.Nib2FC-$96,x
ldx X.Buf86-$AC,y
eor X.dnibl4,x
ref3 sta $1000,y SELF MODIFIED
rd8 ldx IO.D2.RData+$60 SELF MODIFIED
bpl rd8
iny
bne L57A5
and #$FC
eor X.Nib2FC-$96,x
clc
beq L57CD
sec
L57CD pla
ldy #$55
sta (ZPPtr1),y
rts
*--------------------------------------
X.Nib2FC .HS 0004
.HS FFFF
.HS 080C
.HS FF
.HS 101418
X.XX000000 .HS 008040C0
.HS FFFF
.HS 1C20
.HS FFFFFF
.HS 24282C3034
.HS FFFF
.HS 383C4044484C
.HS FF
.HS 5054585C606468
X.00XX0000 .HS 00201030
.HS FFFFFFFF
.HS 6C
.HS 00
.HS 707478
.HS FFFFFF
.HS 7C
.HS FFFF
.HS 8084
.HS FF
.HS 888C9094989CA0
X.0000XX00 .HS 0008040C
.HS FF
.HS A4A8AC
.HS FF
.HS B0B4B8BCC0C4C8
.HS FFFF
.HS CCD0D4D8DCE0
.HS 00
.HS E4E8ECF0F4F8FC
*--------------------------------------
X.dnibl2 .HS 00
X.dnibl3 .HS 00
X.dnibl4 .HS 00
X.FC2Nib .HS 96
.HS 02000097
.HS 0100009A
.HS 0300009B
.HS 0002009D
.HS 0202009E
.HS 0102009F
.HS 030200A6
.HS 000100A7
.HS 020100AB
.HS 010100AC
.HS 030100AD
.HS 000300AE
.HS 020300AF
.HS 010300B2
.HS 030300B3
.HS 000002B4
.HS 020002B5
.HS 010002B6
.HS 030002B7
.HS 000202B9
.HS 020202BA
.HS 010202BB
.HS 030202BC
.HS 000102BD
.HS 020102BE
.HS 010102BF
.HS 030102CB
.HS 000302CD
.HS 020302CE
.HS 010302CF
.HS 030302D3
.HS 000001D6
.HS 020001D7
.HS 010001D9
.HS 030001DA
.HS 000201DB
.HS 020201DC
.HS 010201DD
.HS 030201DE
.HS 000101DF
.HS 020101E5
.HS 010101E6
.HS 030101E7
.HS 000301E9
.HS 020301EA
.HS 010301EB
.HS 030301EC
.HS 000003ED
.HS 020003EE
.HS 010003EF
.HS 030003F2
.HS 000203F3
.HS 020203F4
.HS 010203F5
.HS 030203F6
.HS 000103F7
.HS 020103F9
.HS 010103FA
.HS 030103FB
.HS 000303FC
.HS 020303FD
.HS 010303FE
.HS 030303FF
*--------------------------------------
X.Buf86 .BS 86
*--------------------------------------
.LIST ON
X.TRKREAD.L .EQ *-X.TRKREAD
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/shared/x.trkread.s
LOAD usr/src/lib/libblkdev.s
ASM

86
SHARED/X.TRKRR.S.txt Normal file
View File

@ -0,0 +1,86 @@
NEW
AUTO 3,1
*--------------------------------------
* In:
* X = Slotn0
* ZPPtr1 = pDstBuf
* Uses:
* ZPPtr2 = Cnt
*--------------------------------------
X.TrkR.CheckSum .EQ X.TrkFmt.Z
X.TrkR.SectNum .EQ X.TrkFmt.Z+1
X.TrkR.TrkNum .EQ X.TrkFmt.Z+2
X.TrkR.VolNum .EQ X.TrkFmt.Z+3
X.TrkR.TmpByte .EQ X.TrkFmt.Z+4
*--------------------------------------
X.TrkR
*--------------------------------------
X.TrkR.A stz ZPPtr2
lda #$F8 read up to 8192 nibbles
sta ZPPtr2+1
.1 inc ZPPtr2
bne .2
inc ZPPtr2+1
beq .9
.2 lda IO.D2.RData,x
bpl .1
.3 cmp #$D5
bne .1
nop
.4 lda IO.D2.RData,x
bpl .4
cmp #$AA
bne .3
ldy #3
.5 lda IO.D2.RData,x
bpl .5
cmp #$96
bne .3
lda #0
.6 sta X.TrkR.CheckSum
.7 lda IO.D2.RData,x
bpl .7
rol
sta X.TrkR.TmpByte
.8 lda IO.D2.RData,x
bpl .8
and X.TrkR.TmpByte
sta X.TrkR.VolNum,y
eor X.TrkR.CheckSum
dey
bpl .6
tay
bne .9
clc
rts
.9 sec
rts
*--------------------------------------
.LIST ON
X.TrkR.Size .EQ *-X.TrkR
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/shared/x.trkr.s
LOAD usr/src/lib/libblkdev.s
ASM

88
SHARED/X.TRKW.S.txt Normal file
View File

@ -0,0 +1,88 @@
NEW
AUTO 3,1
*--------------------------------------
* In:
* X = Slotn0
* ZPPtr1 = pSrcBuf
*--------------------------------------
X.TrkW lda IO.D2.ReadProt,x
lda IO.D2.ReadMode,x
bmi .9 Write protected
ldy ZPPtr1
stz ZPPtr1
lda (ZPPtr1),y
iny
* bne .10 no chance this happens because mem blocks are $FFF0 aligned....
* inc ZPPtr1+1
*.10
cmp #$80 if CC, it is a sync byte
ora #$80 make sure Bit7 high
sta IO.D2.WriteMode,x (5) goto write mode
ora IO.D2.WShift,x (4)
nop (2)
bra .2 (3)
.1 lda (ZPPtr1),y (5) as NibbleBuf is page aligned, no page crossing
beq .8 (2)(3 if Z) END OF TRACK
* nobody will never try to write 00000000, right?
cmp #$80 (2) if CC, it is a sync byte
ora #$80 (2) make sure Bit7 high
sta IO.D2.WLoad,x (5)
ora IO.D2.WShift,x (4) keep C unmodified
iny (2)
bne .2 (2)(3 if nz)
* 32us Byte,next page : 2 (beq failed)+5 +2+2+5+4+2+2 (bne failed) + 5 + 3 (bcs succeeded) = 32
inc ZPPtr1+1 (5)
bcs .1 (2)(3 if cs) regular 32us byte
* 40us Byte,next page : 2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
nop (2) Sync 40us byte : add 8 cycles
nop (2)
nop (2)
bra .1 (3)
* 32us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+3 (bne succeeded) + 2 +2 + 3 (bcs succeeded) = 32
.2 nop (2)
nop (2)
bcs .1 (2)(3 if cs) regular 32us byte
* 40us Byte,same page : 5+2 (beq failed) +2+2+5+4+2+2 (bne failed) + 5 + 2 (bcs failed) +2+2+2+3 = 40
nop (2) Sync 40us byte : add 8 cycles
nop (2)
nop (2)
bra .1 (3)
.8 pha (3) make sure 32us elapsed before switching to read mode (beq(3)+pha(3)=beq(2)+cmp(2)+ora(2))
lda IO.D2.ReadMode,x close write mode
lda IO.D2.RData,x
pla from pha (3)
clc
rts
.9 lda #MLI.E.WRTPROT
sec
rts
*--------------------------------------
.LIST ON
X.TrkW.Size .EQ *-X.TrkW
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/shared/x.trkw.s
LOAD usr/src/lib/libblkdev.s
ASM

View File

@ -82,14 +82,6 @@ RAMSW.LibCall dec IRQ.InLib
bra RAMSW.Sleep2
*--------------------------------------
*RAMSW.JMPx sta IO.CLRREADAUX
* sta IO.CLRWRITEAUX
*
* sec data in AUX RAM
* ror A2osX.IOOpt
*
* jsr A2osX.LIBC2
RAMSW.2AUXRTS sta IO.SETREADAUX
sta IO.SETWRITEAUX