A2osX/SBIN/SHELL.S.TXT.txt

73 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-08-17 06:25:58 +00:00
PR#3
PREFIX /A2OSX.SRC
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
2016-08-17 06:25:58 +00:00
bcs .9
ldy #hInputFile
sta (pData),y
.9 rts
*--------------------------------------
TXT.ReadFile >PUSHWI UsrBuf256+1
>PUSHWI 127
2016-08-17 06:25:58 +00:00
ldy #hInputFile
lda (pData),y
>PUSHA
>SYSCALL FREAD
2016-08-17 06:25:58 +00:00
bcs .9
tya
beq .10
lda UsrBuf256,y Y,A=Bytes read
2016-08-17 06:25:58 +00:00
cmp #$0D
bne .10
dey
.10 tya
sta (pData)
beq .2
.1 lda UsrBuf256,y
2016-08-17 06:25:58 +00:00
sta (pData),y
dey
bne .1
.2 ldy #bEcho
lda (pData),y
beq .8
>PUSHW pData
>LDYA L.MSG.ECHO
>SYSCALL PrintFYA
2016-08-17 06:25:58 +00:00
.8 clc
.9 rts
*--------------------------------------
TXT.CloseFile ldy #hInputFile
2016-08-17 06:25:58 +00:00
lda (pData),y
beq .9
>SYSCALL FCloseA
2016-08-17 06:25:58 +00:00
.9 lda #0
ldy #hInputFile
sta (pData),y
rts
*--------------------------------------
MAN
SAVE SBIN/SHELL.S.TXT
LOAD SBIN/SHELL.S
ASM