1 | ; Project name : XTIDE Universal BIOS
|
---|
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: Segment to DPT
|
---|
15 | ; Stack: Offset to DPT
|
---|
16 | ; Returns:
|
---|
17 | ; Nothing
|
---|
18 | ; Corrupts registers:
|
---|
19 | ; AX, BX, CX, DX, SI, DI, ES
|
---|
20 | ;--------------------------------------------------------------------
|
---|
21 | ALIGN JUMP_ALIGN
|
---|
22 | BootMenuPrintCfg_ForOurDrive:
|
---|
23 | pop di
|
---|
24 | mov si, g_szCfgHeader
|
---|
25 | call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
|
---|
26 | call BootMenuPrintCfg_GetPointers
|
---|
27 | ; Fall to PushAndFormatCfgString
|
---|
28 |
|
---|
29 |
|
---|
30 | ;--------------------------------------------------------------------
|
---|
31 | ; PushAndFormatCfgString
|
---|
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:
|
---|
39 | ; AX, DX, SI, DI
|
---|
40 | ;--------------------------------------------------------------------
|
---|
41 | PushAndFormatCfgString:
|
---|
42 | push bp
|
---|
43 | mov bp, sp
|
---|
44 | ; Fall to first push below
|
---|
45 |
|
---|
46 | ;--------------------------------------------------------------------
|
---|
47 | ; PushAddressingMode
|
---|
48 | ; Parameters:
|
---|
49 | ; DS:DI: Ptr to DPT
|
---|
50 | ; ES:BX: Ptr to BOOTNFO
|
---|
51 | ; CS:SI: Ptr to IDEVARS
|
---|
52 | ; Returns:
|
---|
53 | ; Nothing (jumps to next push below)
|
---|
54 | ; Corrupts registers:
|
---|
55 | ; AX
|
---|
56 | ;--------------------------------------------------------------------
|
---|
57 | PushAddressingMode:
|
---|
58 | xchg ax, bx
|
---|
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]
|
---|
62 | xchg bx, ax
|
---|
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:
|
---|
72 |
|
---|
73 | ;--------------------------------------------------------------------
|
---|
74 | ; PushBlockMode
|
---|
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:
|
---|
82 | ; AX
|
---|
83 | ;--------------------------------------------------------------------
|
---|
84 | PushBlockMode:
|
---|
85 | eMOVZX ax, BYTE [di+DPT.bSetBlock]
|
---|
86 | push ax
|
---|
87 |
|
---|
88 | ;--------------------------------------------------------------------
|
---|
89 | ; PushBusType
|
---|
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 | ;--------------------------------------------------------------------
|
---|
99 | PushBusType:
|
---|
100 | xchg ax, bx ; Store BX to AX
|
---|
101 | eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType]
|
---|
102 | mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH
|
---|
103 | eMOVZX dx, bh
|
---|
104 | push bx ; Push character
|
---|
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 | ;--------------------------------------------------------------------
|
---|
118 | ; PushIRQ
|
---|
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:
|
---|
126 | ; AX, DX
|
---|
127 | ;--------------------------------------------------------------------
|
---|
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
|
---|
148 | push ax
|
---|
149 |
|
---|
150 | ;--------------------------------------------------------------------
|
---|
151 | ; PushResetStatus
|
---|
152 | ; Parameters:
|
---|
153 | ; DS:DI: Ptr to DPT
|
---|
154 | ; ES:BX: Ptr to BOOTNFO
|
---|
155 | ; CS:SI: Ptr to IDEVARS
|
---|
156 | ; Returns:
|
---|
157 | ; Nothing (falls to next push below)
|
---|
158 | ; Corrupts registers:
|
---|
159 | ; AX
|
---|
160 | ;--------------------------------------------------------------------
|
---|
161 | PushResetStatus:
|
---|
162 | eMOVZX ax, BYTE [di+DPT.bReset]
|
---|
163 | push ax
|
---|
164 |
|
---|
165 | ;--------------------------------------------------------------------
|
---|
166 | ; PrintValuesFromStack
|
---|
167 | ; Parameters:
|
---|
168 | ; Stack: All formatting parameters
|
---|
169 | ; Returns:
|
---|
170 | ; Nothing
|
---|
171 | ; Corrupts registers:
|
---|
172 | ; AX, SI, DI
|
---|
173 | ;--------------------------------------------------------------------
|
---|
174 | PrintValuesFromStack:
|
---|
175 | mov si, g_szCfgFormat
|
---|
176 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
|
---|
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...
|
---|
194 | LOAD_BDA_SEGMENT_TO es, ax, ! ; ...to BOOTNFO
|
---|
195 | mov al, [di+DPT.bIdeOff]
|
---|
196 | xchg si, ax ; CS:SI now points to IDEVARS
|
---|
197 | ret
|
---|