source: xtideuniversalbios/trunk/Assembly_Library/Src/File/Directory.asm@ 605

Last change on this file since 605 was 592, checked in by Krister Nordvall, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 4.6 KB
Line 
1; Project name : Assembly Library
2; Description : Functions for accessing directories.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Directory_GetDiskTransferAreaAddressToDSSI
25; Parameters:
26; Nothing
27; Returns:
28; DS:SI: Ptr to DTA
29; Corrupts registers:
30; AX
31;--------------------------------------------------------------------
32ALIGN JUMP_ALIGN
33Directory_GetDiskTransferAreaAddressToDSSI:
34 push es
35 push bx
36
37 mov ah, GET_DISK_TRANSFER_AREA_ADDRESS
38 int DOS_INTERRUPT_21h
39 push es
40 pop ds
41 mov si, bx
42
43 pop bx
44 pop es
45 ret
46
47
48;--------------------------------------------------------------------
49; Directory_ChangeToPathFromDSSI
50; Parameters:
51; DS:SI: Ptr to NULL terminated path (max 64 bytes)
52; Returns:
53; AX: Error code
54; CF: Cleared if success
55; Set if error
56; Corrupts registers:
57; Nothing
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60Directory_ChangeToPathFromDSSI:
61 xchg dx, si ; Path now in DS:DX
62 mov ah, SET_CURRENT_DIRECTORY
63 int DOS_INTERRUPT_21h
64 xchg si, dx
65 ret
66
67
68;--------------------------------------------------------------------
69; Directory_WriteCurrentPathToDSSI
70; Parameters:
71; DS:SI: Ptr to destination buffer (64 bytes)
72; Returns:
73; AX: Error code
74; CF: Cleared if success
75; Set if error
76; Corrupts registers:
77; Nothing
78;--------------------------------------------------------------------
79ALIGN JUMP_ALIGN
80Directory_WriteCurrentPathToDSSI:
81 push dx
82
83 mov ah, GET_CURRENT_DIRECTORY ; GET_CURRENT_DIRECTORY = 47h
84 cwd ; Default drive (00h)
85 int DOS_INTERRUPT_21h
86
87 pop dx
88 ret
89
90
91;--------------------------------------------------------------------
92; Directory_GetMatchCountToAXforSearchStringInDSSIwithAttributesInCX
93; Parameters:
94; CX: File attributes
95; DS:SI: NULL terminated search string (may include path and wildcards)
96; Returns:
97; AX: Number of matching files found
98; Corrupts registers:
99; Nothing
100;--------------------------------------------------------------------
101%ifndef EXCLUDE_FROM_XTIDECFG
102ALIGN JUMP_ALIGN
103Directory_GetMatchCountToAXforSearchStringInDSSIwithAttributesInCX:
104 push dx
105 xor dx, dx ; Zero counter
106 call Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
107 jc SHORT .NoMoreFilesFound
108ALIGN JUMP_ALIGN
109.FindNextFile:
110 inc dx ; Increment match count
111 call Directory_UpdateDTAForNextMatchUsingPreviousParameters
112 jnc SHORT .FindNextFile
113ALIGN JUMP_ALIGN
114.NoMoreFilesFound:
115 xchg ax, dx ; Match count to AX
116 pop dx
117 ret
118%endif
119
120
121;--------------------------------------------------------------------
122; Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
123; Parameters:
124; CX: File attributes
125; DS:SI: NULL terminated search string (may include path and wildcards)
126; Returns:
127; AX: Error code
128; CF: Cleared if success
129; Set if error
130; Disk Transfer Area (DTA) will be updated
131; Corrupts registers:
132; Nothing
133;--------------------------------------------------------------------
134ALIGN JUMP_ALIGN
135Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX:
136 xchg dx, si ; Search string now in DS:DX
137 mov ax, FIND_FIRST_MATCHING_FILE<<8 ; Zero AL (special flag for APPEND)
138 int DOS_INTERRUPT_21h
139 xchg si, dx
140 ret
141
142
143;--------------------------------------------------------------------
144; Directory_UpdateDTAForNextMatchUsingPreviousParameters
145; Parameters:
146; Nothing (Parameters from previous call to
147; Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX are used)
148; Returns:
149; AX: Error code
150; CF: Cleared if success
151; Set if error
152; Disk Transfer Area (DTA) will be updated
153; Corrupts registers:
154; Nothing
155;--------------------------------------------------------------------
156ALIGN JUMP_ALIGN
157Directory_UpdateDTAForNextMatchUsingPreviousParameters:
158 mov ah, FIND_NEXT_MATCHING_FILE
159 int DOS_INTERRUPT_21h
160 ret
Note: See TracBrowser for help on using the repository browser.