2018-01-18 06:49:41 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2018-01-18 06:49:41 +00:00
|
|
|
|
AUTO 4,1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2018-11-07 16:11:02 +00:00
|
|
|
|
IO.Reset jsr IO.Reset.In
|
|
|
|
|
jsr IO.Reset.Out
|
|
|
|
|
jsr IO.Reset.Err
|
2019-02-26 16:50:42 +00:00
|
|
|
|
IO.Reset.9 rts
|
2019-04-04 15:44:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.Load pha
|
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.RDONLY
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
>SYSCALL LoadTxtFile
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-02-26 16:50:42 +00:00
|
|
|
|
IO.Pipe.In >LDA.G IO.hOut
|
2019-02-18 06:42:17 +00:00
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
|
|
|
|
|
>STZ.G IO.hOut
|
2019-02-15 16:38:17 +00:00
|
|
|
|
|
2019-02-26 16:50:42 +00:00
|
|
|
|
>PUSHWI 0 auxtype
|
|
|
|
|
>PUSHBI 0 type
|
|
|
|
|
>PUSHBI O.RDONLY
|
|
|
|
|
>LEA.G IO.NodBuf
|
|
|
|
|
|
|
|
|
|
>SYSCALL fopen
|
2019-04-01 06:07:56 +00:00
|
|
|
|
bcs IO.Set.RTS
|
2019-04-04 15:44:20 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-07 16:11:02 +00:00
|
|
|
|
IO.Set.In pha
|
|
|
|
|
jsr IO.Reset.In
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>STA.G IO.hIn
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
sta (pPS),y
|
2019-04-01 06:07:56 +00:00
|
|
|
|
IO.Set.RTS rts
|
2019-04-04 15:44:20 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-07 16:11:02 +00:00
|
|
|
|
IO.Reset.In >LDA.G IO.hIn
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
pha
|
2019-02-19 11:30:45 +00:00
|
|
|
|
|
2018-11-07 16:11:02 +00:00
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
2019-02-25 16:36:09 +00:00
|
|
|
|
|
2018-11-07 16:11:02 +00:00
|
|
|
|
>SYSCALL fclose
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
|
|
|
|
|
>STZ.G IO.hIn
|
2019-02-15 16:38:17 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
IO.Reset.In.RTS rts
|
2019-04-04 15:44:20 +00:00
|
|
|
|
*--------------------------------------
|
2019-05-17 14:57:14 +00:00
|
|
|
|
IO.Pipe.Out >LDYAI 256
|
2019-05-02 15:59:11 +00:00
|
|
|
|
>SYSCALL pipe
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bcs IO.Reset.In.RTS
|
|
|
|
|
>STA.G IO.hPipe
|
|
|
|
|
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
|
|
|
|
>PUSHW L.NOD.Template
|
|
|
|
|
>LEA.G IO.NodBuf
|
|
|
|
|
>SYSCALL sprintf
|
|
|
|
|
|
|
|
|
|
>PUSHB.G IO.hPipe
|
2019-02-18 06:42:17 +00:00
|
|
|
|
>PUSHWI 0
|
2019-02-15 16:38:17 +00:00
|
|
|
|
>LEA.G IO.NodBuf
|
|
|
|
|
>SYSCALL mknod
|
2019-02-18 06:42:17 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>PUSHWI 0 auxtype
|
|
|
|
|
>PUSHBI 0 type
|
2019-02-26 16:50:42 +00:00
|
|
|
|
>PUSHBI O.WRONLY
|
2019-02-18 06:42:17 +00:00
|
|
|
|
>LEA.G IO.NodBuf
|
|
|
|
|
|
|
|
|
|
>SYSCALL fopen
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bcc IO.Set.Out
|
2019-03-11 15:43:33 +00:00
|
|
|
|
|
2019-02-18 06:42:17 +00:00
|
|
|
|
.99 pha
|
2019-02-15 16:38:17 +00:00
|
|
|
|
>LDA.G IO.hPipe
|
|
|
|
|
>SYSCALL close
|
|
|
|
|
pla
|
2019-02-18 06:42:17 +00:00
|
|
|
|
sec
|
2019-02-15 16:38:17 +00:00
|
|
|
|
rts
|
2018-11-07 16:11:02 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.Set.Out pha
|
|
|
|
|
jsr IO.Reset.Out
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>STA.G IO.hOut
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.Reset.Out >LDA.G IO.hOut
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
2019-02-25 16:36:09 +00:00
|
|
|
|
|
2018-11-07 16:11:02 +00:00
|
|
|
|
>SYSCALL fclose
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
|
|
|
|
|
>STZ.G IO.hOut
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.Set.Err pha
|
|
|
|
|
jsr IO.Reset.Err
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>STA.G IO.hErr
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
IO.Reset.Err >LDA.G IO.hErr
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fclose
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
sta (pPS),y
|
|
|
|
|
|
|
|
|
|
>STZ.G IO.hErr
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
IO.PrintBatchErrMsg
|
2019-02-14 14:51:24 +00:00
|
|
|
|
>LDYA ZPInputBuf
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2019-03-01 14:36:20 +00:00
|
|
|
|
ldy #S.PS.RC
|
|
|
|
|
lda (pPs),y
|
2019-03-05 16:49:34 +00:00
|
|
|
|
cmp #E.SYN
|
2019-03-01 14:36:20 +00:00
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
>LDYA ZPInputCmdPtr
|
|
|
|
|
bra .11
|
|
|
|
|
|
|
|
|
|
.10 >LDYA ZPInputBufPtr
|
|
|
|
|
|
|
|
|
|
.11 >STYA ZPPtr2
|
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
stz M32.TMP Line Count
|
|
|
|
|
stz M32.TMP+1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.1 inc M32.TMP
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bne .2
|
2019-04-01 06:07:56 +00:00
|
|
|
|
inc M32.TMP+1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.2 ldy #$ff
|
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
beq .4 EoF
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
bne .3 Scan until EoL
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.4 tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
tax
|
2018-11-10 14:30:09 +00:00
|
|
|
|
lda ZPPtr1+1
|
2019-02-14 14:51:24 +00:00
|
|
|
|
adc #0
|
|
|
|
|
pha
|
|
|
|
|
|
2019-03-01 14:36:20 +00:00
|
|
|
|
cpx ZPPtr2
|
|
|
|
|
sbc ZPPtr2+1
|
2019-02-14 14:51:24 +00:00
|
|
|
|
pla
|
|
|
|
|
bcs .41
|
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
bne .40
|
|
|
|
|
inc
|
|
|
|
|
.40 stx ZPPtr1
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
bra .1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.41 ldy #$ff
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.5 iny
|
|
|
|
|
lda (ZPPtr1),y
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .6
|
2019-02-14 14:51:24 +00:00
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .6
|
2019-02-14 14:51:24 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
phy
|
2018-11-27 21:26:03 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fputc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
ply
|
|
|
|
|
bra .5
|
|
|
|
|
|
2018-11-27 21:26:03 +00:00
|
|
|
|
.6 >PUSHBI 0
|
|
|
|
|
>PUSHW L.MSG.ECHOCRLF
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fprintf
|
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.7 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
phy
|
2018-11-27 21:26:03 +00:00
|
|
|
|
>PUSHBI '-'
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fputc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
ply
|
2019-02-14 14:51:24 +00:00
|
|
|
|
bra .7
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-04-01 06:07:56 +00:00
|
|
|
|
.8 >PUSHW M32.TMP
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
2018-11-27 21:26:03 +00:00
|
|
|
|
>PUSHW L.MSG.BATCHERR
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fprintf
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-11 15:29:08 +00:00
|
|
|
|
IO.PrintErrMsg pha Save EC for PrintF
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
|
|
|
|
ldx L.ERR.Codes
|
|
|
|
|
stx ZPPTR1
|
|
|
|
|
ldx L.ERR.Codes+1
|
|
|
|
|
stx ZPPTR1+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 cmp (ZPPTR1),y
|
|
|
|
|
beq .2
|
|
|
|
|
iny
|
|
|
|
|
cpy #ERR.Count
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.2 lda L.ERR.Messages
|
2016-10-29 19:58:21 +00:00
|
|
|
|
sta ZPPTR1
|
|
|
|
|
lda L.ERR.Messages+1
|
|
|
|
|
sta ZPPTR1+1
|
|
|
|
|
|
2017-03-19 21:47:54 +00:00
|
|
|
|
.3 dey
|
|
|
|
|
bmi .8
|
2018-07-13 14:38:24 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPTR1
|
|
|
|
|
sta ZPPTR1
|
2017-03-19 21:47:54 +00:00
|
|
|
|
bcc .3
|
2016-10-29 19:58:21 +00:00
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
bra .3
|
|
|
|
|
|
2018-11-08 14:23:06 +00:00
|
|
|
|
.8 >PUSHW ZPPTR1
|
2017-09-11 15:29:08 +00:00
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
2018-10-08 05:55:28 +00:00
|
|
|
|
>PUSHBI 3
|
|
|
|
|
>PUSHW L.MSG.ERROR
|
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL fprintf
|
2016-10-29 19:58:21 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2019-02-08 16:13:43 +00:00
|
|
|
|
SAVE USR/SRC/BIN/SH.S.IO
|
|
|
|
|
LOAD USR/SRC/BIN/SH.S
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ASM
|