]> git.sur5r.net Git - cc65/commitdiff
Added the telldir() function.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 3 Jun 2012 14:03:22 +0000 (14:03 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 3 Jun 2012 14:03:22 +0000 (14:03 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5673 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/cbm/Makefile
libsrc/cbm/dir.inc
libsrc/cbm/telldir.s [new file with mode: 0644]

index 66d08522d019beba5b1535b800b4620bc91226be..c25d068305fe3592b8cc78770e23760cb6118b2b 100644 (file)
@@ -86,6 +86,7 @@ S_OBJS =      c_acptr.o       \
                 scratch.o       \
                 sysremove.o     \
                 sysrename.o     \
+                telldir.o       \
                 toascii.o       \
                wherex.o        \
                 wherey.o        \
index 481492313af40866613e4ac9a965d8c8201f56e8..ffab6c20c3dd9754c7fb54ddd586985c8820b8a1 100644 (file)
@@ -10,7 +10,7 @@
 
 .struct DIR
     fd          .word
-    offs        .word
+    off         .word     
     name        .byte   16+1
 .endstruct
 
diff --git a/libsrc/cbm/telldir.s b/libsrc/cbm/telldir.s
new file mode 100644 (file)
index 0000000..dc1822d
--- /dev/null
@@ -0,0 +1,35 @@
+;
+; Ullrich von Bassewitz, 2012-06-03
+;
+; Based on C code by Groepaz
+;
+; long __fastcall__ telldir (DIR *dir);
+;
+
+
+        .include        "dir.inc"
+        .include        "zeropage.inc"
+
+
+.proc   _telldir
+
+        sta     ptr1
+        stx     ptr1+1
+
+; Clear high word of returned value
+
+        lda     #0
+        sta     sreg
+        sta     sreg+1
+
+; Return dir->off
+
+        ldy     #DIR::off+1
+        lda     (ptr1),y
+        tax
+        dey
+        lda     (ptr1),y
+        rts
+
+.endproc
+