2016-08-26 15:10:38 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* For All SYS.xxxx calls, X = #SYSCall
|
|
|
|
|
* Must be kept in X before calling
|
2016-08-28 20:48:01 +00:00
|
|
|
|
* S.PFTCheckXYZ
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FOPEN
|
|
|
|
|
* In :
|
|
|
|
|
* PULLW = PATH (PSTR)
|
|
|
|
|
* PULLB = MODE
|
2016-08-28 20:48:01 +00:00
|
|
|
|
* SYS.FOPEN.R .EQ $01 //Ignored (No ProDOS equivalent)
|
|
|
|
|
* SYS.FOPEN.W .EQ $02 //Ignored (No ProDOS equivalent)
|
|
|
|
|
* SYS.FOPEN.A .EQ $04 Append
|
|
|
|
|
* SYS.FOPEN.T .EQ $08 Open/Append in Text mode
|
|
|
|
|
* SYS.FOPEN.X .EQ $80 Create if not exists
|
|
|
|
|
* PULLB = TYPE
|
|
|
|
|
* PULLW = AUXTYPE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
* Out :
|
|
|
|
|
* CC : A = hFILE
|
|
|
|
|
* CS : A = EC
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FOPEN jsr S.PFTCHECKPATHSTK
|
|
|
|
|
>PULLW MLICALL.PARAMS+1
|
|
|
|
|
>PULLB S.FOPEN.MODE
|
2016-08-28 20:48:01 +00:00
|
|
|
|
>PULLB S.FOPEN.TYPE
|
|
|
|
|
>PULLW S.FOPEN.AUXTYPE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
>MLICALL MLIGETFILEINFO
|
|
|
|
|
bcc .10 Already Exists
|
|
|
|
|
|
|
|
|
|
bit S.FOPEN.MODE Create if not exists ?
|
|
|
|
|
bpl .9 No, return MLI error
|
|
|
|
|
|
|
|
|
|
lda #$C3 Yes, Create...
|
|
|
|
|
sta MLICALL.PARAMS+3 Access
|
|
|
|
|
lda S.FOPEN.TYPE
|
|
|
|
|
sta MLICALL.PARAMS+4 File type
|
|
|
|
|
>LDYA S.FOPEN.AUXTYPE
|
|
|
|
|
>STYA MLICALL.PARAMS+5 Aux type
|
|
|
|
|
lda #$01 Storage=Standard Files
|
|
|
|
|
sta MLICALL.PARAMS+7
|
|
|
|
|
>MLICALL MLICREATE
|
|
|
|
|
bcc .10
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.10 >PUSHWI S.FILE.PRODOS
|
2016-08-26 15:10:38 +00:00
|
|
|
|
>PUSHBI S.MEM.F.INIT0
|
|
|
|
|
jsr S.GetMem
|
|
|
|
|
bcs .99
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
2016-08-26 15:10:38 +00:00
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
stx hFILE
|
|
|
|
|
|
|
|
|
|
>PUSHWI 1024 get a ProDOS IOBUF
|
|
|
|
|
>PUSHBI S.MEM.F.ALIGN+S.MEM.F.NOMOVE
|
|
|
|
|
jsr S.GetMem
|
2016-09-01 15:42:38 +00:00
|
|
|
|
bcs .98
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
|
|
|
|
>STYA MLICALL.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
|
|
|
|
|
txa
|
|
|
|
|
ldy #S.FILE.PRODOS.IOBUF
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
|
|
|
|
|
>MLICALL MLIOPEN
|
2016-08-28 20:48:01 +00:00
|
|
|
|
bcs .98
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
lda MLICALL.PARAMS+5 get ref_num
|
2016-08-26 15:10:38 +00:00
|
|
|
|
ldy #S.FILE.PRODOS.REF
|
|
|
|
|
sta (ZPQuickPtr1),y
|
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
sta MLICALL.PARAMS+1 Next MLI Calls are REF_NUM based
|
|
|
|
|
|
2016-08-26 15:10:38 +00:00
|
|
|
|
lda S.FOPEN.MODE
|
2016-08-28 20:48:01 +00:00
|
|
|
|
and #SYS.FOPEN.A Append ?
|
|
|
|
|
beq .20
|
|
|
|
|
|
|
|
|
|
>MLICALL MLIGETEOF
|
|
|
|
|
bcs .98
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
>MLICALL MLISETMARK
|
|
|
|
|
bcs .98
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
.20 lda S.FOPEN.MODE
|
|
|
|
|
and #SYS.FOPEN.T Text Mode ?
|
|
|
|
|
beq .30
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
lda #$FF
|
|
|
|
|
sta MLICALL.PARAMS+2
|
|
|
|
|
lda #$0D
|
|
|
|
|
sta MLICALL.PARAMS+3
|
|
|
|
|
>MLICALL MLINEWLINE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
.30 lda hFILE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
clc
|
|
|
|
|
rts CC
|
|
|
|
|
|
|
|
|
|
.98 pha save MLI error
|
|
|
|
|
jsr S.FCLOSEA.1
|
|
|
|
|
pla get back MLI error
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FOPEN.MODE .BS 1
|
2016-08-28 20:48:01 +00:00
|
|
|
|
S.FOPEN.TYPE .BS 1
|
|
|
|
|
S.FOPEN.AUXTYPE .BS 2
|
2016-08-26 15:10:38 +00:00
|
|
|
|
hFILE .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FCLOSEA
|
|
|
|
|
* In :
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FCLOSEA jsr S.PFTCHECKFILEA
|
2016-09-01 15:42:38 +00:00
|
|
|
|
sta hFILE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
jsr S.GetMemPtrA
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
|
|
|
|
|
S.FCLOSEA.1 ldy #S.FILE.PRODOS.REF
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .1
|
|
|
|
|
sta MLICALL.PARAMS+1
|
|
|
|
|
>MLICALL MLICLOSE
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.FILE.PRODOS.IOBUF
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
beq .2
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
|
|
|
|
|
.2 lda hFILE
|
|
|
|
|
jsr S.FreeMemA
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FREAD
|
|
|
|
|
* In :
|
|
|
|
|
* PULLB = hFILE
|
|
|
|
|
* PULLW = Bytes To Read
|
|
|
|
|
* PULLW = Dest Ptr
|
|
|
|
|
* Out :
|
|
|
|
|
* Y,A = Bytes Read
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FREAD jsr S.PFTCHECKFILESTK
|
2016-08-28 20:48:01 +00:00
|
|
|
|
>PULLA
|
2016-08-29 15:12:04 +00:00
|
|
|
|
jsr FIL.SetupPrt1A
|
2016-08-26 15:10:38 +00:00
|
|
|
|
>PULLW MLICALL.PARAMS+4
|
|
|
|
|
>PULLW MLICALL.PARAMS+2
|
|
|
|
|
>MLICALL MLIREAD
|
|
|
|
|
bcs .9
|
|
|
|
|
>LDYA MLICALL.PARAMS+6
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FWRITE
|
|
|
|
|
* In :
|
|
|
|
|
* PULLB = hFILE
|
|
|
|
|
* PULLW = Bytes To Write
|
|
|
|
|
* PULLW = Src Ptr
|
|
|
|
|
* Out :
|
|
|
|
|
* Y,A = Bytes Written
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FWRITE jsr S.PFTCHECKFILESTK
|
2016-08-28 20:48:01 +00:00
|
|
|
|
>PULLA
|
2016-08-29 15:12:04 +00:00
|
|
|
|
jsr FIL.SetupPrt1A
|
2016-08-26 15:10:38 +00:00
|
|
|
|
>PULLW MLICALL.PARAMS+4
|
|
|
|
|
>PULLW MLICALL.PARAMS+2
|
|
|
|
|
>MLICALL MLIWRITE
|
|
|
|
|
bcs .9
|
|
|
|
|
>LDYA MLICALL.PARAMS+6
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* S.FFLUSHA
|
|
|
|
|
* In :
|
|
|
|
|
* A = hFILE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.FFLUSHA jsr S.PFTCHECKFILEA
|
2016-08-29 15:12:04 +00:00
|
|
|
|
jsr FIL.SetupPrt1A
|
2016-08-26 15:10:38 +00:00
|
|
|
|
>MLICALL MLIFLUSH
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
* S.FSEEK
|
|
|
|
|
* In :
|
|
|
|
|
* PULLB = hFILE
|
|
|
|
|
* PULLB = From
|
|
|
|
|
* PULLW = OffsetLo
|
|
|
|
|
* PULLW = OffsetHi
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
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
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
S.FSEEK.FROM .BS 1
|
|
|
|
|
S.FSEEK.OFFSET .BS 4
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
* 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
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
* S.FEOFA
|
|
|
|
|
* In :
|
|
|
|
|
* A = hFILE
|
|
|
|
|
* Out :
|
|
|
|
|
* CC :
|
|
|
|
|
* A=0 EOF
|
|
|
|
|
* A !=0 NOT EOF
|
|
|
|
|
* CS :
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
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
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
* S.REMOVEYA
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
S.REMOVEYA jsr S.PFTCHECKPATHYA
|
|
|
|
|
>STYA MLICALL.PARAMS+1
|
|
|
|
|
>MLICALL MLIDESTROY
|
|
|
|
|
rts
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
* S.RENAME
|
|
|
|
|
* In :
|
|
|
|
|
* PULLW = Old Name
|
|
|
|
|
* PULLW = New Name
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
S.RENAME jsr S.PFTCHECKPATHYA
|
|
|
|
|
>PULLW MLICALL.PARAMS+1
|
|
|
|
|
>PULLW MLICALL.PARAMS+2
|
|
|
|
|
>MLICALL MLIRENAME
|
|
|
|
|
rts
|
2016-08-26 15:10:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-08-29 15:12:04 +00:00
|
|
|
|
FIL.SetupPrt1A jsr S.GetMemPtrA
|
|
|
|
|
>STYA ZPQuickPtr1
|
|
|
|
|
ldy #S.FILE.PRODOS.REF
|
|
|
|
|
lda (ZPQuickPtr1),y
|
|
|
|
|
sta MLICALL.PARAMS+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-26 15:10:38 +00:00
|
|
|
|
MAN
|
2016-09-02 06:09:44 +00:00
|
|
|
|
SAVE SYS/KERNEL.S.FILE
|
2016-08-26 15:10:38 +00:00
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|