2019-11-06 13:14:42 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2019-12-16 13:14:11 +00:00
|
|
|
|
FILE.New jsr BUF.ResetSel
|
2019-12-17 12:28:49 +00:00
|
|
|
|
jsr SCRN.UpdateStatusBar
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.NEWFILE
|
|
|
|
|
|
|
|
|
|
FILE.New.1 >SYSCALL RealPath
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hFileName
|
|
|
|
|
|
|
|
|
|
>LDYAI 4096
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>STYA BufLen
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
>STYA BufPtr
|
2019-11-15 16:15:43 +00:00
|
|
|
|
>STYA.G BufBase
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
|
|
|
|
txa
|
2020-01-23 14:48:22 +00:00
|
|
|
|
>STA.G hBuf FileLen already set to 0
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (BufPtr)
|
|
|
|
|
|
|
|
|
|
stz FileLen
|
2019-11-06 13:14:42 +00:00
|
|
|
|
stz FileLen+1
|
2019-11-27 16:47:13 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
jsr SCRN.Home
|
|
|
|
|
clc
|
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
.9 rts
|
2019-11-06 13:14:42 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-12 16:39:22 +00:00
|
|
|
|
FILE.Load jsr BUF.ResetSel
|
2019-12-17 12:28:49 +00:00
|
|
|
|
jsr SCRN.UpdateStatusBar
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>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-12-16 13:14:11 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
bra FILE.New.1
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
2019-12-16 13:14:11 +00:00
|
|
|
|
.1 >LDA.G STATBUF+S.STAT.P.TYPE
|
2019-11-06 13:14:42 +00:00
|
|
|
|
cmp #S.FI.T.TXT
|
2019-11-12 16:39:22 +00:00
|
|
|
|
beq FILE.Load.TXT
|
2019-11-06 13:14:42 +00:00
|
|
|
|
cmp #$FA S-C/ASM?
|
2019-11-12 16:39:22 +00:00
|
|
|
|
bne .9
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
jmp FILE.Load.ASM
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
.9 lda #MLI.E.INCFF
|
2019-11-06 13:14:42 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-11-12 16:39:22 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
FILE.Load.TXT stz FileLen
|
|
|
|
|
stz FileLen+1
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
jsr SCRN.Home
|
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
stz TmpByte hLineBuffer
|
|
|
|
|
stz TmpIndex hFile
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>STZ.G FileType
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
jsr FILE.GetBuffer
|
|
|
|
|
bcs .99
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
>LDYAI 256
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .99
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
stx TmpByte
|
2019-11-06 16:25:00 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
>PUSHWZ Aux type
|
2019-11-06 16:25:00 +00:00
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.RDONLY+O.TEXT
|
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>SYSCALL fopen
|
2019-11-12 16:39:22 +00:00
|
|
|
|
.99 bcs .9
|
2019-11-06 16:25:00 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
sta TmpIndex
|
2019-11-17 14:39:55 +00:00
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
.1 >PUSHWI 254
|
|
|
|
|
>PUSHW ZPPTR1
|
|
|
|
|
lda TmpIndex
|
|
|
|
|
>SYSCALL fread
|
2019-11-17 14:39:55 +00:00
|
|
|
|
bcs .7
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPTR1),y Y = line len
|
2019-11-06 16:25:00 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
ldy #0
|
2019-11-12 16:39:22 +00:00
|
|
|
|
lda (ZPPTR1)
|
2019-11-17 14:39:55 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
eor #C.LF
|
|
|
|
|
bne .2
|
2019-11-06 16:25:00 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
phy
|
|
|
|
|
|
2019-11-12 16:39:22 +00:00
|
|
|
|
lda #2
|
|
|
|
|
>STA.G FileType
|
2019-11-06 16:25:00 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
ply
|
|
|
|
|
iny
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
.2 lda (ZPPTR1),y
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
sta (BufPtr)
|
|
|
|
|
inc BufPtr
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
inc BufPtr+1
|
|
|
|
|
|
|
|
|
|
.3 inx
|
|
|
|
|
iny
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.4 txa
|
|
|
|
|
clc
|
|
|
|
|
adc FileLen
|
|
|
|
|
sta FileLen
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
inc FileLen+1
|
2019-11-12 16:39:22 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
.7 cmp #MLI.E.EOF
|
2019-11-12 16:39:22 +00:00
|
|
|
|
bne .9
|
2019-11-17 14:39:55 +00:00
|
|
|
|
|
|
|
|
|
.8 lda #0
|
|
|
|
|
sta (BufPtr)
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2019-11-17 14:39:55 +00:00
|
|
|
|
.HS B0 BCS
|
|
|
|
|
.9 sec
|
|
|
|
|
jmp FILE.Close
|
2019-11-06 13:14:42 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-12 16:39:22 +00:00
|
|
|
|
FILE.Load.ASM
|
2019-11-06 13:14:42 +00:00
|
|
|
|
lda #MLI.E.INCFF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-11-17 14:39:55 +00:00
|
|
|
|
FILE.Save >LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
2019-12-16 13:14:11 +00:00
|
|
|
|
bcs FILE.Save.9
|
2019-11-17 14:39:55 +00:00
|
|
|
|
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
stx TmpByte
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
>LDA.G FileType
|
|
|
|
|
tax
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
jmp (J.SAVE,x)
|
2019-12-16 13:14:11 +00:00
|
|
|
|
FILE.Save.9 rts
|
2019-11-12 16:39:22 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-17 14:39:55 +00:00
|
|
|
|
FILE.Save.CR clc
|
|
|
|
|
.HS B0 BCS
|
|
|
|
|
FILE.Save.CRLF sec
|
|
|
|
|
ror TmpIndex+1
|
2019-12-16 13:14:11 +00:00
|
|
|
|
stz TmpIndex hFile
|
2019-11-17 14:39:55 +00:00
|
|
|
|
|
|
|
|
|
>PUSHWZ Aux type
|
2019-11-06 13:14:42 +00:00
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.CREATE+O.WRONLY
|
|
|
|
|
>LDA.G hFileName
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>SYSCALL FOpen
|
2019-12-16 13:14:11 +00:00
|
|
|
|
bcs FILE.Save.9
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
sta TmpIndex
|
|
|
|
|
|
|
|
|
|
>LDYA.G BufBase
|
|
|
|
|
>STYA BufPtr
|
|
|
|
|
|
|
|
|
|
.1 lda (BufPtr)
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (BufPtr),y
|
|
|
|
|
sta (ZPPTR1),y
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
bit TmpIndex+1
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda #C.LF
|
|
|
|
|
sta (ZPPTR1),y
|
|
|
|
|
|
|
|
|
|
.3 tya
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc BufPtr
|
|
|
|
|
sta BufPtr
|
|
|
|
|
bcc .4
|
|
|
|
|
|
|
|
|
|
inc BufPtr+1
|
|
|
|
|
|
|
|
|
|
.4 lda #0
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW ZPPTR1
|
|
|
|
|
lda TmpIndex
|
|
|
|
|
>SYSCALL FWrite
|
2019-12-17 12:28:49 +00:00
|
|
|
|
bcs FILE.Close
|
2019-11-06 13:14:42 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
bra .1
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
.8 >STZ.G bUnSaved
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
FILE.Close php
|
|
|
|
|
pha
|
|
|
|
|
lda TmpByte
|
|
|
|
|
beq .1
|
|
|
|
|
>SYSCALL freemem
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
.1 lda TmpIndex
|
|
|
|
|
beq .2
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
>SYSCALL fclose
|
2019-12-16 13:14:11 +00:00
|
|
|
|
|
2019-12-17 12:28:49 +00:00
|
|
|
|
.2 pla
|
|
|
|
|
plp
|
|
|
|
|
rts
|
2019-11-17 14:39:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
FILE.Save.ASM
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-11-06 13:14:42 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-12 16:39:22 +00:00
|
|
|
|
FILE.GetBuffer >LDA.G STATBUF+S.STAT.SIZE+3
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
lda (pData),y Size HI
|
|
|
|
|
cmp #16
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
lda #13 Min = 3k
|
|
|
|
|
|
|
|
|
|
.1 adc #3 1K more
|
|
|
|
|
|
|
|
|
|
ldy #0 Size LO
|
|
|
|
|
>STYA BufLen
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .99
|
2019-11-15 16:15:43 +00:00
|
|
|
|
|
2019-11-17 14:39:55 +00:00
|
|
|
|
>STYA BufPtr
|
|
|
|
|
>STYA.G BufBase
|
2019-11-12 16:39:22 +00:00
|
|
|
|
txa
|
2020-01-23 14:48:22 +00:00
|
|
|
|
>STA.G hBuf
|
2019-11-12 16:39:22 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (BufPtr)
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #E.FTB
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2019-11-06 13:14:42 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/BIN/EDIT.S.FILE
|
|
|
|
|
LOAD USR/SRC/BIN/EDIT.S
|
|
|
|
|
ASM
|