2005-04-12 09:12:48 +00:00
|
|
|
;
|
|
|
|
; Oliver Schmidt, 12.01.2005
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export rwprolog, rwcommon, rwepilog
|
2018-05-20 13:30:18 +00:00
|
|
|
.import popax, popptr1
|
2005-04-12 09:12:48 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "zeropage.inc"
|
|
|
|
.include "errno.inc"
|
|
|
|
.include "fcntl.inc"
|
|
|
|
.include "mli.inc"
|
|
|
|
.include "filedes.inc"
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
rwprolog:
|
|
|
|
; Save count
|
2013-05-09 11:56:54 +00:00
|
|
|
sta ptr2
|
|
|
|
stx ptr2+1
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Get and save buf
|
2018-05-20 13:30:18 +00:00
|
|
|
jsr popptr1
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Get and process fd
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr popax
|
|
|
|
jmp getfd ; Returns A, Y and C
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
rwcommon:
|
|
|
|
; Set fd
|
2013-05-09 11:56:54 +00:00
|
|
|
sta mliparam + MLI::RW::REF_NUM
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Set buf
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ptr1
|
|
|
|
ldx ptr1+1
|
|
|
|
sta mliparam + MLI::RW::DATA_BUFFER
|
|
|
|
stx mliparam + MLI::RW::DATA_BUFFER+1
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Set count
|
2013-05-09 11:56:54 +00:00
|
|
|
lda ptr2
|
|
|
|
ldx ptr2+1
|
|
|
|
sta mliparam + MLI::RW::REQUEST_COUNT
|
|
|
|
stx mliparam + MLI::RW::REQUEST_COUNT+1
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
; Call read or write
|
|
|
|
tya
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #RW_COUNT
|
|
|
|
jsr callmli
|
|
|
|
bcc rwepilog
|
|
|
|
cmp #$4C ; "End of file encountered"
|
|
|
|
bne oserr
|
2005-04-12 09:12:48 +00:00
|
|
|
|
|
|
|
rwepilog:
|
|
|
|
; Return success
|
2013-05-09 11:56:54 +00:00
|
|
|
sta __oserror ; A = 0
|
|
|
|
lda mliparam + MLI::RW::TRANS_COUNT
|
|
|
|
ldx mliparam + MLI::RW::TRANS_COUNT+1
|
2005-04-12 09:12:48 +00:00
|
|
|
rts
|
|
|
|
|
2010-06-15 20:38:05 +00:00
|
|
|
; Set __oserror
|
2013-05-09 11:56:54 +00:00
|
|
|
oserr: jmp __mappederrno
|