[88] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 2 | ; Description : Functions for printing drive configuration
|
---|
| 3 | ; information on Boot Menu.
|
---|
| 4 |
|
---|
| 5 | ; Section containing code
|
---|
| 6 | SECTION .text
|
---|
| 7 |
|
---|
| 8 | ;--------------------------------------------------------------------
|
---|
| 9 | ; Prints Hard Disk configuration for drive handled by our BIOS.
|
---|
| 10 | ; Cursor is set to configuration header string position.
|
---|
| 11 | ;
|
---|
| 12 | ; BootMenuPrintCfg_ForOurDrive
|
---|
| 13 | ; Parameters:
|
---|
[127] | 14 | ; DS: Segment to DPT
|
---|
| 15 | ; Stack: Offset to DPT
|
---|
[3] | 16 | ; Returns:
|
---|
| 17 | ; Nothing
|
---|
| 18 | ; Corrupts registers:
|
---|
[150] | 19 | ; AX, BX, CX, DX, SI, DI
|
---|
[3] | 20 | ;--------------------------------------------------------------------
|
---|
| 21 | ALIGN JUMP_ALIGN
|
---|
| 22 | BootMenuPrintCfg_ForOurDrive:
|
---|
[127] | 23 | pop di
|
---|
[96] | 24 | mov si, g_szCfgHeader
|
---|
| 25 | call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
|
---|
[150] | 26 | eMOVZX ax, BYTE [di+DPT.bIdevarsOffset]
|
---|
| 27 | xchg si, ax ; CS:SI now points to IDEVARS
|
---|
[96] | 28 | ; Fall to PushAndFormatCfgString
|
---|
[3] | 29 |
|
---|
| 30 | ;--------------------------------------------------------------------
|
---|
[96] | 31 | ; PushAndFormatCfgString
|
---|
[3] | 32 | ; Parameters:
|
---|
| 33 | ; DS:DI: Ptr to DPT
|
---|
| 34 | ; CS:SI: Ptr to IDEVARS
|
---|
| 35 | ; Returns:
|
---|
| 36 | ; Nothing
|
---|
| 37 | ; Corrupts registers:
|
---|
[88] | 38 | ; AX, DX, SI, DI
|
---|
[3] | 39 | ;--------------------------------------------------------------------
|
---|
[96] | 40 | PushAndFormatCfgString:
|
---|
[88] | 41 | push bp
|
---|
| 42 | mov bp, sp
|
---|
[3] | 43 | ; Fall to first push below
|
---|
| 44 |
|
---|
| 45 | ;--------------------------------------------------------------------
|
---|
[88] | 46 | ; PushAddressingMode
|
---|
[3] | 47 | ; Parameters:
|
---|
| 48 | ; DS:DI: Ptr to DPT
|
---|
| 49 | ; CS:SI: Ptr to IDEVARS
|
---|
| 50 | ; Returns:
|
---|
[88] | 51 | ; Nothing (jumps to next push below)
|
---|
[3] | 52 | ; Corrupts registers:
|
---|
[96] | 53 | ; AX
|
---|
[3] | 54 | ;--------------------------------------------------------------------
|
---|
[88] | 55 | PushAddressingMode:
|
---|
[150] | 56 | call AccessDPT_GetAddressingModeForWordLookToBX
|
---|
[182] | 57 | mov al,g_szAddressingModes_Displacement
|
---|
| 58 | mul bl
|
---|
| 59 | add ax,g_szAddressingModes
|
---|
| 60 | push ax
|
---|
| 61 | ;
|
---|
| 62 | ; Ensure that addressing modes are correctly spaced in memory
|
---|
| 63 | ;
|
---|
| 64 | %if g_szLCHS <> g_szAddressingModes
|
---|
| 65 | %error "g_szAddressingModes Displacement Incorrect 1"
|
---|
| 66 | %endif
|
---|
| 67 | %if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
|
---|
| 68 | %error "g_szAddressingModes Displacement Incorrect 2"
|
---|
| 69 | %endif
|
---|
| 70 | %if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement
|
---|
| 71 | %error "g_szAddressingModes Displacement Incorrect 3"
|
---|
| 72 | %endif
|
---|
| 73 | %if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement
|
---|
| 74 | %error "g_szAddressingModes Displacement Incorrect 4"
|
---|
| 75 | %endif
|
---|
| 76 |
|
---|
[3] | 77 | ;--------------------------------------------------------------------
|
---|
[88] | 78 | ; PushBlockMode
|
---|
[3] | 79 | ; Parameters:
|
---|
| 80 | ; DS:DI: Ptr to DPT
|
---|
| 81 | ; CS:SI: Ptr to IDEVARS
|
---|
| 82 | ; Returns:
|
---|
| 83 | ; Nothing (falls to next push below)
|
---|
| 84 | ; Corrupts registers:
|
---|
[88] | 85 | ; AX
|
---|
[3] | 86 | ;--------------------------------------------------------------------
|
---|
[88] | 87 | PushBlockMode:
|
---|
[150] | 88 | mov ax, 1
|
---|
[158] | 89 | test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
|
---|
[150] | 90 | jz SHORT .PushBlockSizeFromAX
|
---|
| 91 | mov al, [di+DPT_ATA.bSetBlock]
|
---|
| 92 | .PushBlockSizeFromAX:
|
---|
[3] | 93 | push ax
|
---|
| 94 |
|
---|
| 95 | ;--------------------------------------------------------------------
|
---|
[88] | 96 | ; PushBusType
|
---|
[3] | 97 | ; Parameters:
|
---|
| 98 | ; DS:DI: Ptr to DPT
|
---|
| 99 | ; CS:SI: Ptr to IDEVARS
|
---|
| 100 | ; Returns:
|
---|
| 101 | ; Nothing (jumps to next push below)
|
---|
| 102 | ; Corrupts registers:
|
---|
| 103 | ; AX, DX
|
---|
| 104 | ;--------------------------------------------------------------------
|
---|
[181] | 105 | ;PushBusType:
|
---|
[182] | 106 | mov al,g_szBusTypeValues_Displacement
|
---|
| 107 | mul BYTE [cs:si+IDEVARS.bDevice]
|
---|
| 108 | shr ax,1
|
---|
| 109 | add ax,g_szBusTypeValues
|
---|
| 110 | push ax
|
---|
[3] | 111 |
|
---|
[182] | 112 | ;
|
---|
| 113 | ; Ensure that bus type strings are correctly spaced in memory
|
---|
| 114 | ;
|
---|
| 115 | %if g_szBusTypeValues_8Dual <> g_szBusTypeValues
|
---|
| 116 | %error "g_szBusTypeValues Displacement Incorrect 1"
|
---|
| 117 | %endif
|
---|
| 118 | %if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
|
---|
| 119 | %error "g_szBusTypeValues Displacement Incorrect 2"
|
---|
| 120 | %endif
|
---|
| 121 | %if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
|
---|
| 122 | %error "g_szBusTypeValues Displacement Incorrect 3"
|
---|
| 123 | %endif
|
---|
| 124 | %if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement
|
---|
| 125 | %error "g_szBusTypeValues Displacement Incorrect 4"
|
---|
| 126 | %endif
|
---|
| 127 | %if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
|
---|
| 128 | %error "g_szBusTypeValues Displacement Incorrect 5"
|
---|
| 129 | %endif
|
---|
| 130 | %if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
|
---|
| 131 | %error "g_szBusTypeValues Displacement Incorrect 6"
|
---|
| 132 | %endif
|
---|
| 133 |
|
---|
[3] | 134 | ;--------------------------------------------------------------------
|
---|
[88] | 135 | ; PushIRQ
|
---|
[3] | 136 | ; Parameters:
|
---|
| 137 | ; DS:DI: Ptr to DPT
|
---|
| 138 | ; CS:SI: Ptr to IDEVARS
|
---|
| 139 | ; Returns:
|
---|
| 140 | ; Nothing (falls to next push below)
|
---|
| 141 | ; Corrupts registers:
|
---|
[88] | 142 | ; AX, DX
|
---|
[3] | 143 | ;--------------------------------------------------------------------
|
---|
[88] | 144 | PushIRQ:
|
---|
| 145 | mov dl, ' ' ; Load space to DL
|
---|
| 146 | mov al, [cs:si+IDEVARS.bIRQ]
|
---|
| 147 | test al, al ; Interrupts disabled?
|
---|
| 148 | jz SHORT .PushIrqDisabled
|
---|
| 149 | add al, '0' ; Digit to ASCII
|
---|
| 150 | cmp al, '9' ; Only one digit needed?
|
---|
| 151 | jbe SHORT .PushCharacters
|
---|
| 152 |
|
---|
| 153 | ; Two digits needed
|
---|
| 154 | sub al, 10 ; Limit to single digit ASCII
|
---|
| 155 | mov dl, '1' ; Load '1 to DX
|
---|
| 156 | jmp SHORT .PushCharacters
|
---|
| 157 | ALIGN JUMP_ALIGN
|
---|
| 158 | .PushIrqDisabled:
|
---|
| 159 | mov al, '-' ; Load line to AL
|
---|
| 160 | xchg ax, dx ; Space to AL, line to DL
|
---|
| 161 | ALIGN JUMP_ALIGN
|
---|
| 162 | .PushCharacters:
|
---|
| 163 | push dx
|
---|
[3] | 164 | push ax
|
---|
| 165 |
|
---|
| 166 | ;--------------------------------------------------------------------
|
---|
[88] | 167 | ; PushResetStatus
|
---|
[3] | 168 | ; Parameters:
|
---|
| 169 | ; DS:DI: Ptr to DPT
|
---|
| 170 | ; CS:SI: Ptr to IDEVARS
|
---|
| 171 | ; Returns:
|
---|
[88] | 172 | ; Nothing (falls to next push below)
|
---|
[3] | 173 | ; Corrupts registers:
|
---|
[88] | 174 | ; AX
|
---|
[3] | 175 | ;--------------------------------------------------------------------
|
---|
[88] | 176 | PushResetStatus:
|
---|
[158] | 177 | mov al, [di+DPT.bFlagsHigh]
|
---|
| 178 | and ax, MASKH_DPT_RESET
|
---|
[88] | 179 | push ax
|
---|
[3] | 180 |
|
---|
| 181 | ;--------------------------------------------------------------------
|
---|
[96] | 182 | ; PrintValuesFromStack
|
---|
[3] | 183 | ; Parameters:
|
---|
| 184 | ; Stack: All formatting parameters
|
---|
| 185 | ; Returns:
|
---|
| 186 | ; Nothing
|
---|
| 187 | ; Corrupts registers:
|
---|
[88] | 188 | ; AX, SI, DI
|
---|
[3] | 189 | ;--------------------------------------------------------------------
|
---|
[96] | 190 | PrintValuesFromStack:
|
---|
[3] | 191 | mov si, g_szCfgFormat
|
---|
[127] | 192 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
|
---|
[96] | 193 |
|
---|