A2osX/SBIN/SHELL.S.TXT.txt

73 lines
1.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.

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
TXT.OpenFileYA pha
>PUSHWI 0 Aux type
>PUSHBI 4 S.FILEINFO.TYPE.TXT
>PUSHBI SYS.FOpen.R+SYS.FOpen.T
pla
>PUSHYA
>SYSCALL FOpen
bcs .9
ldy #hInputFile
sta (pData),y
.9 rts
*--------------------------------------
TXT.ReadFile >PUSHWI UsrBuf256+1
>PUSHWI 127
ldy #hInputFile
lda (pData),y
>PUSHA
>SYSCALL FRead
bcs .9
tya
beq .10
lda UsrBuf256,y Y,A=Bytes read
cmp #$0D
bne .10
dey
.10 tya
sta (pData)
beq .2
.1 lda UsrBuf256,y
sta (pData),y
dey
bne .1
.2 ldy #bEcho
lda (pData),y
beq .8
>PUSHW pData
>LDYA L.MSG.ECHO
>SYSCALL PPrintFYA
.8 clc
.9 rts
*--------------------------------------
TXT.CloseFile ldy #hInputFile
lda (pData),y
beq .9
>SYSCALL FCloseA
.9 lda #0
ldy #hInputFile
sta (pData),y
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/SHELL.S.TXT
LOAD /A2OSX.SRC/SBIN/SHELL.S
ASM