source: xtideuniversalbios/trunk/BIOS_Drive_Information_Tool/Src/Print.asm@ 424

Last change on this file since 424 was 424, checked in by Tomi Tilli, 12 years ago

Changes to BIOS Drive Information Tool:

  • Up to date with recent CHS translation changes.
  • Block mode and PIO capabilities are now displayed.
File size: 7.6 KB
Line 
1; Project name : BIOS Drive Information Tool
2; Description : Functions to print information read from BIOS.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 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; Print_SetCharacterOutputToSTDOUT
25; Parameters:
26; Nothing
27; Returns:
28; Nothing
29; Corrupts registers:
30; AX, BX, DI
31;--------------------------------------------------------------------
32Print_SetCharacterOutputToSTDOUT:
33 mov bl, ATTRIBUTES_NOT_USED
34 mov ax, DosCharOut
35 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
36 ret
37
38;--------------------------------------------------------------------
39; Use DOS standard output so strings can be redirected to a file.
40;
41; DosCharOut
42; Parameters:
43; AL: Character to output
44; DS: BDA segment (zero)
45; ES:DI: Ptr to video memory where to output
46; Returns:
47; DI: Incremented for next character
48; Corrupts registers:
49; AX, DX
50;--------------------------------------------------------------------
51DosCharOut:
52 xchg dx, ax
53 mov ah, 02h ; DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
54 int 21h ; Call DOS
55 ret
56
57
58;---------------------------------------------------------------------
59; Print_ErrorMessageFromAHifError
60; Parameters:
61; AH: BIOS error code
62; CF: Set if error, cleared otherwise
63; Returns:
64; Nothing
65; Corrupts registers:
66; AX, BP, SI, DI (CF remains unchanged)
67;--------------------------------------------------------------------
68Print_ErrorMessageFromAHifError:
69 jnc SHORT .NoErrors
70 eMOVZX ax, ah
71 mov si, g_szBiosError
72 call Print_FormatStringFromSIwithParameterInAX
73 stc ; Keep the CF set
74ALIGN JUMP_ALIGN
75.NoErrors:
76 ret
77
78
79;---------------------------------------------------------------------
80; Print_DriveNumberFromDLusingFormatStringInSI
81; Parameters:
82; DL: Drive Number
83; SI: Offset to format string
84; Returns:
85; Nothing
86; Corrupts registers:
87; AX, BP, DI
88;--------------------------------------------------------------------
89Print_DriveNumberFromDLusingFormatStringInSI:
90 eMOVZX ax, dl
91 ; Fall to Print_FormatStringFromSIwithParameterInAX
92
93
94;---------------------------------------------------------------------
95; Print_FormatStringFromSIwithParameterInAX
96; Print_FormatStringFromSIwithParametersInAXDX
97; Print_FormatStringFromSIwithParametersInAXDXCX
98; Parameters:
99; AX: Format parameter 1
100; DX: Format parameter 2
101; CX: Format parameter 3
102; SI: Offset to format string
103; Returns:
104; Nothing
105; Corrupts registers:
106; AX, BP, DI
107;--------------------------------------------------------------------
108Print_FormatStringFromSIwithParameterInAX:
109 mov bp, sp
110 push ax
111 jmp JumpToFormatNullTerminatedStringFromSI
112
113Print_FormatStringFromSIwithParametersInAXDX:
114 mov bp, sp
115 push ax
116 push dx
117 jmp JumpToFormatNullTerminatedStringFromSI
118
119Print_FormatStringFromSIwithParametersInAXDXCX:
120 mov bp, sp
121 push ax
122 push dx
123 push cx
124 jmp SHORT JumpToFormatNullTerminatedStringFromSI
125
126
127;---------------------------------------------------------------------
128; Print_ModeFromDLandCHSfromAXBLBH
129; Parameters:
130; AX: Number of L-CHS cylinders (1...1024)
131; BL: Number of L-CHS heads (1...255)
132; BH: Number of L-CHS sectors per track (1...63)
133; DL: CHS Translate Mode
134; Returns:
135; Nothing
136; Corrupts registers:
137; AX, BP, SI, DI
138;--------------------------------------------------------------------
139Print_ModeFromDLandCHSfromAXLBH:
140 mov bp, sp
141
142 xor dh, dh
143 mov si, dx
144 shl si, 1 ; Shift for WORD lookup
145 push WORD [si+.rgszXlateModeToString]
146
147 ePUSH_T si, g_szFormatCHS
148 push ax ; Cylinders
149 eMOVZX ax, bl
150 push ax ; Heads
151 mov al, bh
152 push ax ; Sectors per track
153
154 mov si, g_szXlateAndCHS
155 jmp SHORT JumpToFormatNullTerminatedStringFromSI
156
157.rgszXlateModeToString:
158 dw g_szNormal
159 dw g_szLarge
160 dw g_szLBA
161
162
163;---------------------------------------------------------------------
164; Print_CHSfromCXDXAX
165; Parameters:
166; CX: Number of cylinders (1...16383)
167; DX: Number of heads (1...255)
168; AX: Sectors per track (1...63)
169; Returns:
170; Nothing
171; Corrupts registers:
172; AX, BP, DI
173;--------------------------------------------------------------------
174Print_CHSfromCXDXAX:
175 push si
176
177 mov bp, sp
178 push cx
179 push dx
180 push ax
181 mov si, g_szFormatCHS
182 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
183
184 pop si
185 ret
186
187
188;---------------------------------------------------------------------
189; Print_NameFromAtaInfoInBX
190; Parameters:
191; DS:BX: Ptr to ATA information
192; Returns:
193; Nothing
194; Corrupts registers:
195; AX, CX, BP, SI, DI
196;--------------------------------------------------------------------
197Print_NameFromAtaInfoInBX:
198 cld
199 lea si, [bx+ATA1.strModel]
200 mov di, si
201 mov cx, A1_MODEL_NUMBER_LENGTH/2
202ALIGN JUMP_ALIGN
203.ReverseNextWord:
204 lodsw
205 xchg al, ah
206 stosw
207 loop .ReverseNextWord
208 dec di
209 xor ax, ax
210 stosb ; Terminate with NULL
211
212 mov bp, sp
213 lea si, [bx+ATA1.strModel]
214 push si
215 mov si, g_szFormatDrvName
216 jmp SHORT JumpToFormatNullTerminatedStringFromSI
217
218
219;---------------------------------------------------------------------
220; Print_TotalSectorsFromBXDXAX
221; Parameters:
222; BX:DX:AX: Total number of sectors
223; Returns:
224; Nothing
225; Corrupts registers:
226; AX, BX, BP, DI
227;--------------------------------------------------------------------
228Print_TotalSectorsFromBXDXAX:
229 ePUSH_T di, 0
230 push bx
231 push dx
232 push ax
233 mov bp, sp
234 mov bx, 10
235 CALL_DISPLAY_LIBRARY PrintQWordFromSSBPwithBaseInBX
236 add sp, BYTE 8
237
238 push si
239 mov si, g_szNewline
240 call Print_NullTerminatedStringFromSI
241 pop si
242
243 ret
244
245
246;---------------------------------------------------------------------
247; Print_EbiosVersionFromBXandExtensionsFromCX
248; Parameters:
249; BX: Version of extensions
250; CX: Interface support bit map
251; Returns:
252; Nothing
253; Corrupts registers:
254; AX, BP, SI, DI
255;--------------------------------------------------------------------
256Print_EbiosVersionFromBXandExtensionsFromCX:
257 mov bp, sp
258 push bx
259 push cx
260 mov si, g_szNewExtensions
261 jmp SHORT JumpToFormatNullTerminatedStringFromSI
262
263
264;---------------------------------------------------------------------
265; JumpToFormatNullTerminatedStringFromSI
266; Parameters:
267; BP: SP before pushing parameters
268; CS:SI: Ptr to format string
269; Returns:
270; Pushed parameters are cleaned from stack
271; Corrupts registers:
272; AX, DI
273;--------------------------------------------------------------------
274JumpToFormatNullTerminatedStringFromSI:
275 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
276 ret
277
278
279;---------------------------------------------------------------------
280; Print_NullTerminatedStringFromSI
281; Parameters:
282; CS:SI: Ptr to string to display
283; Returns:
284; Nothing
285; Corrupts registers:
286; AX, DI
287;--------------------------------------------------------------------
288Print_NullTerminatedStringFromSI:
289 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
290 ret
Note: See TracBrowser for help on using the repository browser.