1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

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:
Patrick Pelletier 2018-08-20 00:56:01 -07:00 committed by Oliver Schmidt
parent 8cb930b50e
commit 59a4ab8778

View File

@ -6,6 +6,7 @@
.export _lseek
.import popax, popptr1
.macpack cpu
.include "zeropage.inc"
.include "errno.inc"
@ -85,12 +86,12 @@ seek_common:
bcs oserr
; Need to return the position in EAX
.ifdef __APPLE2ENH__
.if (.cpu .bitand ::CPU_ISET_65SC02)
stz sreg+1
.else
lda #0
.else
lda #$00
sta sreg+1
.endif
.endif
lda mliparam + MLI::MARK::POSITION+2
sta sreg
ldx mliparam + MLI::MARK::POSITION+1
@ -102,7 +103,13 @@ seek_common:
einval: lda #EINVAL
; Set __errno
errno: jmp __directerrno
errno: ldx #$FF
stx sreg
stx sreg+1
jmp __directerrno
; Set __oserror
oserr: jmp __mappederrno
oserr: ldx #$FF
stx sreg
stx sreg+1
jmp __mappederrno