Revert "revert read.s"

This reverts commit 65d5786da5.
This commit is contained in:
Oliver Schmidt 2021-03-06 11:56:22 +01:00
parent 8ae5a4a134
commit d6f2fda575

View file

@ -8,6 +8,7 @@
.include "zeropage.inc"
.include "telestrat.inc"
.include "fcntl.inc"
;int read (int fd, void* buf, unsigned count);
@ -21,8 +22,19 @@
sta ptr2 ; in order to calculate nb of bytes read
stx ptr2+1 ;
; jsr popax ; fp pointer don't care in this version
jsr popax ; fp pointer don't care in this version
cpx #$00
bne @is_not_stdin
cmp #STDIN_FILENO
bne @is_not_stdin
; stdin
@L1:
BRK_TELEMON XRD0 ; waits until key is pressed
bcs @L1
rts
@is_not_stdin:
lda ptr1 ;
ldy ptr1+1 ;
BRK_TELEMON XFREAD ; calls telemon30 routine