[3] | 1 | ; Project name : IDE BIOS
|
---|
| 2 | ; Description : Functions for printing boot related strings.
|
---|
| 3 |
|
---|
| 4 | ; Section containing code
|
---|
| 5 | SECTION .text
|
---|
| 6 |
|
---|
| 7 | ;--------------------------------------------------------------------
|
---|
| 8 | ; Prints trying to boot string.
|
---|
| 9 | ;
|
---|
| 10 | ; BootPrint_TryToBootFromDL
|
---|
| 11 | ; Parameters:
|
---|
| 12 | ; DL: Drive to boot from (translated, 00h or 80h)
|
---|
| 13 | ; DS: RAMVARS segment
|
---|
| 14 | ; Returns:
|
---|
| 15 | ; Nothing
|
---|
| 16 | ; Corrupts registers:
|
---|
| 17 | ; AX, CX, SI, DI
|
---|
| 18 | ;--------------------------------------------------------------------
|
---|
| 19 | ALIGN JUMP_ALIGN
|
---|
| 20 | BootPrint_TryToBootFromDL:
|
---|
| 21 | push dx
|
---|
| 22 | ePUSH_T ax, BootPrint_PopDxAndReturn ; Return address
|
---|
| 23 |
|
---|
| 24 | xor dh, dh ; Translated drive number to DX
|
---|
| 25 | push dx ; Push translated drive number
|
---|
| 26 | call DriveXlate_ToOrBack
|
---|
| 27 | push dx ; Push untranslated drive number
|
---|
| 28 |
|
---|
| 29 | mov ax, g_szFloppyDrv ; Assume "Floppy Drive"
|
---|
| 30 | test dl, 80h ; Hard Disk?
|
---|
| 31 | jz SHORT .PushHardOrFloppy
|
---|
| 32 | add ax, BYTE g_szHardDrv - g_szFloppyDrv
|
---|
| 33 | .PushHardOrFloppy:
|
---|
| 34 | push ax
|
---|
| 35 |
|
---|
| 36 | mov si, g_szTryToBoot
|
---|
| 37 | mov dh, 6 ; 6 bytes pushed to stack
|
---|
| 38 | jmp PrintString_JumpToFormat
|
---|
| 39 |
|
---|
| 40 | ALIGN JUMP_ALIGN
|
---|
| 41 | BootPrint_PopDxAndReturn:
|
---|
| 42 | pop dx
|
---|
| 43 | ret
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | ;--------------------------------------------------------------------
|
---|
| 47 | ; Prints message that valid boot sector has been found.
|
---|
| 48 | ;
|
---|
| 49 | ; BootPrint_BootSectorLoaded
|
---|
| 50 | ; Parameters:
|
---|
| 51 | ; Nothing
|
---|
| 52 | ; Returns:
|
---|
| 53 | ; Nothing
|
---|
| 54 | ; Corrupts registers:
|
---|
| 55 | ; AX, CX, SI
|
---|
| 56 | ;--------------------------------------------------------------------
|
---|
| 57 | ALIGN JUMP_ALIGN
|
---|
| 58 | BootPrint_BootSectorLoaded:
|
---|
| 59 | push dx
|
---|
| 60 | ePUSH_T ax, BootPrint_PopDxAndReturn ; Return address
|
---|
| 61 |
|
---|
| 62 | ePUSH_T ax, g_szFound
|
---|
[87] | 63 | jmp SHORT BootPrint_MsgCodeShared
|
---|
[3] | 64 |
|
---|
| 65 |
|
---|
| 66 | ;--------------------------------------------------------------------
|
---|
| 67 | ; Prints message that first sector is not boot sector.
|
---|
| 68 | ;
|
---|
| 69 | ; BootPrint_FirstSectorNotBootable
|
---|
| 70 | ; Parameters:
|
---|
| 71 | ; Nothing
|
---|
| 72 | ; Returns:
|
---|
| 73 | ; Nothing
|
---|
| 74 | ; Corrupts registers:
|
---|
| 75 | ; AX, CX, DX, SI
|
---|
| 76 | ;--------------------------------------------------------------------
|
---|
| 77 | ALIGN JUMP_ALIGN
|
---|
| 78 | BootPrint_FirstSectorNotBootable:
|
---|
| 79 | ePUSH_T ax, g_szNotFound
|
---|
[87] | 80 | BootPrint_MsgCodeShared:
|
---|
[3] | 81 | ePUSH_T ax, g_szBootSector
|
---|
| 82 | mov si, g_szSectRead
|
---|
| 83 | mov dh, 4 ; 4 bytes pushed to stack
|
---|
| 84 | jmp PrintString_JumpToFormat
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | ;--------------------------------------------------------------------
|
---|
| 88 | ; Prints error code for failed first sector read attempt.
|
---|
| 89 | ;
|
---|
| 90 | ; BootPrint_FailedToLoadFirstSector
|
---|
| 91 | ; Parameters:
|
---|
| 92 | ; AH: INT 13h error code
|
---|
| 93 | ; Returns:
|
---|
| 94 | ; Nothing
|
---|
| 95 | ; Corrupts registers:
|
---|
| 96 | ; AX, CX, DX, SI
|
---|
| 97 | ;--------------------------------------------------------------------
|
---|
| 98 | ALIGN JUMP_ALIGN
|
---|
| 99 | BootPrint_FailedToLoadFirstSector:
|
---|
| 100 | eMOVZX cx, ah ; Error code to CX
|
---|
| 101 | push cx ; Push INT 13h error code
|
---|
| 102 | mov si, g_szReadError
|
---|
| 103 | mov dh, 2 ; 2 bytes pushed to stack
|
---|
| 104 | jmp PrintString_JumpToFormat
|
---|