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

Last change on this file since 122 was 122, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • Bottom info now appears but menu does not.
File size: 13.1 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; Prints Boot Menu title strings.
9;
10; BootMenuPrint_TitleStrings
11;   Parameters:
12;       Nothing
13;   Returns:
14;       CF:     Set since menu event handled
15;   Corrupts registers:
16;       AX, SI, DI
17;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19BootMenuPrint_TitleStrings:
20    mov     si, ROMVARS.szTitle
21    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
22    CALL_DISPLAY_LIBRARY PrintNewlineCharacters
23    mov     si, ROMVARS.szVersion
24    jmp     BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
25
26
27;--------------------------------------------------------------------
28; BootMenuPrint_ClearScreen
29;   Parameters:
30;       Nothing
31;   Returns:
32;       Nothing
33;   Corrupts registers:
34;       AX, DI
35;--------------------------------------------------------------------
36ALIGN JUMP_ALIGN
37BootMenuPrint_ClearScreen:
38    mov     ax, ' ' | (MONO_NORMAL<<8)
39    CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH
40    ret
41
42
43;--------------------------------------------------------------------
44; BootMenuPrint_FloppyMenuitem
45;   Parameters:
46;       DL:     Untranslated Floppy Drive number
47;   Returns:
48;       Nothing
49;   Corrupts registers:
50;       AX, DX, SI, DI
51;--------------------------------------------------------------------
52ALIGN JUMP_ALIGN
53BootMenuPrint_FloppyMenuitem:
54    push    bp
55
56    mov     bp, sp
57    mov     si, g_szFDLetter
58    ePUSH_T ax, g_szFloppyDrv
59    add     dl, 'A'
60    push    dx                  ; Drive letter
61    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
62
63
64;--------------------------------------------------------------------
65; BootMenuPrint_HardDiskMenuitem
66;   Parameters:
67;       DL:     Untranslated Hard Disk number
68;       DS:     RAMVARS segment
69;   Returns:
70;       CF:     Set since menu event handled
71;   Corrupts registers:
72;       AX, BX, SI, DI
73;--------------------------------------------------------------------
74ALIGN JUMP_ALIGN
75BootMenuPrint_HardDiskMenuitem:
76    call    FindDPT_ForDriveNumber      ; DS:DI to point DPT
77    jnc     SHORT .HardDiskMenuitemForForeignDrive
78    ; Fall to .HardDiskMenuitemForOurDrive
79
80;--------------------------------------------------------------------
81; .HardDiskMenuitemForOurDrive
82;   Parameters:
83;       DL:     Untranslated Hard Disk number
84;       DS:     RAMVARS segment
85;   Returns:
86;       CF:     Set since menu event handled
87;   Corrupts registers:
88;       AX, BX, SI, DI
89;--------------------------------------------------------------------
90;ALIGN JUMP_ALIGN
91.HardDiskMenuitemForOurDrive:
92    call    BootInfo_GetOffsetToBX
93    lea     si, [bx+BOOTNFO.szDrvName]
94    xor     bx, bx          ; BDA segment
95    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromBXSI
96    stc
97    ret
98
99;--------------------------------------------------------------------
100; BootMenuPrint_HardDiskMenuitemForForeignDrive
101;   Parameters:
102;       DL:     Untranslated Hard Disk number
103;       DS:     RAMVARS segment
104;   Returns:
105;       CF:     Set since menu event handled
106;   Corrupts registers:
107;       AX, SI, DI
108;--------------------------------------------------------------------
109ALIGN JUMP_ALIGN
110.HardDiskMenuitemForForeignDrive:
111    mov     si, g_szforeignHD
112    jmp     BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
113
114
115;--------------------------------------------------------------------
116; BootMenuPrint_FloppyMenuitemInformation
117;   Parameters:
118;       DL:     Untranslated Floppy Drive number
119;       DS:     RAMVARS segment
120;   Returns:
121;       CF:     Set since menu event was handled successfully
122;   Corrupts registers:
123;       AX, BX, CX, DX, SI, DI, ES
124;--------------------------------------------------------------------
125ALIGN JUMP_ALIGN
126BootMenuPrint_FloppyMenuitemInformation:
127    call    BootMenuPrint_ClearInformationArea
128    call    FloppyDrive_GetType         ; Get Floppy Drive type to BX
129    test    bx, bx                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
130    jz      SHORT .PrintXTFloppyType
131    cmp     bl, FLOPPY_TYPE_35_ED
132    ja      SHORT .PrintUnknownFloppyType
133    jmp     SHORT .PrintKnownFloppyType
134
135;--------------------------------------------------------------------
136; .PrintXTFloppyType
137;   Parameters:
138;       Nothing
139;   Returns:
140;       CF:     Set since menu event was handled successfully
141;   Corrupts registers:
142;       AX, SI, DI
143;--------------------------------------------------------------------
144ALIGN JUMP_ALIGN
145.PrintXTFloppyType:
146    push    bp
147    mov     si, g_szFddSizeOr
148    jmp     SHORT .FormatXTorUnknownTypeFloppyDrive
149
150;--------------------------------------------------------------------
151; .PrintUnknownFloppyType
152;   Parameters:
153;       Nothing
154;   Returns:
155;       CF:     Set since menu event was handled successfully
156;   Corrupts registers:
157;       AX, SI, DI
158;--------------------------------------------------------------------
159ALIGN JUMP_ALIGN
160.PrintUnknownFloppyType:
161    push    bp
162    mov     si, g_szFddUnknown
163.FormatXTorUnknownTypeFloppyDrive:
164    mov     bp, sp
165    ePUSH_T ax, g_szCapacity
166    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
167
168;--------------------------------------------------------------------
169; .PrintKnownFloppyType
170;   Parameters:
171;       BX:     Floppy drive type
172;   Returns:
173;       CF:     Set since menu event was handled successfully
174;   Corrupts registers:
175;       AX, BX, SI, DI
176;--------------------------------------------------------------------
177ALIGN JUMP_ALIGN
178.PrintKnownFloppyType:
179    push    bp
180
181    mov     bp, sp
182    mov     si, g_szFddSize
183    ePUSH_T ax, g_szCapacity
184    dec     bx                      ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD)
185    shl     bx, 1                   ; Shift for WORD lookup
186    mov     ax, [cs:bx+.rgwPhysicalSize]
187    push    ax                      ; '5' or '3'
188    mov     al, ah
189    push    ax                      ; '1/4' or '1/2'
190    push    WORD [cs:bx+.rgwCapacity]
191    jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
192
193ALIGN WORD_ALIGN
194.rgwCapacity:
195    dw      360
196    dw      1200
197    dw      720
198    dw      1440
199    dw      2880
200    dw      2880
201.rgwPhysicalSize:
202    db      '5', 172    ; 1, FLOPPY_TYPE_525_DD
203    db      '5', 172    ; 2, FLOPPY_TYPE_525_HD
204    db      '3', 171    ; 3, FLOPPY_TYPE_35_DD
205    db      '3', 171    ; 4, FLOPPY_TYPE_35_HD
206    db      '3', 171    ; 5, 3.5" ED on some BIOSes
207    db      '3', 171    ; 6, FLOPPY_TYPE_35_ED
208
209
210;--------------------------------------------------------------------
211; Prints Hard Disk Menuitem information strings.
212;
213; BootMenuPrint_HardDiskMenuitemInformation
214;   Parameters:
215;       DL:     Untranslated Hard Disk number
216;       DS:     RAMVARS segment
217;   Returns:
218;       CF:     Set since menu event was handled successfully
219;   Corrupts registers:
220;       BX, CX, DX, SI, DI, ES
221;--------------------------------------------------------------------
222ALIGN JUMP_ALIGN
223BootMenuPrint_HardDiskMenuitemInformation:
224    call    FindDPT_ForDriveNumber      ; DS:DI to point DPT
225    jnc     SHORT .HardDiskMenuitemInfoForForeignDrive
226    call    .HardDiskMenuitemInfoSizeForOurDrive
227    jmp     BootMenuPrintCfg_ForOurDrive
228
229;--------------------------------------------------------------------
230; .HardDiskMenuitemInfoForForeignDrive
231;   Parameters:
232;       DL:     Untranslated Hard Disk number
233;       DS:     RAMVARS segment
234;   Returns:
235;       CF:     Set since menu event was handled successfully
236;   Corrupts registers:
237;       AX, BX, CX, DX, SI, DI
238;--------------------------------------------------------------------
239ALIGN JUMP_ALIGN
240.HardDiskMenuitemInfoForForeignDrive:
241    push    bp
242    mov     bp, sp
243    ePUSH_T ax, g_szCapacity
244
245    call    DriveXlate_ToOrBack
246    call    HCapacity_GetSectorCountFromForeignAH08h
247    call    ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
248
249    mov     si, g_szSizeSingle
250    jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
251
252;--------------------------------------------------------------------
253; .HardDiskMenuitemInfoSizeForOurDrive
254;   Parameters:
255;       DL:     Untranslated Hard Disk number
256;       DS:DI:  Ptr to DPT
257;   Returns:
258;       Nothing
259;   Corrupts registers:
260;       AX, BX, CX, DX, SI, ES
261;--------------------------------------------------------------------
262ALIGN JUMP_ALIGN
263.HardDiskMenuitemInfoSizeForOurDrive:
264    push    bp
265    mov     bp, sp
266    ePUSH_T ax, g_szCapacity
267
268    ; Get and push L-CHS size
269    call    HCapacity_GetSectorCountFromOurAH08h
270    call    ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
271
272    ; Get and push total LBA size
273    call    BootInfo_GetTotalSectorCount
274    call    ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
275
276    mov     si, g_szSizeDual
277    ; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP
278
279
280;--------------------------------------------------------------------
281; BootMenuPrint_FormatCSSIfromParamsInSSBP
282;   Parameters:
283;       CS:SI:  Ptr to string to format
284;       BP:     SP before pushing parameters
285;   Returns:
286;       BP:     Popped from stack
287;   Corrupts registers:
288;       AX, DI
289;--------------------------------------------------------------------
290ALIGN JUMP_ALIGN
291BootMenuPrint_FormatCSSIfromParamsInSSBP:
292    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
293    stc             ; Successfull return from menu event
294    pop     bp
295    ret
296
297
298;--------------------------------------------------------------------
299; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
300;   Parameters:
301;       BX:DX:AX:   Sector count
302;   Returns:
303;       Size in stack
304;   Corrupts registers:
305;       AX, BX, CX, DX, SI
306;--------------------------------------------------------------------
307ALIGN JUMP_ALIGN
308ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
309    pop     si      ; Pop return address
310    call    Size_ConvertSectorCountInBXDXAXtoKiB
311    mov     cx, BYTE_MULTIPLES.kiB
312    call    Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
313    push    ax      ; Size in magnitude
314    push    cx      ; Tenths
315    push    dx      ; Magnitude character
316    jmp     si
317
318
319;--------------------------------------------------------------------
320; BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
321;   Parameters:
322;       CS:SI:  Ptr to NULL terminated string to print
323;   Returns:
324;       CF:     Set since menu event was handled successfully
325;   Corrupts registers:
326;       AX
327;--------------------------------------------------------------------
328ALIGN JUMP_ALIGN
329BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
330    push    di
331    CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
332    pop     di
333    stc
334    ret
335
336
337;--------------------------------------------------------------------
338; BootMenuPrint_ClearInformationArea
339;   Parameters:
340;       Nothing
341;   Returns:
342;       CF:     Set
343;   Corrupts registers:
344;       AX, DI
345;--------------------------------------------------------------------
346ALIGN JUMP_ALIGN
347BootMenuPrint_ClearInformationArea:
348    CALL_MENU_LIBRARY ClearInformationArea
349    stc
350    ret
351
352
353;--------------------------------------------------------------------
354; BootMenuPrint_TheBottomOfScreen
355;   Parameters:
356;       DS:     RAMVARS segment
357;   Returns:
358;       Nothing
359;   Corrupts registers:
360;       AX, BX, CX, DX, SI, DI
361;--------------------------------------------------------------------
362ALIGN JUMP_ALIGN
363BootMenuPrint_TheBottomOfScreen:
364    call    FloppyDrive_GetCount
365    mov     bl, cl                  ; Floppy Drive count to BL
366    call    RamVars_GetHardDiskCountFromBDAtoCX
367    mov     bh, cl                  ; Hard Disk count to BH
368    ; Fall to .MoveCursorToHotkeyStrings
369
370;--------------------------------------------------------------------
371; .MoveCursorToHotkeyStrings
372;   Parameters:
373;       Nothing
374;   Returns:
375;       Nothing
376;   Corrupts registers:
377;       AX, DI
378;--------------------------------------------------------------------
379.MoveCursorToHotkeyStrings:
380    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
381    xor     al, al
382    dec     ah
383    CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX
384    ; Fall to .PrintHotkeyString
385
386;--------------------------------------------------------------------
387; .PrintHotkeyString
388;   Parameters:
389;       BL:     Floppy Drives
390;       BH:     Hard Drives
391;   Returns:
392;       Nothing
393;   Corrupts registers:
394;       AX, CX, DX, SI, DI
395;--------------------------------------------------------------------
396.PrintHotkeyString:
397    ; Display Library should not be called like this
398    mov     si, ATTRIBUTE_CHARS.cHighlightedItem
399    call    MenuAttribute_GetToAXfromTypeInSI
400    xchg    dx, ax
401    mov     cx, MONO_BRIGHT
402
403    test    bl, bl      ; Any Floppy Drives?
404    jz      SHORT .SkipFloppyDriveHotkeys
405    mov     ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)
406    mov     si, g_szFDD
407    call    PushHotkeyParamsAndFormat
408
409.SkipFloppyDriveHotkeys:
410    test    bh, bh      ; Any Hard Drives?
411    jz      SHORT .SkipHardDriveHotkeys
412    xchg    ax, cx      ; Store Key Attribute
413    call    BootMenu_GetLetterForFirstHardDiskToCL
414    mov     ch, ANGLE_QUOTE_RIGHT
415    xchg    ax, cx
416    mov     si, g_szHDD
417    call    PushHotkeyParamsAndFormat
418
419.SkipHardDriveHotkeys:
420    ; Fall to .PrintRomBootHotkey
421
422;--------------------------------------------------------------------
423; .PrintRomBootHotkey
424;   Parameters:
425;       CX:     Key Attribute
426;       DX:     Description Attribute
427;   Returns:
428;       Nothing
429;   Corrupts registers:
430;       AX, SI, DI
431;--------------------------------------------------------------------
432.PrintRomBootHotkey:
433    mov     ax, 'F' | ('8'<<8)      ; F8
434    mov     si, g_szRomBoot
435    ; Fall to PushHotkeyParamsAndFormat
436
437;--------------------------------------------------------------------
438; PushHotkeyParamsAndFormat
439;   Parameters:
440;       AL:     First character
441;       AH:     Second character
442;       CX:     Key Attribute
443;       DX:     Description Attribute
444;       CS:SI:  Description string
445;   Returns:
446;       Nothing
447;   Corrupts registers:
448;       AX, SI, DI
449;--------------------------------------------------------------------
450ALIGN JUMP_ALIGN
451PushHotkeyParamsAndFormat:
452    push    bp
453    mov     bp, sp
454
455    push    cx          ; Key attribute
456    push    ax          ; First character
457    xchg    al, ah
458    push    ax          ; Second character
459    push    dx          ; Description attribute
460    push    si          ; Description string
461    push    cx          ; Key attribute for last space
462    mov     si, g_szHotkey
463    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
Note: See TracBrowser for help on using the repository browser.