1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-07 04:29:01 +00:00
cc65/libsrc/telestrat/read.s
jedeoric 4f26650228
[Telestrat] chdir management (#1419)
* add syschdir

* revert read.s

* remove extra line

* Now we update __cwd

* Fix tab

* Fix another tab

* Fix tab

* Fix tab and jmp

* fix xgetcwd

* Fix comments
2021-03-11 09:42:14 +01:00

40 lines
784 B
ArmAsm

;
; jede jede@oric.org 2017-01-22
;
.export _read
.import popax
.include "zeropage.inc"
.include "telestrat.inc"
;int read (int fd, void* buf, unsigned count);
.proc _read
sta ptr1 ; Count
stx ptr1+1 ; Count
jsr popax ; Get buf
sta PTR_READ_DEST
stx PTR_READ_DEST+1
sta ptr2 ; In order to calculate nb of bytes read
stx ptr2+1 ;
lda ptr1 ;
ldy ptr1+1 ;
BRK_TELEMON XFREAD ; calls telemon30 routine
; Compute nb of bytes read
lda PTR_READ_DEST+1
sec
sbc ptr2+1
tax
lda PTR_READ_DEST
sec
sbc ptr2
; Here A and X contains number of bytes read
rts
.endproc