1
0
mirror of https://github.com/A2osX/A2osX.git synced 2025-04-15 01:37:15 +00:00

A2osX-1.00 PREVIEW : bugfix in KERNEL(rename),CUP,GREP,DU,OD,FORMAT

This commit is contained in:
burniouf 2025-01-25 13:24:13 +01:00
parent ade86cb9df
commit 414ee8b8d9
15 changed files with 583 additions and 334 deletions

File diff suppressed because it is too large Load Diff

@ -3,6 +3,42 @@
## Copyright
Copyright 2015 - 2020, Remy Gibert and the A2osX contributors.
# D2MotorControl
Switch On/off Drive Motor
PUSHB DSSS0000
PUSHB on/off
## RETURN VALUE
CC : success
CS : A = Error
# D2Recalibrate
Reset Drive head position
PUSHB DSSS0000
## RETURN VALUE
CC : success
CS : A = Error
# D2MoveHead
Select Drive head
PUSHB DSSS0000
PUSHB HeadNum
## RETURN VALUE
CC : success
CS : A = Error
# D2MoveHead
Move Drive head
PUSHB DSSS0000
PUSHB FromTrk
PUSHB ToTrk
## RETURN VALUE
CC : success
CS : A = Error
# D2TrkFmt16s
Write a track (16 sectors)
PUSHB DSSS0000
@ -56,10 +92,8 @@ int getprodoscatsize (short int options, short int catsize, int devsize );
## ASM
PUSHW = DevSize (in 512b blocks)
PUSHB = Catalog Size (in blocks)
PUSHB = Options
## RETURN VALUE
X=BlockCount (max 22)
Y,A=BufSize (max $4400)
# BuildProDOSCat

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -16,15 +16,17 @@ ZS.START
ZPPtr1 .BS 2
ZPBuf .BS 2
ZPBufPtr .BS 2
pFILEtoClose .BS 2
ArgIndex .BS 1
ArgLine .BS 1
OptionIdx .BS 1
hBuf .BS 1
FieldNum .BS 1
StartChar .BS 1
EndChar .BS 1
Separator .BS 1
hToClose .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -32,20 +34,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 SegmentSize
.DA CS.END
.DA ID.END
.DA DS.END
.DA #32 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
@ -57,117 +59,66 @@ CS.INIT clc
CS.RUN lda #C.SPACE
sta Separator
.10 jsr CS.RUN.NextArg
.1 jsr CS.RUN.NextArg
bcs .8
lda (ZPPtr1)
cmp #'-'
beq .1
beq .2
lda ArgIndex
sta ArgLine
bra .10
bra .1
.1 ldy #1
lda (ZPPtr1),y
.2 jsr CS.RUN.CheckOp
bcc .1 scan for any other args
ldx #OptionList.Cnt-1
.2 cmp OptionList,x
beq .3
dex
bpl .2
.97 lda #E.SYN
.98 pha
>LDYA L.MSG.USAGE
>LIBC PutS
pla
sec
.9 rts
.3 txa
lsr
beq .98 -H
cmp #4 -S
bne .4
jsr CS.RUN.NextArg
bcs .97
lda (ZPPtr1)
sta Separator
bra .10
.4 sta OptionIdx
jsr CS.RUN.NextArg
bcs .97
>LIBC AToI
bcs .97
tax
bne .97
tya
ldx OptionIdx
sta FieldNum-1,x
bra .10 scan for any other args
.99 rts
*--------------------------------------
.8 >LDYAI 256
>LIBC GetMem
bcs .9
>LIBC Malloc
bcs .99
>STYA ZPBuf
>STYA ZPBufPtr
stx hBuf
lda ArgLine
beq .80
>SS
>PUSHW ZPBufPtr
lda ArgLine
>LIBC ArgV
>PUSHYA
>LIBC StrCpy
>SR
jsr CS.RUN.OUT
bcs .9
bcs .99
lda #0 Exit with no Error
sec
rts
.80 ldy #S.PS.hStdIn
lda (pPS),y
tay
ldx FILEs.hFD-1,y
ldy FDs.pLO-1,x
lda FDs.pHI-1,x
>STYA ZPPtr1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne CS.RUN.LOOP
ldy #S.PS.hStdIn
lda (pPS),y
sta hToClose
*--------------------------------------
.80 jsr CS.RUN.CheckPipe
bcs .98
*--------------------------------------
CS.RUN.LOOP >SLEEP
ldy #S.PS.hStdIn
lda (pPS),y
>PUSHA
>LDYA ZPBuf
>STYA ZPBufPtr
>PUSHYA
>PUSHWI 255
>SS
>PUSHW ZPBuf
>PUSHWI 256
>PUSHW pFILEtoClose
>LIBC FGetS
>SR
bcs .8
lda (ZPBufPtr)
@ -224,10 +175,11 @@ CS.RUN.OUT ldx FieldNum
rts
*--------------------------------------
CS.RUN.PRINTCR >PUSHW L.MSG.CRLF
CS.RUN.PRINTCR >SS
>PUSHW L.MSG.CRLF
>PUSHBI 0
>LIBC PrintF
>SR
rts
*--------------------------------------
CS.RUN.OUT.MN ldy #0
@ -279,6 +231,89 @@ CS.RUN.NextArg inc ArgIndex
.9 rts
*--------------------------------------
CS.RUN.CheckOp ldy #1
lda (ZPPtr1),y
ldx #OptionList.Cnt-1
.2 cmp OptionList,x
beq .3
dex
bpl .2
.98 lda #E.SYN
sec
.99 rts
.3 txa
lsr
beq .98 -H
cmp #4 -S
bne .4
jsr CS.RUN.NextArg
bcs .98
lda (ZPPtr1)
sta Separator
clc
rts
.4 sta OptionIdx
jsr CS.RUN.NextArg
bcs .98
>LIBC AToI
bcs .99
tax
bne .98
tya
ldx OptionIdx
sta FieldNum-1,x
clc
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
>STYA pFILEtoClose
clc
rts
.98 lda #E.SYN
sec
.99 rts
*--------------------------------------
CS.RUN.AddYToBufPtr
tya
clc
@ -289,23 +324,23 @@ CS.RUN.AddYToBufPtr
inc ZPBufPtr+1
.8 rts
*--------------------------------------
CS.QUIT lda hToClose
CS.QUIT >LDYA pFILEtoClose
beq .1
>LIBC FClose Close the pipe
.1 lda hBuf
.1 >LDYA ZPBuf
beq .8
>LIBC FreeMem
>LIBC Free
.8 clc
rts
*--------------------------------------
CS.DOEVENT sec
CS.SIG sec
rts
*--------------------------------------
CS.END
CS.END .EQ *
*--------------------------------------
OptionList .AS "HhFfMmNnSs"
OptionList.Cnt .EQ *-OptionList
@ -317,10 +352,12 @@ MSG.USAGE .CS 'Usage : CUT "line of text"\r\n'
.CS " -N nn : Output Ending at nn\r\n"
.CS " -S ch : Change default SPACE separator to 'ch'"
MSG.CRLF .CZ "\r\n"
*--------------------------------------
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
DS.START
STATBUF .BS S.STAT
DS.END .ED
*--------------------------------------
MAN

