2018-01-10 16:34:57 +00:00
|
|
|
|
NEW
|
2019-09-02 06:09:28 +00:00
|
|
|
|
AUTO 3,1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-25 16:42:22 +00:00
|
|
|
|
FIO.Init.RTS rts
|
|
|
|
|
|
|
|
|
|
FIO.Init >LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2020-02-25 16:42:22 +00:00
|
|
|
|
bcs FIO.Init.RTS
|
|
|
|
|
>STYA ZPLineBuf
|
|
|
|
|
txa
|
|
|
|
|
>STA.G SRC.hLineBuf
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2020-02-25 16:42:22 +00:00
|
|
|
|
bcs FIO.Init.RTS
|
|
|
|
|
>STYA ZPTmpBuf
|
|
|
|
|
txa
|
|
|
|
|
>STA.G SRC.hTmpBuf
|
|
|
|
|
|
|
|
|
|
>LDYA L.ASM.6502
|
2020-02-23 20:01:48 +00:00
|
|
|
|
FIO.LOAD.CPU >STYA ZPPtr2
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-10-16 15:48:03 +00:00
|
|
|
|
ldy #S.PS.hARGV
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda (pPS),y
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-01-10 16:34:57 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ldy #$ff
|
|
|
|
|
ldx #$ff
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-18 16:48:16 +00:00
|
|
|
|
.1 iny
|
2018-03-28 15:23:32 +00:00
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr1),y
|
2020-02-23 20:01:48 +00:00
|
|
|
|
sta ASM.CPU.FILE,x
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .1
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda #'.'
|
2020-02-23 20:01:48 +00:00
|
|
|
|
sta ASM.CPU.FILE,x
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ldy #$ff
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
jsr SRC.IsLetterOrDigit
|
|
|
|
|
bcs .3
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
sta ASM.CPU.FILE,x
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bra .2
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
.3 stz ASM.CPU.FILE,x
|
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
>LDA.G ASM.hCPUFILE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .4
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
>STZ.G ASM.hCPUFILE
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.4 >PUSHW L.MSG.CPU.FILE
|
2020-02-23 20:01:48 +00:00
|
|
|
|
>PUSHW L.ASM.CPU.FILE
|
2018-11-26 21:52:49 +00:00
|
|
|
|
>PUSHBI 2
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr OUT.Print
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW L.ASM.CPU.FILE
|
2018-10-02 15:52:30 +00:00
|
|
|
|
>PUSHBI O.RDONLY
|
2020-02-23 20:01:48 +00:00
|
|
|
|
>PUSHBI S.FI.T.BIN
|
|
|
|
|
>PUSHWZ Aux type
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>SYSCALL LoadFile
|
|
|
|
|
bcs .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
txa
|
2020-02-27 16:46:40 +00:00
|
|
|
|
>STA.G ASM.hCPUFILE
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>STYA ZPPtr1
|
2018-01-15 06:50:44 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ldy #ASM.T.AM
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPAMPtr
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
adc ZPPtr1+1
|
|
|
|
|
sta ZPAMPtr+1
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPRPtr
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
adc ZPPtr1+1
|
|
|
|
|
sta ZPRPtr+1
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPOpsPtr
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
adc ZPPtr1+1
|
|
|
|
|
sta ZPOpsPtr+1
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2018-01-10 16:34:57 +00:00
|
|
|
|
*---------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
FIO.OpenFile >STYA ZPPtr1
|
2020-02-23 20:01:48 +00:00
|
|
|
|
>PUSHW L.MSG.SRC.FILE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>PUSHW ZPPtr1
|
2018-11-26 21:52:49 +00:00
|
|
|
|
>PUSHBI 2
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr OUT.Print
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-24 13:33:28 +00:00
|
|
|
|
>LDA.G SRC.Depth
|
2018-04-06 15:10:02 +00:00
|
|
|
|
cmp #IN.MAXDEPTH
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .1
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.SRC.TOO.MANY.IN
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
.1 >PUSHW ZPPtr1
|
2020-02-27 16:46:40 +00:00
|
|
|
|
>PUSHW ZPTmpBuf
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>SYSCALL Stat
|
|
|
|
|
bcs .99
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
ldy #S.STAT.P.TYPE
|
|
|
|
|
lda (ZPTmpBuf),y
|
2020-02-23 20:01:48 +00:00
|
|
|
|
cmp #S.FI.T.TXT
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .2
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
2020-02-23 20:01:48 +00:00
|
|
|
|
ldx #O.RDONLY+O.TEXT
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bra .3
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.2 cmp #$FA S-C/BAS?
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bne .98
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
ldx #O.RDONLY
|
|
|
|
|
|
|
|
|
|
.3 >PUSHW ZPPtr1
|
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
2020-02-27 16:46:40 +00:00
|
|
|
|
ldy #S.STAT.P.TYPE
|
|
|
|
|
lda (ZPTmpBuf),y
|
|
|
|
|
>PUSHA
|
2019-06-07 15:02:51 +00:00
|
|
|
|
>PUSHWZ
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .99
|
2019-01-28 07:44:37 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
pha
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>INC.G SRC.Depth
|
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
2020-02-28 07:21:46 +00:00
|
|
|
|
adc #SRC.hFILES-1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
2020-02-24 13:33:28 +00:00
|
|
|
|
>LDA.G SRC.Depth
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
2020-02-28 07:21:46 +00:00
|
|
|
|
adc #SRC.hFILETYPES-1
|
2018-03-28 15:23:32 +00:00
|
|
|
|
tay
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2020-02-27 16:46:40 +00:00
|
|
|
|
phy
|
|
|
|
|
ldy #S.STAT.P.TYPE
|
|
|
|
|
lda (ZPTmpBuf),y
|
|
|
|
|
ply
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sta (pData),y
|
2018-01-10 16:34:57 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda #0
|
|
|
|
|
>STA.G SRC.LINENUM
|
|
|
|
|
iny
|
|
|
|
|
sta (pData),y
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
.98 lda #E.SRC.INV.TYPE
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-24 13:33:28 +00:00
|
|
|
|
FIO.ReadLine >LDA.G SRC.Depth
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #SRC.hFILETYPES-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .10
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>PUSHWI 256
|
2019-01-28 07:44:37 +00:00
|
|
|
|
>PUSHW ZPLineBuf
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
bcs .19
|
|
|
|
|
tya
|
|
|
|
|
beq .13
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
dey
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda (ZPLineBuf),y
|
|
|
|
|
eor #C.CR
|
|
|
|
|
beq .22
|
|
|
|
|
iny
|
|
|
|
|
.22 lda #0 replace ending $0D with $00
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.13 sta (ZPLineBuf),y
|
|
|
|
|
|
|
|
|
|
>INC.G SRC.LINENUM
|
|
|
|
|
bne .19
|
|
|
|
|
>INC.G SRC.LINENUM+1
|
|
|
|
|
.19 rts
|
2018-01-11 16:34:09 +00:00
|
|
|
|
*---------------------------------------
|
2019-01-28 07:44:37 +00:00
|
|
|
|
.10 >PUSHWI 3
|
|
|
|
|
>PUSHW ZPTmpBuf
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
bcs .19
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPTmpBuf),y
|
|
|
|
|
pha
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPTmpBuf),y
|
|
|
|
|
>STA.G SRC.LINENUM+1
|
|
|
|
|
pla
|
|
|
|
|
>STA.G SRC.LINENUM
|
|
|
|
|
lda (ZPTmpBuf) LEN
|
|
|
|
|
sec
|
|
|
|
|
sbc #3
|
|
|
|
|
bcc .9 LEN should be at least 3
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
>PUSHYA
|
2018-07-25 15:26:14 +00:00
|
|
|
|
>PUSHW ZPTmpBuf
|
2018-03-28 15:23:32 +00:00
|
|
|
|
jsr FIO.ReadFromFile
|
|
|
|
|
bcs .9
|
|
|
|
|
>LDYA ZPTmpBuf
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ldy #0
|
|
|
|
|
.1 lda (ZPPtr1)
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .11
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.11 tax
|
|
|
|
|
bmi .2
|
|
|
|
|
sta (ZPLineBuf),y
|
|
|
|
|
beq .8 Ending 00
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
iny
|
|
|
|
|
bne .1
|
|
|
|
|
bra .99
|
|
|
|
|
.2 cmp #$C0 REPEAT char?
|
|
|
|
|
bne .5
|
2018-01-12 16:05:04 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda (ZPPtr1) Get Repeat Count
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.3 tax
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
lda (ZPPtr1) Get Repeat Char
|
|
|
|
|
inc ZPPtr1
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.4 sta (ZPLineBuf),y
|
|
|
|
|
iny
|
|
|
|
|
beq .99
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
bra .1
|
|
|
|
|
.5 and #$3F Compute blank count
|
|
|
|
|
tax
|
|
|
|
|
lda #$20
|
|
|
|
|
.6 sta (ZPLineBuf),y
|
|
|
|
|
iny
|
|
|
|
|
beq .99
|
|
|
|
|
dex
|
|
|
|
|
bne .6
|
|
|
|
|
bra .1
|
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2019-03-25 07:04:40 +00:00
|
|
|
|
.99 lda #E.LINE.TOO.LONG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*--------------------------------------
|
2018-03-28 15:23:32 +00:00
|
|
|
|
FIO.ReadFromFile
|
2020-02-24 13:33:28 +00:00
|
|
|
|
>LDA.G SRC.Depth
|
2018-03-28 15:23:32 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #SRC.hFILES-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2019-01-28 07:44:37 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
>SYSCALL FRead
|
|
|
|
|
bcs .9
|
2020-02-23 20:01:48 +00:00
|
|
|
|
tax $100 byte transfered ?
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .9
|
2019-03-25 07:04:40 +00:00
|
|
|
|
lda #E.LINE.TOO.LONG
|
2018-03-28 15:23:32 +00:00
|
|
|
|
sec
|
|
|
|
|
.9 rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
2020-02-24 13:33:28 +00:00
|
|
|
|
FIO.FileClose >LDA.G SRC.Depth
|
2018-03-28 15:23:32 +00:00
|
|
|
|
beq .8
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
sec
|
2018-03-28 15:23:32 +00:00
|
|
|
|
adc #SRC.hFILES-1
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2020-02-23 20:01:48 +00:00
|
|
|
|
|
2018-03-28 15:23:32 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
MAN
|
2020-08-17 13:03:39 +00:00
|
|
|
|
SAVE usr/src/bin/asm.s.fio
|
|
|
|
|
LOAD usr/src/bin/asm.s
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ASM
|