2015-10-28 16:55:12 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-06-16 13:01:08 +00:00
|
|
|
|
LOMEM $A00
|
2015-10-28 16:55:12 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*---------------------------------------
|
2017-08-30 15:26:34 +00:00
|
|
|
|
FIO.Init ldy #S.PS.hARGS
|
2015-12-04 16:33:33 +00:00
|
|
|
|
lda (pPS),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-12-04 16:33:33 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
tay
|
|
|
|
|
adc #3 len of ".T."
|
|
|
|
|
sta ASM.T.FILENAMELEN
|
|
|
|
|
adc #4 len of "6502"
|
|
|
|
|
sta ASM.T.FILENAME
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr1),y
|
|
|
|
|
sta ASM.T.FILENAME,y
|
|
|
|
|
dey
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
ldy #6
|
|
|
|
|
|
|
|
|
|
.3 lda ASM.T.DEFAULT,y
|
|
|
|
|
sta ASM.T.FILENAME,x
|
|
|
|
|
dex
|
|
|
|
|
dey
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
jmp FIO.LOAD.ASM.T
|
|
|
|
|
.99 rts
|
|
|
|
|
*---------------------------------------
|
2015-11-20 16:31:14 +00:00
|
|
|
|
FIO.OpenFileA sta FIO.hFileName
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-28 16:55:12 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2015-11-20 16:31:14 +00:00
|
|
|
|
stz FIO.hFullPath
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'/'
|
|
|
|
|
beq .1
|
|
|
|
|
|
2015-11-20 16:31:14 +00:00
|
|
|
|
>PUSHB FIO.hFileName
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>PUSHA
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrCat
|
2015-11-20 16:31:14 +00:00
|
|
|
|
sta FIO.hFullPath
|
|
|
|
|
sta FIO.hFileName
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2015-10-28 16:55:12 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
.1 >PUSHW ZPPtr1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYA L.MSG.SRC.FILE
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
|
|
|
|
ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
2015-10-30 16:34:59 +00:00
|
|
|
|
cmp #SRC.IN.MAXDEPTH
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
lda #ERR.SRC.TOO.MANY.IN
|
|
|
|
|
sec
|
2015-11-20 16:31:14 +00:00
|
|
|
|
bra FIO.OpenFileA.Exit
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.10 >PUSHWI 0
|
|
|
|
|
>PUSHBI 4
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>PUSHBI SYS.FOpen.R+SYS.FOpen.T
|
2016-10-29 19:58:21 +00:00
|
|
|
|
lda FIO.hFileName
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>PUSHYA
|
2017-06-16 13:01:08 +00:00
|
|
|
|
>SYSCALL FOpen
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
2016-10-29 19:58:21 +00:00
|
|
|
|
adc #SRC.hFILES
|
2015-10-28 16:55:12 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #SRC.hFILETYPES
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* cmp #$FA S-C/BAS?
|
|
|
|
|
* beq .8
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* cmp #$04 TXT ?
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* bne .98
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
|
|
|
|
.8 ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
2015-11-20 16:31:14 +00:00
|
|
|
|
bra FIO.OpenFileA.Exit
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
|
|
|
|
.98 lda #ERR.SRC.INV.TYPE
|
|
|
|
|
|
|
|
|
|
.99 sec
|
2015-11-20 16:31:14 +00:00
|
|
|
|
FIO.OpenFileA.Exit php
|
|
|
|
|
pha
|
|
|
|
|
lda FIO.hFullPath
|
|
|
|
|
beq .1
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2015-11-20 16:31:14 +00:00
|
|
|
|
.1 pla
|
|
|
|
|
plp
|
2015-10-28 16:55:12 +00:00
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-11-13 16:25:31 +00:00
|
|
|
|
FIO.ReadLine stz SRC.BufPtr
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
|
|
|
|
ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
|
|
|
|
adc #SRC.hFILETYPES-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .10
|
|
|
|
|
|
|
|
|
|
>PUSHWI 256
|
2016-09-26 06:18:51 +00:00
|
|
|
|
>PUSHWI UsrBuf256
|
2015-10-28 16:55:12 +00:00
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
bcs .19
|
|
|
|
|
|
|
|
|
|
lda #0 replace ending $0D with $00
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,y
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.19 rts
|
|
|
|
|
|
|
|
|
|
.10 >PUSHWI 3
|
|
|
|
|
>PUSHW L.SRC.Buffer
|
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda SRC.Buffer+1
|
|
|
|
|
sta SRC.LINENUM
|
|
|
|
|
lda SRC.Buffer+2
|
|
|
|
|
sta SRC.LINENUM+1
|
|
|
|
|
|
|
|
|
|
lda SRC.Buffer LEN
|
|
|
|
|
sec
|
|
|
|
|
sbc #3
|
|
|
|
|
bcc .9 LEN should be at least 3
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.SRC.BUFFER
|
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda SRC.Buffer,y
|
|
|
|
|
bmi .2
|
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,x
|
2015-10-28 16:55:12 +00:00
|
|
|
|
beq .8 Ending 00
|
|
|
|
|
inx
|
|
|
|
|
beq .99
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.2 cmp #$C0 REPEAT char?
|
|
|
|
|
bne .5
|
|
|
|
|
iny
|
|
|
|
|
beq .99
|
|
|
|
|
lda SRC.Buffer,y
|
|
|
|
|
iny
|
|
|
|
|
beq .99
|
|
|
|
|
.3 pha
|
|
|
|
|
lda SRC.Buffer,y
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,x
|
2015-10-28 16:55:12 +00:00
|
|
|
|
pla
|
|
|
|
|
inx
|
|
|
|
|
beq .99
|
|
|
|
|
dec
|
|
|
|
|
bne .3
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.5 and #$3F Compute blank count
|
|
|
|
|
.6 pha
|
|
|
|
|
lda #$20
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta UsrBuf256,x
|
2015-10-28 16:55:12 +00:00
|
|
|
|
pla
|
|
|
|
|
inx
|
|
|
|
|
beq .99
|
|
|
|
|
dec
|
|
|
|
|
bne .6
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.99 lda #ERR.LINE.TOO.LONG
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
FIO.ReadFromFile ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
clc
|
2017-06-16 13:01:08 +00:00
|
|
|
|
adc #SRC.hFILES-1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>PUSHA
|
2017-06-16 13:01:08 +00:00
|
|
|
|
>SYSCALL FRead
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
tax $100 byte transfered ?
|
|
|
|
|
beq .9
|
|
|
|
|
lda #ERR.LINE.TOO.LONG
|
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
FIO.FileClose ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
clc
|
2017-06-16 13:01:08 +00:00
|
|
|
|
adc #SRC.hFILES-1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FClose.A
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
|
|
|
|
ldy #SRC.COUNT
|
|
|
|
|
lda (pData),y
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-12-04 16:33:33 +00:00
|
|
|
|
FIO.LOAD.ASM.T ldy #ASM.T.hMem
|
2015-10-28 16:55:12 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .1
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ldy #ASM.T.hMem
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.1 >PUSHW L.ASM.T.FILENAME
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYA L.MSG.T.FILE
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2016-09-22 06:19:49 +00:00
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI 6 S.FILEINFO.TYPE.BIN
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>PUSHBI SYS.FOpen.R
|
2016-09-22 06:19:49 +00:00
|
|
|
|
>PUSHW L.ASM.T.FILENAME
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadFile
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
ldy #ASM.T.hMem
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
2015-12-04 16:33:33 +00:00
|
|
|
|
FIO.EmitByte clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-28 16:55:12 +00:00
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/BIN/ASM.S.FIO
|
2017-06-16 13:01:08 +00:00
|
|
|
|
LOAD /A2OSX.SRC/BIN/ASM.S
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ASM
|