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

Last change on this file since 372 was 371, checked in by gregli@…, 13 years ago

Small changes. 1) Changes biosdrvs.com to output CR+LF instead of LF+CR, consistent with DOS/Windows, but I did not update the Assembly Library as this would break the Configurator; 2) Put a C/C++ section in Version.inc for the serial server; 3) Configurator defaults the EEPROM address after scanning for a EEPROM in memory (as it does for loading the BIOS from ROM); 4) Added a command to the Configurator main menu to save chages to the file from which it was loaded (if it was loaded form a file), which is symmetric with the Load command and more discoverable than exiting DOS and then being prompted (which is still there too, if changes are unsaved).

File size: 5.7 KB
RevLine 
[327]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;--------------------------------------------------------------------
[359]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;--------------------------------------------------------------------
[327]25; Use DOS standard output so strings can be redirected to a file.
26;
[359]27; DosCharOut
[327]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
[359]38DosCharOut:
[327]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
[359]69; Print_VersionStringFromAXusingFormatStringInSI
[327]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
[359]83Print_VersionStringFromAXusingFormatStringInSI:
[327]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
[371]169 push si
170 mov si, g_szNewline
171 call Print_NullTerminatedStringFromSI
172 pop si
173
[327]174 ret
175
176
177;---------------------------------------------------------------------
178; Print_EbiosVersionFromBXandExtensionsFromCX
179; Parameters:
180; BX: Version of extensions
181; CX: Interface support bit map
182; Returns:
183; Nothing
184; Corrupts registers:
185; AX, BP, SI, DI
186;--------------------------------------------------------------------
187ALIGN JUMP_ALIGN
188Print_EbiosVersionFromBXandExtensionsFromCX:
189 mov bp, sp
190 push bx
191 push cx
192 mov si, g_szNewExtensions
193 jmp SHORT JumpToFormatNullTerminatedStringFromSI
194
195
196;---------------------------------------------------------------------
197; JumpToFormatNullTerminatedStringFromSI
198; Parameters:
199; BP: SP before pushing parameters
200; CS:SI: Ptr to format string
201; Returns:
202; Pushed parameters are cleaned from stack
203; Corrupts registers:
204; AX, DI
205;--------------------------------------------------------------------
206ALIGN JUMP_ALIGN
207JumpToFormatNullTerminatedStringFromSI:
208 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
209 ret
210
211
212;---------------------------------------------------------------------
213; Print_NullTerminatedStringFromSI
214; Parameters:
215; CS:SI: Ptr to string to display
216; Returns:
217; Nothing
218; Corrupts registers:
219; AX, DI
220;--------------------------------------------------------------------
221ALIGN JUMP_ALIGN
222Print_NullTerminatedStringFromSI:
223 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
224 ret
Note: See TracBrowser for help on using the repository browser.