]> git.sur5r.net Git - cc65/commitdiff
Added initcwd.s from Stefan Haubenthal which initializes _cwd on startup.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 24 Jul 2005 13:20:49 +0000 (13:20 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 24 Jul 2005 13:20:49 +0000 (13:20 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3540 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/cbm/Makefile
libsrc/cbm/initcwd.s [new file with mode: 0644]

index 29dbc49f21eb07ae23c188d0829c56faf1d05c64..555109735ecb4c2a9df39d8cb5ee3e7c37b21d83 100644 (file)
@@ -70,6 +70,7 @@ S_OBJS =      c_acptr.o       \
                gotox.o         \
                gotoxy.o        \
                gotoy.o         \
+                initcwd.o       \
                 open.o          \
                 oserrlist.o     \
                oserror.o       \
diff --git a/libsrc/cbm/initcwd.s b/libsrc/cbm/initcwd.s
new file mode 100644 (file)
index 0000000..2df6dba
--- /dev/null
@@ -0,0 +1,35 @@
+;
+; Stefan Haubenthal, 2005-06-08
+;
+; CBM _curunit to _cwd
+;
+
+       .export         initcwd
+       .import         __curunit, __cwd
+       .import         pusha0, tosudiva0
+       .importzp       sreg, ptr1
+
+       .macpack        generic
+
+       .segment        "INIT"
+
+.proc  initcwd
+
+       lda     __curunit
+       jsr     pusha0
+       lda     #10
+       jsr     tosudiva0
+       ldx     #0
+       lda     sreg
+       beq     :+              ; >=10
+       add     #'0'
+       sta     __cwd
+       inx
+:      lda     ptr1            ; rem
+       add     #'0'
+       sta     __cwd,x
+       lda     #0
+       sta     __cwd+1,x
+       rts
+
+.endproc