A2osX/BIN/CC.S.FIO.txt

213 lines
3.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
FIO.LoadLIB.o >LDA.G LibCount
cmp #LIBS.MAX
bne .1
lda #E.OOH
sec
.9 rts
.1 clc
adc #hLibNs
tay
lda ArgIndex
sta (pData),y
>PUSHW L.ENV.LIB
>PUSHW pData >PUSHEA.G PathBuf
>SYSCALL GetEnv
bcs .9
>PUSHW pData
lda ArgIndex
>SYSCALL ArgV
>PUSHYA
>SYSCALL strcat
>PUSHW pData
>PUSHW L.LIB.O
>SYSCALL strcat
>PUSHW L.MSG.READING
>PUSHW pData
>PUSHBI 2
>SYSCALL PrintF
>PUSHW pData
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.BIN
>PUSHWZ Aux type
>SYSCALL loadfile
bcs .99
>LDA.G LibCount
clc
adc #hLibOs
tay
txa
sta (pData),y
>INC.G LibCount
clc
.99 rts
*--------------------------------------
FIO.FOpen1st >LDA.G CC.InFileArg
>SYSCALL ArgV
FIO.FOpen phy
pha
>PUSHW L.MSG.READING
pla
pha
>PUSHYA
>PUSHBI 2
>SYSCALL PrintF
pla
ply
>PUSHYA
>PUSHBI O.RDONLY
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
tax
>LDA.G hFilePtr
inc
sta (pData),y
tay
txa
sta (pData),y
>LDA.G LineCntPtr
inc
inc
sta (pData),y
tay
lda #0
sta (pData),y
iny
sta (pData),y
.9 rts
*--------------------------------------
FIO.FGetS >LDYA.G LineBufPtr
>STYA ZPLineBufPtr
lda #0
sta (ZPLineBufPtr) set to Empty line
>LDA.G LineCntPtr
tay
lda (pData),y
inc
sta (pData),y
bne .1
iny
lda (pData),y
inc
sta (pData),y
.1 >LDA.G hFilePtr
tay
lda (pData),y
>PUSHA
>PUSHW ZPLineBufPtr
>PUSHWI 255
>SYSCALL FGetS
bcs .9
>LDA.G bVerbose
bpl .8
jsr PrintVerboseMsg
.8
.9 rts
*--------------------------------------
FIO.FClose >LDA.G hFilePtr
cmp #hFilePtr
beq .8
tay
lda (pData),y
>SYSCALL FClose
>LDA.G hFilePtr
dec
sta (pData),y
cmp #hFilePtr
beq .8
>LDA.G LineCntPtr
dec
dec
sta (pData),y NZ
.8 rts
*--------------------------------------
FIO.FCreate lda ZPCCCode+1
sta PCC.FH+PCC.FH.CONST+1
sec
sbc #$20
sta PCC.FH+PCC.FH.CSSIZE+1
lda ZPCCCode
sta PCC.FH+PCC.FH.CSSIZE
sta PCC.FH+PCC.FH.CONST
clc
adc ZPCCConst
sta PCC.FH+PCC.FH.LIBS
lda ZPCCCode+1
adc ZPCCConst+1
sta PCC.FH+PCC.FH.LIBS+1
lda ZPCCData
sta PCC.FH+PCC.FH.DSSIZE
lda ZPCCData+1
sta PCC.FH+PCC.FH.DSSIZE+1
>LDA.G CC.OutFileArg
>SYSCALL ArgV
>STYA ZPPtr1
>PUSHW L.MSG.GENERATING
>PUSHW ZPPtr1
>PUSHBI 2
>SYSCALL PrintF
>PUSHW ZPPtr1
>PUSHBI O.WRONLY+O.CREATE
>PUSHBI S.FI.T.BIN
>PUSHWI $2000 Aux type
>SYSCALL FOpen
bcs .9
>STA.G CC.hOutFile
>PUSHA A = CC.hOutFile
>PUSHW L.PCC.FH
>PUSHWI PCC.FH.L
>SYSCALL FWrite
.9 rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.fio
LOAD usr/src/bin/cc.s
ASM