[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 |
---|
| 57 | push WORD [cs:bx+rgszAddressingModeString] |
---|
[3] | 58 | |
---|
| 59 | ;-------------------------------------------------------------------- |
---|
[88] | 60 | ; PushBlockMode |
---|
[3] | 61 | ; Parameters: |
---|
| 62 | ; DS:DI: Ptr to DPT |
---|
| 63 | ; CS:SI: Ptr to IDEVARS |
---|
| 64 | ; Returns: |
---|
| 65 | ; Nothing (falls to next push below) |
---|
| 66 | ; Corrupts registers: |
---|
[88] | 67 | ; AX |
---|
[3] | 68 | ;-------------------------------------------------------------------- |
---|
[88] | 69 | PushBlockMode: |
---|
[150] | 70 | mov ax, 1 |
---|
| 71 | test WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED |
---|
| 72 | jz SHORT .PushBlockSizeFromAX |
---|
| 73 | mov al, [di+DPT_ATA.bSetBlock] |
---|
| 74 | .PushBlockSizeFromAX: |
---|
[3] | 75 | push ax |
---|
| 76 | |
---|
| 77 | ;-------------------------------------------------------------------- |
---|
[88] | 78 | ; PushBusType |
---|
[3] | 79 | ; Parameters: |
---|
| 80 | ; DS:DI: Ptr to DPT |
---|
| 81 | ; CS:SI: Ptr to IDEVARS |
---|
| 82 | ; Returns: |
---|
| 83 | ; Nothing (jumps to next push below) |
---|
| 84 | ; Corrupts registers: |
---|
| 85 | ; AX, DX |
---|
| 86 | ;-------------------------------------------------------------------- |
---|
[88] | 87 | PushBusType: |
---|
[3] | 88 | xchg ax, bx ; Store BX to AX |
---|
[150] | 89 | eMOVZX bx, BYTE [cs:si+IDEVARS.bDevice] |
---|
| 90 | mov bx, [cs:bx+rgwBusTypeValues] ; Char to BL, Int to BH |
---|
[3] | 91 | eMOVZX dx, bh |
---|
[88] | 92 | push bx ; Push character |
---|
[150] | 93 | push dx ; Push 1, 8, 16 or 32 |
---|
[3] | 94 | xchg bx, ax ; Restore BX |
---|
| 95 | |
---|
| 96 | ;-------------------------------------------------------------------- |
---|
[88] | 97 | ; PushIRQ |
---|
[3] | 98 | ; Parameters: |
---|
| 99 | ; DS:DI: Ptr to DPT |
---|
| 100 | ; CS:SI: Ptr to IDEVARS |
---|
| 101 | ; Returns: |
---|
| 102 | ; Nothing (falls to next push below) |
---|
| 103 | ; Corrupts registers: |
---|
[88] | 104 | ; AX, DX |
---|
[3] | 105 | ;-------------------------------------------------------------------- |
---|
[88] | 106 | PushIRQ: |
---|
| 107 | mov dl, ' ' ; Load space to DL |
---|
| 108 | mov al, [cs:si+IDEVARS.bIRQ] |
---|
| 109 | test al, al ; Interrupts disabled? |
---|
| 110 | jz SHORT .PushIrqDisabled |
---|
| 111 | add al, '0' ; Digit to ASCII |
---|
| 112 | cmp al, '9' ; Only one digit needed? |
---|
| 113 | jbe SHORT .PushCharacters |
---|
| 114 | |
---|
| 115 | ; Two digits needed |
---|
| 116 | sub al, 10 ; Limit to single digit ASCII |
---|
| 117 | mov dl, '1' ; Load '1 to DX |
---|
| 118 | jmp SHORT .PushCharacters |
---|
| 119 | ALIGN JUMP_ALIGN |
---|
| 120 | .PushIrqDisabled: |
---|
| 121 | mov al, '-' ; Load line to AL |
---|
| 122 | xchg ax, dx ; Space to AL, line to DL |
---|
| 123 | ALIGN JUMP_ALIGN |
---|
| 124 | .PushCharacters: |
---|
| 125 | push dx |
---|
[3] | 126 | push ax |
---|
| 127 | |
---|
| 128 | ;-------------------------------------------------------------------- |
---|
[88] | 129 | ; PushResetStatus |
---|
[3] | 130 | ; Parameters: |
---|
| 131 | ; DS:DI: Ptr to DPT |
---|
| 132 | ; CS:SI: Ptr to IDEVARS |
---|
| 133 | ; Returns: |
---|
[88] | 134 | ; Nothing (falls to next push below) |
---|
[3] | 135 | ; Corrupts registers: |
---|
[88] | 136 | ; AX |
---|
[3] | 137 | ;-------------------------------------------------------------------- |
---|
[88] | 138 | PushResetStatus: |
---|
[150] | 139 | mov ax, [di+DPT.wFlags] |
---|
| 140 | and ax, MASK_DPT_RESET |
---|
[88] | 141 | push ax |
---|
[3] | 142 | |
---|
| 143 | ;-------------------------------------------------------------------- |
---|
[96] | 144 | ; PrintValuesFromStack |
---|
[3] | 145 | ; Parameters: |
---|
| 146 | ; Stack: All formatting parameters |
---|
| 147 | ; Returns: |
---|
| 148 | ; Nothing |
---|
| 149 | ; Corrupts registers: |
---|
[88] | 150 | ; AX, SI, DI |
---|
[3] | 151 | ;-------------------------------------------------------------------- |
---|
[96] | 152 | PrintValuesFromStack: |
---|
[3] | 153 | mov si, g_szCfgFormat |
---|
[127] | 154 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP |
---|
[96] | 155 | |
---|
| 156 | |
---|
[150] | 157 | ALIGN WORD_ALIGN |
---|
| 158 | rgszAddressingModeString: |
---|
| 159 | dw g_szLCHS |
---|
| 160 | dw g_szPCHS |
---|
| 161 | dw g_szLBA28 |
---|
| 162 | dw g_szLBA48 |
---|
| 163 | |
---|
| 164 | rgwBusTypeValues: |
---|
| 165 | db 'D', 8 ; DEVICE_8BIT_DUAL_PORT_XTIDE |
---|
| 166 | db 'X', 8 ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0 |
---|
| 167 | db 'S', 8 ; DEVICE_8BIT_SINGLE_PORT |
---|
| 168 | db ' ', 16 ; DEVICE_16BIT_ATA |
---|
| 169 | db ' ', 32 ; DEVICE_32BIT_ATA |
---|
| 170 | db ' ', 1 ; DEVICE_SERIAL_PORT |
---|