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
|
---|
20 | ;--------------------------------------------------------------------
|
---|
21 | ALIGN JUMP_ALIGN
|
---|
22 | BootMenuPrintCfg_ForOurDrive:
|
---|
23 | pop di
|
---|
24 | mov si, g_szCfgHeader
|
---|
25 | call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
|
---|
26 | eMOVZX ax, BYTE [di+DPT.bIdevarsOffset]
|
---|
27 | xchg si, ax ; CS:SI now points to IDEVARS
|
---|
28 | ; Fall to PushAndFormatCfgString
|
---|
29 |
|
---|
30 | ;--------------------------------------------------------------------
|
---|
31 | ; PushAndFormatCfgString
|
---|
32 | ; Parameters:
|
---|
33 | ; DS:DI: Ptr to DPT
|
---|
34 | ; CS:SI: Ptr to IDEVARS
|
---|
35 | ; Returns:
|
---|
36 | ; Nothing
|
---|
37 | ; Corrupts registers:
|
---|
38 | ; AX, DX, SI, DI
|
---|
39 | ;--------------------------------------------------------------------
|
---|
40 | PushAndFormatCfgString:
|
---|
41 | push bp
|
---|
42 | mov bp, sp
|
---|
43 | ; Fall to first push below
|
---|
44 |
|
---|
45 | ;--------------------------------------------------------------------
|
---|
46 | ; PushAddressingMode
|
---|
47 | ; Parameters:
|
---|
48 | ; DS:DI: Ptr to DPT
|
---|
49 | ; CS:SI: Ptr to IDEVARS
|
---|
50 | ; Returns:
|
---|
51 | ; Nothing (jumps to next push below)
|
---|
52 | ; Corrupts registers:
|
---|
53 | ; AX
|
---|
54 | ;--------------------------------------------------------------------
|
---|
55 | PushAddressingMode:
|
---|
56 | call AccessDPT_GetAddressingModeForWordLookToBX
|
---|
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 |
|
---|
77 | ;--------------------------------------------------------------------
|
---|
78 | ; PushBlockMode
|
---|
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:
|
---|
85 | ; AX
|
---|
86 | ;--------------------------------------------------------------------
|
---|
87 | PushBlockMode:
|
---|
88 | mov ax, 1
|
---|
89 | test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
|
---|
90 | jz SHORT .PushBlockSizeFromAX
|
---|
91 | mov al, [di+DPT_ATA.bSetBlock]
|
---|
92 | .PushBlockSizeFromAX:
|
---|
93 | push ax
|
---|
94 |
|
---|
95 | ;--------------------------------------------------------------------
|
---|
96 | ; PushBusType
|
---|
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 | ;--------------------------------------------------------------------
|
---|
105 | ;PushBusType:
|
---|
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
|
---|
111 |
|
---|
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 |
|
---|
134 | ;--------------------------------------------------------------------
|
---|
135 | ; PushIRQ
|
---|
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:
|
---|
142 | ; AX, DX
|
---|
143 | ;--------------------------------------------------------------------
|
---|
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
|
---|
164 | push ax
|
---|
165 |
|
---|
166 | ;--------------------------------------------------------------------
|
---|
167 | ; PushResetStatus
|
---|
168 | ; Parameters:
|
---|
169 | ; DS:DI: Ptr to DPT
|
---|
170 | ; CS:SI: Ptr to IDEVARS
|
---|
171 | ; Returns:
|
---|
172 | ; Nothing (falls to next push below)
|
---|
173 | ; Corrupts registers:
|
---|
174 | ; AX
|
---|
175 | ;--------------------------------------------------------------------
|
---|
176 | PushResetStatus:
|
---|
177 | mov al, [di+DPT.bFlagsHigh]
|
---|
178 | and ax, MASKH_DPT_RESET
|
---|
179 | push ax
|
---|
180 |
|
---|
181 | ;--------------------------------------------------------------------
|
---|
182 | ; PrintValuesFromStack
|
---|
183 | ; Parameters:
|
---|
184 | ; Stack: All formatting parameters
|
---|
185 | ; Returns:
|
---|
186 | ; Nothing
|
---|
187 | ; Corrupts registers:
|
---|
188 | ; AX, SI, DI
|
---|
189 | ;--------------------------------------------------------------------
|
---|
190 | PrintValuesFromStack:
|
---|
191 | mov si, g_szCfgFormat
|
---|
192 | jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
|
---|
193 |
|
---|