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

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

Changes to XTIDE Universal BIOS:

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