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

Last change on this file since 365 was 359, checked in by aitotat@…, 13 years ago

Changes to BIOS Drive Information Tool:

  • L-CHS variables generated by XTIDE Universal BIOS are now displayed.
File size: 5.6 KB
Line 
1; Project name : BIOS Drive Information Tool
2; Description : Functions to print information read from BIOS.
3
4
5; Section containing code
6SECTION .text
7
8;--------------------------------------------------------------------
9; Print_SetCharacterOutputToSTDOUT
10; Parameters:
11; Nothing
12; Returns:
13; Nothing
14; Corrupts registers:
15; AX, BX, DI
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18Print_SetCharacterOutputToSTDOUT:
19 mov bl, ATTRIBUTES_NOT_USED
20 mov ax, DosCharOut
21 CALL_DISPLAY_LIBRARY SetCharOutputFunctionFromAXwithAttribFlagInBL
22 ret
23
24;--------------------------------------------------------------------
25; Use DOS standard output so strings can be redirected to a file.
26;
27; DosCharOut
28; Parameters:
29; AL: Character to output
30; DS: BDA segment (zero)
31; ES:DI: Ptr to video memory where to output
32; Returns:
33; DI: Incremented for next character
34; Corrupts registers:
35; AX, DX
36;--------------------------------------------------------------------
37ALIGN JUMP_ALIGN
38DosCharOut:
39 xchg dx, ax
40 mov ah, 02h ; DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
41 int 21h ; Call DOS
42 ret
43
44
45;---------------------------------------------------------------------
46; Print_ErrorMessageFromAHifError
47; Parameters:
48; AH: BIOS error code
49; CF: Set if error, cleared otherwise
50; Returns:
51; Nothing
52; Corrupts registers:
53; AX, BP, SI, DI (CF remains unchanged)
54;--------------------------------------------------------------------
55ALIGN JUMP_ALIGN
56Print_ErrorMessageFromAHifError:
57 jnc SHORT .NoErrors
58 eMOVZX ax, ah
59 mov si, g_szBiosError
60 call Print_BiosFunctionNumberFromAXusingFormatStringInSI
61 stc ; Keep the CF set
62ALIGN JUMP_ALIGN
63.NoErrors:
64 ret
65
66
67;---------------------------------------------------------------------
68; Print_DriveNumberFromDLusingFormatStringInSI
69; Print_VersionStringFromAXusingFormatStringInSI
70; Print_BiosFunctionNumberFromAXusingFormatStringInSI
71; Print_SectorSizeFromAXusingFormatStringInSI
72; Parameters:
73; DL: Drive Number
74; AX: Function number
75; Returns:
76; Nothing
77; Corrupts registers:
78; AX, BP, DI
79;--------------------------------------------------------------------
80ALIGN JUMP_ALIGN
81Print_DriveNumberFromDLusingFormatStringInSI:
82 eMOVZX ax, dl
83Print_VersionStringFromAXusingFormatStringInSI:
84Print_BiosFunctionNumberFromAXusingFormatStringInSI:
85Print_SectorSizeFromAXusingFormatStringInSI:
86 mov bp, sp
87 push ax
88 jmp SHORT JumpToFormatNullTerminatedStringFromSI
89
90
91;---------------------------------------------------------------------
92; Print_CHSfromCXDXAX
93; Parameters:
94; CX: Number of cylinders (1...16383)
95; DX: Number of heads (1...255)
96; AX: Sectors per track (1...63)
97; Returns:
98; Nothing
99; Corrupts registers:
100; AX, BP, DI
101;--------------------------------------------------------------------
102ALIGN JUMP_ALIGN
103Print_CHSfromCXDXAX:
104 push si
105
106 mov bp, sp
107 push cx
108 push dx
109 push ax
110 mov si, g_szFormatCHS
111 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
112
113 pop si
114 ret
115
116
117;---------------------------------------------------------------------
118; Print_NameFromAtaInfoInBX
119; Parameters:
120; DS:BX: Ptr to ATA information
121; Returns:
122; Nothing
123; Corrupts registers:
124; AX, CX, BP, SI, DI
125;--------------------------------------------------------------------
126ALIGN JUMP_ALIGN
127Print_NameFromAtaInfoInBX:
128 cld
129 lea si, [bx+ATA1.strModel]
130 mov di, si
131 mov cx, A1_MODEL_NUMBER_LENGTH/2
132ALIGN JUMP_ALIGN
133.ReverseNextWord:
134 lodsw
135 xchg al, ah
136 stosw
137 loop .ReverseNextWord
138 dec di
139 xor ax, ax
140 stosb ; Terminate with NULL
141
142 mov bp, sp
143 lea si, [bx+ATA1.strModel]
144 push si
145 mov si, g_szFormatDrvName
146 jmp SHORT JumpToFormatNullTerminatedStringFromSI
147
148
149;---------------------------------------------------------------------
150; Print_TotalSectorsFromBXDXAX
151; Parameters:
152; BX:DX:AX: Total number of sectors
153; Returns:
154; Nothing
155; Corrupts registers:
156; AX, BX, BP, DI
157;--------------------------------------------------------------------
158ALIGN JUMP_ALIGN
159Print_TotalSectorsFromBXDXAX:
160 ePUSH_T di, 0
161 push bx
162 push dx
163 push ax
164 mov bp, sp
165 mov bx, 10
166 CALL_DISPLAY_LIBRARY PrintQWordFromSSBPwithBaseInBX
167 add sp, BYTE 8
168
169 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
170 ret
171
172
173;---------------------------------------------------------------------
174; Print_EbiosVersionFromBXandExtensionsFromCX
175; Parameters:
176; BX: Version of extensions
177; CX: Interface support bit map
178; Returns:
179; Nothing
180; Corrupts registers:
181; AX, BP, SI, DI
182;--------------------------------------------------------------------
183ALIGN JUMP_ALIGN
184Print_EbiosVersionFromBXandExtensionsFromCX:
185 mov bp, sp
186 push bx
187 push cx
188 mov si, g_szNewExtensions
189 jmp SHORT JumpToFormatNullTerminatedStringFromSI
190
191
192;---------------------------------------------------------------------
193; JumpToFormatNullTerminatedStringFromSI
194; Parameters:
195; BP: SP before pushing parameters
196; CS:SI: Ptr to format string
197; Returns:
198; Pushed parameters are cleaned from stack
199; Corrupts registers:
200; AX, DI
201;--------------------------------------------------------------------
202ALIGN JUMP_ALIGN
203JumpToFormatNullTerminatedStringFromSI:
204 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
205 ret
206
207
208;---------------------------------------------------------------------
209; Print_NullTerminatedStringFromSI
210; Parameters:
211; CS:SI: Ptr to string to display
212; Returns:
213; Nothing
214; Corrupts registers:
215; AX, DI
216;--------------------------------------------------------------------
217ALIGN JUMP_ALIGN
218Print_NullTerminatedStringFromSI:
219 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
220 ret
Note: See TracBrowser for help on using the repository browser.