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

Last change on this file since 245 was 243, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Brought back optional "A then C" boot loader.
  • Now there is only one INT 19h handler that remains unchanged.
File size: 12.9 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;--------------------------------------------------------------------
[241]8; BootMenuPrint_RefreshItem
9;
[189]10; Parameters:
11; DL: Untranslated Floppy Drive number
12; Returns:
13; Nothing
14; Corrupts registers:
[241]15; AX, BX, DX, SI, DI
[189]16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
[241]18BootMenuPrint_RefreshItem:
19 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
20 jnc BootMenuEvent_EventCompleted ; if no menu item selected, out we go
21
[189]22 push bp
23 mov bp, sp
24
[241]25 call RamVars_IsDriveHandledByThisBIOS
26 jnc .notOurs
27
28 call FindDPT_ForDriveNumber ; if it is one of ours, print the string in bootnfo
29 call BootInfo_ConvertDPTtoBX
30 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA
31 jmp .go
[189]32
[241]33.notOurs:
34 mov si,g_szDriveNum
35 mov bx,g_szForeignHD ; assume a hard disk for the moment
36
37 test dl,80h
38 js .go
39 mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption...
40
41.go:
42 mov ax, dx ; preserve DL for the floppy drive letter addition
43 call DriveXlate_ToOrBack
44 push dx ; translated drive number
45 push bx ; sub string
46 add al, 'A' ; floppy drive letter (we always push this although
47 push ax ; the hard disks don't ever use it, but it does no harm)
48
49 jmp short BootMenuPrint_FormatCSSIfromParamsInSSBP
[130]50
51;--------------------------------------------------------------------
[88]52; Prints Boot Menu title strings.
[3]53;
[88]54; BootMenuPrint_TitleStrings
[3]55; Parameters:
[88]56; Nothing
[3]57; Returns:
[88]58; CF: Set since menu event handled
[3]59; Corrupts registers:
[88]60; AX, SI, DI
[3]61;--------------------------------------------------------------------
62ALIGN JUMP_ALIGN
[88]63BootMenuPrint_TitleStrings:
64 mov si, ROMVARS.szTitle
[96]65 call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
66 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
[88]67 mov si, ROMVARS.szVersion
[161]68 ; Fall to BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[3]69
70;--------------------------------------------------------------------
[128]71; BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
72; Parameters:
73; CS:SI: Ptr to NULL terminated string to print
74; Returns:
75; CF: Set since menu event was handled successfully
76; Corrupts registers:
[186]77; AX, DI
[128]78;--------------------------------------------------------------------
79ALIGN JUMP_ALIGN
80BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
[186]81;
82; We send all CSSI strings through the Format routine for the case of
83; compressed strings, but this doesn't hurt in the non-compressed case either
84; (perhaps a little slower, but shouldn't be noticeable to the user)
85; and results in smaller code size.
86;
87 push bp
88 mov bp,sp
[192]89 jmp short BootMenuPrint_FormatCSSIfromParamsInSSBP
[128]90
[192]91
[128]92;--------------------------------------------------------------------
[3]93; BootMenuPrint_FloppyMenuitemInformation
94; Parameters:
95; DL: Untranslated Floppy Drive number
96; DS: RAMVARS segment
97; Returns:
[88]98; CF: Set since menu event was handled successfully
[3]99; Corrupts registers:
[88]100; AX, BX, CX, DX, SI, DI, ES
[3]101;--------------------------------------------------------------------
[192]102
[241]103ALIGN JUMP_ALIGN
104BootMenuPrint_RefreshInformation:
105 CALL_MENU_LIBRARY ClearInformationArea
[192]106
[241]107 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
108 jnc BootMenuEvent_EventCompleted ; if no menu selection, abort
[182]109
[161]110 push bp
111 mov bp, sp
[241]112
113 test dl, dl ; are we a hard disk?
114 js BootMenuPrint_HardDiskRefreshInformation
[182]115
[241]116 call FloppyDrive_GetType ; Get Floppy Drive type to BX
[182]117
[241]118 mov cx, g_szFddSizeOr ; .PrintXTFloppyType
119 test bx, bx ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
120 jz SHORT BootMenuPrint_HardDiskRefreshInformation.output
121
122 mov cl, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
[3]123 cmp bl, FLOPPY_TYPE_35_ED
[241]124 ja SHORT BootMenuPrint_HardDiskRefreshInformation.output
[182]125
[161]126 ; Fall to .PrintKnownFloppyType
[3]127
128;--------------------------------------------------------------------
[161]129; .PrintKnownFloppyType
[3]130; Parameters:
[161]131; BX: Floppy drive type
[3]132; Returns:
[88]133; CF: Set since menu event was handled successfully
[3]134; Corrupts registers:
[161]135; AX, BX, SI, DI
[182]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;
[3]148;--------------------------------------------------------------------
[161]149.PrintKnownFloppyType:
[241]150 mov cl, (g_szFddSize - $$) & 0xff
151 push cx
[182]152
[241]153 mov cl, (g_szFddThreeHalf - $$) & 0xff
[182]154 cmp bl, FLOPPY_TYPE_525_HD
155 ja .ThreeHalf
[241]156 mov cl, (g_szFddFiveQuarter - $$) & 0xff
[182]157.ThreeHalf:
[241]158 push cx ; "5 1/4" or "3 1/2"
[3]159
[182]160 mov al,FloppyTypes.rgbCapacityMultiplier
161 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
162 push ax
[161]163
[241]164 jmp short BootMenuPrint_HardDiskRefreshInformation.output
[88]165
[192]166
167;--------------------------------------------------------------------
[3]168; Prints Hard Disk Menuitem information strings.
169;
170; BootMenuPrint_HardDiskMenuitemInformation
171; Parameters:
172; DL: Untranslated Hard Disk number
173; DS: RAMVARS segment
174; Returns:
[88]175; CF: Set since menu event was handled successfully
[3]176; Corrupts registers:
177; BX, CX, DX, SI, DI, ES
178;--------------------------------------------------------------------
179ALIGN JUMP_ALIGN
[241]180BootMenuPrint_HardDiskRefreshInformation:
[150]181 call RamVars_IsDriveHandledByThisBIOS
182 jnc SHORT .HardDiskMenuitemInfoForForeignDrive
[241]183 call FindDPT_ForDriveNumber ; DS:DI to point DPT
[127]184 ; Fall to .HardDiskMenuitemInfoForOurDrive
[3]185
186;--------------------------------------------------------------------
[127]187; .HardDiskMenuitemInfoForOurDrive
[3]188; Parameters:
189; DL: Untranslated Hard Disk number
[127]190; DS:DI: Ptr to DPT
[3]191; Returns:
[127]192; Nothing
[3]193; Corrupts registers:
[127]194; AX, BX, CX, DX, SI, DI, ES
[3]195;--------------------------------------------------------------------
[127]196.HardDiskMenuitemInfoForOurDrive:
[241]197 ePUSH_T ax, g_szSizeDual
198
[127]199 ; Get and push L-CHS size
[150]200 call AH15h_GetSectorCountToDXAX
[88]201 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
202
[127]203 ; Get and push total LBA size
204 call BootInfo_GetTotalSectorCount
[241]205 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
206 jmp BootMenuPrintCfg_ForOurDrive
207
[3]208;--------------------------------------------------------------------
[127]209; .HardDiskMenuitemInfoForForeignDrive
[3]210; Parameters:
211; DL: Untranslated Hard Disk number
[127]212; DS: RAMVARS segment
[3]213; Returns:
[127]214; CF: Set since menu event was handled successfully
[3]215; Corrupts registers:
[127]216; AX, BX, CX, DX, SI, DI
[3]217;--------------------------------------------------------------------
218ALIGN JUMP_ALIGN
[127]219.HardDiskMenuitemInfoForForeignDrive:
220 call DriveXlate_ToOrBack
[150]221 call AH15h_GetSectorCountFromForeignDriveToDXAX
[88]222 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
223
[241]224ALIGN JUMP_ALIGN
225.output:
226 mov si, g_szCapacity
227;;; fall-through
[3]228
229;--------------------------------------------------------------------
[241]230; BootMenuPrint_FormatCSSIfromParamsInSSBP
[88]231; Parameters:
[241]232; CS:SI: Ptr to string to format
233; BP: SP before pushing parameters
[88]234; Returns:
[241]235; BP: Popped from stack
236; CF: Set since menu event was handled successfully
[88]237; Corrupts registers:
[120]238; AX, DI
[88]239;--------------------------------------------------------------------
240ALIGN JUMP_ALIGN
[241]241BootMenuPrint_FormatCSSIfromParamsInSSBP:
242 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
243 stc ; Successfull return from menu event
244 pop bp
[88]245 ret
[192]246
[241]247
[88]248;--------------------------------------------------------------------
[192]249; BootMenuPrint_ClearScreen
[88]250; Parameters:
[192]251; Nothing
[88]252; Returns:
[192]253; Nothing
[88]254; Corrupts registers:
[192]255; AX, DI
[88]256;--------------------------------------------------------------------
257ALIGN JUMP_ALIGN
[192]258BootMenuPrint_ClearScreen:
259 call BootMenuPrint_InitializeDisplayContext
260 xor ax, ax
261 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
262 mov ax, ' ' | (MONO_NORMAL<<8)
263 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
264 ret
[88]265
266
267;--------------------------------------------------------------------
268; BootMenuPrint_TheBottomOfScreen
[3]269; Parameters:
270; DS: RAMVARS segment
271; Returns:
[88]272; Nothing
[3]273; Corrupts registers:
[92]274; AX, BX, CX, DX, SI, DI
[3]275;--------------------------------------------------------------------
276ALIGN JUMP_ALIGN
[88]277BootMenuPrint_TheBottomOfScreen:
[124]278 call FloppyDrive_GetCountToCX
[88]279 mov bl, cl ; Floppy Drive count to BL
280 call RamVars_GetHardDiskCountFromBDAtoCX
281 mov bh, cl ; Hard Disk count to BH
[92]282 ; Fall to .MoveCursorToHotkeyStrings
[3]283
[92]284;--------------------------------------------------------------------
285; .MoveCursorToHotkeyStrings
286; Parameters:
287; Nothing
288; Returns:
289; Nothing
290; Corrupts registers:
291; AX, DI
292;--------------------------------------------------------------------
293.MoveCursorToHotkeyStrings:
294 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
295 xor al, al
296 dec ah
297 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
298 ; Fall to .PrintHotkeyString
[3]299
300;--------------------------------------------------------------------
[92]301; .PrintHotkeyString
[3]302; Parameters:
[92]303; BL: Floppy Drives
304; BH: Hard Drives
[88]305; Returns:
[92]306; Nothing
[88]307; Corrupts registers:
[120]308; AX, CX, DX, SI, DI
[88]309;--------------------------------------------------------------------
[92]310.PrintHotkeyString:
311 ; Display Library should not be called like this
312 mov si, ATTRIBUTE_CHARS.cHighlightedItem
313 call MenuAttribute_GetToAXfromTypeInSI
314 xchg dx, ax
[122]315 mov cx, MONO_BRIGHT
[88]316
[92]317 test bl, bl ; Any Floppy Drives?
318 jz SHORT .SkipFloppyDriveHotkeys
319 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)
320 mov si, g_szFDD
321 call PushHotkeyParamsAndFormat
[88]322
[92]323.SkipFloppyDriveHotkeys:
324 test bh, bh ; Any Hard Drives?
325 jz SHORT .SkipHardDriveHotkeys
[122]326 xchg ax, cx ; Store Key Attribute
[92]327 call BootMenu_GetLetterForFirstHardDiskToCL
328 mov ch, ANGLE_QUOTE_RIGHT
329 xchg ax, cx
330 mov si, g_szHDD
331 call PushHotkeyParamsAndFormat
332
333.SkipHardDriveHotkeys:
334 ; Fall to .PrintRomBootHotkey
335
[88]336;--------------------------------------------------------------------
[92]337; .PrintRomBootHotkey
[88]338; Parameters:
[92]339; CX: Key Attribute
340; DX: Description Attribute
[3]341; Returns:
[88]342; Nothing
[3]343; Corrupts registers:
[120]344; AX, SI, DI
[3]345;--------------------------------------------------------------------
[92]346.PrintRomBootHotkey:
347 mov ax, 'F' | ('8'<<8) ; F8
348 mov si, g_szRomBoot
349 ; Fall to PushHotkeyParamsAndFormat
350
351;--------------------------------------------------------------------
352; PushHotkeyParamsAndFormat
353; Parameters:
354; AL: First character
355; AH: Second character
356; CX: Key Attribute
357; DX: Description Attribute
358; CS:SI: Description string
359; Returns:
360; Nothing
361; Corrupts registers:
[120]362; AX, SI, DI
[92]363;--------------------------------------------------------------------
[3]364ALIGN JUMP_ALIGN
[92]365PushHotkeyParamsAndFormat:
366 push bp
367 mov bp, sp
368
369 push cx ; Key attribute
370 push ax ; First character
371 xchg al, ah
372 push ax ; Second character
373 push dx ; Description attribute
374 push si ; Description string
375 push cx ; Key attribute for last space
376 mov si, g_szHotkey
[241]377
378BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
379 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
[161]380
[182]381
[192]382;--------------------------------------------------------------------
383; BootMenuPrint_InitializeDisplayContext
384; Parameters:
385; Nothing
386; Returns:
387; Nothing
388; Corrupts registers:
389; AX, DI
390;--------------------------------------------------------------------
391ALIGN JUMP_ALIGN
392BootMenuPrint_InitializeDisplayContext:
393 CALL_DISPLAY_LIBRARY InitializeDisplayContext
394 ret
395
396
[241]397;--------------------------------------------------------------------
398; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
399; Parameters:
400; BX:DX:AX: Sector count
401; Returns:
402; Size in stack
403; Corrupts registers:
404; AX, BX, CX, DX, SI
405;--------------------------------------------------------------------
406ALIGN JUMP_ALIGN
407ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
408 pop si ; Pop return address
409 ePUSH_T cx, g_szCapacityNum ; Push format substring
410 call Size_ConvertSectorCountInBXDXAXtoKiB
411 mov cx, BYTE_MULTIPLES.kiB
412 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
413 push ax ; Size in magnitude
414 push cx ; Tenths
415 push dx ; Magnitude character
416 jmp si
417
418
419FloppyTypes:
420.rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size
421.rgbCapacity:
422 db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1
423 db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2
424 db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3
425 db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4
426 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5
427 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6
Note: See TracBrowser for help on using the repository browser.