Changeset 161 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot
- Timestamp:
- May 8, 2011, 8:02:52 PM (14 years ago)
- google:author:
- krille_n_@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm
r155 r161 56 56 CALL_DISPLAY_LIBRARY PrintNewlineCharacters 57 57 mov si, ROMVARS.szVersion 58 ; Fall t hrough to BootMenuPrint_NullTerminatedStringFromCSSIandSetCF58 ; Fall to BootMenuPrint_NullTerminatedStringFromCSSIandSetCF 59 59 60 60 … … 169 169 mov si, g_szDriveNum 170 170 push ax 171 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP171 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 172 172 173 173 … … 187 187 call FloppyDrive_GetType ; Get Floppy Drive type to BX 188 188 test bx, bx ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD) 189 push bp 190 mov bp, sp 189 191 jz SHORT .PrintXTFloppyType 190 192 cmp bl, FLOPPY_TYPE_35_ED 191 193 ja SHORT .PrintUnknownFloppyType 192 jmp SHORT .PrintKnownFloppyType 193 194 ;-------------------------------------------------------------------- 195 ; .PrintXTFloppyType 196 ; Parameters: 197 ; Nothing 198 ; Returns: 199 ; CF: Set since menu event was handled successfully 200 ; Corrupts registers: 201 ; AX, SI, DI 202 ;-------------------------------------------------------------------- 203 ALIGN JUMP_ALIGN 204 .PrintXTFloppyType: 205 push bp 206 mov si, g_szFddSizeOr 207 jmp SHORT .FormatXTorUnknownTypeFloppyDrive 208 209 ;-------------------------------------------------------------------- 210 ; .PrintUnknownFloppyType 211 ; Parameters: 212 ; Nothing 213 ; Returns: 214 ; CF: Set since menu event was handled successfully 215 ; Corrupts registers: 216 ; AX, SI, DI 217 ;-------------------------------------------------------------------- 218 ALIGN JUMP_ALIGN 219 .PrintUnknownFloppyType: 220 push bp 221 mov si, g_szFddUnknown 222 .FormatXTorUnknownTypeFloppyDrive: 223 mov bp, sp 224 ePUSH_T ax, g_szCapacity 225 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP 194 ; Fall to .PrintKnownFloppyType 195 226 196 227 197 ;-------------------------------------------------------------------- … … 236 206 ALIGN JUMP_ALIGN 237 207 .PrintKnownFloppyType: 238 push bp239 mov bp, sp240 208 mov si, g_szFddSize 241 209 ePUSH_T ax, g_szCapacity 242 210 dec bx ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD) 243 211 shl bx, 1 ; Shift for WORD lookup 244 mov ax, [cs:bx+ .rgwPhysicalSize]212 mov ax, [cs:bx+FloppyTypes.rgwPhysicalSize] 245 213 push ax ; '5' or '3' 246 214 mov al, ah 247 215 push ax ; '1/4' or '1/2' 248 push WORD [cs:bx+ .rgwCapacity]216 push WORD [cs:bx+FloppyTypes.rgwCapacity] 249 217 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 250 218 219 220 ;-------------------------------------------------------------------- 221 ; .PrintXTFloppyType 222 ; .PrintUnknownFloppyType 223 ; Parameters: 224 ; Nothing 225 ; Returns: 226 ; CF: Set since menu event was handled successfully 227 ; Corrupts registers: 228 ; AX, SI, DI 229 ;-------------------------------------------------------------------- 230 ALIGN JUMP_ALIGN 231 .PrintXTFloppyType: 232 mov si, g_szFddSizeOr 233 jmp SHORT .FormatXTorUnknownTypeFloppyDrive 234 ALIGN JUMP_ALIGN 235 .PrintUnknownFloppyType: 236 mov si, g_szFddUnknown 237 .FormatXTorUnknownTypeFloppyDrive: 238 ePUSH_T ax, g_szCapacity 239 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 240 241 242 ;-------------------------------------------------------------------- 243 ; Prints Hard Disk Menuitem information strings. 244 ; 245 ; BootMenuPrint_HardDiskMenuitemInformation 246 ; Parameters: 247 ; DL: Untranslated Hard Disk number 248 ; DS: RAMVARS segment 249 ; Returns: 250 ; CF: Set since menu event was handled successfully 251 ; Corrupts registers: 252 ; BX, CX, DX, SI, DI, ES 253 ;-------------------------------------------------------------------- 254 ALIGN JUMP_ALIGN 255 BootMenuPrint_HardDiskMenuitemInformation: 256 call RamVars_IsDriveHandledByThisBIOS 257 jnc SHORT .HardDiskMenuitemInfoForForeignDrive 258 call FindDPT_ForDriveNumber ; DS:DI to point DPT 259 ; Fall to .HardDiskMenuitemInfoForOurDrive 260 261 ;-------------------------------------------------------------------- 262 ; .HardDiskMenuitemInfoForOurDrive 263 ; Parameters: 264 ; DL: Untranslated Hard Disk number 265 ; DS:DI: Ptr to DPT 266 ; Returns: 267 ; Nothing 268 ; Corrupts registers: 269 ; AX, BX, CX, DX, SI, DI, ES 270 ;-------------------------------------------------------------------- 271 ALIGN JUMP_ALIGN 272 .HardDiskMenuitemInfoForOurDrive: 273 push di 274 ePUSH_T ax, BootMenuPrintCfg_ForOurDrive ; Return from BootMenuPrint_FormatCSSIfromParamsInSSBP 275 push bp 276 mov bp, sp 277 ePUSH_T ax, g_szCapacity 278 279 ; Get and push L-CHS size 280 mov [RAMVARS.bTimeoutTicksLeft], dl ; Store drive number 281 call AH15h_GetSectorCountToDXAX 282 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 283 284 ; Get and push total LBA size 285 mov dl, [RAMVARS.bTimeoutTicksLeft] ; Restore drive number 286 call BootInfo_GetTotalSectorCount 287 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 288 289 mov si, g_szSizeDual 290 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 291 292 293 ;-------------------------------------------------------------------- 294 ; .HardDiskMenuitemInfoForForeignDrive 295 ; Parameters: 296 ; DL: Untranslated Hard Disk number 297 ; DS: RAMVARS segment 298 ; Returns: 299 ; CF: Set since menu event was handled successfully 300 ; Corrupts registers: 301 ; AX, BX, CX, DX, SI, DI 302 ;-------------------------------------------------------------------- 303 ALIGN JUMP_ALIGN 304 .HardDiskMenuitemInfoForForeignDrive: 305 push bp 306 mov bp, sp 307 ePUSH_T ax, g_szCapacity 308 309 call DriveXlate_ToOrBack 310 call AH15h_GetSectorCountFromForeignDriveToDXAX 311 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 312 313 mov si, g_szSizeSingle 314 ; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP 315 316 317 ;-------------------------------------------------------------------- 318 ; BootMenuPrint_FormatCSSIfromParamsInSSBP 319 ; Parameters: 320 ; CS:SI: Ptr to string to format 321 ; BP: SP before pushing parameters 322 ; Returns: 323 ; BP: Popped from stack 324 ; Corrupts registers: 325 ; AX, DI 326 ;-------------------------------------------------------------------- 327 ALIGN JUMP_ALIGN 328 BootMenuPrint_FormatCSSIfromParamsInSSBP: 329 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI 330 stc ; Successfull return from menu event 331 pop bp 332 ret 333 334 335 ;-------------------------------------------------------------------- 336 ; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat 337 ; Parameters: 338 ; BX:DX:AX: Sector count 339 ; Returns: 340 ; Size in stack 341 ; Corrupts registers: 342 ; AX, BX, CX, DX, SI 343 ;-------------------------------------------------------------------- 344 ALIGN JUMP_ALIGN 345 ConvertSectorCountInBXDXAXtoSizeAndPushForFormat: 346 pop si ; Pop return address 347 call Size_ConvertSectorCountInBXDXAXtoKiB 348 mov cx, BYTE_MULTIPLES.kiB 349 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX 350 push ax ; Size in magnitude 351 push cx ; Tenths 352 push dx ; Magnitude character 353 jmp si 354 355 356 ;-------------------------------------------------------------------- 357 ; BootMenuPrint_ClearInformationArea 358 ; Parameters: 359 ; Nothing 360 ; Returns: 361 ; CF: Set 362 ; Corrupts registers: 363 ; AX, DI 364 ;-------------------------------------------------------------------- 365 ALIGN JUMP_ALIGN 366 BootMenuPrint_ClearInformationArea: 367 CALL_MENU_LIBRARY ClearInformationArea 368 stc 369 ret 370 371 372 ;-------------------------------------------------------------------- 373 ; BootMenuPrint_TheBottomOfScreen 374 ; Parameters: 375 ; DS: RAMVARS segment 376 ; Returns: 377 ; Nothing 378 ; Corrupts registers: 379 ; AX, BX, CX, DX, SI, DI 380 ;-------------------------------------------------------------------- 381 ALIGN JUMP_ALIGN 382 BootMenuPrint_TheBottomOfScreen: 383 call FloppyDrive_GetCountToCX 384 mov bl, cl ; Floppy Drive count to BL 385 call RamVars_GetHardDiskCountFromBDAtoCX 386 mov bh, cl ; Hard Disk count to BH 387 ; Fall to .MoveCursorToHotkeyStrings 388 389 ;-------------------------------------------------------------------- 390 ; .MoveCursorToHotkeyStrings 391 ; Parameters: 392 ; Nothing 393 ; Returns: 394 ; Nothing 395 ; Corrupts registers: 396 ; AX, DI 397 ;-------------------------------------------------------------------- 398 .MoveCursorToHotkeyStrings: 399 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH 400 xor al, al 401 dec ah 402 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX 403 ; Fall to .PrintHotkeyString 404 405 ;-------------------------------------------------------------------- 406 ; .PrintHotkeyString 407 ; Parameters: 408 ; BL: Floppy Drives 409 ; BH: Hard Drives 410 ; Returns: 411 ; Nothing 412 ; Corrupts registers: 413 ; AX, CX, DX, SI, DI 414 ;-------------------------------------------------------------------- 415 .PrintHotkeyString: 416 ; Display Library should not be called like this 417 mov si, ATTRIBUTE_CHARS.cHighlightedItem 418 call MenuAttribute_GetToAXfromTypeInSI 419 xchg dx, ax 420 mov cx, MONO_BRIGHT 421 422 test bl, bl ; Any Floppy Drives? 423 jz SHORT .SkipFloppyDriveHotkeys 424 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8) 425 mov si, g_szFDD 426 call PushHotkeyParamsAndFormat 427 428 .SkipFloppyDriveHotkeys: 429 test bh, bh ; Any Hard Drives? 430 jz SHORT .SkipHardDriveHotkeys 431 xchg ax, cx ; Store Key Attribute 432 call BootMenu_GetLetterForFirstHardDiskToCL 433 mov ch, ANGLE_QUOTE_RIGHT 434 xchg ax, cx 435 mov si, g_szHDD 436 call PushHotkeyParamsAndFormat 437 438 .SkipHardDriveHotkeys: 439 ; Fall to .PrintRomBootHotkey 440 441 ;-------------------------------------------------------------------- 442 ; .PrintRomBootHotkey 443 ; Parameters: 444 ; CX: Key Attribute 445 ; DX: Description Attribute 446 ; Returns: 447 ; Nothing 448 ; Corrupts registers: 449 ; AX, SI, DI 450 ;-------------------------------------------------------------------- 451 .PrintRomBootHotkey: 452 mov ax, 'F' | ('8'<<8) ; F8 453 mov si, g_szRomBoot 454 ; Fall to PushHotkeyParamsAndFormat 455 456 ;-------------------------------------------------------------------- 457 ; PushHotkeyParamsAndFormat 458 ; Parameters: 459 ; AL: First character 460 ; AH: Second character 461 ; CX: Key Attribute 462 ; DX: Description Attribute 463 ; CS:SI: Description string 464 ; Returns: 465 ; Nothing 466 ; Corrupts registers: 467 ; AX, SI, DI 468 ;-------------------------------------------------------------------- 469 ALIGN JUMP_ALIGN 470 PushHotkeyParamsAndFormat: 471 push bp 472 mov bp, sp 473 474 push cx ; Key attribute 475 push ax ; First character 476 xchg al, ah 477 push ax ; Second character 478 push dx ; Description attribute 479 push si ; Description string 480 push cx ; Key attribute for last space 481 mov si, g_szHotkey 482 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP 483 251 484 ALIGN WORD_ALIGN 485 FloppyTypes: 252 486 .rgwCapacity: 253 487 dw 360 … … 264 498 db '3', 171 ; 5, 3.5" ED on some BIOSes 265 499 db '3', 171 ; 6, FLOPPY_TYPE_35_ED 266 267 268 ;--------------------------------------------------------------------269 ; Prints Hard Disk Menuitem information strings.270 ;271 ; BootMenuPrint_HardDiskMenuitemInformation272 ; Parameters:273 ; DL: Untranslated Hard Disk number274 ; DS: RAMVARS segment275 ; Returns:276 ; CF: Set since menu event was handled successfully277 ; Corrupts registers:278 ; BX, CX, DX, SI, DI, ES279 ;--------------------------------------------------------------------280 ALIGN JUMP_ALIGN281 BootMenuPrint_HardDiskMenuitemInformation:282 call RamVars_IsDriveHandledByThisBIOS283 jnc SHORT .HardDiskMenuitemInfoForForeignDrive284 call FindDPT_ForDriveNumber ; DS:DI to point DPT285 ; Fall to .HardDiskMenuitemInfoForOurDrive286 287 ;--------------------------------------------------------------------288 ; .HardDiskMenuitemInfoForOurDrive289 ; Parameters:290 ; DL: Untranslated Hard Disk number291 ; DS:DI: Ptr to DPT292 ; Returns:293 ; Nothing294 ; Corrupts registers:295 ; AX, BX, CX, DX, SI, DI, ES296 ;--------------------------------------------------------------------297 ALIGN JUMP_ALIGN298 .HardDiskMenuitemInfoForOurDrive:299 push di300 ePUSH_T ax, BootMenuPrintCfg_ForOurDrive ; Return from BootMenuPrint_FormatCSSIfromParamsInSSBP301 push bp302 mov bp, sp303 ePUSH_T ax, g_szCapacity304 305 ; Get and push L-CHS size306 mov [RAMVARS.bTimeoutTicksLeft], dl ; Store drive number307 call AH15h_GetSectorCountToDXAX308 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat309 310 ; Get and push total LBA size311 mov dl, [RAMVARS.bTimeoutTicksLeft] ; Restore drive number312 call BootInfo_GetTotalSectorCount313 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat314 315 mov si, g_szSizeDual316 jmp SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP317 318 319 ;--------------------------------------------------------------------320 ; .HardDiskMenuitemInfoForForeignDrive321 ; Parameters:322 ; DL: Untranslated Hard Disk number323 ; DS: RAMVARS segment324 ; Returns:325 ; CF: Set since menu event was handled successfully326 ; Corrupts registers:327 ; AX, BX, CX, DX, SI, DI328 ;--------------------------------------------------------------------329 ALIGN JUMP_ALIGN330 .HardDiskMenuitemInfoForForeignDrive:331 push bp332 mov bp, sp333 ePUSH_T ax, g_szCapacity334 335 call DriveXlate_ToOrBack336 call AH15h_GetSectorCountFromForeignDriveToDXAX337 call ConvertSectorCountInBXDXAXtoSizeAndPushForFormat338 339 mov si, g_szSizeSingle340 ; Fall to BootMenuPrint_FormatCSSIfromParamsInSSBP341 342 343 ;--------------------------------------------------------------------344 ; BootMenuPrint_FormatCSSIfromParamsInSSBP345 ; Parameters:346 ; CS:SI: Ptr to string to format347 ; BP: SP before pushing parameters348 ; Returns:349 ; BP: Popped from stack350 ; Corrupts registers:351 ; AX, DI352 ;--------------------------------------------------------------------353 ALIGN JUMP_ALIGN354 BootMenuPrint_FormatCSSIfromParamsInSSBP:355 CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI356 stc ; Successfull return from menu event357 pop bp358 ret359 360 361 ;--------------------------------------------------------------------362 ; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat363 ; Parameters:364 ; BX:DX:AX: Sector count365 ; Returns:366 ; Size in stack367 ; Corrupts registers:368 ; AX, BX, CX, DX, SI369 ;--------------------------------------------------------------------370 ALIGN JUMP_ALIGN371 ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:372 pop si ; Pop return address373 call Size_ConvertSectorCountInBXDXAXtoKiB374 mov cx, BYTE_MULTIPLES.kiB375 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX376 push ax ; Size in magnitude377 push cx ; Tenths378 push dx ; Magnitude character379 jmp si380 381 382 ;--------------------------------------------------------------------383 ; BootMenuPrint_ClearInformationArea384 ; Parameters:385 ; Nothing386 ; Returns:387 ; CF: Set388 ; Corrupts registers:389 ; AX, DI390 ;--------------------------------------------------------------------391 ALIGN JUMP_ALIGN392 BootMenuPrint_ClearInformationArea:393 CALL_MENU_LIBRARY ClearInformationArea394 stc395 ret396 397 398 ;--------------------------------------------------------------------399 ; BootMenuPrint_TheBottomOfScreen400 ; Parameters:401 ; DS: RAMVARS segment402 ; Returns:403 ; Nothing404 ; Corrupts registers:405 ; AX, BX, CX, DX, SI, DI406 ;--------------------------------------------------------------------407 ALIGN JUMP_ALIGN408 BootMenuPrint_TheBottomOfScreen:409 call FloppyDrive_GetCountToCX410 mov bl, cl ; Floppy Drive count to BL411 call RamVars_GetHardDiskCountFromBDAtoCX412 mov bh, cl ; Hard Disk count to BH413 ; Fall to .MoveCursorToHotkeyStrings414 415 ;--------------------------------------------------------------------416 ; .MoveCursorToHotkeyStrings417 ; Parameters:418 ; Nothing419 ; Returns:420 ; Nothing421 ; Corrupts registers:422 ; AX, DI423 ;--------------------------------------------------------------------424 .MoveCursorToHotkeyStrings:425 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH426 xor al, al427 dec ah428 CALL_DISPLAY_LIBRARY SetCursorCoordinatesFromAX429 ; Fall to .PrintHotkeyString430 431 ;--------------------------------------------------------------------432 ; .PrintHotkeyString433 ; Parameters:434 ; BL: Floppy Drives435 ; BH: Hard Drives436 ; Returns:437 ; Nothing438 ; Corrupts registers:439 ; AX, CX, DX, SI, DI440 ;--------------------------------------------------------------------441 .PrintHotkeyString:442 ; Display Library should not be called like this443 mov si, ATTRIBUTE_CHARS.cHighlightedItem444 call MenuAttribute_GetToAXfromTypeInSI445 xchg dx, ax446 mov cx, MONO_BRIGHT447 448 test bl, bl ; Any Floppy Drives?449 jz SHORT .SkipFloppyDriveHotkeys450 mov ax, 'A' | (ANGLE_QUOTE_RIGHT<<8)451 mov si, g_szFDD452 call PushHotkeyParamsAndFormat453 454 .SkipFloppyDriveHotkeys:455 test bh, bh ; Any Hard Drives?456 jz SHORT .SkipHardDriveHotkeys457 xchg ax, cx ; Store Key Attribute458 call BootMenu_GetLetterForFirstHardDiskToCL459 mov ch, ANGLE_QUOTE_RIGHT460 xchg ax, cx461 mov si, g_szHDD462 call PushHotkeyParamsAndFormat463 464 .SkipHardDriveHotkeys:465 ; Fall to .PrintRomBootHotkey466 467 ;--------------------------------------------------------------------468 ; .PrintRomBootHotkey469 ; Parameters:470 ; CX: Key Attribute471 ; DX: Description Attribute472 ; Returns:473 ; Nothing474 ; Corrupts registers:475 ; AX, SI, DI476 ;--------------------------------------------------------------------477 .PrintRomBootHotkey:478 mov ax, 'F' | ('8'<<8) ; F8479 mov si, g_szRomBoot480 ; Fall to PushHotkeyParamsAndFormat481 482 ;--------------------------------------------------------------------483 ; PushHotkeyParamsAndFormat484 ; Parameters:485 ; AL: First character486 ; AH: Second character487 ; CX: Key Attribute488 ; DX: Description Attribute489 ; CS:SI: Description string490 ; Returns:491 ; Nothing492 ; Corrupts registers:493 ; AX, SI, DI494 ;--------------------------------------------------------------------495 ALIGN JUMP_ALIGN496 PushHotkeyParamsAndFormat:497 push bp498 mov bp, sp499 500 push cx ; Key attribute501 push ax ; First character502 xchg al, ah503 push ax ; Second character504 push dx ; Description attribute505 push si ; Description string506 push cx ; Key attribute for last space507 mov si, g_szHotkey508 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
Note:
See TracChangeset
for help on using the changeset viewer.