@ -127,7 +127,7 @@ CS.RUN jsr CS.RUN.SetCRLF
rts
*--------------------------------------
.6 lda ArgDir do we have a Source dir ?
bne .8
bne CS.RUN.LOOP
ldy #S.PS.pCWD
jsr A2osX.GetPSy
@ -137,9 +137,6 @@ CS.RUN jsr CS.RUN.SetCRLF
ply
jsr X.InitSrcDirYA
bcs .99
.8 >LEA.G TIME.SysTime
>LIBC Time
*--------------------------------------
CS.RUN.LOOP stz bPass2
@ -151,6 +148,7 @@ CS.RUN.LOOP stz bPass2
ply
>LIBC FEOF
bcc .2
rts I/O error
.2 tay
@ -170,7 +168,7 @@ CS.RUN.LOOP stz bPass2
.3 bit bPause
bmi .1
*--------------------------------------
jsr X.GetEntry First entry
bcs .9
@ -203,7 +201,7 @@ CS.RUN.LOOP stz bPass2
dec bPass2
bra .1
*--------------------------------------
.9 bit bSummary
bmi .91
@ -294,6 +292,7 @@ CS.RUN.PRINT.REG
bcs .9
jsr CS.RUN.PrintCwd
>SS
>PUSHW L.MSG.REG2
>PUSHW ZPFileName
@ -410,13 +409,7 @@ CS.RUN.PrintBaseDir
*--------------------------------------
CS.RUN.PrintCwd >SS
>PUSHW L.MSG.CWD
ldy #S.PS.pCWD
jsr A2osX.GetPSy
pha
iny
jsr A2osX.GetPSy
ply
>PUSHYA
>PUSHW.G pSrcBasePath
>PUSHBI 2
>LIBC PrintF
>SR
@ -482,7 +475,6 @@ ID.END .EQ *
.DUMMY
.OR 0
TIME.SysTime .BS S.TIME
BlkCounters .BS 64 Array of 32 bit integers, size 16
.INB usr/src/shared/x.fileenum.g
DS.END .ED

