[88] | 1 | ; Project name : XTIDE Universal BIOS |
---|
[3] | 2 | ; Description : Functions for printing boot menu strings. |
---|
| 3 | |
---|
[376] | 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 | |
---|
[3] | 20 | ; Section containing code |
---|
| 21 | SECTION .text |
---|
| 22 | |
---|
| 23 | ;-------------------------------------------------------------------- |
---|
[241] | 24 | ; BootMenuPrint_RefreshItem |
---|
[294] | 25 | ; |
---|
[189] | 26 | ; Parameters: |
---|
| 27 | ; DL: Untranslated Floppy Drive number |
---|
| 28 | ; Returns: |
---|
| 29 | ; Nothing |
---|
| 30 | ; Corrupts registers: |
---|
[241] | 31 | ; AX, BX, DX, SI, DI |
---|
[189] | 32 | ;-------------------------------------------------------------------- |
---|
[241] | 33 | BootMenuPrint_RefreshItem: |
---|
| 34 | call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS |
---|
| 35 | jnc BootMenuEvent_EventCompleted ; if no menu item selected, out we go |
---|
[294] | 36 | |
---|
[189] | 37 | push bp |
---|
| 38 | mov bp, sp |
---|
| 39 | |
---|
[262] | 40 | call FindDPT_ForDriveNumberInDL |
---|
[258] | 41 | jc .notOurs |
---|
[241] | 42 | |
---|
[254] | 43 | call BootMenuInfo_ConvertDPTtoBX |
---|
[241] | 44 | mov si, g_szDriveNumBOOTNFO ; special g_szDriveNum that prints from BDA |
---|
| 45 | jmp .go |
---|
[294] | 46 | |
---|
[241] | 47 | .notOurs: |
---|
[294] | 48 | mov si,g_szDriveNum |
---|
[241] | 49 | mov bx,g_szForeignHD ; assume a hard disk for the moment |
---|
[294] | 50 | |
---|
| 51 | test dl, dl |
---|
[241] | 52 | js .go |
---|
| 53 | mov bl,((g_szFloppyDrv)-$$ & 0xff) ; and revisit the earlier assumption... |
---|
[294] | 54 | |
---|
[241] | 55 | .go: |
---|
| 56 | mov ax, dx ; preserve DL for the floppy drive letter addition |
---|
| 57 | call DriveXlate_ToOrBack |
---|
| 58 | push dx ; translated drive number |
---|
| 59 | push bx ; sub string |
---|
| 60 | add al, 'A' ; floppy drive letter (we always push this although |
---|
| 61 | push ax ; the hard disks don't ever use it, but it does no harm) |
---|
[294] | 62 | |
---|
[386] | 63 | jmp SHORT BootMenuPrint_RefreshInformation.FormatRelay |
---|
[130] | 64 | |
---|
| 65 | ;-------------------------------------------------------------------- |
---|
[88] | 66 | ; Prints Boot Menu title strings. |
---|
[3] | 67 | ; |
---|
[88] | 68 | ; BootMenuPrint_TitleStrings |
---|
[3] | 69 | ; Parameters: |
---|
[88] | 70 | ; Nothing |
---|
[3] | 71 | ; Returns: |
---|
[88] | 72 | ; CF: Set since menu event handled |
---|
[3] | 73 | ; Corrupts registers: |
---|
[88] | 74 | ; AX, SI, DI |
---|
[3] | 75 | ;-------------------------------------------------------------------- |
---|
[88] | 76 | BootMenuPrint_TitleStrings: |
---|
| 77 | mov si, ROMVARS.szTitle |
---|
[386] | 78 | call DetectPrint_NullTerminatedStringFromCSSIandSetCF |
---|
[96] | 79 | CALL_DISPLAY_LIBRARY PrintNewlineCharacters |
---|
[88] | 80 | mov si, ROMVARS.szVersion |
---|
[386] | 81 | jmp DetectPrint_NullTerminatedStringFromCSSIandSetCF |
---|
[3] | 82 | |
---|
[128] | 83 | |
---|
| 84 | ;-------------------------------------------------------------------- |
---|
[3] | 85 | ; BootMenuPrint_FloppyMenuitemInformation |
---|
| 86 | ; Parameters: |
---|
| 87 | ; DL: Untranslated Floppy Drive number |
---|
| 88 | ; DS: RAMVARS segment |
---|
| 89 | ; Returns: |
---|
[88] | 90 | ; CF: Set since menu event was handled successfully |
---|
[3] | 91 | ; Corrupts registers: |
---|
[88] | 92 | ; AX, BX, CX, DX, SI, DI, ES |
---|
[3] | 93 | ;-------------------------------------------------------------------- |
---|
[241] | 94 | BootMenuPrint_RefreshInformation: |
---|
[294] | 95 | CALL_MENU_LIBRARY ClearInformationArea |
---|
| 96 | |
---|
[241] | 97 | call BootMenu_GetDriveToDXforMenuitemInCX_And_RamVars_GetSegmentToDS |
---|
| 98 | jnc BootMenuEvent_EventCompleted ; if no menu selection, abort |
---|
[182] | 99 | |
---|
[161] | 100 | push bp |
---|
| 101 | mov bp, sp |
---|
[241] | 102 | |
---|
[258] | 103 | mov si, g_szCapacity ; Setup print string now, carries through to print call |
---|
| 104 | |
---|
[262] | 105 | call FindDPT_ForDriveNumberInDL |
---|
[259] | 106 | |
---|
[262] | 107 | inc dl ; are we a hard disk? |
---|
| 108 | dec dl ; inc/dec will set SF, without modifying CF or DL |
---|
[294] | 109 | js .HardDiskRefreshInformation |
---|
[258] | 110 | |
---|
[262] | 111 | jnc .ours ; Based on CF from FindDPT_ForDriveNumberInDL above |
---|
[241] | 112 | call FloppyDrive_GetType ; Get Floppy Drive type to BX |
---|
[258] | 113 | jmp .around |
---|
| 114 | .ours: |
---|
| 115 | call AH8h_GetDriveParameters |
---|
[294] | 116 | .around: |
---|
[182] | 117 | |
---|
[255] | 118 | mov ax, g_szFddSizeOr ; .PrintXTFloppyType |
---|
[294] | 119 | test bl, bl ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) |
---|
[255] | 120 | jz SHORT .PushAXAndOutput |
---|
[241] | 121 | |
---|
[255] | 122 | mov al, (g_szFddUnknown - $$) & 0xff ; .PrintUnknownFloppyType |
---|
[3] | 123 | cmp bl, FLOPPY_TYPE_35_ED |
---|
[255] | 124 | ja SHORT .PushAXAndOutput |
---|
[294] | 125 | |
---|
[161] | 126 | ; Fall to .PrintKnownFloppyType |
---|
[3] | 127 | |
---|
| 128 | ;-------------------------------------------------------------------- |
---|
[161] | 129 | ; .PrintKnownFloppyType |
---|
[3] | 130 | ; Parameters: |
---|
[161] | 131 | ; BX: Floppy drive type |
---|
[3] | 132 | ; Returns: |
---|
[88] | 133 | ; CF: Set since menu event was handled successfully |
---|
[3] | 134 | ; Corrupts registers: |
---|
[161] | 135 | ; AX, BX, SI, DI |
---|
[294] | 136 | ; |
---|
[182] | 137 | ; Floppy Drive Types: |
---|
| 138 | ; |
---|
[294] | 139 | ; 0 Handled above |
---|
[182] | 140 | ; 1 FLOPPY_TYPE_525_DD 5 1/4 360K |
---|
| 141 | ; 2 FLOPPY_TYPE_525_HD 5 1/4 1.2M |
---|
| 142 | ; 3 FLOPPY_TYPE_35_DD 3 1/2 720K |
---|
| 143 | ; 4 FLOPPY_TYPE_35_HD 3 1/2 1.44M |
---|
| 144 | ; 5 3.5" ED on some BIOSes 3 1/2 2.88M |
---|
| 145 | ; 6 FLOPPY_TYPE_35_ED 3 1/2 2.88M |
---|
| 146 | ; >6 Unknwon, handled above |
---|
[294] | 147 | ; |
---|
[3] | 148 | ;-------------------------------------------------------------------- |
---|
[161] | 149 | .PrintKnownFloppyType: |
---|
[255] | 150 | mov al, (g_szFddSize - $$) & 0xff |
---|
| 151 | push ax |
---|
[294] | 152 | |
---|
[255] | 153 | mov al, (g_szFddThreeHalf - $$) & 0xff |
---|
[182] | 154 | cmp bl, FLOPPY_TYPE_525_HD |
---|
| 155 | ja .ThreeHalf |
---|
[255] | 156 | mov al, (g_szFddFiveQuarter - $$) & 0xff |
---|
[294] | 157 | .ThreeHalf: |
---|
[255] | 158 | push ax ; "5 1/4" or "3 1/2" |
---|
[3] | 159 | |
---|
[182] | 160 | mov al,FloppyTypes.rgbCapacityMultiplier |
---|
[258] | 161 | mov bh, 0 |
---|
[182] | 162 | mul byte [cs:bx+FloppyTypes.rgbCapacity - 1] ; -1 since 0 is handled above and not in the table |
---|
[255] | 163 | |
---|
[294] | 164 | .PushAXAndOutput: |
---|
[182] | 165 | push ax |
---|
[161] | 166 | |
---|
[258] | 167 | .FormatRelay: |
---|
[386] | 168 | jmp DetectPrint_FormatCSSIfromParamsInSSBP |
---|
[88] | 169 | |
---|
[192] | 170 | |
---|
| 171 | ;-------------------------------------------------------------------- |
---|
[3] | 172 | ; Prints Hard Disk Menuitem information strings. |
---|
| 173 | ; |
---|
| 174 | ; BootMenuPrint_HardDiskMenuitemInformation |
---|
| 175 | ; Parameters: |
---|
| 176 | ; DS: RAMVARS segment |
---|
| 177 | ; Returns: |
---|
[88] | 178 | ; CF: Set since menu event was handled successfully |
---|
[3] | 179 | ; Corrupts registers: |
---|
| 180 | ; BX, CX, DX, SI, DI, ES |
---|
| 181 | ;-------------------------------------------------------------------- |
---|
[294] | 182 | .HardDiskRefreshInformation: |
---|
[262] | 183 | jc .HardDiskMenuitemInfoForForeignDrive ; Based on CF from FindDPT_ForDriveNumberInDL (way) above |
---|
[3] | 184 | |
---|
[127] | 185 | .HardDiskMenuitemInfoForOurDrive: |
---|
[262] | 186 | ePUSH_T ax, g_szInformation ; Add substring for our hard disk information |
---|
| 187 | call BootMenuInfo_GetTotalSectorCount ; Get Total LBA Size |
---|
[258] | 188 | jmp .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat |
---|
[294] | 189 | |
---|
[127] | 190 | .HardDiskMenuitemInfoForForeignDrive: |
---|
| 191 | call DriveXlate_ToOrBack |
---|
[150] | 192 | call AH15h_GetSectorCountFromForeignDriveToDXAX |
---|
[88] | 193 | |
---|
[258] | 194 | .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat: |
---|
| 195 | ePUSH_T cx, g_szCapacityNum ; Push format substring |
---|
| 196 | call Size_ConvertSectorCountInBXDXAXtoKiB |
---|
| 197 | mov cx, BYTE_MULTIPLES.kiB |
---|
| 198 | call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX |
---|
| 199 | push ax ; Size in magnitude |
---|
| 200 | push cx ; Tenths |
---|
[294] | 201 | push dx ; Magnitude character |
---|
| 202 | |
---|
[258] | 203 | test di,di |
---|
[386] | 204 | jz SHORT BootMenuPrint_RefreshInformation.FormatRelay |
---|
[3] | 205 | |
---|
[258] | 206 | %include "BootMenuPrintCfg.asm" ; inline of code to fill out remainder of information string |
---|
[386] | 207 | jmp DetectPrint_FormatCSSIfromParamsInSSBP |
---|
[258] | 208 | |
---|
| 209 | |
---|
[3] | 210 | ;-------------------------------------------------------------------- |
---|
[192] | 211 | ; BootMenuPrint_ClearScreen |
---|
[88] | 212 | ; Parameters: |
---|
[192] | 213 | ; Nothing |
---|
[88] | 214 | ; Returns: |
---|
[192] | 215 | ; Nothing |
---|
[88] | 216 | ; Corrupts registers: |
---|
[192] | 217 | ; AX, DI |
---|
[88] | 218 | ;-------------------------------------------------------------------- |
---|
[192] | 219 | BootMenuPrint_ClearScreen: |
---|
| 220 | call BootMenuPrint_InitializeDisplayContext |
---|
| 221 | xor ax, ax |
---|
| 222 | CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX |
---|
| 223 | mov ax, ' ' | (MONO_NORMAL<<8) |
---|
| 224 | CALL_DISPLAY_LIBRARY ClearScreenWithCharInALandAttrInAH |
---|
| 225 | ret |
---|
[88] | 226 | |
---|
| 227 | |
---|
| 228 | ;-------------------------------------------------------------------- |
---|
| 229 | ; BootMenuPrint_TheBottomOfScreen |
---|
[3] | 230 | ; Parameters: |
---|
| 231 | ; DS: RAMVARS segment |
---|
| 232 | ; Returns: |
---|
[88] | 233 | ; Nothing |
---|
[3] | 234 | ; Corrupts registers: |
---|
[92] | 235 | ; AX, BX, CX, DX, SI, DI |
---|
[3] | 236 | ;-------------------------------------------------------------------- |
---|
[88] | 237 | BootMenuPrint_TheBottomOfScreen: |
---|
[258] | 238 | call FloppyDrive_GetCountToAX |
---|
| 239 | xchg bx, ax ; Floppy Drive count to BL |
---|
| 240 | call RamVars_GetHardDiskCountFromBDAtoAX |
---|
| 241 | mov bh, al ; Hard Disk count to BH |
---|
[92] | 242 | ; Fall to .MoveCursorToHotkeyStrings |
---|
[3] | 243 | |
---|
[92] | 244 | ;-------------------------------------------------------------------- |
---|
| 245 | ; .MoveCursorToHotkeyStrings |
---|
| 246 | ; Parameters: |
---|
| 247 | ; Nothing |
---|
| 248 | ; Returns: |
---|
| 249 | ; Nothing |
---|
| 250 | ; Corrupts registers: |
---|
| 251 | ; AX, DI |
---|
| 252 | ;-------------------------------------------------------------------- |
---|
| 253 | .MoveCursorToHotkeyStrings: |
---|
| 254 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH |
---|
| 255 | xor al, al |
---|
| 256 | dec ah |
---|
| 257 | CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX |
---|
| 258 | ; Fall to .PrintHotkeyString |
---|
[3] | 259 | |
---|
| 260 | ;-------------------------------------------------------------------- |
---|
[92] | 261 | ; .PrintHotkeyString |
---|
[3] | 262 | ; Parameters: |
---|
[92] | 263 | ; BL: Floppy Drives |
---|
| 264 | ; BH: Hard Drives |
---|
[88] | 265 | ; Returns: |
---|
[92] | 266 | ; Nothing |
---|
[88] | 267 | ; Corrupts registers: |
---|
[120] | 268 | ; AX, CX, DX, SI, DI |
---|
[88] | 269 | ;-------------------------------------------------------------------- |
---|
[92] | 270 | .PrintHotkeyString: |
---|
| 271 | ; Display Library should not be called like this |
---|
| 272 | mov si, ATTRIBUTE_CHARS.cHighlightedItem |
---|
| 273 | call MenuAttribute_GetToAXfromTypeInSI |
---|
| 274 | xchg dx, ax |
---|
[122] | 275 | mov cx, MONO_BRIGHT |
---|
[88] | 276 | |
---|
[92] | 277 | test bl, bl ; Any Floppy Drives? |
---|
| 278 | jz SHORT .SkipFloppyDriveHotkeys |
---|
| 279 | mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8) |
---|
| 280 | mov si, g_szFDD |
---|
| 281 | call PushHotkeyParamsAndFormat |
---|
[88] | 282 | |
---|
[92] | 283 | .SkipFloppyDriveHotkeys: |
---|
| 284 | test bh, bh ; Any Hard Drives? |
---|
| 285 | jz SHORT .SkipHardDriveHotkeys |
---|
[258] | 286 | call BootMenu_GetLetterForFirstHardDiskToAL |
---|
| 287 | mov ah, ANGLE_QUOTE_RIGHT |
---|
[92] | 288 | mov si, g_szHDD |
---|
| 289 | call PushHotkeyParamsAndFormat |
---|
| 290 | |
---|
| 291 | .SkipHardDriveHotkeys: |
---|
| 292 | ; Fall to .PrintRomBootHotkey |
---|
| 293 | |
---|
[88] | 294 | ;-------------------------------------------------------------------- |
---|
[92] | 295 | ; .PrintRomBootHotkey |
---|
[88] | 296 | ; Parameters: |
---|
[92] | 297 | ; CX: Key Attribute |
---|
| 298 | ; DX: Description Attribute |
---|
[3] | 299 | ; Returns: |
---|
[88] | 300 | ; Nothing |
---|
[3] | 301 | ; Corrupts registers: |
---|
[120] | 302 | ; AX, SI, DI |
---|
[3] | 303 | ;-------------------------------------------------------------------- |
---|
[92] | 304 | .PrintRomBootHotkey: |
---|
| 305 | mov ax, 'F' | ('8'<<8) ; F8 |
---|
| 306 | mov si, g_szRomBoot |
---|
| 307 | ; Fall to PushHotkeyParamsAndFormat |
---|
| 308 | |
---|
| 309 | ;-------------------------------------------------------------------- |
---|
| 310 | ; PushHotkeyParamsAndFormat |
---|
| 311 | ; Parameters: |
---|
| 312 | ; AL: First character |
---|
| 313 | ; AH: Second character |
---|
| 314 | ; CX: Key Attribute |
---|
| 315 | ; DX: Description Attribute |
---|
| 316 | ; CS:SI: Description string |
---|
| 317 | ; Returns: |
---|
| 318 | ; Nothing |
---|
| 319 | ; Corrupts registers: |
---|
[120] | 320 | ; AX, SI, DI |
---|
[92] | 321 | ;-------------------------------------------------------------------- |
---|
| 322 | PushHotkeyParamsAndFormat: |
---|
| 323 | push bp |
---|
| 324 | mov bp, sp |
---|
| 325 | |
---|
| 326 | push cx ; Key attribute |
---|
| 327 | push ax ; First character |
---|
| 328 | xchg al, ah |
---|
| 329 | push ax ; Second character |
---|
| 330 | push dx ; Description attribute |
---|
| 331 | push si ; Description string |
---|
| 332 | push cx ; Key attribute for last space |
---|
| 333 | mov si, g_szHotkey |
---|
[386] | 334 | jmp DetectPrint_FormatCSSIfromParamsInSSBP |
---|
[294] | 335 | |
---|
[161] | 336 | |
---|
[241] | 337 | FloppyTypes: |
---|
| 338 | .rgbCapacityMultiplier equ 20 ; Multiplier to reduce word sized values to byte size |
---|
| 339 | .rgbCapacity: |
---|
| 340 | db 360 / FloppyTypes.rgbCapacityMultiplier ; type 1 |
---|
| 341 | db 1200 / FloppyTypes.rgbCapacityMultiplier ; type 2 |
---|
| 342 | db 720 / FloppyTypes.rgbCapacityMultiplier ; type 3 |
---|
| 343 | db 1440 / FloppyTypes.rgbCapacityMultiplier ; type 4 |
---|
| 344 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 5 |
---|
| 345 | db 2880 / FloppyTypes.rgbCapacityMultiplier ; type 6 |
---|