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

Last change on this file since 261 was 259, checked in by gregli@…, 13 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
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for printing boot menu strings.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; BootMenuPrint_RefreshItem
9;
10; Parameters:
11; DL: Untranslated Floppy Drive number
12; Returns:
13; Nothing
14; Corrupts registers:
15; AX, BX, DX, SI, DI
16;--------------------------------------------------------------------
17ALIGN JUMP_ALIGN
18BootMenuPrint_RefreshItem:
19 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
20 jnc BootMenuEvent_EventCompleted ; if no menu item selected, out we go
21
22 push bp
23 mov bp, sp
24
25 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber
26 jc .notOurs
27
28 call BootMenuInfo_ConvertDPTtoBX
29 mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA
30 jmp .go
31
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
48 jmp short BootMenuPrint_RefreshInformation.FormatRelay
49
50;--------------------------------------------------------------------
51; Prints Boot Menu title strings.
52;
53; BootMenuPrint_TitleStrings
54; Parameters:
55; Nothing
56; Returns:
57; CF: Set since menu event handled
58; Corrupts registers:
59; AX, SI, DI
60;--------------------------------------------------------------------
61ALIGN JUMP_ALIGN
62BootMenuPrint_TitleStrings:
63 mov si, ROMVARS.szTitle
64 call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
65 CALL_DISPLAY_LIBRARY PrintNewlineCharacters
66 mov si, ROMVARS.szVersion
67 ; Fall to BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
68
69;--------------------------------------------------------------------
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:
76; AX, DI
77;--------------------------------------------------------------------
78ALIGN JUMP_ALIGN
79BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
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
88 jmp short BootMenuPrint_RefreshInformation.FormatRelay
89
90
91;--------------------------------------------------------------------
92; BootMenuPrint_FloppyMenuitemInformation
93; Parameters:
94; DL: Untranslated Floppy Drive number
95; DS: RAMVARS segment
96; Returns:
97; CF: Set since menu event was handled successfully
98; Corrupts registers:
99; AX, BX, CX, DX, SI, DI, ES
100;--------------------------------------------------------------------
101ALIGN JUMP_ALIGN
102BootMenuPrint_RefreshInformation:
103 CALL_MENU_LIBRARY ClearInformationArea
104
105 call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS
106 jnc BootMenuEvent_EventCompleted ; if no menu selection, abort
107
108 push bp
109 mov bp, sp
110
111 mov si, g_szCapacity ; Setup print string now, carries through to print call
112
113 xor di, di ; Zero DI for checks for our drive later on
114 call RamVars_IsDriveHandledByThisBIOS_And_FindDPT_ForDriveNumber
115
116 test dl, dl ; are we a hard disk?
117 js BootMenuPrint_HardDiskRefreshInformation
118
119 test di, di
120 jnz .ours ; Based on CF from RamVars_IsDriveHandledByThisBIOS above
121 call FloppyDrive_GetType ; Get Floppy Drive type to BX
122 jmp .around
123.ours:
124 call AH8h_GetDriveParameters
125.around:
126
127 mov ax, g_szFddSizeOr ; .PrintXTFloppyType
128 test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
129 jz SHORT .PushAXAndOutput
130
131 mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
132 cmp bl, FLOPPY_TYPE_35_ED
133 ja SHORT .PushAXAndOutput
134
135 ; Fall to .PrintKnownFloppyType
136
137;--------------------------------------------------------------------
138; .PrintKnownFloppyType
139; Parameters:
140; BX: Floppy drive type
141; Returns:
142; CF: Set since menu event was handled successfully
143; Corrupts registers:
144; AX, BX, SI, DI
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;
157;--------------------------------------------------------------------
158.PrintKnownFloppyType:
159 mov al, (g_szFddSize - $$) & 0xff
160 push ax
161
162 mov al, (g_szFddThreeHalf - $$) & 0xff
163 cmp bl, FLOPPY_TYPE_525_HD
164 ja .ThreeHalf
165 mov al, (g_szFddFiveQuarter - $$) & 0xff
166.ThreeHalf:
167 push ax ; "5 1/4" or "3 1/2"
168
169 mov al,FloppyTypes.rgbCapacityMultiplier
170 mov bh, 0
171 mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
172
173.PushAXAndOutput:
174 push ax
175
176.FormatRelay:
177 jmp short BootMenuPrint_FormatCSSIfromParamsInSSBP
178
179
180;--------------------------------------------------------------------
181; Prints Hard Disk Menuitem information strings.
182;
183; BootMenuPrint_HardDiskMenuitemInformation
184; Parameters:
185; DS: RAMVARS segment
186; Returns:
187; CF: Set since menu event was handled successfully
188; Corrupts registers:
189; BX, CX, DX, SI, DI, ES
190;--------------------------------------------------------------------
191ALIGN JUMP_ALIGN
192BootMenuPrint_HardDiskRefreshInformation:
193 test di, di
194 jz .HardDiskMenuitemInfoForForeignDrive
195
196.HardDiskMenuitemInfoForOurDrive:
197 ePUSH_T ax, g_szInformation ; Add substring for our hard disk information
198 call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size
199 jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
200
201.HardDiskMenuitemInfoForForeignDrive:
202 call DriveXlate_ToOrBack
203 call AH15h_GetSectorCountFromForeignDriveToDXAX
204
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
216
217%include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string
218
219;;; fall-through to BootMenuPrint_FormatCSSIfromParamsInSSBP
220
221
222;--------------------------------------------------------------------
223; BootMenuPrint_FormatCSSIfromParamsInSSBP
224; Parameters:
225; CS:SI: Ptr to string to format
226; BP: SP before pushing parameters
227; Returns:
228; BP: Popped from stack
229; CF: Set since menu event was handled successfully
230; Corrupts registers:
231; AX, DI
232;--------------------------------------------------------------------
233ALIGN JUMP_ALIGN
234BootMenuPrint_FormatCSSIfromParamsInSSBP:
235 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
236 stc ; Successfull return from menu event
237 pop bp
238 ret
239
240
241;--------------------------------------------------------------------
242; BootMenuPrint_ClearScreen
243; Parameters:
244; Nothing
245; Returns:
246; Nothing
247; Corrupts registers:
248; AX, DI
249;--------------------------------------------------------------------
250ALIGN JUMP_ALIGN
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
258
259
260;--------------------------------------------------------------------
261; BootMenuPrint_TheBottomOfScreen
262; Parameters:
263; DS: RAMVARS segment
264; Returns:
265; Nothing
266; Corrupts registers:
267; AX, BX, CX, DX, SI, DI
268;--------------------------------------------------------------------
269ALIGN JUMP_ALIGN
270BootMenuPrint_TheBottomOfScreen:
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
275 ; Fall to .MoveCursorToHotkeyStrings
276
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
292
293;--------------------------------------------------------------------
294; .PrintHotkeyString
295; Parameters:
296; BL: Floppy Drives
297; BH: Hard Drives
298; Returns:
299; Nothing
300; Corrupts registers:
301; AX, CX, DX, SI, DI
302;--------------------------------------------------------------------
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
308 mov cx, MONO_BRIGHT
309
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
315
316.SkipFloppyDriveHotkeys:
317 test bh, bh ; Any Hard Drives?
318 jz SHORT .SkipHardDriveHotkeys
319 call BootMenu_GetLetterForFirstHardDiskToAL
320 mov ah, ANGLE_QUOTE_RIGHT
321 mov si, g_szHDD
322 call PushHotkeyParamsAndFormat
323
324.SkipHardDriveHotkeys:
325 ; Fall to .PrintRomBootHotkey
326
327;--------------------------------------------------------------------
328; .PrintRomBootHotkey
329; Parameters:
330; CX: Key Attribute
331; DX: Description Attribute
332; Returns:
333; Nothing
334; Corrupts registers:
335; AX, SI, DI
336;--------------------------------------------------------------------
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:
353; AX, SI, DI
354;--------------------------------------------------------------------
355ALIGN JUMP_ALIGN
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
368
369BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay:
370 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
371
372
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
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.