source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm@ 388

Last change on this file since 388 was 386, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Boot menu is now an optional module (MODULE_BOOT_MENU).
File size: 10.6 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for printing boot menu strings.
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; BootMenuPrint_RefreshItem
25;
26; Parameters:
27; DL: Untranslated Floppy Drive number
28; Returns:
29; Nothing
30; Corrupts registers:
31; AX, BX, DX, SI, DI
32;--------------------------------------------------------------------
33BootMenuPrint_RefreshItem:
34 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
35 jnc BootMenuEvent_EventCompleted ; if no menu item selected, out we go
36
37 push bp
38 mov bp, sp
39
40 call FindDPT_ForDriveNumberInDL
41 jc .notOurs
42
43 call BootMenuInfo_ConvertDPTtoBX
44 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA
45 jmp .go
46
47.notOurs:
48 mov si,g_szDriveNum
49 mov bx,g_szForeignHD ; assume a hard disk for the moment
50
51 test dl, dl
52 js .go
53 mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption...
54
55.go:
56 mov ax, dx ; preserve DL for the floppy drive letter addition
57 call DriveXlate_ToOrBack
58 push dx ; translated drive number
59 push bx ; sub string
60 add al, 'A' ; floppy drive letter (we always push this although
61 push ax ; the hard disks don't ever use it, but it does no harm)
62
63 jmp SHORT BootMenuPrint_RefreshInformation.FormatRelay
64
65;--------------------------------------------------------------------
66; Prints Boot Menu title strings.
67;
68; BootMenuPrint_TitleStrings
69; Parameters:
70; Nothing
71; Returns:
72; CF: Set since menu event handled
73; Corrupts registers:
74; AX, SI, DI
75;--------------------------------------------------------------------
76BootMenuPrint_TitleStrings:
77 mov si, ROMVARS.szTitle
78 call DetectPrint_NullTerminatedStringFromCSSIandSetCF
79 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
80 mov si, ROMVARS.szVersion
81 jmp DetectPrint_NullTerminatedStringFromCSSIandSetCF
82
83
84;--------------------------------------------------------------------
85; BootMenuPrint_FloppyMenuitemInformation
86; Parameters:
87; DL: Untranslated Floppy Drive number
88; DS: RAMVARS segment
89; Returns:
90; CF: Set since menu event was handled successfully
91; Corrupts registers:
92; AX, BX, CX, DX, SI, DI, ES
93;--------------------------------------------------------------------
94BootMenuPrint_RefreshInformation:
95 CALL_MENU_LIBRARY ClearInformationArea
96
97 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
98 jnc BootMenuEvent_EventCompleted ; if no menu selection, abort
99
100 push bp
101 mov bp, sp
102
103 mov si, g_szCapacity ; Setup print string now, carries through to print call
104
105 call FindDPT_ForDriveNumberInDL
106
107 inc dl ; are we a hard disk?
108 dec dl ; inc/dec will set SF, without modifying CF or DL
109 js .HardDiskRefreshInformation
110
111 jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above
112 call FloppyDrive_GetType ; Get Floppy Drive type to BX
113 jmp .around
114.ours:
115 call AH8h_GetDriveParameters
116.around:
117
118 mov ax, g_szFddSizeOr ; .PrintXTFloppyType
119 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
120 jz SHORT .PushAXAndOutput
121
122 mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
123 cmp bl, FLOPPY_TYPE_35_ED
124 ja SHORT .PushAXAndOutput
125
126 ; Fall to .PrintKnownFloppyType
127
128;--------------------------------------------------------------------
129; .PrintKnownFloppyType
130; Parameters:
131; BX: Floppy drive type
132; Returns:
133; CF: Set since menu event was handled successfully
134; Corrupts registers:
135; AX, BX, SI, DI
136;
137; Floppy Drive Types:
138;
139; 0 Handled above
140; 1 FLOPPY_TYPE_525_DD 5 1/4 360K
141; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M
142; 3 FLOPPY_TYPE_35_DD 3 1/2 720K
143; 4 FLOPPY_TYPE_35_HD 3 1/2 1.44M
144; 5 3.5" ED on some BIOSes 3 1/2 2.88M
145; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M
146; >6 Unknwon, handled above
147;
148;--------------------------------------------------------------------
149.PrintKnownFloppyType:
150 mov al, (g_szFddSize - $$) & 0xff
151 push ax
152
153 mov al, (g_szFddThreeHalf - $$) & 0xff
154 cmp bl, FLOPPY_TYPE_525_HD
155 ja .ThreeHalf
156 mov al, (g_szFddFiveQuarter - $$) & 0xff
157.ThreeHalf:
158 push ax ; "5 1/4" or "3 1/2"
159
160 mov al,FloppyTypes.rgbCapacityMultiplier
161 mov bh, 0
162 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
163
164.PushAXAndOutput:
165 push ax
166
167.FormatRelay:
168 jmp DetectPrint_FormatCSSIfromParamsInSSBP
169
170
171;--------------------------------------------------------------------
172; Prints Hard Disk Menuitem information strings.
173;
174; BootMenuPrint_HardDiskMenuitemInformation
175; Parameters:
176; DS: RAMVARS segment
177; Returns:
178; CF: Set since menu event was handled successfully
179; Corrupts registers:
180; BX, CX, DX, SI, DI, ES
181;--------------------------------------------------------------------
182.HardDiskRefreshInformation:
183 jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
184
185.HardDiskMenuitemInfoForOurDrive:
186 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information
187 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size
188 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
189
190.HardDiskMenuitemInfoForForeignDrive:
191 call DriveXlate_ToOrBack
192 call AH15h_GetSectorCountFromForeignDriveToDXAX
193
194.ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
195 ePUSH_T cx, g_szCapacityNum ; Push format substring
196 call Size_ConvertSectorCountInBXDXAXtoKiB
197 mov cx, BYTE_MULTIPLES.kiB
198 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
199 push ax ; Size in magnitude
200 push cx ; Tenths
201 push dx ; Magnitude character
202
203 test di,di
204 jz SHORT BootMenuPrint_RefreshInformation.FormatRelay
205
206%include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string
207 jmp DetectPrint_FormatCSSIfromParamsInSSBP
208
209
210;--------------------------------------------------------------------
211; BootMenuPrint_ClearScreen
212; Parameters:
213; Nothing
214; Returns:
215; Nothing
216; Corrupts registers:
217; AX, DI
218;--------------------------------------------------------------------
219BootMenuPrint_ClearScreen:
220 call BootMenuPrint_InitializeDisplayContext
221 xor ax, ax
222 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
223 mov ax, ' ' | (MONO_NORMAL<<8)
224 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
225 ret
226
227
228;--------------------------------------------------------------------
229; BootMenuPrint_TheBottomOfScreen
230; Parameters:
231; DS: RAMVARS segment
232; Returns:
233; Nothing
234; Corrupts registers:
235; AX, BX, CX, DX, SI, DI
236;--------------------------------------------------------------------
237BootMenuPrint_TheBottomOfScreen:
238 call FloppyDrive_GetCountToAX
239 xchg bx, ax ; Floppy Drive count to BL
240 call RamVars_GetHardDiskCountFromBDAtoAX
241 mov bh, al ; Hard Disk count to BH
242 ; Fall to .MoveCursorToHotkeyStrings
243
244;--------------------------------------------------------------------
245; .MoveCursorToHotkeyStrings
246; Parameters:
247; Nothing
248; Returns:
249; Nothing
250; Corrupts registers:
251; AX, DI
252;--------------------------------------------------------------------
253.MoveCursorToHotkeyStrings:
254 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
255 xor al, al
256 dec ah
257 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
258 ; Fall to .PrintHotkeyString
259
260;--------------------------------------------------------------------
261; .PrintHotkeyString
262; Parameters:
263; BL: Floppy Drives
264; BH: Hard Drives
265; Returns:
266; Nothing
267; Corrupts registers:
268; AX, CX, DX, SI, DI
269;--------------------------------------------------------------------
270.PrintHotkeyString:
271 ; Display Library should not be called like this
272 mov si, ATTRIBUTE_CHARS.cHighlightedItem
273 call MenuAttribute_GetToAXfromTypeInSI
274 xchg dx, ax
275 mov cx, MONO_BRIGHT
276
277 test bl, bl ; Any Floppy Drives?
278 jz SHORT .SkipFloppyDriveHotkeys
279 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)
280 mov si, g_szFDD
281 call PushHotkeyParamsAndFormat
282
283.SkipFloppyDriveHotkeys:
284 test bh, bh ; Any Hard Drives?
285 jz SHORT .SkipHardDriveHotkeys
286 call BootMenu_GetLetterForFirstHardDiskToAL
287 mov ah, ANGLE_QUOTE_RIGHT
288 mov si, g_szHDD
289 call PushHotkeyParamsAndFormat
290
291.SkipHardDriveHotkeys:
292 ; Fall to .PrintRomBootHotkey
293
294;--------------------------------------------------------------------
295; .PrintRomBootHotkey
296; Parameters:
297; CX: Key Attribute
298; DX: Description Attribute
299; Returns:
300; Nothing
301; Corrupts registers:
302; AX, SI, DI
303;--------------------------------------------------------------------
304.PrintRomBootHotkey:
305 mov ax, 'F' | ('8'<<8) ; F8
306 mov si, g_szRomBoot
307 ; Fall to PushHotkeyParamsAndFormat
308
309;--------------------------------------------------------------------
310; PushHotkeyParamsAndFormat
311; Parameters:
312; AL: First character
313; AH: Second character
314; CX: Key Attribute
315; DX: Description Attribute
316; CS:SI: Description string
317; Returns:
318; Nothing
319; Corrupts registers:
320; AX, SI, DI
321;--------------------------------------------------------------------
322PushHotkeyParamsAndFormat:
323 push bp
324 mov bp, sp
325
326 push cx ; Key attribute
327 push ax ; First character
328 xchg al, ah
329 push ax ; Second character
330 push dx ; Description attribute
331 push si ; Description string
332 push cx ; Key attribute for last space
333 mov si, g_szHotkey
334 jmp DetectPrint_FormatCSSIfromParamsInSSBP
335
336
337FloppyTypes:
338.rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size
339.rgbCapacity:
340 db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1
341 db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2
342 db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3
343 db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4
344 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5
345 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6
Note: See TracBrowser for help on using the repository browser.