]> git.sur5r.net Git - cc65/commitdiff
Fix ftell() on Apple II to return the correct value.
authorPatrick Pelletier <code@funwithsoftware.org>
Sun, 19 Aug 2018 23:04:42 +0000 (16:04 -0700)
committerOliver Schmidt <ol.sc@web.de>
Mon, 20 Aug 2018 20:24:48 +0000 (22:24 +0200)
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

index 22bcbee306d5527f14d14be6f7b762e13847f0c0..b1b7b6afb56940ed49661d458c9ab4424ed1d293 100644 (file)
@@ -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