PCCardFS 3.29 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
;-------------------------------------------------------------------------
;
; PCCardFS_entry
;
; Entry point for PCMCIA cards.
PCCardFS_entry

        TEQ     r0,#FreeReason_GetName
        BEQ     PCCardFS_GetName
        TEQ     r0,#FreeReason_GetSpace
        BEQ     PCCardFS_GetSpace
        TEQ     r0,#FreeReason_ComparePath
        BEQ     PCCardFS_ComparePath

        Pull    "PC"

;-----------------------------------------------------------------------
; PCCardFS_GetName
;
; Put the name of the drive specified in r3 into the buffer at r2
;
PCCardFS_GetName

        Push    "r1-r3"

        Debug   xx,"Get name"

        MOV     r0,r3
        ADR     r1,disc_desc
        SWI     XPCCardFS_DescribeDisc
        Pull    "r1-r3,PC",VS

        Debug   xx,"Get name- SWI OK"

        ADD     r4,r1,#22

      [ Version >= 4               ; Cope with unnamed discs
        LDRB    r14,[r4]
        CMP     r14,#" "
        MOVLE   r14,#":"
        STRLEB  r14,[r2],#1
        MOVLE   r4,r3
      ]

        MOV     r0,r2
      [ Version >= 4
        MOV     r3,#10             ; Max length
        BL      copy_r0r4r3_space  ; Copy name to buffer
      |
        BL      copy_r0r4_null     ; Copy name to buffer
      ]

        MOV     r0,#11             ; Name is 10 chars + terminator.

        Debug   xx,"r0 set ",r0

        Pull    "r1-r3,PC"
;-----------------------------------------------------------------------
; PCCardFS_GetSpace
;
; Put the free space on the drive specified in r3 into the buffer at r2
;
PCCardFS_GetSpace

        Push    "r1-r3"

        Debug   xx,"Get space"


        MOV     r0,r3
        ADR     r1,disc_desc
        SWI     XPCCardFS_DescribeDisc
        Pull    "r1-r3,PC",VS

        LDR     r0,[r1,#16]        ; Store disc size in buffer.
        STR     r0,[r2]

        MOV     r0,r3
        SWI     XPCCardFS_FreeSpace
        Pull    "r1-r3,PC",VS

        STR     r0,[r2,#4]         ; Free space
        LDR     r1,[r2]
        SUB     r1,r1,r0
        STR     r1,[r2,#8]         ; used space

        Pull    "r1-r3,PC"


;-------------------------------------------------------------------------
; PCCardFS_ComparePath
;
;

PCCardFS_ComparePath

        Push  "r0-r9"

        Debug  xx,"PCCardFS compare path"

        ADR    r1,dataarea
01
        LDRB   r0,[r2],#1
        CMP    r0,#"."
        Debug  xx,"Copy ",r0
        MOVEQ  r0,#0
        STRB   r0,[r1],#1
        CMP    r0,#0
        BNE    %BT01            ; Copy to first "."

        ADR    r3,dataarea
        MOV    r2,r3
        Push   "PC"
        B      PCCardFS_GetName
        MOV    r0,r0
        Debug  xx,"Got name ",r0

        ADR    r2,dataarea
        LDR    r3,[sp,#3*4]
        CMPSTR r2,r3

        Pull   "r0-r9,PC"

        LNK     s.SWIs