Kernel : Implementing new FILE API with Path Filtering #2, INIT2/INIT3 bug fixes

This commit is contained in:
Rémy GIBERT 2016-08-29 17:12:04 +02:00
parent 399646b8aa
commit 73425bb3dc
7 changed files with 173 additions and 81 deletions

View File

@ -281,6 +281,9 @@ SYS.FWRITE .EQ $E6
SYS.FFLUSH .EQ $E8
SYS.FSEEK .EQ $EA
SYS.FSEEK.SET .EQ $00
SYS.FSEEK.CUR .EQ $01
SYS.FSEEK.END .EQ $02
SYS.FTELL .EQ $EC
SYS.FEOF .EQ $EE

View File

@ -13,33 +13,29 @@ AUTO 6
* CS : A = EC
*--------------------------------------
S.OPENDIRYA jsr S.PFTCHECKPATHYA
* if we are here, we only have to deal with Local ProDOS path
clc
rts
*--------------------------------------
* In :
* Y,A = PTR to S.DIR
* A = hDIR
* Out :
* CC : Y,A = PTR to S.DIRENT
* CS : A = EC
*--------------------------------------
S.READDIRYA
S.READDIRA jsr S.PFTCHECKDIRA
.8 clc
rts
.9 sec
clc
rts
*--------------------------------------
* In :
* Y,A = PTR to S.DIR
* A = hDIR
*--------------------------------------
S.CLOSEDIRYA
S.CLOSEDIRA jsr S.PFTCHECKDIRA
clc
rts
*--------------------------------------
*--------------------------------------

View File

@ -143,11 +143,7 @@ S.FCLOSEA.1 ldy #S.FILE.PRODOS.REF
*--------------------------------------
S.FREAD jsr S.PFTCHECKFILESTK
>PULLA
jsr S.GetMemPtrA
>STYA ZPQuickPtr1
ldy #S.FILE.PRODOS.REF
lda (ZPQuickPtr1),y
sta MLICALL.PARAMS+1
jsr FIL.SetupPrt1A
>PULLW MLICALL.PARAMS+4
>PULLW MLICALL.PARAMS+2
>MLICALL MLIREAD
@ -165,12 +161,7 @@ S.FREAD jsr S.PFTCHECKFILESTK
*--------------------------------------
S.FWRITE jsr S.PFTCHECKFILESTK
>PULLA
jsr S.GetMemPtrA
>STYA ZPQuickPtr1
ldy #S.FILE.PRODOS.REF
lda (ZPQuickPtr1),y
sta MLICALL.PARAMS+1
>PULLB MLICALL.PARAMS+1
jsr FIL.SetupPrt1A
>PULLW MLICALL.PARAMS+4
>PULLW MLICALL.PARAMS+2
>MLICALL MLIWRITE
@ -183,28 +174,123 @@ S.FWRITE jsr S.PFTCHECKFILESTK
* A = hFILE
*--------------------------------------
S.FFLUSHA jsr S.PFTCHECKFILEA
jsr S.GetMemPtrA
>STYA ZPQuickPtr1
ldy #S.FILE.PRODOS.REF
lda (ZPQuickPtr1),y
sta MLICALL.PARAMS+1
jsr FIL.SetupPrt1A
>MLICALL MLIFLUSH
rts
*--------------------------------------
* S.FSEEK
* In :
* PULLB = hFILE
* PULLB = From
* PULLW = OffsetLo
* PULLW = OffsetHi
*--------------------------------------
S.FSEEK
S.FSEEK jsr S.PFTCHECKFILESTK
>PULLA
jsr FIL.SetupPrt1A
>PULLB S.FSEEK.FROM
>PULLW S.FSEEK.OFFSET
>PULLW S.FSEEK.OFFSET+2
lda S.FSEEK.FROM
beq .3
cmp #SYS.FSEEK.CUR
bne .1
>MLICALL MLIGETMARK
bcs .9
bcc .2
.1 cmp #SYS.FSEEK.END
bne .3
>MLICALL MLIGETEOF
bcs .9
.2 lda MLICALL.PARAMS+2
adc S.FSEEK.OFFSET
sta MLICALL.PARAMS+2
lda MLICALL.PARAMS+3
adc S.FSEEK.OFFSET+1
sta MLICALL.PARAMS+3
lda MLICALL.PARAMS+4
adc S.FSEEK.OFFSET+2
sta MLICALL.PARAMS+4
bcs .99 Offset out of range!
.3 >MLICALL MLISETMARK
.9 rts
.99 lda #SYSMGR.ERRFTB
sec
rts
*--------------------------------------
S.FSEEK.FROM .BS 1
S.FSEEK.OFFSET .BS 4
*--------------------------------------
S.FTELL
* S.FTELLA
* In :
* A = hFILE
* Out :
* Y,A,X = Offset
*--------------------------------------
S.FTELLA jsr S.PFTCHECKFILEA
S.FTELLA.1 jsr FIL.SetupPrt1A
>MLICALL MLIGETMARK
bcs .9
>LDYA MLICALL.PARAMS+2
ldx MLICALL.PARAMS+4
.9 rts
*--------------------------------------
S.FEOF
* S.FEOFA
* In :
* A = hFILE
* Out :
* CC :
* A=0 EOF
* A !=0 NOT EOF
* CS :
*--------------------------------------
S.FEOFA jsr S.PFTCHECKFILEA
jsr FIL.SetupPrt1A
jsr S.FTELLA.1
bcs .9
>STYA S.FEOFA.MARK
stx S.FEOFA.MARK+2
>MLICALL MLIGETEOF
bcs .9
sec
lda MLICALL.PARAMS+2
sbc S.FEOFA.MARK
bne .8
lda MLICALL.PARAMS+3
sbc S.FEOFA.MARK+1
bne .8
lda MLICALL.PARAMS+4
sbc S.FEOFA.MARK+2
.8 clc
.9 rts
S.FEOFA.MARK .BS 3
*--------------------------------------
S.REMOVE
* S.REMOVEYA
*--------------------------------------
S.REMOVEYA jsr S.PFTCHECKPATHYA
>STYA MLICALL.PARAMS+1
>MLICALL MLIDESTROY
rts
*--------------------------------------
S.RENAME
* S.RENAME
* In :
* PULLW = Old Name
* PULLW = New Name
*--------------------------------------
S.RENAME jsr S.PFTCHECKPATHYA
>PULLW MLICALL.PARAMS+1
>PULLW MLICALL.PARAMS+2
>MLICALL MLIRENAME
rts
*--------------------------------------
S.MKDIRYA jsr S.PFTCHECKPATHYA
>STYA MLICALL.PARAMS+1
@ -217,6 +303,13 @@ S.MKDIRYA jsr S.PFTCHECKPATHYA
>MLICALL MLICREATE
rts
*--------------------------------------
FIL.SetupPrt1A jsr S.GetMemPtrA
>STYA ZPQuickPtr1
ldy #S.FILE.PRODOS.REF
lda (ZPQuickPtr1),y
sta MLICALL.PARAMS+1
rts
*--------------------------------------
MAN
SAVE SYS/KERNEL.S.FIL
LOAD SYS/KERNEL.S

