From 3a8365c44565b6c97b957f63ca451905f23434d5 Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 3 Jun 2012 14:03:22 +0000 Subject: [PATCH] Added the telldir() function. git-svn-id: svn://svn.cc65.org/cc65/trunk@5673 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/cbm/Makefile | 1 + libsrc/cbm/dir.inc | 2 +- libsrc/cbm/telldir.s | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 libsrc/cbm/telldir.s diff --git a/libsrc/cbm/Makefile b/libsrc/cbm/Makefile index 66d08522d..c25d06830 100644 --- a/libsrc/cbm/Makefile +++ b/libsrc/cbm/Makefile @@ -86,6 +86,7 @@ S_OBJS = c_acptr.o \ scratch.o \ sysremove.o \ sysrename.o \ + telldir.o \ toascii.o \ wherex.o \ wherey.o \ diff --git a/libsrc/cbm/dir.inc b/libsrc/cbm/dir.inc index 481492313..ffab6c20c 100644 --- a/libsrc/cbm/dir.inc +++ b/libsrc/cbm/dir.inc @@ -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 index 000000000..dc1822dfd --- /dev/null +++ b/libsrc/cbm/telldir.s @@ -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 + -- 2.39.5