mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
80 lines
1.3 KiB
Plaintext
80 lines
1.3 KiB
Plaintext
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 SYS.FOPEN
|
||
bcs .9
|
||
|
||
ldy #hInputFile
|
||
sta (pData),y
|
||
.9 rts
|
||
*--------------------------------------
|
||
TXT.ReadFile >PUSHWI UsrBuf256+1
|
||
>PUSHWI 127
|
||
ldy #hInputFile
|
||
lda (pData),y
|
||
>PUSHA
|
||
>SYSCALL SYS.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
|
||
|
||
lda #'>'
|
||
>SYSCALL SYS.COutA
|
||
lda #'"'
|
||
>SYSCALL SYS.COutA
|
||
>LDYA pData
|
||
>SYSCALL SYS.PStrOutYA
|
||
lda #'"'
|
||
>SYSCALL SYS.COutA
|
||
lda #13
|
||
>SYSCALL SYS.COutA
|
||
.8 clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
TXT.CloseFile ldy #hInputFile
|
||
lda (pData),y
|
||
beq .9
|
||
|
||
>SYSCALL SYS.FCLOSEA
|
||
|
||
.9 lda #0
|
||
ldy #hInputFile
|
||
sta (pData),y
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SBIN/SHELL.S.TXT
|
||
LOAD SBIN/SHELL.S
|
||
ASM
|