From 68a115cacf588b64a5e098497d2e6a2c2139f33e Mon Sep 17 00:00:00 2001 From: Patrick Pelletier Date: Sun, 19 Aug 2018 16:04:42 -0700 Subject: [PATCH] Fix ftell() on Apple II to return the correct value. Fixes this issue: https://github.com/cc65/cc65/issues/722 ftell() returns the value returned by lseek(), and lseek() for the Apple II wasn't returning a value. --- libsrc/apple2/lseek.s | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libsrc/apple2/lseek.s b/libsrc/apple2/lseek.s index 22bcbee30..b1b7b6afb 100644 --- a/libsrc/apple2/lseek.s +++ b/libsrc/apple2/lseek.s @@ -84,6 +84,14 @@ seek_common: jsr callmli bcs oserr + ; Need to return the position in EAX + lda #0 + sta sreg+1 + lda mliparam + MLI::MARK::POSITION+2 + sta sreg + ldx mliparam + MLI::MARK::POSITION+1 + lda mliparam + MLI::MARK::POSITION + rts ; Load errno code -- 2.39.5