lseek: Implement additional feedback from PR #723.
* Check CPU_ISET_65SC02 rather than APPLE2ENH. * Set sreg and sreg+1 to $FF on error, to return -1 as a long.
This commit is contained in:
committed by
Oliver Schmidt
parent
8cb930b50e
commit
59a4ab8778
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
.export _lseek
|
.export _lseek
|
||||||
.import popax, popptr1
|
.import popax, popptr1
|
||||||
|
.macpack cpu
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "errno.inc"
|
.include "errno.inc"
|
||||||
@@ -85,10 +86,10 @@ seek_common:
|
|||||||
bcs oserr
|
bcs oserr
|
||||||
|
|
||||||
; Need to return the position in EAX
|
; Need to return the position in EAX
|
||||||
.ifdef __APPLE2ENH__
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||||
stz sreg+1
|
stz sreg+1
|
||||||
.else
|
.else
|
||||||
lda #0
|
lda #$00
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
.endif
|
.endif
|
||||||
lda mliparam + MLI::MARK::POSITION+2
|
lda mliparam + MLI::MARK::POSITION+2
|
||||||
@@ -102,7 +103,13 @@ seek_common:
|
|||||||
einval: lda #EINVAL
|
einval: lda #EINVAL
|
||||||
|
|
||||||
; Set __errno
|
; Set __errno
|
||||||
errno: jmp __directerrno
|
errno: ldx #$FF
|
||||||
|
stx sreg
|
||||||
|
stx sreg+1
|
||||||
|
jmp __directerrno
|
||||||
|
|
||||||
; Set __oserror
|
; Set __oserror
|
||||||
oserr: jmp __mappederrno
|
oserr: ldx #$FF
|
||||||
|
stx sreg
|
||||||
|
stx sreg+1
|
||||||
|
jmp __mappederrno
|
||||||
|
|||||||
Reference in New Issue
Block a user