]> git.sur5r.net Git - cc65/commitdiff
initcwd from Oliver Schmidt
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 19 Apr 2005 11:31:00 +0000 (11:31 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 19 Apr 2005 11:31:00 +0000 (11:31 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3466 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/apple2/Makefile
libsrc/apple2/initcwd.s [new file with mode: 0644]
libsrc/apple2/mli.inc
libsrc/apple2enh/Makefile

index d5fa0553e746785a4d3e11fe3bfa15c45eb219fc..f25b1e92a8b0b33308606f5fd6cbcf02d35addf8 100644 (file)
@@ -65,6 +65,7 @@ OBJS= _scrsize.o      \
         getenv.o        \
        gotoxy.o        \
        gotoy.o         \
+       initcwd.o       \
         joy_stddrv.o    \
        kbhit.o         \
         mainargs.o      \
diff --git a/libsrc/apple2/initcwd.s b/libsrc/apple2/initcwd.s
new file mode 100644 (file)
index 0000000..d1ebcc1
--- /dev/null
@@ -0,0 +1,37 @@
+;
+; Oliver Schmidt, 18.04.2005
+;
+
+        .export         initcwd
+        .import                __cwd
+
+        .include       "zeropage.inc"
+        .include        "mli.inc"
+
+initcwd:
+        ; Use imported buffer
+        lda    #<__cwd
+        ldx    #>__cwd
+        sta     mliparam + MLI::PREFIX::PATHNAME
+        stx     mliparam + MLI::PREFIX::PATHNAME+1
+
+        ; Get current working directory
+        lda     #GET_PREFIX_CALL
+        ldx     #PREFIX_COUNT
+        jsr     callmli
+
+        ; Check length byte
+        ldx    __cwd
+        beq    done
+
+        ; Replace trailing slash with zero
+        sta    __cwd,x         ; A = 0
+
+        ; Remove length byte
+        tax
+:       inx
+        lda    __cwd,x
+        sta    __cwd-1,x
+        bne    :-
+
+done:   rts
index ef77cd2e652169c74007cf726f4c6ab3cb4e218f..a1a599723161a53c97b18fa74ba5bc50c2ee8e57 100644 (file)
@@ -11,9 +11,19 @@ RW_BLOCK_COUNT  = 3
 CREATE_CALL     = $C0
 CREATE_COUNT    = 7
 
+DESTROY_CALL    = $C1
+DESTROY_COUNT   = 1
+
+RENAME_CALL     = $C2
+RENAME_COUNT    = 2
+
 ON_LINE_CALL    = $C5
 ON_LINE_COUNT   = 2
 
+SET_PREFIX_CALL = $C6
+GET_PREFIX_CALL = $C7
+PREFIX_COUNT    = 1
+
 OPEN_CALL       = $C8
 OPEN_COUNT      = 3
 
@@ -35,60 +45,73 @@ EOF_COUNT       = 2
         .struct MLI
                 .union
                         .struct RW_BLOCK
-                                PARAM_COUNT    .byte
-                                UNIT_NUM       .byte
-                                DATA_BUFFER    .addr
-                                BLOCK_NUM      .word
+                                PARAM_COUNT     .byte
+                                UNIT_NUM        .byte
+                                DATA_BUFFER     .addr
+                                BLOCK_NUM       .word
                         .endstruct
                         .struct CREATE
-                                PARAM_COUNT    .byte
-                                PATHNAME       .addr
-                                ACCESS         .byte
-                                FILE_TYPE      .byte
-                                AUX_TYPE       .word
-                                STORAGE_TYPE   .byte
-                                CREATE_DATE    .word
-                                CREATE_TIME    .word
+                                PARAM_COUNT     .byte
+                                PATHNAME        .addr
+                                ACCESS          .byte
+                                FILE_TYPE       .byte
+                                AUX_TYPE        .word
+                                STORAGE_TYPE    .byte
+                                CREATE_DATE     .word
+                                CREATE_TIME     .word
                         .endstruct
-                        .struct        ON_LINE
-                                PARAM_COUNT    .byte
-                                UNIT_NUM       .byte
-                                DATA_BUFFER    .addr
+                        .struct DESTROY
+                                PARAM_COUNT     .byte
+                                PATHNAME        .addr
                         .endstruct
-                        .struct OPEN
+                        .struct RENAME
+                                PARAM_COUNT     .byte
+                                PATHNAME        .addr
+                                NEW_PATHNAME    .addr
+                        .endstruct
+                        .struct ON_LINE
+                                PARAM_COUNT     .byte
+                                UNIT_NUM        .byte
+                                DATA_BUFFER     .addr
+                        .endstruct
+                        .struct PREFIX
                                 PARAM_COUNT    .byte
                                 PATHNAME       .addr
-                                IO_BUFFER      .addr
-                                REF_NUM                .byte
+                        .endstruct
+                        .struct OPEN
+                                PARAM_COUNT     .byte
+                                PATHNAME        .addr
+                                IO_BUFFER       .addr
+                                REF_NUM         .byte
                         .endstruct
                         .struct RW
-                                PARAM_COUNT    .byte
-                                REF_NUM                .byte
-                                DATA_BUFFER    .addr
-                                REQUEST_COUNT  .word
-                                TRANS_COUNT    .word
+                                PARAM_COUNT     .byte
+                                REF_NUM         .byte
+                                DATA_BUFFER     .addr
+                                REQUEST_COUNT   .word
+                                TRANS_COUNT     .word
                         .endstruct
                         .struct CLOSE
-                                PARAM_COUNT    .byte
-                                REF_NUM                .byte
+                                PARAM_COUNT     .byte
+                                REF_NUM         .byte
                         .endstruct
                         .struct MARK
-                                PARAM_COUNT    .byte
-                                REF_NUM                .byte
-                                POSITION       .byte 3
+                                PARAM_COUNT     .byte
+                                REF_NUM         .byte
+                                POSITION        .byte 3
                         .endstruct
                         .struct EOF
-                                PARAM_COUNT    .byte
-                                REF_NUM                .byte
-                                EOF            .byte 3
+                                PARAM_COUNT     .byte
+                                REF_NUM         .byte
+                                EOF             .byte 3
                         .endstruct
                 .endunion
         .endstruct
 
-        .global                mliparam
-        .global                callmli
+        .global         mliparam
+        .global         callmli
 
-ENTRY   :=     $BF00           ; MLI call entry point
-DEVNUM  :=     $BF30           ; Most recent accessed device
-PFIXPTR :=     $BF9A           ; If = 0, no prefix active
-KVERSION:=      $BFFF          ; Kernel version number
+ENTRY   :=      $BF00          ; MLI call entry point
+DEVNUM  :=      $BF30          ; Most recent accessed device
+PFIXPTR :=      $BF9A          ; If = 0, no prefix active
+KVERSION:=      $BFFF           ; Kernel version number
index 5467bf0c9517ee55bbf9763f143caa2684c71055..fa96c0b32dec269c286da889e98e2f20bb63d17f 100644 (file)
@@ -65,6 +65,7 @@ OBJS= _scrsize.o      \
         getenv.o        \
        gotoxy.o        \
        gotoy.o         \
+       initcwd.o       \
         joy_stddrv.o    \
        kbhit.o         \
         mainargs.o      \