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

Last change on this file since 95 was 92, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

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