From 59a4ab877886a57334060b0e0366fbb69aa6e493 Mon Sep 17 00:00:00 2001 From: Patrick Pelletier Date: Mon, 20 Aug 2018 00:56:01 -0700 Subject: [PATCH] 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. --- libsrc/apple2/lseek.s | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libsrc/apple2/lseek.s b/libsrc/apple2/lseek.s index 6d5eba8a2..d1633c32c 100644 --- a/libsrc/apple2/lseek.s +++ b/libsrc/apple2/lseek.s @@ -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 -- 2.39.5