source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm@ 591

Last change on this file since 591 was 589, checked in by Krister Nordvall, 8 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 9.8 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for printing drive detection strings.
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; DetectPrint_InitializeDisplayContext
25; Parameters:
26; Nothing
27; Returns:
28; Nothing
29; Corrupts registers:
30; AX, DI
31;--------------------------------------------------------------------
32DetectPrint_InitializeDisplayContext:
33 JMP_DISPLAY_LIBRARY InitializeDisplayContext
34
35
36%ifdef MODULE_HOTKEYS
37;--------------------------------------------------------------------
38; DetectPrint_GetSoftwareCoordinatesToAX
39; Parameters:
40; Nothing
41; Returns:
42; Nothing
43; Corrupts registers:
44; AX, DI
45;--------------------------------------------------------------------
46DetectPrint_GetSoftwareCoordinatesToAX:
47 JMP_DISPLAY_LIBRARY GetSoftwareCoordinatesToAX
48%endif
49
50
51;--------------------------------------------------------------------
52; DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP
53; Parameters:
54; CS:CX: Ptr to "Master" or "Slave" string
55; CS:BP: Ptr to IDEVARS
56; Returns:
57; Nothing
58; Corrupts registers:
59; AX, CX, DX, SI, DI
60;--------------------------------------------------------------------
61DetectPrint_StartDetectWithMasterOrSlaveStringInCXandIdeVarsInCSBP:
62 mov ax, [cs:bp+IDEVARS.wBasePort] ; For IDE: AX=port address, DH=.bDevice
63 ; Fall to DetectPrint_StartDetectWithAutodetectedBasePortInAXandIdeVarsInCSBP
64
65;--------------------------------------------------------------------
66; DetectPrint_StartDetectWithAutodetectedBasePortInAXandIdeVarsInCSBP
67; Parameters:
68; AX: Base Port Address
69; CS:CX: Ptr to "Master" or "Slave" string
70; CS:BP: Ptr to IDEVARS
71; Returns:
72; Nothing
73; Corrupts registers:
74; AX, CX, DX, SI, DI
75;--------------------------------------------------------------------
76DetectPrint_StartDetectWithAutodetectedBasePortInAXandIdeVarsInCSBP:
77 mov dx, [cs:bp+IDEVARS.bDevice-1] ; For Serial: AL=port address>>2, AH=baud rate
78 ; DL=COM number character, DH=.bDevice
79 push bp ; Setup stack for call to
80 mov bp, sp ; BootMenuPrint_FormatCSSIfromParamsInSSBP
81
82 push cx ; Push "Master" or "Slave"
83
84 mov cl, (g_szDetectPort-$$) & 0xff ; Setup print string for standard IDE
85 ; Note that we modify only the low order bits of CX a lot here,
86 ; saving code space rather than reloading CX completely.
87 ; This optimization requires that all the g_szDetect* strings are
88 ; on the same 256 byte page, which is checked in strings.asm.
89
90%ifdef MODULE_SERIAL
91 cmp dh, DEVICE_SERIAL_PORT ; Check if this is a serial device
92 jne SHORT .pushAndPrint ; CX = string to print, AX = port address, DX won't be used
93
94 mov cl, (g_szDetectCOM-$$) & 0xff ; Setup print string for COM ports
95 push cx ; And push now. We use the fact that format strings can contain
96 ; themselves format strings.
97
98 push dx ; Push COM number character
99 ; If the string is going to be "Auto", we will push a NULL (zero)
100 ; here for the COM port number, which will be eaten by the
101 ; print routine (DisplayPrint_CharacterFromAL), resulting in
102 ; just "COM" being printed without a character after it.
103
104 mov cl, (g_szDetectCOMAuto-$$) & 0xff ; Setup secondary print string for "Auto"
105
106 test dl, dl ; Check if serial port "Auto"
107 jz SHORT .pushAndPrintSerial ; CX = string to print, AX and DX won't be used
108
109 mov cl, (g_szDetectCOMLarge-$$) & 0xff ; Setup secondary print string for "COMn/xx.yK"
110
111 mov al, ah ; baud rate divisor to AL
112 cbw ; clear AH, AL will always be less than 128
113 xchg si, ax ; move AX to SI for divide
114 mov ax, 1152 ; baud rate to display is 115200/divisor, the "00" is handled
115 ; in the print strings
116 cwd ; clear top 16-bits of dividend
117 div si ; and divide... Now AX = baud rate/100, DX = 0 (always a clean divide)
118
119 mov si, 10 ; Now separate the whole portion from the fractional for "K" display
120 div si ; and divide... Now AX = baud rate/1000, DX = low order digit
121
122 cmp ax, si ; < 10: "2400", "9600", etc.; >= 10: "19.2K", "38.4K", etc.
123 jae SHORT .pushAndPrintSerial
124
125 mov cl, (g_szDetectCOMSmall-$$) & 0xff ; Setup secondary print string for "COMn/XXy00"
126
127.pushAndPrintSerial:
128.pushAndPrint:
129%endif
130
131 push cx ; Push print string
132 push ax ; Push high order digits, or port address, or N/A
133 push dx ; Push low order digit, or N/A
134
135 mov si, g_szDetectOuter ; Load SI with default wrapper string "IDE %s at %s: "
136
137 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP
138
139
140;--------------------------------------------------------------------
141; DetectPrint_DriveNameFromDrvDetectInfoInESBX
142; Parameters:
143; ES:BX: Ptr to DRVDETECTINFO (if drive found)
144; Returns:
145; Nothing
146; Corrupts registers:
147; AX, SI, DI
148;--------------------------------------------------------------------
149DetectPrint_DriveNameFromDrvDetectInfoInESBX:
150 push bp
151 mov bp, sp
152 lea si, [bx+DRVDETECTINFO.szDrvName]
153 push si
154 mov si, g_szDriveName
155 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP
156
157
158;--------------------------------------------------------------------
159; Prints BIOS name and segment address where it is found.
160;
161; DetectPrint_RomFoundAtSegment
162; Parameters:
163; Nothing
164; Returns:
165; Nothing
166; Corrupts registers:
167; AX, SI, DI
168;--------------------------------------------------------------------
169DetectPrint_RomFoundAtSegment:
170 mov si, g_szRomAt
171 mov di, cs ; BIOS segment address, for later inclusion in the output, parameterized
172 ; so that it can be a different value when using .BootMenuEntry
173
174.BootMenuEntry:
175 push bp
176 mov bp, sp
177
178%ifndef USE_186
179 mov ax, ROMVARS.szTitle
180 push ax
181 push di ; BIOS segment
182 mov al, ROMVARS.szVersion & 0FFh
183 push ax
184%else
185 ; szTitle and szVersion have the high order byte of their addresses zero,
186 ; so these push instructions are only 2 bytes
187 ;
188 push ROMVARS.szTitle
189 push di ; BIOS segment
190 push ROMVARS.szVersion
191%endif
192
193 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP
194
195
196;--------------------------------------------------------------------
197; DetectPrint_FailedToLoadFirstSector
198; Parameters:
199; AH: INT 13h error code
200; Returns:
201; CF: Set
202; Corrupts registers:
203; AX, CX, SI, DI
204;--------------------------------------------------------------------
205DetectPrint_FailedToLoadFirstSector:
206 push bp
207 mov bp, sp
208 eMOVZX cx, ah
209 push cx ; Push INT 13h error code
210 mov si, g_szReadError
211 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP ; Sets CF
212
213
214;--------------------------------------------------------------------
215; DetectPrint_TryToBootFromDL
216; Parameters:
217; DL: Drive to boot from (translated, 00h or 80h)
218; DS: RAMVARS segment
219; Returns:
220; Nothing
221; Corrupts registers:
222; AX, DH, SI, DI
223;--------------------------------------------------------------------
224DetectPrint_TryToBootFromDL:
225 push bp
226 mov bp, sp
227
228%ifdef MODULE_DRIVEXLATE
229
230 call DriveXlate_ToOrBack ; DL = Untranslated Drive number
231 mov dh, dl
232 call DriveXlate_ToOrBack ; DL = Translated Drive number
233
234 call DriveXlate_ConvertDriveNumberFromDLtoDriveLetter ; DL = Translated letter
235 xchg dl, dh
236 call DriveXlate_ConvertDriveNumberFromDLtoDriveLetter ; DL = Untranslated letter
237 push dx
238 xchg dl, dh
239 push dx
240
241 call DriveXlate_ConvertDriveLetterInDLtoDriveNumber ; Restore DL
242
243%else
244 ePUSH_T ax, ' ' ; No drive translation so print space
245
246 ; Get boot drive letters
247 call BootVars_GetLetterForFirstHardDriveToAX
248 test dl, dl
249 eCMOVNS al, DEFAULT_FLOPPY_DRIVE_LETTER
250 push ax
251
252%endif ; MODULE_DRIVEXLATE
253
254 mov si, g_szTryToBoot
255 jmp SHORT DetectPrint_FormatCSSIfromParamsInSSBP
256
257
258;--------------------------------------------------------------------
259; DetectPrint_NullTerminatedStringFromCSSI
260; DetectPrint_NullTerminatedStringFromCSSIandSetCF
261; Parameters:
262; CS:SI: Ptr to NULL terminated string to print
263; Returns:
264; CF: Set since menu event was handled successfully
265; Corrupts registers:
266; AX, DI
267;--------------------------------------------------------------------
268DetectPrint_NullTerminatedStringFromCSSI:
269DetectPrint_NullTerminatedStringFromCSSIandSetCF:
270;
271; We send all CSSI strings through the Format routine for the case of
272; compressed strings, but this doesn't hurt in the non-compressed case either
273; (perhaps a little slower, but shouldn't be noticeable to the user)
274; and results in smaller code size.
275;
276 push bp
277 mov bp, sp
278 ; Fall to DetectPrint_FormatCSSIfromParamsInSSBP
279
280;--------------------------------------------------------------------
281; DetectPrint_FormatCSSIfromParamsInSSBP
282; Parameters:
283; CS:SI: Ptr to string to format
284; BP: SP before pushing parameters
285; Returns:
286; BP: Popped from stack
287; CF: Set since menu event was handled successfully
288; Corrupts registers:
289; AX, DI
290;--------------------------------------------------------------------
291DetectPrint_FormatCSSIfromParamsInSSBP:
292 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
293 stc ; Successful return from menu event
294 pop bp
295 ret
Note: See TracBrowser for help on using the repository browser.