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

Last change on this file since 119 was 98, checked in by Tomi Tilli, 13 years ago

Changes to XTIDE Universal BIOS:

  • Some more initialization optimizations.
File size: 13.1 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for printing boot menu strings.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
[88]8; Prints Boot Menu title strings.
[3]9;
[88]10; BootMenuPrint_TitleStrings
[3]11; Parameters:
[88]12; Nothing
[3]13; Returns:
[88]14; CF: Set since menu event handled
[3]15; Corrupts registers:
[88]16; AX, SI, DI
[3]17;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
[88]19BootMenuPrint_TitleStrings:
20 mov si, ROMVARS.szTitle
[96]21 call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
22 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
[88]23 mov si, ROMVARS.szVersion
[96]24 jmp BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[3]25
26
27;--------------------------------------------------------------------
[96]28; BootMenuPrint_ClearScreen
[3]29; Parameters:
[84]30; Nothing
[3]31; Returns:
32; Nothing
33; Corrupts registers:
[88]34; AX, DI
[3]35;--------------------------------------------------------------------
36ALIGN JUMP_ALIGN
37BootMenuPrint_ClearScreen:
[88]38 mov ax, ' ' | (MONO_NORMAL<<8)
39 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
[3]40 ret
41
42
43;--------------------------------------------------------------------
44; BootMenuPrint_FloppyMenuitem
45; Parameters:
46; DL: Untranslated Floppy Drive number
47; Returns:
[88]48; Nothing
[3]49; Corrupts registers:
[88]50; AX, DX, SI
[3]51;--------------------------------------------------------------------
52ALIGN JUMP_ALIGN
53BootMenuPrint_FloppyMenuitem:
[88]54 push bp
55
56 mov bp, sp
57 mov si, g_szFDLetter
[3]58 ePUSH_T ax, g_szFloppyDrv
[88]59 add dl, 'A'
60 push dx ; Drive letter
61 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
[3]62
63
64;--------------------------------------------------------------------
65; BootMenuPrint_HardDiskMenuitem
66; Parameters:
67; DL: Untranslated Hard Disk number
68; DS: RAMVARS segment
69; Returns:
[88]70; CF: Set since menu event handled
[3]71; Corrupts registers:
[88]72; AX, BX, SI, DI
[3]73;--------------------------------------------------------------------
74ALIGN JUMP_ALIGN
75BootMenuPrint_HardDiskMenuitem:
76 call FindDPT_ForDriveNumber ; DS:DI to point DPT
[88]77 jnc SHORT .HardDiskMenuitemForForeignDrive
78 ; Fall to .HardDiskMenuitemForOurDrive
[3]79
80;--------------------------------------------------------------------
[88]81; .HardDiskMenuitemForOurDrive
[3]82; Parameters:
83; DL: Untranslated Hard Disk number
84; DS: RAMVARS segment
85; Returns:
[88]86; CF: Set since menu event handled
[3]87; Corrupts registers:
[88]88; AX, BX, SI, DI
[3]89;--------------------------------------------------------------------
[88]90;ALIGN JUMP_ALIGN
91.HardDiskMenuitemForOurDrive:
92 call BootInfo_GetOffsetToBX
93 lea si, [bx+BOOTNFO.szDrvName]
94 xor bx, bx ; BDA segment
95 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
96 stc
97 ret
[3]98
99;--------------------------------------------------------------------
[88]100; BootMenuPrint_HardDiskMenuitemForForeignDrive
[3]101; Parameters:
102; DL: Untranslated Hard Disk number
103; DS: RAMVARS segment
104; Returns:
[88]105; CF: Set since menu event handled
[3]106; Corrupts registers:
[88]107; AX, SI, DI
[3]108;--------------------------------------------------------------------
109ALIGN JUMP_ALIGN
[88]110.HardDiskMenuitemForForeignDrive:
111 mov si, g_szforeignHD
[96]112 jmp BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[3]113
114
115;--------------------------------------------------------------------
116; BootMenuPrint_FloppyMenuitemInformation
117; Parameters:
118; DL: Untranslated Floppy Drive number
119; DS: RAMVARS segment
120; Returns:
[88]121; CF: Set since menu event was handled successfully
[3]122; Corrupts registers:
[88]123; AX, BX, CX, DX, SI, DI, ES
[3]124;--------------------------------------------------------------------
125ALIGN JUMP_ALIGN
126BootMenuPrint_FloppyMenuitemInformation:
[88]127 call BootMenuPrint_ClearInformationArea
128 call FloppyDrive_GetType ; Get Floppy Drive type to BX
129 test bx, bx ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
130 jz SHORT .PrintXTFloppyType
[3]131 cmp bl, FLOPPY_TYPE_35_ED
[88]132 ja SHORT .PrintUnknownFloppyType
133 jmp SHORT .PrintKnownFloppyType
[3]134
135;--------------------------------------------------------------------
[88]136; .PrintXTFloppyType
[3]137; Parameters:
138; Nothing
139; Returns:
[88]140; CF: Set since menu event was handled successfully
[3]141; Corrupts registers:
[88]142; AX, SI, DI
[3]143;--------------------------------------------------------------------
144ALIGN JUMP_ALIGN
[88]145.PrintXTFloppyType:
146 push bp
[3]147 mov si, g_szFddSizeOr
[88]148 jmp SHORT .FormatXTorUnknownTypeFloppyDrive
[3]149
150;--------------------------------------------------------------------
[88]151; .PrintUnknownFloppyType
[3]152; Parameters:
153; Nothing
154; Returns:
[88]155; CF: Set since menu event was handled successfully
[3]156; Corrupts registers:
[88]157; AX, SI, DI
[3]158;--------------------------------------------------------------------
159ALIGN JUMP_ALIGN
[88]160.PrintUnknownFloppyType:
161 push bp
[3]162 mov si, g_szFddUnknown
[88]163.FormatXTorUnknownTypeFloppyDrive:
164 mov bp, sp
[3]165 ePUSH_T ax, g_szCapacity
[88]166 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
[3]167
168;--------------------------------------------------------------------
[88]169; .PrintKnownFloppyType
[3]170; Parameters:
171; BX: Floppy drive type
172; Returns:
[88]173; CF: Set since menu event was handled successfully
[3]174; Corrupts registers:
[88]175; AX, BX, SI, DI
[3]176;--------------------------------------------------------------------
177ALIGN JUMP_ALIGN
[88]178.PrintKnownFloppyType:
179 push bp
180
181 mov bp, sp
182 mov si, g_szFddSize
183 ePUSH_T ax, g_szCapacity
[3]184 dec bx ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD)
185 shl bx, 1 ; Shift for WORD lookup
186 mov ax, [cs:bx+.rgwPhysicalSize]
[88]187 push ax ; '5' or '3'
188 mov al, ah
[3]189 push ax ; '1/4' or '1/2'
[88]190 push WORD [cs:bx+.rgwCapacity]
191 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
192
[3]193ALIGN WORD_ALIGN
194.rgwCapacity:
195 dw 360
196 dw 1200
197 dw 720
198 dw 1440
199 dw 2880
200 dw 2880
201.rgwPhysicalSize:
[88]202 db '5', 172 ; 1, FLOPPY_TYPE_525_DD
203 db '5', 172 ; 2, FLOPPY_TYPE_525_HD
204 db '3', 171 ; 3, FLOPPY_TYPE_35_DD
205 db '3', 171 ; 4, FLOPPY_TYPE_35_HD
206 db '3', 171 ; 5, 3.5" ED on some BIOSes
207 db '3', 171 ; 6, FLOPPY_TYPE_35_ED
[3]208
209
210;--------------------------------------------------------------------
211; Prints Hard Disk Menuitem information strings.
212;
213; BootMenuPrint_HardDiskMenuitemInformation
214; Parameters:
215; DL: Untranslated Hard Disk number
216; DS: RAMVARS segment
217; Returns:
[88]218; CF: Set since menu event was handled successfully
[3]219; Corrupts registers:
220; BX, CX, DX, SI, DI, ES
221;--------------------------------------------------------------------
222ALIGN JUMP_ALIGN
223BootMenuPrint_HardDiskMenuitemInformation:
224 call FindDPT_ForDriveNumber ; DS:DI to point DPT
[88]225 jnc SHORT .HardDiskMenuitemInfoForForeignDrive
226 call .HardDiskMenuitemInfoSizeForOurDrive
[3]227 jmp BootMenuPrintCfg_ForOurDrive
228
229;--------------------------------------------------------------------
[88]230; .HardDiskMenuitemInfoForForeignDrive
[3]231; Parameters:
232; DL: Untranslated Hard Disk number
233; DS: RAMVARS segment
234; Returns:
[88]235; CF: Set since menu event was handled successfully
[3]236; Corrupts registers:
237; AX, BX, CX, DX, SI, DI
238;--------------------------------------------------------------------
239ALIGN JUMP_ALIGN
[88]240.HardDiskMenuitemInfoForForeignDrive:
241 push bp
242 mov bp, sp
243 ePUSH_T ax, g_szCapacity
244
[3]245 call DriveXlate_ToOrBack
246 call HCapacity_GetSectorCountFromForeignAH08h
[88]247 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
248
[3]249 mov si, g_szSizeSingle
[88]250 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
[3]251
252;--------------------------------------------------------------------
[88]253; .HardDiskMenuitemInfoSizeForOurDrive
[3]254; Parameters:
255; DL: Untranslated Hard Disk number
256; DS:DI: Ptr to DPT
257; Returns:
258; Nothing
259; Corrupts registers:
260; AX, BX, CX, DX, SI, ES
261;--------------------------------------------------------------------
262ALIGN JUMP_ALIGN
[88]263.HardDiskMenuitemInfoSizeForOurDrive:
264 push bp
265 mov bp, sp
266 ePUSH_T ax, g_szCapacity
[3]267
[88]268 ; Get and push L-CHS size
269 call HCapacity_GetSectorCountFromOurAH08h
270 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
271
[3]272 ; Get and push total LBA size
273 call BootInfo_GetTotalSectorCount
[88]274 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
[3]275
276 mov si, g_szSizeDual
[88]277 ; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP
[3]278
279
280;--------------------------------------------------------------------
[88]281; BootMenuPrint_FormatCSSIfromParamsInSSBP
282; Parameters:
283; CS:SI: Ptr to string to format
284; SS:BP: Ptr to format parameters
285; Returns:
286; BP: Popped from stack
287; Corrupts registers:
288; AX
289;--------------------------------------------------------------------
290ALIGN JUMP_ALIGN
291BootMenuPrint_FormatCSSIfromParamsInSSBP:
292 push di
293 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
294 stc ; Successfull return from menu event
295 pop di
296 pop bp
297 ret
298
299
300;--------------------------------------------------------------------
301; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
302; Parameters:
303; BX:DX:AX: Sector count
304; Returns:
305; Size in stack
306; Corrupts registers:
307; AX, BX, CX, DX, SI
308;--------------------------------------------------------------------
309ALIGN JUMP_ALIGN
310ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
311 pop si ; Pop return address
312 call Size_ConvertSectorCountInBXDXAXtoKiB
313 mov cx, BYTE_MULTIPLES.kiB
314 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
315 push ax ; Size in magnitude
316 push cx ; Tenths
317 push dx ; Magnitude character
318 jmp si
319
320
321;--------------------------------------------------------------------
[96]322; BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[88]323; Parameters:
324; CS:SI: Ptr to NULL terminated string to print
325; Returns:
326; CF: Set since menu event was handled successfully
327; Corrupts registers:
[98]328; AX
[88]329;--------------------------------------------------------------------
330ALIGN JUMP_ALIGN
[96]331BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
[98]332 push di
[88]333 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
[98]334 pop di
[88]335 stc
336 ret
337
338
339;--------------------------------------------------------------------
340; BootMenuPrint_ClearInformationArea
341; Parameters:
342; Nothing
343; Returns:
344; CF: Set
345; Corrupts registers:
346; AX, DI
347;--------------------------------------------------------------------
348ALIGN JUMP_ALIGN
349BootMenuPrint_ClearInformationArea:
350 CALL_MENU_LIBRARY ClearInformationArea
351 stc
352 ret
353
354
355;--------------------------------------------------------------------
356; BootMenuPrint_TheBottomOfScreen
[3]357; Parameters:
358; DS: RAMVARS segment
359; Returns:
[88]360; Nothing
[3]361; Corrupts registers:
[92]362; AX, BX, CX, DX, SI, DI
[3]363;--------------------------------------------------------------------
364ALIGN JUMP_ALIGN
[88]365BootMenuPrint_TheBottomOfScreen:
366 call FloppyDrive_GetCount
367 mov bl, cl ; Floppy Drive count to BL
368 call RamVars_GetHardDiskCountFromBDAtoCX
369 mov bh, cl ; Hard Disk count to BH
[92]370 ; Fall to .MoveCursorToHotkeyStrings
[3]371
[92]372;--------------------------------------------------------------------
373; .MoveCursorToHotkeyStrings
374; Parameters:
375; Nothing
376; Returns:
377; Nothing
378; Corrupts registers:
379; AX, DI
380;--------------------------------------------------------------------
381.MoveCursorToHotkeyStrings:
382 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
383 xor al, al
384 dec ah
385 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
386 ; Fall to .PrintHotkeyString
[3]387
388;--------------------------------------------------------------------
[92]389; .PrintHotkeyString
[3]390; Parameters:
[92]391; BL: Floppy Drives
392; BH: Hard Drives
[88]393; Returns:
[92]394; Nothing
[88]395; Corrupts registers:
[92]396; AX, CX, DX, SI
[88]397;--------------------------------------------------------------------
[92]398.PrintHotkeyString:
399 ; Display Library should not be called like this
400 mov si, ATTRIBUTE_CHARS.cTitle
401 call MenuAttribute_GetToAXfromTypeInSI
402 xchg cx, ax
403 mov si, ATTRIBUTE_CHARS.cHighlightedItem
404 call MenuAttribute_GetToAXfromTypeInSI
405 xchg dx, ax
[88]406
[92]407 test bl, bl ; Any Floppy Drives?
408 jz SHORT .SkipFloppyDriveHotkeys
409 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)
410 mov si, g_szFDD
411 call PushHotkeyParamsAndFormat
[88]412
[92]413.SkipFloppyDriveHotkeys:
414 test bh, bh ; Any Hard Drives?
415 jz SHORT .SkipHardDriveHotkeys
416 call BootMenu_GetLetterForFirstHardDiskToCL
417 mov ch, ANGLE_QUOTE_RIGHT
418 xchg ax, cx
419 mov si, g_szHDD
420 call PushHotkeyParamsAndFormat
421
422.SkipHardDriveHotkeys:
423 ; Fall to .PrintRomBootHotkey
424
[88]425;--------------------------------------------------------------------
[92]426; .PrintRomBootHotkey
[88]427; Parameters:
[92]428; CX: Key Attribute
429; DX: Description Attribute
[3]430; Returns:
[88]431; Nothing
[3]432; Corrupts registers:
[92]433; AX, SI
[3]434;--------------------------------------------------------------------
[92]435.PrintRomBootHotkey:
436 mov ax, 'F' | ('8'<<8) ; F8
437 mov si, g_szRomBoot
438 ; Fall to PushHotkeyParamsAndFormat
439
440;--------------------------------------------------------------------
441; PushHotkeyParamsAndFormat
442; Parameters:
443; AL: First character
444; AH: Second character
445; CX: Key Attribute
446; DX: Description Attribute
447; CS:SI: Description string
448; Returns:
449; Nothing
450; Corrupts registers:
451; AX, SI
452;--------------------------------------------------------------------
[3]453ALIGN JUMP_ALIGN
[92]454PushHotkeyParamsAndFormat:
455 push bp
456 mov bp, sp
457
458 push cx ; Key attribute
459 push ax ; First character
460 xchg al, ah
461 push ax ; Second character
462 push dx ; Description attribute
463 push si ; Description string
464 push cx ; Key attribute for last space
465 mov si, g_szHotkey
466 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
Note: See TracBrowser for help on using the repository browser.