2017-01-31 21:09:14 +00:00
|
|
|
;
|
|
|
|
; jede jede@oric.org 2017-01-22
|
|
|
|
;
|
|
|
|
|
2017-01-31 21:20:19 +00:00
|
|
|
.export _read
|
|
|
|
|
|
|
|
.import popax
|
|
|
|
|
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "telestrat.inc"
|
2019-02-05 22:27:52 +00:00
|
|
|
|
2017-02-01 23:11:11 +00:00
|
|
|
;int read (int fd, void* buf, unsigned count);
|
2017-01-31 21:09:14 +00:00
|
|
|
|
|
|
|
.proc _read
|
2021-03-11 08:42:14 +00:00
|
|
|
|
|
|
|
sta ptr1 ; Count
|
|
|
|
stx ptr1+1 ; Count
|
|
|
|
jsr popax ; Get buf
|
2017-01-31 21:09:14 +00:00
|
|
|
|
|
|
|
sta PTR_READ_DEST
|
|
|
|
stx PTR_READ_DEST+1
|
2021-03-11 08:42:14 +00:00
|
|
|
sta ptr2 ; In order to calculate nb of bytes read
|
2017-01-31 21:09:14 +00:00
|
|
|
stx ptr2+1 ;
|
2019-02-05 22:27:52 +00:00
|
|
|
|
2021-03-06 10:56:22 +00:00
|
|
|
|
2019-02-05 22:27:52 +00:00
|
|
|
lda ptr1 ;
|
2017-01-31 21:09:14 +00:00
|
|
|
ldy ptr1+1 ;
|
|
|
|
BRK_TELEMON XFREAD ; calls telemon30 routine
|
2021-03-11 08:42:14 +00:00
|
|
|
; Compute nb of bytes read
|
2017-01-31 21:09:14 +00:00
|
|
|
lda PTR_READ_DEST+1
|
|
|
|
sec
|
|
|
|
sbc ptr2+1
|
2019-02-05 22:27:52 +00:00
|
|
|
tax
|
2017-01-31 21:09:14 +00:00
|
|
|
lda PTR_READ_DEST
|
|
|
|
sec
|
|
|
|
sbc ptr2
|
|
|
|
; Here A and X contains number of bytes read
|
|
|
|
rts
|
|
|
|
.endproc
|