2010-12-29 10:37:57 +00:00
|
|
|
;
|
|
|
|
; Karri Kaksonen, 2010
|
|
|
|
;
|
|
|
|
; This function reads count bytes from the place where the address counter is.
|
|
|
|
; Use lseek to place the address counter where you want to read from.
|
|
|
|
;
|
|
|
|
; The file descriptor is ignored in this implementation. The read operation
|
|
|
|
; reads bytes from a raw cart and does not understand the concept of files.
|
|
|
|
; So if you read over the end of file you get data from the next file.
|
|
|
|
;
|
2012-09-11 13:01:39 +00:00
|
|
|
; The count-parameter is positive (Atari style).
|
2010-12-29 10:37:57 +00:00
|
|
|
;
|
|
|
|
; int __fastcall__ read(int fd,void *buf,int count)
|
|
|
|
;
|
2013-05-09 11:56:54 +00:00
|
|
|
.importzp _FileDestPtr
|
|
|
|
.import lynxread0
|
|
|
|
.import pushax,ldaxysp,ldax0sp,incsp6
|
|
|
|
.export _read
|
2010-12-29 10:37:57 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.segment "CODE"
|
2010-12-29 10:37:57 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _read: near
|
2010-12-29 10:37:57 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.segment "CODE"
|
2010-12-29 10:37:57 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr pushax
|
|
|
|
ldy #$03
|
|
|
|
jsr ldaxysp
|
|
|
|
sta _FileDestPtr
|
|
|
|
stx _FileDestPtr+1
|
|
|
|
jsr ldax0sp
|
|
|
|
pha
|
2012-09-11 13:01:39 +00:00
|
|
|
txa
|
2013-05-09 11:56:54 +00:00
|
|
|
eor #$FF
|
|
|
|
tay
|
|
|
|
pla
|
|
|
|
eor #$FF
|
|
|
|
tax
|
|
|
|
jsr lynxread0
|
|
|
|
jsr ldax0sp
|
|
|
|
jmp incsp6
|
2010-12-29 10:37:57 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|