View File

@ -8,18 +8,6 @@ AUTO 6
Kernel.Init2 >LDAXI MSG.Init2
jsr PrintCStrAX
sei
ldx #$FF init 6502 stack to highest
txs
sta SETALTZP
stx A2osX.SaveSM
stx A2osX.SaveSX
sta CLRALTZP Make MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli
>LDAXI MSG.Relocate
jsr PrintCStrAX
@ -32,8 +20,8 @@ Kernel.Init2 >LDAXI MSG.Init2
>STYA ZPQuickPtr2
>LDYAI A2osX.BE00.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
lda RRAMWRAMBNK2
lda RRAMWRAMBNK2
@ -43,7 +31,6 @@ Kernel.Init2 >LDAXI MSG.Init2
>STYA ZPQuickPtr2
>LDYAI A2osX.D002.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
lda RRAMWRAMBNK1
@ -55,7 +42,6 @@ Kernel.Init2 >LDAXI MSG.Init2
>STYA ZPQuickPtr2
>LDYAI A2osX.D001.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
>LDYAI A2osX.E000
@ -64,7 +50,6 @@ Kernel.Init2 >LDAXI MSG.Init2
>STYA ZPQuickPtr2
>LDYAI A2osX.E000.SIZE^$FFFF
>STYA ZPQuickPtr3
jsr Kernel.Move
>LDYAI D.STACK.TOP
@ -83,12 +68,10 @@ Kernel.Init2 >LDAXI MSG.Init2
jsr CPU.Init
>LDAXI MSG.K.INIT
>LDAXI MSG.Setup
jsr PrintCStrAX
sta SETALTZP
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
jsr GO.AUXLC
jsr S.IrqMgrInit
bcs *
@ -103,21 +86,17 @@ Kernel.Init2 >LDAXI MSG.Init2
jsr S.TskMgrInit
bcs *
sta CLRALTZP Make sure MAIN ZP...
jsr GO.MAINLC Make sure MAIN ZP...
lda RROMBNK1 ... & ROM is enabled for X.PRINT.F
>LDAXI MSG.Init2.OK
jsr PrintCStrAX
sta SETALTZP
lda RRAMWRAMBNK1
lda RRAMWRAMBNK1
rts
*--------------------------------------
MSG.Init2 >CSTRING "A2osX[Stage2]:Init\n"
MSG.Relocate >CSTRING "Relocating KERNEL...\n"
MSG.HZ >CSTRING "Kernel SYS Timer Set For %d0 hz Machine.\n"
MSG.K.INIT >CSTRING "Kernel Setup...\n"
MSG.Setup >CSTRING "Kernel Setup...\n"
MSG.Init2.OK >CSTRING "A2osX[Stage2]:Complete.\n"
*--------------------------------------
CPU.Init >LDAXI MSG.CPU
@ -130,7 +109,7 @@ CPU.Init >LDAXI MSG.CPU
lda MSG.CPUTYPEL,y
jsr PrintCStrAX
CPU.Init.Speed lda MACHID
lda MACHID
and #MACHID.TYPE
cmp #MACHID.TYPE.IIc
beq CPU.Init.Z80

