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

Last change on this file since 129 was 128, checked in by krille_n_@…, 14 years ago

Changes to the XTIDE Universal BIOS:

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