source: xtideuniversalbios/tags/Assembly_Library_for_v2.0.0beta1/Src/File/Directory.asm@ 589

Last change on this file since 589 was 116, checked in by krille_n_@…, 13 years ago

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
File size: 3.9 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for accessing directories.
3
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Directory_GetDiskTransferAreaAddressToDSSI
10; Parameters:
11; Nothing
12; Returns:
13; DS:SI: Ptr to DTA
14; Corrupts registers:
15; AX
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18Directory_GetDiskTransferAreaAddressToDSSI:
19 push es
20 push bx
21
22 mov ah, GET_DISK_TRANSFER_AREA_ADDRESS
23 int DOS_INTERRUPT_21h
24 push es
25 pop ds
26 mov si, bx
27
28 pop bx
29 pop es
30 ret
31
32
33;--------------------------------------------------------------------
34; Directory_ChangeToPathFromDSSI
35; Parameters:
36; DS:SI: Ptr to NULL terminated path (max 64 bytes)
37; Returns:
38; AX: Error code
39; CF: Cleared if success
40; Set if error
41; Corrupts registers:
42; Nothing
43;--------------------------------------------------------------------
44ALIGN JUMP_ALIGN
45Directory_ChangeToPathFromDSSI:
46 xchg dx, si ; Path now in DS:DX
47 mov ah, SET_CURRENT_DIRECTORY
48 int DOS_INTERRUPT_21h
49 xchg si, dx
50 ret
51
52
53;--------------------------------------------------------------------
54; Directory_WriteCurrentPathToDSSI
55; Parameters:
56; DS:SI: Ptr to destination buffer (64 bytes)
57; Returns:
58; AX: Error code
59; CF: Cleared if success
60; Set if error
61; Corrupts registers:
62; Nothing
63;--------------------------------------------------------------------
64ALIGN JUMP_ALIGN
65Directory_WriteCurrentPathToDSSI:
66 push dx
67
68 mov ah, GET_CURRENT_DIRECTORY ; GET_CURRENT_DIRECTORY = 47h
69 cwd ; Default drive (00h)
70 int DOS_INTERRUPT_21h
71
72 pop dx
73 ret
74
75
76;--------------------------------------------------------------------
77; Directory_GetMatchCountToAXforSearchStringInDSSIwithAttributesInCX
78; Parameters:
79; CX: File attributes
80; DS:SI: NULL terminated search string (may include path and wildcards)
81; Returns:
82; AX: Number of matching files found
83; Corrupts registers:
84; Nothing
85;--------------------------------------------------------------------
86ALIGN JUMP_ALIGN
87Directory_GetMatchCountToAXforSearchStringInDSSIwithAttributesInCX:
88 push dx
89 xor dx, dx ; Zero counter
90 call Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
91 jc SHORT .NoMoreFilesFound
92ALIGN JUMP_ALIGN
93.FindNextFile:
94 inc dx ; Increment match count
95 call Directory_UpdateDTAForNextMatchUsingPreviousParameters
96 jnc SHORT .FindNextFile
97ALIGN JUMP_ALIGN
98.NoMoreFilesFound:
99 xchg ax, dx ; Match count to AX
100 pop dx
101 ret
102
103
104;--------------------------------------------------------------------
105; Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
106; Parameters:
107; CX: File attributes
108; DS:SI: NULL terminated search string (may include path and wildcards)
109; Returns:
110; AX: Error code
111; CF: Cleared if success
112; Set if error
113; Disk Transfer Area (DTA) will be updated
114; Corrupts registers:
115; Nothing
116;--------------------------------------------------------------------
117ALIGN JUMP_ALIGN
118Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX:
119 xchg dx, si ; Search string now in DS:DX
120 mov ax, FIND_FIRST_MATCHING_FILE<<8 ; Zero AL (special flag for APPEND)
121 int DOS_INTERRUPT_21h
122 xchg si, dx
123 ret
124
125
126;--------------------------------------------------------------------
127; Directory_UpdateDTAForNextMatchUsingPreviousParameters
128; Parameters:
129; Nothing (Parameters from previous call to
130; Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX are used)
131; Returns:
132; AX: Error code
133; CF: Cleared if success
134; Set if error
135; Disk Transfer Area (DTA) will be updated
136; Corrupts registers:
137; Nothing
138;--------------------------------------------------------------------
139ALIGN JUMP_ALIGN
140Directory_UpdateDTAForNextMatchUsingPreviousParameters:
141 mov ah, FIND_NEXT_MATCHING_FILE
142 int DOS_INTERRUPT_21h
143 ret
Note: See TracBrowser for help on using the repository browser.