KERNEL 0.94-2:Fixes for DIRENT api

This commit is contained in:
burniouf 2021-07-28 18:50:59 +02:00
parent 30d8231517
commit b25303e93a
12 changed files with 162 additions and 186 deletions

Binary file not shown.

Binary file not shown.

View File

@ -22,18 +22,14 @@ GFX.Close >LDA.G hDevGFX
GFX.TEXT ldy #S.PS.hStdIn
lda (pPS),y
bit #1
bne GFX.IOCTL
tax
lda hFDs-1,x
bra GFX.IOCTL
GFX.TEXT.RTS clc
rts
*--------------------------------------
GFX.GR ldy #S.PS.hStdIn
lda (pPS),y
bit #1
beq GFX.TEXT.RTS
>LDA.G hDevGFX
GFX.GR >LDA.G hDevGFX
beq GFX.TEXT.RTS
GFX.IOCTL >PUSHA

View File

@ -25,8 +25,10 @@ ZPFileStat .BS 2
ZPFullPath .BS 2
ZPNewPath .BS 2
ZPLineBuf .BS 2
hSrcFullPath .BS 1
hSrcNewPath .BS 1
ArgIndex .BS 1
bPause .BS 1
bContinue .BS 1
@ -63,13 +65,16 @@ L.MSG.ERR .DA MSG.ERR
CS.INIT clc
rts
*--------------------------------------
CS.RUN >INC.G ArgIndex
CS.RUN inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .5
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
jsr CS.RUN.CheckOpt
bcc CS.RUN
@ -82,6 +87,7 @@ CS.RUN >INC.G ArgIndex
.4 >LDA.G hSrcBasePath
bne .9
>LDYA ZPPtr1
jsr InitSrcDirYA
bcc CS.RUN
@ -91,16 +97,14 @@ CS.RUN >INC.G ArgIndex
>SYSCALL GetMem
bcs .99
>STYA ZPFullPath
txa
>STA.G hSrcFullPath
stx hSrcFullPath
>LDYAI 256
>SYSCALL GetMem
bcs .99
>STYA ZPNewPath
txa
>STA.G hSrcNewPath
stx hSrcNewPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
@ -282,16 +286,14 @@ CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
>LDA.G hFilter
beq .1
jsr .7
>SYSCALL FreeMem
.1 >LDA.G hSrcFullPath
beq .2
lda hSrcFullPath
jsr .7
>SYSCALL FreeMem
lda hSrcNewPath
.2 >LDA.G hSrcNewPath
beq .8
.7 beq .8
>SYSCALL FreeMem
@ -335,15 +337,7 @@ MSG.FILE .AZ "File:%s..."
*--------------------------------------
.DUMMY
.OR 0
DS.START
ArgIndex .BS 1
hSrcFullPath .BS 1
hSrcNewPath .BS 1
hFile .BS 1
hMem .BS 1
.INB usr/src/shared/x.fileenum.g
DS.START .INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------
MAN

View File

