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

Last change on this file since 371 was 369, checked in by gregli@…, 12 years ago

Removed align directives for initalization code and added define for align in boot-time calls to the assembly library (defaulting to 1), resulting in a significant savings for the AT and 386 builds. Fixed a bug with switch command line handling in the serial server. Put in CR characters in licesnse.txt, so that it properly displays on Windows. In the configurator, added default values for user supplied CHS and LBA values, defaulting to values within range when those features are enabled. Updated the copyright message in the configurator as the literal word Copyright is important.

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