mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
263 lines
4.2 KiB
Plaintext
263 lines
4.2 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
IO.Reset jsr IO.Reset.In
|
||
jsr IO.Reset.Out
|
||
jsr IO.Reset.Err
|
||
IO.Reset.9 rts
|
||
*--------------------------------------
|
||
IO.Load pha
|
||
>PUSHWZ Aux type
|
||
>PUSHBI S.FI.T.TXT
|
||
>PUSHBI O.RDONLY
|
||
|
||
pla
|
||
>SYSCALL LoadTxtFile
|
||
rts
|
||
*--------------------------------------
|
||
IO.Pipe.In >LDA.G IO.hOut
|
||
ldy #S.PS.hStdOut
|
||
sta (pPS),y
|
||
|
||
>STZ.G IO.hOut
|
||
|
||
>PUSHWZ auxtype
|
||
>PUSHBI 0 type
|
||
>PUSHBI O.RDONLY
|
||
>LEA.G IO.FIFO
|
||
|
||
>SYSCALL fopen
|
||
bcs IO.Set.RTS
|
||
*--------------------------------------
|
||
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
|
||
IO.Set.RTS rts
|
||
*--------------------------------------
|
||
IO.Reset.In >LDA.G IO.hIn
|
||
beq .8
|
||
|
||
pha
|
||
|
||
ldy #S.PS.hStdIn
|
||
lda (pPS),y
|
||
|
||
>SYSCALL fclose
|
||
|
||
pla
|
||
ldy #S.PS.hStdIn
|
||
sta (pPS),y
|
||
|
||
>STZ.G IO.hIn
|
||
.8 clc
|
||
IO.Reset.In.RTS rts
|
||
*--------------------------------------
|
||
IO.Pipe.Out >PUSHWZ mode
|
||
>LEA.G IO.FIFO
|
||
>SYSCALL MKFIFO
|
||
bcs IO.Reset.In.RTS
|
||
|
||
>PUSHWZ auxtype
|
||
>PUSHBI 0 type
|
||
>PUSHBI O.WRONLY
|
||
>LEA.G IO.FIFO
|
||
>SYSCALL fopen
|
||
bcs IO.Reset.In.RTS
|
||
*--------------------------------------
|
||
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
|
||
|
||
>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
|
||
*--------------------------------------
|
||
IO.PrintBatchErrMsg
|
||
>LDYA ZPInputBuf
|
||
>STYA ZPPtr1
|
||
|
||
ldy #S.PS.RC
|
||
lda (pPs),y
|
||
cmp #E.SYN
|
||
beq .10
|
||
|
||
>LDYA ZPInputCmdPtr
|
||
bra .11
|
||
|
||
.10 >LDYA ZPInputBufPtr
|
||
|
||
.11 >STYA ZPPtr2
|
||
|
||
stz M32.TMP Line Count
|
||
stz M32.TMP+1
|
||
|
||
.1 inc M32.TMP
|
||
bne .2
|
||
inc M32.TMP+1
|
||
|
||
.2 ldy #$ff
|
||
|
||
.3 iny
|
||
lda (ZPPtr1),y
|
||
beq .4 EoF
|
||
|
||
cmp #C.CR
|
||
bne .3 Scan until EoL
|
||
|
||
.4 tya
|
||
clc
|
||
adc ZPPtr1
|
||
tax
|
||
lda ZPPtr1+1
|
||
adc #0
|
||
pha
|
||
|
||
cpx ZPPtr2
|
||
sbc ZPPtr2+1
|
||
pla
|
||
bcs .41
|
||
|
||
inx
|
||
bne .40
|
||
inc
|
||
.40 stx ZPPtr1
|
||
sta ZPPtr1+1
|
||
bra .1
|
||
|
||
.41 ldy #$ff
|
||
|
||
.5 iny
|
||
lda (ZPPtr1),y
|
||
sta (ZPCLBuf),y
|
||
beq .6
|
||
|
||
eor #C.CR
|
||
bne .5
|
||
|
||
sta (ZPCLBuf),y
|
||
|
||
.6 >PUSHW ZPCLBuf
|
||
|
||
>PUSHBI 2
|
||
>PUSHW L.MSG.BATCHLINE
|
||
jsr .80
|
||
|
||
ldy #$ff
|
||
ldx #'-'
|
||
|
||
.7 iny
|
||
lda (ZPCLBuf),y
|
||
beq .8
|
||
|
||
txa
|
||
sta (ZPCLBuf),y
|
||
bra .7
|
||
|
||
.8 >PUSHW M32.TMP
|
||
>PUSHW ZPCLBuf
|
||
>PUSHBI 4
|
||
>PUSHW L.MSG.BATCHERR
|
||
|
||
.80 ldy #S.PS.hStdErr
|
||
lda (pPS),y
|
||
>SYSCALL fprintf
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
IO.PrintErrMsg pha Save EC for PrintF
|
||
|
||
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
|
||
|
||
.2 lda L.ERR.Messages
|
||
sta ZPPTR1
|
||
lda L.ERR.Messages+1
|
||
sta ZPPTR1+1
|
||
|
||
.3 dey
|
||
bmi .8
|
||
|
||
lda (ZPPTR1)
|
||
sec
|
||
adc ZPPTR1
|
||
sta ZPPTR1
|
||
bcc .3
|
||
inc ZPPTR1+1
|
||
bra .3
|
||
|
||
.8 >PUSHW ZPPTR1
|
||
pla
|
||
>PUSHA
|
||
>PUSHBI 3
|
||
>PUSHW L.MSG.ERROR
|
||
ldy #S.PS.hStdErr
|
||
lda (pPS),y
|
||
>SYSCALL fprintf
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/BIN/SH.S.IO
|
||
LOAD USR/SRC/BIN/SH.S
|
||
ASM
|