[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: |
---|
[88] | 19 | ; AX, BX, CX, DX, SI, DI, ES |
---|
[3] | 20 | ;-------------------------------------------------------------------- |
---|
| 21 | ALIGN JUMP_ALIGN |
---|
| 22 | BootMenuPrintCfg_ForOurDrive: |
---|
[127] | 23 | pop di |
---|
[96] | 24 | mov si, g_szCfgHeader |
---|
| 25 | call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF |
---|
[3] | 26 | call BootMenuPrintCfg_GetPointers |
---|
[96] | 27 | ; Fall to PushAndFormatCfgString |
---|
[3] | 28 | |
---|
| 29 | |
---|
| 30 | ;-------------------------------------------------------------------- |
---|
[96] | 31 | ; PushAndFormatCfgString |
---|
[3] | 32 | ; Parameters: |
---|
| 33 | ; DS:DI: Ptr to DPT |
---|
| 34 | ; ES:BX: Ptr to BOOTNFO |
---|
| 35 | ; CS:SI: Ptr to IDEVARS |
---|
| 36 | ; Returns: |
---|
| 37 | ; Nothing |
---|
| 38 | ; Corrupts registers: |
---|
[88] | 39 | ; AX, DX, SI, DI |
---|
[3] | 40 | ;-------------------------------------------------------------------- |
---|
[96] | 41 | PushAndFormatCfgString: |
---|
[88] | 42 | push bp |
---|
| 43 | mov bp, sp |
---|
[3] | 44 | ; Fall to first push below |
---|
| 45 | |
---|
| 46 | ;-------------------------------------------------------------------- |
---|
[88] | 47 | ; PushAddressingMode |
---|
[3] | 48 | ; Parameters: |
---|
| 49 | ; DS:DI: Ptr to DPT |
---|
| 50 | ; ES:BX: Ptr to BOOTNFO |
---|
| 51 | ; CS:SI: Ptr to IDEVARS |
---|
| 52 | ; Returns: |
---|
[88] | 53 | ; Nothing (jumps to next push below) |
---|
[3] | 54 | ; Corrupts registers: |
---|
[96] | 55 | ; AX |
---|
[3] | 56 | ;-------------------------------------------------------------------- |
---|
[88] | 57 | PushAddressingMode: |
---|
[96] | 58 | xchg ax, bx |
---|
[88] | 59 | mov bx, MASK_DPT_ADDR ; Load addressing mode mask |
---|
| 60 | and bl, [di+DPT.bFlags] ; Addressing mode now in BX |
---|
| 61 | push WORD [cs:bx+.rgszAddressingModeString] |
---|
[96] | 62 | xchg bx, ax |
---|
[88] | 63 | jmp SHORT .NextPush |
---|
| 64 | ALIGN WORD_ALIGN |
---|
| 65 | .rgszAddressingModeString: |
---|
| 66 | dw g_szLCHS |
---|
| 67 | dw g_szPCHS |
---|
| 68 | dw g_szLBA28 |
---|
| 69 | dw g_szLBA48 |
---|
| 70 | ALIGN JUMP_ALIGN |
---|
| 71 | .NextPush: |
---|
[3] | 72 | |
---|
| 73 | ;-------------------------------------------------------------------- |
---|
[88] | 74 | ; PushBlockMode |
---|
[3] | 75 | ; Parameters: |
---|
| 76 | ; DS:DI: Ptr to DPT |
---|
| 77 | ; ES:BX: Ptr to BOOTNFO |
---|
| 78 | ; CS:SI: Ptr to IDEVARS |
---|
| 79 | ; Returns: |
---|
| 80 | ; Nothing (falls to next push below) |
---|
| 81 | ; Corrupts registers: |
---|
[88] | 82 | ; AX |
---|
[3] | 83 | ;-------------------------------------------------------------------- |
---|
[88] | 84 | PushBlockMode: |
---|
| 85 | eMOVZX ax, BYTE [di+DPT.bSetBlock] |
---|
[3] | 86 | push ax |
---|
| 87 | |
---|
| 88 | ;-------------------------------------------------------------------- |
---|
[88] | 89 | ; PushBusType |
---|
[3] | 90 | ; Parameters: |
---|
| 91 | ; DS:DI: Ptr to DPT |
---|
| 92 | ; ES:BX: Ptr to BOOTNFO |
---|
| 93 | ; CS:SI: Ptr to IDEVARS |
---|
| 94 | ; Returns: |
---|
| 95 | ; Nothing (jumps to next push below) |
---|
| 96 | ; Corrupts registers: |
---|
| 97 | ; AX, DX |
---|
| 98 | ;-------------------------------------------------------------------- |
---|
[88] | 99 | PushBusType: |
---|
[3] | 100 | xchg ax, bx ; Store BX to AX |
---|
| 101 | eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType] |
---|
[116] | 102 | mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH |
---|
[3] | 103 | eMOVZX dx, bh |
---|
[88] | 104 | push bx ; Push character |
---|
[3] | 105 | push dx ; Push 8, 16 or 32 |
---|
| 106 | xchg bx, ax ; Restore BX |
---|
| 107 | jmp SHORT .NextPush |
---|
| 108 | ALIGN WORD_ALIGN |
---|
| 109 | .rgwBusTypeValues: |
---|
| 110 | db 'D', 8 ; BUS_TYPE_8_DUAL |
---|
| 111 | db ' ', 16 ; BUS_TYPE_16 |
---|
| 112 | db ' ', 32 ; BUS_TYPE_32 |
---|
| 113 | db 'S', 8 ; BUS_TYPE_8_SINGLE |
---|
| 114 | ALIGN JUMP_ALIGN |
---|
| 115 | .NextPush: |
---|
| 116 | |
---|
| 117 | ;-------------------------------------------------------------------- |
---|
[88] | 118 | ; PushIRQ |
---|
[3] | 119 | ; Parameters: |
---|
| 120 | ; DS:DI: Ptr to DPT |
---|
| 121 | ; ES:BX: Ptr to BOOTNFO |
---|
| 122 | ; CS:SI: Ptr to IDEVARS |
---|
| 123 | ; Returns: |
---|
| 124 | ; Nothing (falls to next push below) |
---|
| 125 | ; Corrupts registers: |
---|
[88] | 126 | ; AX, DX |
---|
[3] | 127 | ;-------------------------------------------------------------------- |
---|
[88] | 128 | PushIRQ: |
---|
| 129 | mov dl, ' ' ; Load space to DL |
---|
| 130 | mov al, [cs:si+IDEVARS.bIRQ] |
---|
| 131 | test al, al ; Interrupts disabled? |
---|
| 132 | jz SHORT .PushIrqDisabled |
---|
| 133 | add al, '0' ; Digit to ASCII |
---|
| 134 | cmp al, '9' ; Only one digit needed? |
---|
| 135 | jbe SHORT .PushCharacters |
---|
| 136 | |
---|
| 137 | ; Two digits needed |
---|
| 138 | sub al, 10 ; Limit to single digit ASCII |
---|
| 139 | mov dl, '1' ; Load '1 to DX |
---|
| 140 | jmp SHORT .PushCharacters |
---|
| 141 | ALIGN JUMP_ALIGN |
---|
| 142 | .PushIrqDisabled: |
---|
| 143 | mov al, '-' ; Load line to AL |
---|
| 144 | xchg ax, dx ; Space to AL, line to DL |
---|
| 145 | ALIGN JUMP_ALIGN |
---|
| 146 | .PushCharacters: |
---|
| 147 | push dx |
---|
[3] | 148 | push ax |
---|
| 149 | |
---|
| 150 | ;-------------------------------------------------------------------- |
---|
[88] | 151 | ; PushResetStatus |
---|
[3] | 152 | ; Parameters: |
---|
| 153 | ; DS:DI: Ptr to DPT |
---|
| 154 | ; ES:BX: Ptr to BOOTNFO |
---|
| 155 | ; CS:SI: Ptr to IDEVARS |
---|
| 156 | ; Returns: |
---|
[88] | 157 | ; Nothing (falls to next push below) |
---|
[3] | 158 | ; Corrupts registers: |
---|
[88] | 159 | ; AX |
---|
[3] | 160 | ;-------------------------------------------------------------------- |
---|
[88] | 161 | PushResetStatus: |
---|
| 162 | eMOVZX ax, BYTE [di+DPT.bReset] |
---|
| 163 | push ax |
---|
[3] | 164 | |
---|
| 165 | ;-------------------------------------------------------------------- |
---|
[96] | 166 | ; PrintValuesFromStack |
---|
[3] | 167 | ; Parameters: |
---|
| 168 | ; Stack: All formatting parameters |
---|
| 169 | ; Returns: |
---|
| 170 | ; Nothing |
---|
| 171 | ; Corrupts registers: |
---|
[88] | 172 | ; AX, SI, DI |
---|
[3] | 173 | ;-------------------------------------------------------------------- |
---|
[96] | 174 | PrintValuesFromStack: |
---|
[3] | 175 | mov si, g_szCfgFormat |
---|
[127] | 176 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP |
---|
[96] | 177 | |
---|
| 178 | |
---|
| 179 | ;-------------------------------------------------------------------- |
---|
| 180 | ; BootMenuPrintCfg_GetPointers |
---|
| 181 | ; Parameters: |
---|
| 182 | ; DS:DI: Ptr to DPT |
---|
| 183 | ; Returns: |
---|
| 184 | ; DS:DI: Ptr to DPT |
---|
| 185 | ; ES:BX: Ptr to BOOTNFO |
---|
| 186 | ; CS:SI: Ptr to IDEVARS |
---|
| 187 | ; Corrupts registers: |
---|
| 188 | ; AX, DL |
---|
| 189 | ;-------------------------------------------------------------------- |
---|
| 190 | ALIGN JUMP_ALIGN |
---|
| 191 | BootMenuPrintCfg_GetPointers: |
---|
| 192 | mov dl, [di+DPT.bDrvNum] ; Load Drive number to DL |
---|
| 193 | call BootInfo_GetOffsetToBX ; ES:BX now points... |
---|
[116] | 194 | LOAD_BDA_SEGMENT_TO es, ax, ! ; ...to BOOTNFO |
---|
[96] | 195 | mov al, [di+DPT.bIdeOff] |
---|
| 196 | xchg si, ax ; CS:SI now points to IDEVARS |
---|
| 197 | ret |
---|