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

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

For function int13/0h, restored the code to only reset the floppy drives if a floppy drive was passed in for reset. Other minor optimizations. Better create new floppy support in Serial Server.

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