mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
100 lines
1.6 KiB
Plaintext
100 lines
1.6 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
TXT.OpenFileYA >SYSCALL SYS.MLIOpenYA
|
||
bcs .9
|
||
|
||
ldy #hInputFile
|
||
sta (pData),y
|
||
pha
|
||
txa
|
||
ldy #hInputBuffer
|
||
sta (pData),y
|
||
|
||
>PUSHBI $0D Line separator for TXT file
|
||
>PUSHBI $FF
|
||
pla
|
||
>PUSHA
|
||
>SYSCALL SYS.MLINewLine
|
||
bcc .9
|
||
pha
|
||
jsr TXT.CloseFile
|
||
pla
|
||
sec
|
||
.9 rts
|
||
*--------------------------------------
|
||
TXT.ReadFile >PUSHWI 127
|
||
>PUSHWI TmpBuffer256+1
|
||
ldy #hInputFile
|
||
lda (pData),y
|
||
>PUSHA
|
||
>SYSCALL SYS.MLIRead
|
||
bcs .9
|
||
|
||
tya
|
||
beq .10
|
||
|
||
lda TmpBuffer256,y Y,A=Bytes read
|
||
cmp #$0D
|
||
bne .10
|
||
|
||
dey
|
||
|
||
.10 tya
|
||
sta (pData)
|
||
beq .2
|
||
|
||
.1 lda TmpBuffer256,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 #hInputArgs
|
||
lda (pData),y
|
||
beq .1
|
||
>SYSCALL SYS.FreeMemA
|
||
|
||
.1 ldy #hInputFile
|
||
lda (pData),y
|
||
beq .9
|
||
|
||
>SYSCALL SYS.MLICloseA
|
||
ldy #hInputBuffer
|
||
lda (pData),y
|
||
>SYSCALL SYS.FreeMemA
|
||
|
||
.9 lda #0
|
||
ldy #hInputArgs
|
||
sta (pData),y
|
||
ldy #hInputFile
|
||
sta (pData),y
|
||
ldy #hInputBuffer
|
||
sta (pData),y
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SBIN/SHELL.S.TXT
|
||
LOAD SBIN/SHELL.S
|
||
ASM
|