@ -27,12 +27,12 @@ ZPFileStat .BS 2
ZPLineBuf .BS 2
ZPPWBuf .BS 2
ArgCount .BS 1
ColCount .BS 1
bPass2 .BS 1
hLineBuf .BS 1
hPWBuf .BS 1
ArgCount .BS 1
bPause .BS 1
bAllmostAll .BS 1
bColumn .BS 1
@ -148,17 +148,14 @@ CS.RUN jsr CS.RUN.ISATTY
bcs .9
>STYA ZPPWBuf
txa
>STA.G hPWBuf
stx hPWBuf
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPLineBuf
txa
>STA.G hLineBuf
stx hLineBuf
*--------------------------------------
CS.RUN.LOOP stz bPass2
@ -186,7 +183,7 @@ CS.RUN.LOOP stz bPass2
bmi .1
jsr GetEntry
bcs .9
bcs .6
jsr FilterMatch
bcs .8 no match, skip....
@ -196,7 +193,7 @@ CS.RUN.LOOP stz bPass2
lda (ZPFileName)
cmp #'.'
beq .8
beq .5
.4 ldy #S.STAT.MODE+1
lda (ZPFileStat),y
@ -209,11 +206,11 @@ CS.RUN.LOOP stz bPass2
jsr CS.RUN.PRINT.JMP
bcs .99
.8 jsr GetNextEntry
.5 jsr GetNextEntry
bcc .1
bit bPass2
bmi .9
bmi .6
jsr ResetSrcDir
bcs .99
@ -221,14 +218,14 @@ CS.RUN.LOOP stz bPass2
dec bPass2
bra .1
.9 bit bLong
bmi .91
.6 bit bLong
bmi .7
jsr CS.RUN.NewLine
bcs .99
.91 jsr LeaveSubDir
bcs .98
.7 jsr LeaveSubDir
bcs .8
jsr BasePath..
@ -238,7 +235,7 @@ CS.RUN.LOOP stz bPass2
jsr GetNextEntry
jmp CS.RUN.LOOP
.98 lda #0
.8 lda #0
sec
.99 rts
*--------------------------------------
@ -720,15 +717,15 @@ CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
ldy #hFilter
lda (pData),y
jsr .7
ldy #hPWBuf
lda hPWBuf
jsr .7
ldy #hLineBuf
lda hLineBuf
.7 lda (pData),y
beq .8
.7 beq .8
>SYSCALL FreeMem
@ -830,20 +827,19 @@ MSG.USAGE .AS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n"
.AZ " -R : Recursively list subdirectories\r\n"
*--------------------------------------
MSG.ENTER .AZ "Directory:%s"
MSG.REG .AZ "%19s"
MSG.REGEXT .AZ "%s %6s %6s %10u %s %s %s %H %s"
MSG.REG .AZ "%19s"
MSG.DIREXT .AS "%s %6s %6s %s %s <dir> "
MSG.DIR .AZ "\e[32m%s/\e[0m"
MSG.DIREXT .AZ "%s %6s %6s %s %s <dir> %s"
MSG.BDEV .AZ "\e[32m%s/\e[0m"
MSG.BDEVEXT .AZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEVEXT .AZ "\e[36m/%15s\e[0m s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .AZ "\e[36m/%s\e[0m"
*--------------------------------------
PRODOS.FT.HEX .HS 0406FAFCFDE2CBCCCFFF
PRODOS.FT.HEX .HS 0406FAFCFDCBCCCFFF
PRODOS.FT.TXT .AZ "txt"
.AZ "bin"
.AZ "asm"
.AZ "bas"
.AZ "var"
.AZ "atk"
.AZ "pix"
.AZ "fon"
.AZ "pak"
@ -869,9 +865,6 @@ TIME.SysTime .BS S.TIME
TIME.Create .BS 10 DD-mmm-YY\0
TIME.Mod .BS 10
hLineBuf .BS 1
hPWBuf .BS 1
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------

View File

@ -25,7 +25,9 @@ ZPFileStat .BS 2
ZPFullPath .BS 2
ZPNewPath .BS 2
ZPLineBuf .BS 2
ArgIndex .BS 1
hSrcFullPath .BS 1
hSrcNewPath .BS 1
bPause .BS 1
@ -63,13 +65,16 @@ L.MSG.ERR .DA MSG.ERR
CS.INIT clc
rts
*--------------------------------------
CS.RUN >INC.G ArgIndex
CS.RUN inc ArgIndex
lda ArgIndex
>SYSCALL ArgV
bcs .5
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
jsr CS.RUN.CheckOpt
bcc CS.RUN
@ -82,24 +87,26 @@ CS.RUN >INC.G ArgIndex
.4 >LDA.G hSrcBasePath
bne .9
>LDYA ZPPtr1
jsr InitSrcDirYA
bcc CS.RUN
.99 rts
*--------------------------------------
.5 >LDYAI 256
>SYSCALL GetMem
bcs .99
>STYA ZPFullPath
txa
>STA.G hSrcFullPath
stx hSrcFullPath
>LDYAI 256
>SYSCALL GetMem
bcs .99
>STYA ZPNewPath
txa
>STA.G hSrcNewPath
stx hSrcNewPath
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
@ -229,6 +236,7 @@ CS.RUN.FILE jsr FilterMatch
.9 rts
*--------------------------------------
CS.RUN.CheckErr bcs .1
>LDYA L.MSG.OK
>SYSCALL PutS
rts
@ -280,16 +288,14 @@ CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
>LDA.G hFilter
beq .1
jsr .7
>SYSCALL FreeMem
.1 >LDA.G hSrcFullPath
beq .2
lda hSrcFullPath
jsr .7
>SYSCALL FreeMem
lda hSrcNewPath
.2 >LDA.G hSrcNewPath
beq .8
.7 beq .8
>SYSCALL FreeMem
@ -333,15 +339,7 @@ MSG.FILE .AZ "File:%s..."
*--------------------------------------
.DUMMY
.OR 0
DS.START
ArgIndex .BS 1
hSrcFullPath .BS 1
hSrcNewPath .BS 1
hFile .BS 1
hMem .BS 1
.INB usr/src/shared/x.fileenum.g
DS.START .INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------
MAN

View File

@ -306,7 +306,7 @@ CS.RUN.FILE jsr FilterMatch
CS.RUN.FILE.LOOP
.1 >PUSHB hFile
>PUSHW ZPLineBuf
>PUSHWI 256
>PUSHWI 255
>SYSCALL FGetS
bcs .8
@ -418,16 +418,17 @@ CS.RUN.IncFLine phy
CS.RUN.IncFWord phy
ldy #fWordCount
ldx #4
CS.RUN.IncF ldx #4
CS.RUN.IncF lda (pData),y
.1 lda (pData),y
inc
sta (pData),y
bne .8
iny
dex
bne CS.RUN.IncF
bne .1
.8 ply
rts
@ -523,7 +524,7 @@ CS.RUN.PrintTstat
bit bWord
bpl .1
>PUSHW L.MSG.LONG
>PUSHW L.MSG.LONGTAB
>PUSHL.G tWordCount
>PUSHBI 4
>SYSCALL PrintF
@ -532,7 +533,7 @@ CS.RUN.PrintTstat
.1 bit bLine
bpl .2
>PUSHW L.MSG.LONG
>PUSHW L.MSG.LONGTAB
>PUSHL.G tLineCount
>PUSHBI 4
>SYSCALL PrintF
@ -541,7 +542,7 @@ CS.RUN.PrintTstat
.2 bit bChar
bpl .3
>PUSHW L.MSG.LONG
>PUSHW L.MSG.LONGTAB
>PUSHL.G tCharCount
>PUSHBI 4
>SYSCALL PrintF

View File

@ -45,7 +45,7 @@ NEW
CELL
LOOP
LOOP
TEXT
KEY TEXT
." All done." ;
MANDELBROT

View File

@ -145,8 +145,7 @@ m128k sta idapple Save MACHID in temp location
tsb LDR.MSG.PRODOS+1
tsb LDR.MSG.PRODOS+2
jsr LDR.Scr80Select
jsr LDR.Scr80Init
jsr LDR.Scr80Init X = LDR.MSG.machine type
ldx #$F
@ -362,7 +361,7 @@ LDR.ClkDevScan jsr LDR.IsIIc
lda $CFFF
lda $C400
ldy #8
stz $C0C0
stz $C0C1
@ -377,7 +376,7 @@ LDR.ClkDevScan jsr LDR.IsIIc
.2 sta $C0C3
stz $C0C0
lsr
dex
bne .2
@ -401,24 +400,24 @@ LDR.ClkDevScan jsr LDR.IsIIc
pla
sta $C0C3
plp
sed
ldx #DS121x.ValidHI-DS121x.ValidLO
.6 lda DS121x.DATA1-1,x
cmp DS121x.ValidLO-1,x
bcc LDR.ClkDevNCLK
cmp DS121x.ValidHI-1,x
bcc .7
bne LDR.ClkDevNCLK
.7 dex
bne .6
cld
lda #'D'
@ -528,11 +527,11 @@ LDR.ClkDevTCLK jsr LDR.IsIIc
.1 jsr LDR.CheckTClkID
bcs .7
sta SETPAGE2
stz $478,x
stz $7f8,x
* sta SETPAGE2
* stz $478,x
* stz $7f8,x
sta CLRPAGE2
* sta CLRPAGE2
stz $478,x
stz $7f8,x
@ -983,8 +982,10 @@ LDR.SetDevID ldy #$FE check attributes byte.
sta devid
rts
*--------------------------------------
LDR.Scr80Select jsr LDR.IsIIc
bcs .99
LDR.Scr80Init phx Save MDR.MSG
jsr LDR.IsIIc
bcs LDR.Scr80Init2
php
sei
@ -996,7 +997,7 @@ LDR.Scr80Select jsr LDR.IsIIc
.1 ldy COL80IDX,x
lda $C300,y
cmp COL80VAL,x
bne .9
bne .2
dex
bpl .1
@ -1004,18 +1005,13 @@ LDR.Scr80Select jsr LDR.IsIIc
lda $C30C is it an apple 80 col compatible card?
and #$F0
cmp #$80
bne .9
beq .3
.2 sta CLRC3ROM
plp
rts
.9 sta CLRC3ROM
plp
.99 rts
.3 plp
*--------------------------------------
LDR.Scr80Init lda #$8C Reset 80 col screen ($0C:HOME)
LDR.Scr80Init2 lda #$8C Reset 80 col screen ($0C:HOME)
jsr $C300
jsr setnorm
@ -1146,6 +1142,9 @@ LDR.Scr80Init lda #$8C Reset 80 col screen ($0C:HOME)
jsr setnorm
ldx #LDR.MSG.PRODOS
jsr LDR.PrintX
plx MDR.MSG.machine type
*--------------------------------------
LDR.PrintX bit RROMBNK2

View File

@ -595,11 +595,11 @@ CORE.IRQ.TCLOCK.Off
lda $c080,x
ldx IRQ.0n
sta SETPAGE2
stz $478,x
stz $7f8,x
* sta SETPAGE2
* stz $478,x
* stz $7f8,x
sta CLRPAGE2
* sta CLRPAGE2
stz $478,x
stz $7f8,x
*--------------------------------------

View File

@ -40,7 +40,6 @@ K.OpenDir jsr PFT.CheckPathYA
*\--------------------------------------
.DUMMY ZPTMP,9
.OR ZPTMP 9 Bytes
K.ReadDir.hBlk .BS 1
K.ReadDir.ECIB .BS 1
K.ReadDir.EL .BS 1
@ -82,7 +81,7 @@ K.ReadDir.ROOT ldy #S.FD.DIR.FC did we already returned something ?
>LDYAI 16+S.STAT*18+1 14*(Vols+Stat) + 4*(PFT+Stat) + \0
jsr K.ReadDir.GetBufYA
jsr K.ReadDir.GetBuf
bcs DIRENT.RTS
.1 lda (ZPPtr2)
@ -186,20 +185,14 @@ K.ReadDir.DEV jmp DIRENT.EOF TODO : /dev
*--------------------------------------
K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
lda /K.Buf256 read in
stz K.MLI.PARAMS+2
lda /K.Buf256 read in Buf256+IOBuf
sta K.MLI.PARAMS+3
stz K.MLI.PARAMS+2 For reading
sta K.MLI.PARAMS+3 For reading
ldy #4 Skip 4 bytes linked list
sty ZPPtr2 PTR to Buffer for PASS #1
sty ZPPtr3 PTR to Buffer for PASS #2
sta ZPPtr2+1 PTR to Buffer for PASS #1
sta ZPPtr3+1 PTR to Buffer for PASS #2
>LDYAI 512
>STYA K.MLI.PARAMS+4
stz K.MLI.PARAMS+4
lda /512
sta K.MLI.PARAMS+5
>MLICALL MLIREAD Read A block from directory
bcs .99
@ -207,30 +200,18 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
lda (pFD),y
bne .2 no, we have all we need....
ldy #$1f+3
ldx #3
.1 lda (ZPPtr2),y Get K.ReadDir.EL.... From Block
.1 lda K.Buf256+$23,x Get K.ReadDir.EL.... From Block
sta K.ReadDir.EL,x
dey
dex
bpl .1
ldx #8
ldy #16
.10 lda (ZPPtr2),y
pha
iny
dex
bne .10
ldx #8
ldx #7
ldy #S.FD.DIR.ACL+7
.20 pla
.20 lda K.Buf256+$14,x
cpy #S.FD.DIR.MODE+1
bne .30
@ -239,7 +220,7 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
.30 sta (pFD),y
dey
dex
bne .20
bpl .20
inc K.ReadDir.EC Add one to EC because we include VOL/DIR Header
bne .4
@ -270,8 +251,11 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
bne .5
iny
clc
beq .99 no...exit
bne .5
lda #MLI.E.EOF
sec
rts
*--------------------------------------
* pass #1 compute BufSize...
*--------------------------------------
@ -282,7 +266,9 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
sta K.ReadDir.BufSize
stz K.ReadDir.BufSize+1
K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block
jsr K.ReadDir.P3Init
K.ReadDir.DIR1 lda (ZPPtr3)
beq .7 Free slot....goto next
and #$F0 get storage_type
@ -292,7 +278,7 @@ K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block
cmp #$E0 directory header ?
beq .2
lda (ZPPtr2) regular DIR or File, get LEN
lda (ZPPtr3) regular DIR or File, get LEN
and #$F compute filename len
sec add "#<filename>" + S.STAT
adc #S.STAT
@ -308,21 +294,13 @@ K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block
inc K.ReadDir.BufSize+1
.3 inx
.3 inx X,Y = !Total entry Count
bne .7
iny
bra K.ReadDir.DIR2 we reached last entry in whole DIR
beq K.ReadDir.DIR2 we reached last entry in whole DIR
.7 lda ZPPtr2
clc
adc K.ReadDir.EL
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 dec K.ReadDir.ECIB
.7 jsr K.ReadDir.P3Next
bne K.ReadDir.DIR1
*--------------------------------------
* pass #2 Fill Buffer...(ZPPtr1 & Ptr2 can now be trashed)
@ -330,11 +308,14 @@ K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block
K.ReadDir.DIR2 lda K.ReadDir.EPB
sta K.ReadDir.ECIB
>LDYA K.ReadDir.BufSize Get a BufSize bytes buffer for storing results
jsr K.ReadDir.GetBuf
bcc .1
bcc .10
rts
.10 jsr K.ReadDir.P3Init
.1 lda (ZPPtr3)
beq .7 Empty slot, skip
@ -368,17 +349,8 @@ K.ReadDir.DIR2 lda K.ReadDir.EPB
ora K.ReadDir.EC
beq .8 0! no more files in DIR
.7 dec K.ReadDir.ECIB 0! no more file in block
beq .8
lda ZPPtr3
clc
adc K.ReadDir.EL
sta ZPPtr3
bcc .1
inc ZPPtr3+1
bra .1
.7 jsr K.ReadDir.P3Next
bne .1
.8 ldx #3
ldy #S.FD.DIR.EL+3
@ -393,9 +365,28 @@ K.ReadDir.EXIT ldx K.ReadDir.hBuf
txa
jmp K.GetMemPtr
*--------------------------------------
K.ReadDir.P3Init
ldy #4 Skip 4 bytes linked list
sty ZPPtr3
lda /K.Buf256
sta ZPPtr3+1
rts
*--------------------------------------
K.ReadDir.P3Next
lda ZPPtr3
clc
adc K.ReadDir.EL
sta ZPPtr3
bcc .8
inc ZPPtr3+1
.8 dec K.ReadDir.ECIB 0! no more file in block
rts
*--------------------------------------
K.ReadDir.GetBuf
>LDYA K.ReadDir.BufSize Get a BufSize bytes buffer for storing results
K.ReadDir.GetBufYA
jsr K.GetMem0 make sure 0 filled
bcs .9
@ -471,7 +462,9 @@ K.ReadDir.AddToBuf
sta (ZPPtr4)
inc ZPPtr4
bne .8
inc ZPPtr4+1
.8 rts
*--------------------------------------
K.ReadDir.AddStatACL

View File

@ -897,11 +897,13 @@ IrqMgrInit >LDYAI MSG.IRQ
sei
sta CLRPAGE2
lda #$60
sta $5fa
sta $5fb
sta $5fa //c EXTINT COM1:Dont buffer but get IRQ
sta $5fb //c EXTINT COM2:Dont buffer but get IRQ
stz $4FF //c ROM FF
stz $4FC //c ROM 1,2,3,4,5
stz $5FA //c TYPHED no keyboard buffering
stz $4FF //c ROM FF: no ACIABUF
stz $4FC //c ROM 0X: no ACIABUF
plp
.3 jsr IrqMgrInit.Mouse
@ -979,11 +981,11 @@ IrqMgrInit.TClock
lda #$40
sta SETPAGE2
sta $478,x
sta $7f8,x
* sta SETPAGE2
* sta $478,x
* sta $7f8,x
sta CLRPAGE2
* sta CLRPAGE2
sta $478,x
sta $7f8,x