@ -26,7 +26,6 @@ NEW
*\-------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/mli.e.i
*--------------------------------------
@ -40,8 +39,7 @@ ZPBufPtr .BS 2
ArgIndex .BS 1
ArgPattern .BS 1
hFile .BS 1
hBuf .BS 1
pFILE .BS 2
LineNum .BS 2
char .BS 1
@ -61,20 +59,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 SegmentSize
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.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
@ -88,18 +86,19 @@ CS.RUN jsr CS.RUN.CheckArgs
bcs .99
>LDYAI 256
>LIBC GetMem
>LIBC Malloc
bcs .99
>STYA ZPBufPtr
stx hBuf
.1 >SLEEP
>PUSHB hFile
>SS
>PUSHW ZPBufPtr
>PUSHWI 256
>PUSHW pFILE
>LIBC FGetS
>SR
bcs .7
inc LineNum
@ -112,7 +111,7 @@ CS.RUN jsr CS.RUN.CheckArgs
bcc .1
rts
*--------------------------------------
.7 cmp #MLI.E.EOF
bne .98
@ -147,14 +146,14 @@ CS.RUN.CheckArgs
>STYA ZPPatternPtr
bra CS.RUN.CheckArgs
.11 lda hFile
.11 lda pFILE+1
bne .97
>LDYA ZPPtr1
jsr CS.RUN.OPEN
bcs .9
sta hFile
>STYA pFILE
bra CS.RUN.CheckArgs
*--------------------------------------
.1 ldy #1
@ -184,23 +183,13 @@ CS.RUN.CheckArgs
bra CS.RUN.CheckArgs
*--------------------------------------
.7 lda hFile
.7 lda pFILE+1
bne .8
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
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
jsr CS.RUN.CheckPipe
bcs .98
sty hFile
>STYA pFILE
.8 clc
@ -209,9 +198,11 @@ CS.RUN.CheckArgs
.97 lda #E.SYN
.98 pha
>SS
>PUSHW L.MSG.USAGE
>PUSHBI 0
>LIBC PrintF
>SR
pla
sec
rts
@ -225,14 +216,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
>SR
bcs .9
sta hFile
>STYA pFILE
.9 rts
*--------------------------------------
@ -287,10 +280,12 @@ CS.RUN.PRINT >LDYA ZPBufPtr
bit bLineNum
bpl .7
>SS
>PUSHW L.MSG.NUMLINE
>PUSHW LineNum
>PUSHBI 2
>LIBC PrintF
>SR
bcs .9
.7 >LDYA ZPBufPtr
@ -300,6 +295,41 @@ 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
@ -313,23 +343,23 @@ CS.RUN.toUpper bit bIgnoreCase
.9 rts
*--------------------------------------
CS.QUIT lda hFile
CS.QUIT >LDYA pFILE
beq .1
>LIBC FClose
.1 lda hBuf
.1 >LDYA ZPBufPtr
beq .8
>LIBC FreeMem
>LIBC Free
.8 clc
rts
*--------------------------------------
CS.DOEVENT sec
CS.SIG sec
rts
*--------------------------------------
CS.END
CS.END .EQ *
*--------------------------------------
OptionList .AS "HhIiNnQqSsVv"
OptionList.Cnt .EQ *-OptionList
@ -343,10 +373,12 @@ MSG.USAGE .CS "Usage : GREP <pattern> <File> or CMD|GREP <pattern>\r\n"
.CS " -V : Invert Match"
MSG.CRLF .CZ "\r\n"
MSG.NUMLINE .CZ "%5D:"
*--------------------------------------
ID.END .EQ *
*--------------------------------------
.DUMMY
.OR 0
DS.START
STATBUF .BS S.STAT
DS.END .ED
*--------------------------------------
MAN

