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
|
---|
21 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
34 | BootMenuPrint_RefreshItem:
|
---|
35 | call BootMenu_GetDriveToDXforMenuitemInCX
|
---|
36 | jnc BootMenuEvent_Completed ; if no menu item selected, out we go
|
---|
37 |
|
---|
38 | push bp
|
---|
39 | mov bp, sp
|
---|
40 |
|
---|
41 | call FindDPT_ForDriveNumberInDL
|
---|
42 | jc .notOurs
|
---|
43 |
|
---|
44 | call DriveDetectInfo_ConvertDPTtoBX
|
---|
45 | mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA
|
---|
46 | jmp .go
|
---|
47 |
|
---|
48 | .notOurs:
|
---|
49 | mov si,g_szDriveNum
|
---|
50 | mov bx,g_szForeignHD ; assume a hard disk for the moment
|
---|
51 |
|
---|
52 | test dl, dl
|
---|
53 | js .go
|
---|
54 | mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption...
|
---|
55 |
|
---|
56 | .go:
|
---|
57 | mov ax, dx ; preserve DL for the floppy drive letter addition
|
---|
58 | call DriveXlate_ToOrBack
|
---|
59 | push dx ; translated drive number
|
---|
60 | push bx ; sub string
|
---|
61 | add al, 'A' ; floppy drive letter (we always push this although
|
---|
62 | push ax ; the hard disks don't ever use it, but it does no harm)
|
---|
63 |
|
---|
64 | jmp SHORT BootMenuPrint_RefreshInformation.FormatRelay
|
---|
65 |
|
---|
66 | ;--------------------------------------------------------------------
|
---|
67 | ; Prints Boot Menu title strings.
|
---|
68 | ;
|
---|
69 | ; BootMenuPrint_TitleStrings
|
---|
70 | ; Parameters:
|
---|
71 | ; Nothing
|
---|
72 | ; Returns:
|
---|
73 | ; CF: Set since menu event handled
|
---|
74 | ; Corrupts registers:
|
---|
75 | ; AX, SI, DI
|
---|
76 | ;--------------------------------------------------------------------
|
---|
77 | BootMenuPrint_TitleStrings:
|
---|
78 | xor di,di ; Null character will be eaten
|
---|
79 | mov si, g_szBootMenuTitle
|
---|
80 | jmp DetectPrint_RomFoundAtSegment.BootMenuEntry
|
---|
81 |
|
---|
82 |
|
---|
83 | ;--------------------------------------------------------------------
|
---|
84 | ; BootMenuPrint_RefreshInformation
|
---|
85 | ; Parameters:
|
---|
86 | ; CX: Index of highlighted item
|
---|
87 | ; DS: RAMVARS segment
|
---|
88 | ; Returns:
|
---|
89 | ; CF: Set since menu event was handled successfully
|
---|
90 | ; Corrupts registers:
|
---|
91 | ; Does not matter
|
---|
92 | ;--------------------------------------------------------------------
|
---|
93 | BootMenuPrint_RefreshInformation:
|
---|
94 | CALL_MENU_LIBRARY ClearInformationArea
|
---|
95 |
|
---|
96 | call BootMenu_GetDriveToDXforMenuitemInCX
|
---|
97 | jnc BootMenuEvent_Completed ; if no menu selection, abort
|
---|
98 |
|
---|
99 | push bp
|
---|
100 | mov bp, sp
|
---|
101 |
|
---|
102 | mov si, g_szCapacity ; Setup print string now, carries through to print call
|
---|
103 |
|
---|
104 | call FindDPT_ForDriveNumberInDL
|
---|
105 |
|
---|
106 | inc dl ; are we a hard disk?
|
---|
107 | dec dl ; inc/dec will set SF, without modifying CF or DL
|
---|
108 | js .HardDiskRefreshInformation
|
---|
109 |
|
---|
110 | jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above
|
---|
111 | call FloppyDrive_GetType ; Get Floppy Drive type to BX
|
---|
112 | jmp .around
|
---|
113 | .ours:
|
---|
114 | call AH8h_GetDriveParameters
|
---|
115 | .around:
|
---|
116 |
|
---|
117 | mov ax, g_szFddSizeOr ; .PrintXTFloppyType
|
---|
118 | test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
|
---|
119 | jz SHORT .PushAXAndOutput
|
---|
120 |
|
---|
121 | mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
|
---|
122 | cmp bl, FLOPPY_TYPE_35_ED
|
---|
123 | ja SHORT .PushAXAndOutput
|
---|
124 |
|
---|
125 | ; Fall to .PrintKnownFloppyType
|
---|
126 |
|
---|
127 | ;--------------------------------------------------------------------
|
---|
128 | ; .PrintKnownFloppyType
|
---|
129 | ; Parameters:
|
---|
130 | ; BX: Floppy drive type
|
---|
131 | ; Returns:
|
---|
132 | ; CF: Set since menu event was handled successfully
|
---|
133 | ; Corrupts registers:
|
---|
134 | ; AX, BX, SI, DI
|
---|
135 | ;
|
---|
136 | ; Floppy Drive Types:
|
---|
137 | ;
|
---|
138 | ; 0 Handled above
|
---|
139 | ; 1 FLOPPY_TYPE_525_DD 5 1/4 360K
|
---|
140 | ; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M
|
---|
141 | ; 3 FLOPPY_TYPE_35_DD 3 1/2 720K
|
---|
142 | ; 4 FLOPPY_TYPE_35_HD 3 1/2 1.44M
|
---|
143 | ; 5 3.5" ED on some BIOSes 3 1/2 2.88M
|
---|
144 | ; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M
|
---|
145 | ; >6 Unknown, handled above
|
---|
146 | ;
|
---|
147 | ;--------------------------------------------------------------------
|
---|
148 | .PrintKnownFloppyType:
|
---|
149 | mov al, (g_szFddSize - $$) & 0xff
|
---|
150 | push ax
|
---|
151 |
|
---|
152 | mov al, (g_szFddThreeHalf - $$) & 0xff
|
---|
153 | cmp bl, FLOPPY_TYPE_525_HD
|
---|
154 | ja .ThreeHalf
|
---|
155 | mov al, (g_szFddFiveQuarter - $$) & 0xff
|
---|
156 | .ThreeHalf:
|
---|
157 | push ax ; "5 1/4" or "3 1/2"
|
---|
158 |
|
---|
159 | xor bh, bh
|
---|
160 | mov al,FloppyTypes.rgbCapacityMultiplier
|
---|
161 | mul BYTE [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
|
---|
162 |
|
---|
163 | .PushAXAndOutput:
|
---|
164 | push ax
|
---|
165 |
|
---|
166 | .FormatRelay:
|
---|
167 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
168 |
|
---|
169 |
|
---|
170 | ;--------------------------------------------------------------------
|
---|
171 | ; Prints Hard Disk Menuitem information strings.
|
---|
172 | ;
|
---|
173 | ; BootMenuPrint_HardDiskMenuitemInformation
|
---|
174 | ; Parameters:
|
---|
175 | ; DS: RAMVARS segment
|
---|
176 | ; Returns:
|
---|
177 | ; CF: Set since menu event was handled successfully
|
---|
178 | ; Corrupts registers:
|
---|
179 | ; BX, CX, DX, SI, DI, ES
|
---|
180 | ;--------------------------------------------------------------------
|
---|
181 | .HardDiskRefreshInformation:
|
---|
182 | jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
|
---|
183 |
|
---|
184 | .HardDiskMenuitemInfoForOurDrive:
|
---|
185 | ePUSH_T ax, g_szInformation ; Add substring for our hard disk information
|
---|
186 | call GetTotalSectorCount
|
---|
187 | jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
|
---|
188 |
|
---|
189 | .HardDiskMenuitemInfoForForeignDrive:
|
---|
190 | call DriveXlate_ToOrBack
|
---|
191 | call AH15h_GetSectorCountFromForeignDriveToDXAX
|
---|
192 |
|
---|
193 | .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
|
---|
194 | ePUSH_T cx, g_szCapacityNum ; Push format substring
|
---|
195 | call Size_ConvertSectorCountInBXDXAXtoKiB
|
---|
196 | mov cx, BYTE_MULTIPLES.kiB
|
---|
197 | call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
|
---|
198 | push ax ; Size in magnitude
|
---|
199 | push cx ; Tenths
|
---|
200 | push dx ; Magnitude character
|
---|
201 |
|
---|
202 | test di, di ; Zero if foreign drive
|
---|
203 | jz SHORT BootMenuPrint_RefreshInformation.FormatRelay
|
---|
204 |
|
---|
205 | %include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string
|
---|
206 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
207 |
|
---|
208 |
|
---|
209 | FloppyTypes:
|
---|
210 | .rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size
|
---|
211 | .rgbCapacity:
|
---|
212 | db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1
|
---|
213 | db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2
|
---|
214 | db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3
|
---|
215 | db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4
|
---|
216 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5
|
---|
217 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6
|
---|
218 |
|
---|
219 |
|
---|
220 | ;--------------------------------------------------------------------
|
---|
221 | ; GetTotalSectorCount
|
---|
222 | ; Parameters:
|
---|
223 | ; DS:DI: DPT Pointer
|
---|
224 | ; Returns:
|
---|
225 | ; BX:DX:AX: 48-bit sector count
|
---|
226 | ; Corrupts registers:
|
---|
227 | ; CX
|
---|
228 | ;--------------------------------------------------------------------
|
---|
229 | %ifdef MODULE_EBIOS
|
---|
230 | GetTotalSectorCount EQU AccessDPT_GetLbaSectorCountToBXDXAX
|
---|
231 | %else
|
---|
232 | GetTotalSectorCount EQU AH15h_GetSectorCountToBXDXAX
|
---|
233 | %endif
|
---|