1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

space improvements by Daniel Serpell

git-svn-id: svn://svn.cc65.org/cc65/trunk@4484 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg
2009-11-25 17:03:18 +00:00
parent ce931b85be
commit d17e0f7c02

View File

@@ -5,44 +5,44 @@
.include "atari.inc" .include "atari.inc"
.include "errno.inc" .include "errno.inc"
.importzp tmp2,tmp3 .importzp tmp2,tmp3
.import incsp4,ldax0sp,ldaxysp .import popax
.import __errno,__oserror .import __errno,__oserror
.import fdtoiocb .import fdtoiocb
.export __rwsetup .export __rwsetup
__rwsetup: __rwsetup:
sta tmp2 pha ; push size in stack
stx tmp3 ; remember size txa
ldy #3 pha
jsr ldaxysp ; get fd jsr popax ; get buffer address
pha
txa
pha
jsr popax ; get handle
jsr fdtoiocb ; convert to iocb jsr fdtoiocb ; convert to iocb
bmi iocberr bmi iocberr ; negative (X=$FF or A>$7F) on error.
tax tax
cpx #$80 ; iocb must be 0...7 pla ; store address
bcs iocberr
lda tmp2
sta ICBLL,x
lda tmp3 ; size hi
sta ICBLH,x
stx tmp3
jsr ldax0sp ; get buf addr
stx tmp2
ldx tmp3
sta ICBAL,x
lda tmp2
sta ICBAH,x sta ICBAH,x
jsr incsp4 ; pop args pla
lda ICBLL,x sta ICBAL,x
ora ICBLH,x ; return with Z if length was 0 pla ; store length
sta ICBLH,x
pla
sta ICBLL,x
ora ICBLH,x ; returns Z if length is 0
rts rts
iocberr:jsr incsp4 ; pop args iocberr:pla
pla
pla
pla
ldx #$FF ; indicate error + clear ZF ldx #$FF ; indicate error + clear ZF
rts rts
; ;
; this routine updates errno. do a JMP here right after calling ; this routine updates errno. do a JMP here right after calling
; CIOV. we expect status in Y. ; CIOV. we expect status in Y.