2019-11-06 13:14:42 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
NewFile stz FileLen
|
|
|
|
|
stz FileLen+1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-11-06 16:25:00 +00:00
|
|
|
|
LoadFile >PUSHEA.G STATBUF
|
2019-11-06 13:14:42 +00:00
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
2019-11-06 16:25:00 +00:00
|
|
|
|
>SYSCALL stat
|
2019-11-06 13:14:42 +00:00
|
|
|
|
bcs NewFile
|
|
|
|
|
|
|
|
|
|
>LDA.G STATBUF+S.STAT.P.TYPE
|
|
|
|
|
cmp #S.FI.T.TXT
|
|
|
|
|
beq LoadFile.TXT
|
|
|
|
|
cmp #$FA S-C/ASM?
|
|
|
|
|
bne .91
|
|
|
|
|
|
|
|
|
|
jmp LoadFile.ASM
|
|
|
|
|
|
|
|
|
|
.91 lda #MLI.E.INCFF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
>LDA.G STATBUF+S.STAT.SIZE+3
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
lda (pData),y Size HI
|
|
|
|
|
adc #4 1K more
|
|
|
|
|
|
|
|
|
|
ldy #0 Size LO
|
|
|
|
|
>STYA BufLen
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
>STYA BufPtr
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hBuffer
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda (BufPtrBackup),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cpx #C.CR
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
cmp #C.LF
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
.2 cmp #C.SPACE
|
|
|
|
|
bcs .3
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
.3 sta (BufPtr)
|
|
|
|
|
inc BufPtr
|
|
|
|
|
bne .4
|
|
|
|
|
inc BufPtr+1
|
|
|
|
|
.4 inc FileLen
|
|
|
|
|
bne .5
|
|
|
|
|
inc FileLen+1
|
|
|
|
|
|
|
|
|
|
.5 tax set previous char
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
inc BufPtrBackup+1
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 sta (BufPtr)
|
|
|
|
|
clc
|
|
|
|
|
.9 jmp BUF.ResetSel
|
|
|
|
|
|
|
|
|
|
.90 lda #E.FTB
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-11-06 16:25:00 +00:00
|
|
|
|
LoadFile.TXT stz FileLen
|
|
|
|
|
stz FileLen+1
|
|
|
|
|
|
|
|
|
|
>PUSHWZ Aux type
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.RDONLY+O.TEXT
|
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>SYSCALL fopen
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hFile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2019-11-06 13:14:42 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
LoadFile.ASM
|
|
|
|
|
lda #MLI.E.INCFF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
SaveFile >PUSHWZ Aux type
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.CREATE+O.WRONLY
|
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
|
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
|
|
|
|
pha
|
|
|
|
|
>PUSHW FileLen
|
|
|
|
|
>LDA.G hBuffer
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>PUSHYA
|
|
|
|
|
pla
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
>SYSCALL FWrite
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
pla
|
|
|
|
|
phx
|
|
|
|
|
>SYSCALL FClose
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 pla
|
|
|
|
|
>SYSCALL FClose
|
|
|
|
|
|
|
|
|
|
lda #$80
|
|
|
|
|
>STA.G bSaved
|
|
|
|
|
jsr SCRN.UpdateTopBar
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/BIN/EDIT.S.FILE
|
|
|
|
|
LOAD USR/SRC/BIN/EDIT.S
|
|
|
|
|
ASM
|