Kernel version 0.8 : FILE API, OPEN was not resetting file size to 0 when writing to an existing file (no append flag)

This commit is contained in:
Rémy GIBERT 2016-11-04 16:13:22 +01:00
parent a05dc2324f
commit cf15e77a21

View File

@ -32,10 +32,10 @@ K.FOPEN jsr PFT.CheckPathSTK
>PULLW K.FOPEN.AUXTYPE
>MLICALL MLIGETFILEINFO
bcc .10 Already Exists
bcc K.FOPEN.10 Already Exists
bit K.FOPEN.MODE Create if not exists ?
bpl .9 No, return MLI error
bpl K.FOPEN.9 No, return MLI error
lda #S.FILEINFO.ACCESS.FULL Yes, Create...
sta MLICALL.PARAMS+3 Access
@ -46,17 +46,16 @@ K.FOPEN jsr PFT.CheckPathSTK
lda #S.FILEINFO.STORETYPE.STD
sta MLICALL.PARAMS+7
>MLICALL MLICREATE
bcc .10
.9 rts
bcc K.FOPEN.10
K.FOPEN.9 rts
.10 >PUSHWI S.FILE.PRODOS
K.FOPEN.10 >PUSHWI S.FILE.PRODOS
>PUSHBI S.MEM.F.INIT0
jsr K.GetMem
bcs .99
bcs K.FOPEN.9
>STYA ZPQuickPtr1
stx hFILE
stx hFILE
>PUSHWI 1024 get a ProDOS IOBUF
>PUSHBI S.MEM.F.ALIGN+S.MEM.F.NOMOVE
@ -78,10 +77,20 @@ K.FOPEN jsr PFT.CheckPathSTK
sta MLICALL.PARAMS+1 Next MLI Calls are REF_NUM based
lda K.FOPEN.MODE
and #SYS.FOPEN.A Append ?
beq .20
bit #SYS.FOPEN.W
beq .20 Write mode ?
>MLICALL MLIGETEOF
and #SYS.FOPEN.A Append ?
bne .11 yes, go to end of file
stz MLICALL.PARAMS+2
stz MLICALL.PARAMS+3
stz MLICALL.PARAMS+4
>MLICALL MLISETEOF no, reset size to 0
bcs .98
bra .20
.11 >MLICALL MLIGETEOF
bcs .98
>MLICALL MLISETMARK
@ -105,7 +114,7 @@ K.FOPEN jsr PFT.CheckPathSTK
jsr K.FCloseA.1
pla get back MLI error
sec
.99 rts
rts
*--------------------------------------
K.FOPEN.MODE .BS 1
K.FOPEN.TYPE .BS 1