source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrint.asm @ 492

Last change on this file since 492 was 492, checked in by gregli@…, 11 years ago

Removed the dependency between MODULE_BOOT_MENU and MODULE_HOTKEYS. With these changes, 0, 1, or 2 of them can be included in a build. This change also means that the hotkeys don't work while the menu is up. But the most important hotkey there was for Rom Boot, and that has been added to the menu as a choice proper. Lots of changes across the board in the hotkeys code - even if we eventually back this change out (becaue, for example we want hotkeys to work in the menu) we should probably start from this base and add that functionality back in, as these changes results in approximately 120 bytes of savings and includes new functionality, such as the Rom Boot menu item and the Com Detect hotkey.

File size: 7.7 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Functions for printing boot menu strings.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; BootMenuPrint_RefreshItem
25;
26;   Parameters:
27;       CX:     Index of highlighted item
28;       DS:     RAMVARS segment
29;   Returns:
30;       Nothing
31;   Corrupts registers:
32;       Does not matter
33;--------------------------------------------------------------------
34BootMenuPrint_RefreshItem:
35    push    bp
36    mov     bp, sp
37
38    call    BootMenu_GetDriveToDXforMenuitemInCX
39    mov     si, g_szRomBootDash                     ; Standard "Rom Boot" but with a "-" at the front
40    mov     al, 20h                                 ; The space between "Rom" and "Boot"
41    jnc     .ROMBoot                                ; display "Rom Boot" option for last entry
42
43    call    FindDPT_ForDriveNumberInDL
44    jc      .notOurs
45
46    call    DriveDetectInfo_ConvertDPTtoBX
47    mov     si, g_szDriveNumBOOTNFO                 ; special g_szDriveNum that prints from BDA
48    jmp     .go
49
50.notOurs:
51    mov     si,g_szDriveNum
52    mov     bx,g_szForeignHD                        ; assume a hard disk for the moment
53
54    test    dl, dl
55    js      .go
56    mov     bl,((g_szFloppyDrv)-$$ & 0xff)          ; and revisit the earlier assumption...
57
58.go:
59    mov     ax, dx                                  ; preserve DL for the floppy drive letter addition
60    call    DriveXlate_ToOrBack
61
62    test    dl, 0f0h                                ; if there is a character in the upper nibble
63    jnz     .noSpace
64    dec     si                                      ; backup a character to a leading space
65.noSpace:
66
67    push    dx                                      ; translated drive number
68    push    bx                                      ; sub string
69    add     al, 'A'                                 ; floppy drive letter (we always push this although
70                                                    ; the hard disks don't ever use it, but it does no harm)
71.ROMBoot:       
72    push    ax                                     
73
74    jmp     SHORT BootMenuPrint_RefreshInformation.FormatRelay
75
76;--------------------------------------------------------------------
77; Prints Boot Menu title strings.
78;
79; BootMenuPrint_TitleStrings
80;   Parameters:
81;       Nothing
82;   Returns:
83;       CF:     Set since menu event handled
84;   Corrupts registers:
85;       AX, SI, DI
86;--------------------------------------------------------------------
87BootMenuPrint_TitleStrings:
88    xor     di,di                       ; Null character will be eaten
89    mov     si, g_szBootMenuTitle
90    jmp     DetectPrint_RomFoundAtSegment.BootMenuEntry
91
92
93;--------------------------------------------------------------------
94; BootMenuPrint_RefreshInformation
95;   Parameters:
96;       CX:     Index of highlighted item
97;       DS:     RAMVARS segment
98;   Returns:
99;       CF:     Set since menu event was handled successfully
100;   Corrupts registers:
101;       Does not matter
102;--------------------------------------------------------------------
103BootMenuPrint_RefreshInformation:
104    CALL_MENU_LIBRARY ClearInformationArea
105
106    call    BootMenu_GetDriveToDXforMenuitemInCX
107    jnc     BootMenuEvent_Completed                     ; nothing to display if "Rom Boot" option
108
109    push    bp
110    mov     bp, sp
111
112    mov     si, g_szCapacity                            ; Setup print string now, carries through to print call
113
114    call    FindDPT_ForDriveNumberInDL
115
116    inc     dl                                          ; are we a hard disk?
117    dec     dl                                          ; inc/dec will set SF, without modifying CF or DL
118    js      .HardDiskRefreshInformation
119
120    jnc     .ours                                       ; Based on CF from FindDPT_ForDriveNumberInDL 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 Unknown, 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    xor     bh, bh
170    mov     al,FloppyTypes.rgbCapacityMultiplier
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     DetectPrint_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;--------------------------------------------------------------------
191.HardDiskRefreshInformation:
192    jc      .HardDiskMenuitemInfoForForeignDrive        ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
193
194.HardDiskMenuitemInfoForOurDrive:
195    ePUSH_T ax, g_szInformation                         ; Add substring for our hard disk information
196    call    GetTotalSectorCount
197    jmp     .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
198
199.HardDiskMenuitemInfoForForeignDrive:
200    call    DriveXlate_ToOrBack
201    call    AH15h_GetSectorCountFromForeignDriveToDXAX
202
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
210    push    dx                      ; Magnitude character
211
212    test    di, di                  ; Zero if foreign drive
213    jz      SHORT BootMenuPrint_RefreshInformation.FormatRelay
214
215%include "BootMenuPrintCfg.asm"     ; Inline of code to fill out remainder of information string
216    jmp     DetectPrint_FormatCSSIfromParamsInSSBP
217
218
219FloppyTypes:
220.rgbCapacityMultiplier equ 120      ; Multiplier to reduce word sized values to byte size
221.rgbCapacity:
222    db      360   / FloppyTypes.rgbCapacityMultiplier    ;  type 1
223    db      1200  / FloppyTypes.rgbCapacityMultiplier    ;  type 2
224    db      720   / FloppyTypes.rgbCapacityMultiplier    ;  type 3
225    db      1440  / FloppyTypes.rgbCapacityMultiplier    ;  type 4
226    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 5
227    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 6
228
229
230;--------------------------------------------------------------------
231; GetTotalSectorCount
232;   Parameters:
233;       DS:DI:      DPT Pointer
234;   Returns:
235;       BX:DX:AX:   48-bit sector count
236;   Corrupts registers:
237;       CX
238;--------------------------------------------------------------------
239%ifdef MODULE_EBIOS
240GetTotalSectorCount     EQU     AccessDPT_GetLbaSectorCountToBXDXAX
241%else
242GetTotalSectorCount     EQU     AH15h_GetSectorCountToBXDXAX
243%endif
Note: See TracBrowser for help on using the repository browser.