View File

@ -32,9 +32,9 @@ Kernel.Init3 ldx #DEVMGR.SELECT
>LDYAI TskMgr.Table
>STYA pPs
jmp S.KernelRun
rts
.9 >PUSHA
>LDYAI MSG.StartupErr
>SYSCALL SYS.PSTROutYA

View File

@ -6,10 +6,8 @@ AUTO 6
.LIST OFF
*--------------------------------------
* In :
* Y,A = PATH (PSTR)
* PULLW/Y,A = PATH (PSTR)
* Out :
* CC :
* CS : A = EC
*--------------------------------------
S.PFTCHECKPATHSTK
lda (pStack) read PTR.LO on top of stack
@ -63,34 +61,41 @@ S.PFTCHECKPATHYA
.9 >LDYA ZPQuickPtr1 restore passed params
ldx S.PFT.SYSCALL
>LDYA ZPQuickPtr1
rts
*--------------------------------------
* In :
* PUSHB/A = hFILE
* PULLB/A = hFILE/hDIR
* Out :
* CC : Y,A = PTR to S.DIRENT
* CS : A = EC
*--------------------------------------
S.PFTCHECKFILESTK
lda (pStack) read hFILE on top of stack
S.PFTCHECKFILEA
S.PFTCHECKDIRA stx S.PFT.SYSCALL save #SYSCALL
sta S.PFT.hFILE
jsr S.GetMemPtrA X = unmidified
.8 clc
rts
>STYA ZPQuickPtr1
lda (ZPQuickPtr1)
beq .9 Handler is 0, back to kernel....
.9 sec
jsr S.GetMemPtrA
>STYA .1+1
lda S.PFT.SYSCALL getback #SYSCALL
sec
sbc #SYS.FOPEN-4 0=Lib.load, 2=Lib.Unload
tax
pla discard JSR return @
pla
lda S.PFT.hFILE restore passed params
.1 jmp $ffff
.9 lda S.PFT.hFILE
rts
*--------------------------------------
* In :
* hDIR
*--------------------------------------
S.PFTCHECKDIRA lda (pStack) read hDIR on top of stack
rts
*--------------------------------------
S.PFT.hFILE .BS 1
S.PFT.SYSCALL .BS 1
*--------------------------------------
MAN

View File

@ -19,15 +19,31 @@ ZPQuickPtr2 .EQ ZPKERNEL+2 (could be trashed by any JSR)
ZPQuickPtr3 .EQ ZPKERNEL+4
ZPQuickPtr4 .EQ ZPKERNEL+6
*--------------------------------------
* Kernel Stage 2
* Kernel Init Stage 2
*--------------------------------------
sei
ldx #$FF init 6502 stack to highest
txs
sta SETALTZP
stx A2osX.SaveSM
stx A2osX.SaveSX
sta CLRALTZP Make sure MAIN ZP is enabled for X.PRINT.F
lda RROMBNK1 Make sure ROM is enabled for X.PRINT.F
cli
jsr Kernel.Init2
>DEBUGOA
*--------------------------------------
* Kernel Stage 3
* Kernel Init Stage 3
*--------------------------------------
jsr GO.AUXLC
jsr Kernel.Init3
>DEBUGOA
*--------------------------------------
jmp S.KernelRun
*--------------------------------------
.INB X.PRINTF.S
.INB SYS/KERNEL.S.INIT2