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

Last change on this file since 319 was 294, checked in by krille_n_@…, 13 years ago

Commit 2/2 (BIOS):

  • Fixed a bug in AH1h_HStatus.asm.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File size: 11.8 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;--------------------------------------------------------------------
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
[294]21
[189]22 push bp
23 mov bp, sp
24
[262]25 call FindDPT_ForDriveNumberInDL
[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
[294]31
[241]32.notOurs:
[294]33 mov si,g_szDriveNum
[241]34 mov bx,g_szForeignHD ; assume a hard disk for the moment
[294]35
36 test dl, dl
[241]37 js .go
38 mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption...
[294]39
[241]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)
[294]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
[294]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:
[294]103 CALL_MENU_LIBRARY ClearInformationArea
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
[262]113 call FindDPT_ForDriveNumberInDL
[259]114
[262]115 inc dl ; are we a hard disk?
116 dec dl ; inc/dec will set SF, without modifying CF or DL
[294]117 js .HardDiskRefreshInformation
[258]118
[262]119 jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above
[241]120 call FloppyDrive_GetType ; Get Floppy Drive type to BX
[258]121 jmp .around
122.ours:
123 call AH8h_GetDriveParameters
[294]124.around:
[182]125
[255]126 mov ax, g_szFddSizeOr ; .PrintXTFloppyType
[294]127 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
[255]128 jz SHORT .PushAXAndOutput
[241]129
[255]130 mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
[3]131 cmp bl, FLOPPY_TYPE_35_ED
[255]132 ja SHORT .PushAXAndOutput
[294]133
[161]134 ; Fall to .PrintKnownFloppyType
[3]135
136;--------------------------------------------------------------------
[161]137; .PrintKnownFloppyType
[3]138; Parameters:
[161]139; BX: Floppy drive type
[3]140; Returns:
[88]141; CF: Set since menu event was handled successfully
[3]142; Corrupts registers:
[161]143; AX, BX, SI, DI
[294]144;
[182]145; Floppy Drive Types:
146;
[294]147; 0 Handled above
[182]148; 1 FLOPPY_TYPE_525_DD 5 1/4 360K
149; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M
150; 3 FLOPPY_TYPE_35_DD 3 1/2 720K
151; 4 FLOPPY_TYPE_35_HD 3 1/2 1.44M
152; 5 3.5" ED on some BIOSes 3 1/2 2.88M
153; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M
154; >6 Unknwon, handled above
[294]155;
[3]156;--------------------------------------------------------------------
[161]157.PrintKnownFloppyType:
[255]158 mov al, (g_szFddSize - $$) & 0xff
159 push ax
[294]160
[255]161 mov al, (g_szFddThreeHalf - $$) & 0xff
[182]162 cmp bl, FLOPPY_TYPE_525_HD
163 ja .ThreeHalf
[255]164 mov al, (g_szFddFiveQuarter - $$) & 0xff
[294]165.ThreeHalf:
[255]166 push ax ; "5 1/4" or "3 1/2"
[3]167
[182]168 mov al,FloppyTypes.rgbCapacityMultiplier
[258]169 mov bh, 0
[182]170 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
[255]171
[294]172.PushAXAndOutput:
[182]173 push ax
[161]174
[258]175.FormatRelay:
176 jmp short BootMenuPrint_FormatCSSIfromParamsInSSBP
[88]177
[192]178
179;--------------------------------------------------------------------
[3]180; Prints Hard Disk Menuitem information strings.
181;
182; BootMenuPrint_HardDiskMenuitemInformation
183; Parameters:
184; DS: RAMVARS segment
185; Returns:
[88]186; CF: Set since menu event was handled successfully
[3]187; Corrupts registers:
188; BX, CX, DX, SI, DI, ES
189;--------------------------------------------------------------------
190ALIGN JUMP_ALIGN
[294]191.HardDiskRefreshInformation:
[262]192 jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
[3]193
[127]194.HardDiskMenuitemInfoForOurDrive:
[262]195 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information
196 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size
[258]197 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
[294]198
[127]199.HardDiskMenuitemInfoForForeignDrive:
200 call DriveXlate_ToOrBack
[150]201 call AH15h_GetSectorCountFromForeignDriveToDXAX
[88]202
[258]203.ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
204 ePUSH_T cx, g_szCapacityNum ; Push format substring
205 call Size_ConvertSectorCountInBXDXAXtoKiB
206 mov cx, BYTE_MULTIPLES.kiB
207 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
208 push ax ; Size in magnitude
209 push cx ; Tenths
[294]210 push dx ; Magnitude character
211
[258]212 test di,di
213 jz short BootMenuPrint_FormatCSSIfromParamsInSSBP
[3]214
[258]215%include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string
216
217;;; fall-through to BootMenuPrint_FormatCSSIfromParamsInSSBP
218
219
[3]220;--------------------------------------------------------------------
[241]221; BootMenuPrint_FormatCSSIfromParamsInSSBP
[88]222; Parameters:
[241]223; CS:SI: Ptr to string to format
224; BP: SP before pushing parameters
[88]225; Returns:
[241]226; BP: Popped from stack
[294]227; CF: Set since menu event was handled successfully
[88]228; Corrupts registers:
[120]229; AX, DI
[88]230;--------------------------------------------------------------------
231ALIGN JUMP_ALIGN
[241]232BootMenuPrint_FormatCSSIfromParamsInSSBP:
233 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
[294]234 stc ; Successful return from menu event
[241]235 pop bp
[88]236 ret
[294]237
238
[88]239;--------------------------------------------------------------------
[192]240; BootMenuPrint_ClearScreen
[88]241; Parameters:
[192]242; Nothing
[88]243; Returns:
[192]244; Nothing
[88]245; Corrupts registers:
[192]246; AX, DI
[88]247;--------------------------------------------------------------------
248ALIGN JUMP_ALIGN
[192]249BootMenuPrint_ClearScreen:
250 call BootMenuPrint_InitializeDisplayContext
251 xor ax, ax
252 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
253 mov ax, ' ' | (MONO_NORMAL<<8)
254 CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
255 ret
[88]256
257
258;--------------------------------------------------------------------
259; BootMenuPrint_TheBottomOfScreen
[3]260; Parameters:
261; DS: RAMVARS segment
262; Returns:
[88]263; Nothing
[3]264; Corrupts registers:
[92]265; AX, BX, CX, DX, SI, DI
[3]266;--------------------------------------------------------------------
267ALIGN JUMP_ALIGN
[88]268BootMenuPrint_TheBottomOfScreen:
[258]269 call FloppyDrive_GetCountToAX
270 xchg bx, ax ; Floppy Drive count to BL
271 call RamVars_GetHardDiskCountFromBDAtoAX
272 mov bh, al ; Hard Disk count to BH
[92]273 ; Fall to .MoveCursorToHotkeyStrings
[3]274
[92]275;--------------------------------------------------------------------
276; .MoveCursorToHotkeyStrings
277; Parameters:
278; Nothing
279; Returns:
280; Nothing
281; Corrupts registers:
282; AX, DI
283;--------------------------------------------------------------------
284.MoveCursorToHotkeyStrings:
285 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
286 xor al, al
287 dec ah
288 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
289 ; Fall to .PrintHotkeyString
[3]290
291;--------------------------------------------------------------------
[92]292; .PrintHotkeyString
[3]293; Parameters:
[92]294; BL: Floppy Drives
295; BH: Hard Drives
[88]296; Returns:
[92]297; Nothing
[88]298; Corrupts registers:
[120]299; AX, CX, DX, SI, DI
[88]300;--------------------------------------------------------------------
[92]301.PrintHotkeyString:
302 ; Display Library should not be called like this
303 mov si, ATTRIBUTE_CHARS.cHighlightedItem
304 call MenuAttribute_GetToAXfromTypeInSI
305 xchg dx, ax
[122]306 mov cx, MONO_BRIGHT
[88]307
[92]308 test bl, bl ; Any Floppy Drives?
309 jz SHORT .SkipFloppyDriveHotkeys
310 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)
311 mov si, g_szFDD
312 call PushHotkeyParamsAndFormat
[88]313
[92]314.SkipFloppyDriveHotkeys:
315 test bh, bh ; Any Hard Drives?
316 jz SHORT .SkipHardDriveHotkeys
[258]317 call BootMenu_GetLetterForFirstHardDiskToAL
318 mov ah, ANGLE_QUOTE_RIGHT
[92]319 mov si, g_szHDD
320 call PushHotkeyParamsAndFormat
321
322.SkipHardDriveHotkeys:
323 ; Fall to .PrintRomBootHotkey
324
[88]325;--------------------------------------------------------------------
[92]326; .PrintRomBootHotkey
[88]327; Parameters:
[92]328; CX: Key Attribute
329; DX: Description Attribute
[3]330; Returns:
[88]331; Nothing
[3]332; Corrupts registers:
[120]333; AX, SI, DI
[3]334;--------------------------------------------------------------------
[92]335.PrintRomBootHotkey:
336 mov ax, 'F' | ('8'<<8) ; F8
337 mov si, g_szRomBoot
338 ; Fall to PushHotkeyParamsAndFormat
339
340;--------------------------------------------------------------------
341; PushHotkeyParamsAndFormat
342; Parameters:
343; AL: First character
344; AH: Second character
345; CX: Key Attribute
346; DX: Description Attribute
347; CS:SI: Description string
348; Returns:
349; Nothing
350; Corrupts registers:
[120]351; AX, SI, DI
[92]352;--------------------------------------------------------------------
[3]353ALIGN JUMP_ALIGN
[92]354PushHotkeyParamsAndFormat:
355 push bp
356 mov bp, sp
357
358 push cx ; Key attribute
359 push ax ; First character
360 xchg al, ah
361 push ax ; Second character
362 push dx ; Description attribute
363 push si ; Description string
364 push cx ; Key attribute for last space
365 mov si, g_szHotkey
[294]366
367BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
[241]368 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
[161]369
[182]370
[192]371;--------------------------------------------------------------------
372; BootMenuPrint_InitializeDisplayContext
373; Parameters:
374; Nothing
375; Returns:
376; Nothing
377; Corrupts registers:
378; AX, DI
379;--------------------------------------------------------------------
380ALIGN JUMP_ALIGN
381BootMenuPrint_InitializeDisplayContext:
382 CALL_DISPLAY_LIBRARY InitializeDisplayContext
383 ret
384
385
[241]386FloppyTypes:
387.rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size
388.rgbCapacity:
389 db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1
390 db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2
391 db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3
392 db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4
393 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5
394 db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6
Note: See TracBrowser for help on using the repository browser.