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