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 BootMenuInfo_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 | mov si, ROMVARS.szTitle
|
---|
79 | call DetectPrint_NullTerminatedStringFromCSSIandSetCF
|
---|
80 | CALL_DISPLAY_LIBRARY PrintNewlineCharacters
|
---|
81 | mov si, ROMVARS.szVersion
|
---|
82 | jmp DetectPrint_NullTerminatedStringFromCSSIandSetCF
|
---|
83 |
|
---|
84 |
|
---|
85 | ;--------------------------------------------------------------------
|
---|
86 | ; BootMenuPrint_RefreshInformation
|
---|
87 | ; Parameters:
|
---|
88 | ; CX: Index of highlighted item
|
---|
89 | ; DS: RAMVARS segment
|
---|
90 | ; Returns:
|
---|
91 | ; CF: Set since menu event was handled successfully
|
---|
92 | ; Corrupts registers:
|
---|
93 | ; Does not matter
|
---|
94 | ;--------------------------------------------------------------------
|
---|
95 | BootMenuPrint_RefreshInformation:
|
---|
96 | CALL_MENU_LIBRARY ClearInformationArea
|
---|
97 |
|
---|
98 | call BootMenu_GetDriveToDXforMenuitemInCX
|
---|
99 | jnc BootMenuEvent_Completed ; if no menu selection, abort
|
---|
100 |
|
---|
101 | push bp
|
---|
102 | mov bp, sp
|
---|
103 |
|
---|
104 | mov si, g_szCapacity ; Setup print string now, carries through to print call
|
---|
105 |
|
---|
106 | call FindDPT_ForDriveNumberInDL
|
---|
107 |
|
---|
108 | inc dl ; are we a hard disk?
|
---|
109 | dec dl ; inc/dec will set SF, without modifying CF or DL
|
---|
110 | js .HardDiskRefreshInformation
|
---|
111 |
|
---|
112 | jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above
|
---|
113 | call FloppyDrive_GetType ; Get Floppy Drive type to BX
|
---|
114 | jmp .around
|
---|
115 | .ours:
|
---|
116 | call AH8h_GetDriveParameters
|
---|
117 | .around:
|
---|
118 |
|
---|
119 | mov ax, g_szFddSizeOr ; .PrintXTFloppyType
|
---|
120 | test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
|
---|
121 | jz SHORT .PushAXAndOutput
|
---|
122 |
|
---|
123 | mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType
|
---|
124 | cmp bl, FLOPPY_TYPE_35_ED
|
---|
125 | ja SHORT .PushAXAndOutput
|
---|
126 |
|
---|
127 | ; Fall to .PrintKnownFloppyType
|
---|
128 |
|
---|
129 | ;--------------------------------------------------------------------
|
---|
130 | ; .PrintKnownFloppyType
|
---|
131 | ; Parameters:
|
---|
132 | ; BX: Floppy drive type
|
---|
133 | ; Returns:
|
---|
134 | ; CF: Set since menu event was handled successfully
|
---|
135 | ; Corrupts registers:
|
---|
136 | ; AX, BX, SI, DI
|
---|
137 | ;
|
---|
138 | ; Floppy Drive Types:
|
---|
139 | ;
|
---|
140 | ; 0 Handled above
|
---|
141 | ; 1 FLOPPY_TYPE_525_DD 5 1/4 360K
|
---|
142 | ; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M
|
---|
143 | ; 3 FLOPPY_TYPE_35_DD 3 1/2 720K
|
---|
144 | ; 4 FLOPPY_TYPE_35_HD 3 1/2 1.44M
|
---|
145 | ; 5 3.5" ED on some BIOSes 3 1/2 2.88M
|
---|
146 | ; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M
|
---|
147 | ; >6 Unknwon, handled above
|
---|
148 | ;
|
---|
149 | ;--------------------------------------------------------------------
|
---|
150 | .PrintKnownFloppyType:
|
---|
151 | mov al, (g_szFddSize - $$) & 0xff
|
---|
152 | push ax
|
---|
153 |
|
---|
154 | mov al, (g_szFddThreeHalf - $$) & 0xff
|
---|
155 | cmp bl, FLOPPY_TYPE_525_HD
|
---|
156 | ja .ThreeHalf
|
---|
157 | mov al, (g_szFddFiveQuarter - $$) & 0xff
|
---|
158 | .ThreeHalf:
|
---|
159 | push ax ; "5 1/4" or "3 1/2"
|
---|
160 |
|
---|
161 | mov al,FloppyTypes.rgbCapacityMultiplier
|
---|
162 | mov bh, 0
|
---|
163 | mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table
|
---|
164 |
|
---|
165 | .PushAXAndOutput:
|
---|
166 | push ax
|
---|
167 |
|
---|
168 | .FormatRelay:
|
---|
169 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
170 |
|
---|
171 |
|
---|
172 | ;--------------------------------------------------------------------
|
---|
173 | ; Prints Hard Disk Menuitem information strings.
|
---|
174 | ;
|
---|
175 | ; BootMenuPrint_HardDiskMenuitemInformation
|
---|
176 | ; Parameters:
|
---|
177 | ; DS: RAMVARS segment
|
---|
178 | ; Returns:
|
---|
179 | ; CF: Set since menu event was handled successfully
|
---|
180 | ; Corrupts registers:
|
---|
181 | ; BX, CX, DX, SI, DI, ES
|
---|
182 | ;--------------------------------------------------------------------
|
---|
183 | .HardDiskRefreshInformation:
|
---|
184 | jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above
|
---|
185 |
|
---|
186 | .HardDiskMenuitemInfoForOurDrive:
|
---|
187 | ePUSH_T ax, g_szInformation ; Add substring for our hard disk information
|
---|
188 | call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size
|
---|
189 | jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
|
---|
190 |
|
---|
191 | .HardDiskMenuitemInfoForForeignDrive:
|
---|
192 | call DriveXlate_ToOrBack
|
---|
193 | call AH15h_GetSectorCountFromForeignDriveToDXAX
|
---|
194 |
|
---|
195 | .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
|
---|
196 | ePUSH_T cx, g_szCapacityNum ; Push format substring
|
---|
197 | call Size_ConvertSectorCountInBXDXAXtoKiB
|
---|
198 | mov cx, BYTE_MULTIPLES.kiB
|
---|
199 | call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
|
---|
200 | push ax ; Size in magnitude
|
---|
201 | push cx ; Tenths
|
---|
202 | push dx ; Magnitude character
|
---|
203 |
|
---|
204 | test di,di
|
---|
205 | jz SHORT BootMenuPrint_RefreshInformation.FormatRelay
|
---|
206 |
|
---|
207 | %include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string
|
---|
208 | jmp DetectPrint_FormatCSSIfromParamsInSSBP
|
---|
209 |
|
---|
210 |
|
---|
211 | FloppyTypes:
|
---|
212 | .rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size
|
---|
213 | .rgbCapacity:
|
---|
214 | db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1
|
---|
215 | db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2
|
---|
216 | db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3
|
---|
217 | db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4
|
---|
218 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5
|
---|
219 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6
|
---|