@ -8,6 +8,7 @@ NEW
* Y,A = pLIB
*--------------------------------------
K.LoadLib >STYA ZPPtr1
jsr PS.Find.LIB
bcs .99

@ -11,6 +11,7 @@ K.PathBuf .BS 256 Used by INIT3.DetectZ80
K.IOBuf .BS 256
*--------------------------------------
K.MLI.PATH .BS 66 1+64 + \0 ($42)
K.MLI.PATH2 .BS 66 for RENAME
K.MLI.PARAMS .BS 51 18 bytes for GetFileInfo
* GetFileInfoEx/SetFileInfoEx need 1 + 2 + 48 = 51 ($33)
K.DRV.IOCTL .BS 9 9 bytes, S.IOCTL

@ -1033,15 +1033,6 @@ PS.Find stz .1+1 Index in Search list string
sec
PS.Find.RTS rts
*--------------------------------------
PS.Buf2IO ldy #$ff
.1 iny Save Script name in IOBuf
lda K.PathBuf,y
sta K.IOBuf,y
bne .1
rts
*--------------------------------------
PS.GetYw lda (pPS),y
pha
iny

@ -105,6 +105,21 @@ SHARED.PathBuf2FORPNT
.9 rts
*--------------------------------------
SHARED.Path2IO ldy #$ff
.1 iny Save Script name in IOBuf
lda K.PathBuf,y
sta K.IOBuf,y
beq .8
cmp #'/'
bne .1
tax
bra .1
.8 rts
*--------------------------------------
SHARED.GethFDpFDA
sta IO.hFD
tay

@ -756,44 +756,46 @@ K.Remove jsr PFT.GetPathYA
* `#include <stdio.h>`
* `int rename ( const char * oldpath, const char * newpath );`
* ## ASM
* `>SS`
* `>PUSHW oldpath`
* `>PUSHW newpath`
* `>LIBC rename`
* `>SR`
* ## RETURN VALUE
*\--------------------------------------
K.Rename jsr PFT.GetPath2
K.Rename jsr PFT.GetPath0 newpath
bcs .9
jsr PFT.CheckExtFS
bcs .9
>DEBUG
jsr PFT.Translate
bcs .9
cpx #4
beq .10
cpx #4 not ProDOS
beq .1
lda #MLI.E.INCFF
sec
rts
.10 ldy #0
jsr RAMSW.GetStkYW
>STYA ZPPtr1
.1 ldx #$ff
ldy #0
.3 inx
lda K.MLI.PATH,x
sta K.MLI.PATH2,x
bne .3
.1 jsr RAMSW.xP1gY
beq .8
jsr PFT.GetPath2 oldpath
bcs .9
iny
sta K.PathBuf,y
cpy #MLI.MAXPATH
bne .1
jsr PFT.CheckExtFS
bcs .9
.8 sty K.PathBuf
jsr PFT.Translate
bcs .9
>LDYAI K.PathBuf
>LDYAI K.MLI.PATH2
>STYA K.MLI.PARAMS+3
>MLICALL MLI.RENAME

@ -288,7 +288,7 @@ ENV.VarEndChar .BS 1
ENV.bNoExp .BS 1
ENV.bExp .BS 1
*--------------------------------------
STDLIB.Expand jsr PS.Buf2IO
STDLIB.Expand jsr SHARED.Path2IO
stz STDLIB.iBufPtr
@ -640,7 +640,7 @@ STDLIB.EnvVar lda STDLIB.iBufPtr
.9 rts
*--------------------------------------
STDLIB.RealPath jsr PS.Buf2IO
STDLIB.RealPath jsr SHARED.Path2IO
ldx #$ff