1 | ; File name : BootMenuPrintCfg.asm |
---|
2 | ; Project name : IDE BIOS |
---|
3 | ; Created date : 28.3.2010 |
---|
4 | ; Last update : 9.4.2010 |
---|
5 | ; Author : Tomi Tilli |
---|
6 | ; Description : Functions for printing drive configuration |
---|
7 | ; information on Boot Menu. |
---|
8 | |
---|
9 | ; Section containing code |
---|
10 | SECTION .text |
---|
11 | |
---|
12 | ;-------------------------------------------------------------------- |
---|
13 | ; Prints Hard Disk configuration for drive handled by our BIOS. |
---|
14 | ; Cursor is set to configuration header string position. |
---|
15 | ; |
---|
16 | ; BootMenuPrintCfg_ForOurDrive |
---|
17 | ; Parameters: |
---|
18 | ; DS:DI: Ptr to DPT |
---|
19 | ; Returns: |
---|
20 | ; Nothing |
---|
21 | ; Corrupts registers: |
---|
22 | ; AX, BX, CX, DX, SI, ES |
---|
23 | ;-------------------------------------------------------------------- |
---|
24 | ALIGN JUMP_ALIGN |
---|
25 | BootMenuPrintCfg_ForOurDrive: |
---|
26 | call BootMenuPrintCfg_HeaderAndChangeLine |
---|
27 | call BootMenuPrintCfg_GetPointers |
---|
28 | call BootMenuPrintCfg_PushAndFormatCfgString |
---|
29 | jmp BootMenuPrint_ClearOneInfoLine |
---|
30 | |
---|
31 | |
---|
32 | ;-------------------------------------------------------------------- |
---|
33 | ; Prints configuration header and changes for printing values. |
---|
34 | ; |
---|
35 | ; BootMenuPrintCfg_HeaderAndChangeLine |
---|
36 | ; Parameters: |
---|
37 | ; Nothing |
---|
38 | ; Returns: |
---|
39 | ; Nothing |
---|
40 | ; Corrupts registers: |
---|
41 | ; AX, BX, DX |
---|
42 | ;-------------------------------------------------------------------- |
---|
43 | ALIGN JUMP_ALIGN |
---|
44 | BootMenuPrintCfg_HeaderAndChangeLine: |
---|
45 | mov si, g_szCfgHeader |
---|
46 | call PrintString_FromCS |
---|
47 | jmp BootMenuPrint_ClearOneInfoLine |
---|
48 | |
---|
49 | |
---|
50 | ;-------------------------------------------------------------------- |
---|
51 | ; Return all necessary pointers to drive information structs. |
---|
52 | ; |
---|
53 | ; BootMenuPrintCfg_GetPointers |
---|
54 | ; Parameters: |
---|
55 | ; DS:DI: Ptr to DPT |
---|
56 | ; Returns: |
---|
57 | ; DS:DI: Ptr to DPT |
---|
58 | ; ES:BX: Ptr to BOOTNFO |
---|
59 | ; CS:SI: Ptr to IDEVARS |
---|
60 | ; Corrupts registers: |
---|
61 | ; AX, DL |
---|
62 | ;-------------------------------------------------------------------- |
---|
63 | ALIGN JUMP_ALIGN |
---|
64 | BootMenuPrintCfg_GetPointers: |
---|
65 | mov dl, [di+DPT.bDrvNum] ; Load Drive number to DL |
---|
66 | call BootInfo_GetOffsetToBX ; ES:BX now points... |
---|
67 | LOAD_BDA_SEGMENT_TO es, ax ; ...to BOOTNFO |
---|
68 | mov al, [di+DPT.bIdeOff] |
---|
69 | xchg si, ax ; CS:SI now points to IDEVARS |
---|
70 | ret |
---|
71 | |
---|
72 | |
---|
73 | ;-------------------------------------------------------------------- |
---|
74 | ; Pushes all string formatting parameters and prints |
---|
75 | ; formatted configuration string. |
---|
76 | ; |
---|
77 | ; BootMenuPrintCfg_PushAndFormatCfgString |
---|
78 | ; Parameters: |
---|
79 | ; DS:DI: Ptr to DPT |
---|
80 | ; ES:BX: Ptr to BOOTNFO |
---|
81 | ; CS:SI: Ptr to IDEVARS |
---|
82 | ; Returns: |
---|
83 | ; Nothing |
---|
84 | ; Corrupts registers: |
---|
85 | ; AX, CX, DX, SI |
---|
86 | ;-------------------------------------------------------------------- |
---|
87 | ALIGN JUMP_ALIGN |
---|
88 | BootMenuPrintCfg_PushAndFormatCfgString: |
---|
89 | ; Fall to first push below |
---|
90 | |
---|
91 | ;-------------------------------------------------------------------- |
---|
92 | ; BootMenuPrintCfg_PushResetStatus |
---|
93 | ; Parameters: |
---|
94 | ; DS:DI: Ptr to DPT |
---|
95 | ; ES:BX: Ptr to BOOTNFO |
---|
96 | ; CS:SI: Ptr to IDEVARS |
---|
97 | ; Returns: |
---|
98 | ; Nothing (falls to next push below) |
---|
99 | ; Corrupts registers: |
---|
100 | ; AX |
---|
101 | ;-------------------------------------------------------------------- |
---|
102 | BootMenuPrintCfg_PushResetStatus: |
---|
103 | eMOVZX ax, BYTE [di+DPT.bReset] |
---|
104 | push ax |
---|
105 | |
---|
106 | ;-------------------------------------------------------------------- |
---|
107 | ; BootMenuPrintCfg_PushIRQ |
---|
108 | ; Parameters: |
---|
109 | ; DS:DI: Ptr to DPT |
---|
110 | ; ES:BX: Ptr to BOOTNFO |
---|
111 | ; CS:SI: Ptr to IDEVARS |
---|
112 | ; Returns: |
---|
113 | ; Nothing (falls to next push below) |
---|
114 | ; Corrupts registers: |
---|
115 | ; AX, DX |
---|
116 | ;-------------------------------------------------------------------- |
---|
117 | BootMenuPrintCfg_PushIRQ: |
---|
118 | mov dl, ' ' ; Load space to DL |
---|
119 | mov al, [cs:si+IDEVARS.bIRQ] |
---|
120 | test al, al ; Interrupts disabled? |
---|
121 | jz SHORT .PushIrqDisabled |
---|
122 | add al, '0' ; Digit to ASCII |
---|
123 | cmp al, '9' ; Only one digit needed? |
---|
124 | jbe SHORT .PushCharacters |
---|
125 | |
---|
126 | ; Two digits needed |
---|
127 | sub al, 10 ; Limit to single digit ASCII |
---|
128 | mov dl, '1' ; Load '1 to DX |
---|
129 | jmp SHORT .PushCharacters |
---|
130 | ALIGN JUMP_ALIGN |
---|
131 | .PushIrqDisabled: |
---|
132 | mov al, '-' ; Load line to AL |
---|
133 | xchg ax, dx ; Space to AL, line to DL |
---|
134 | ALIGN JUMP_ALIGN |
---|
135 | .PushCharacters: |
---|
136 | push ax |
---|
137 | push dx |
---|
138 | |
---|
139 | ;-------------------------------------------------------------------- |
---|
140 | ; BootMenuPrintCfg_PushBusType |
---|
141 | ; Parameters: |
---|
142 | ; DS:DI: Ptr to DPT |
---|
143 | ; ES:BX: Ptr to BOOTNFO |
---|
144 | ; CS:SI: Ptr to IDEVARS |
---|
145 | ; Returns: |
---|
146 | ; Nothing (jumps to next push below) |
---|
147 | ; Corrupts registers: |
---|
148 | ; AX, DX |
---|
149 | ;-------------------------------------------------------------------- |
---|
150 | BootMenuPrintCfg_PushBusType: |
---|
151 | xchg ax, bx ; Store BX to AX |
---|
152 | eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType] |
---|
153 | mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH |
---|
154 | eMOVZX dx, bh |
---|
155 | push dx ; Push 8, 16 or 32 |
---|
156 | push bx ; Push character |
---|
157 | xchg bx, ax ; Restore BX |
---|
158 | jmp SHORT .NextPush |
---|
159 | ALIGN WORD_ALIGN |
---|
160 | .rgwBusTypeValues: |
---|
161 | db 'D', 8 ; BUS_TYPE_8_DUAL |
---|
162 | db ' ', 16 ; BUS_TYPE_16 |
---|
163 | db ' ', 32 ; BUS_TYPE_32 |
---|
164 | db 'S', 8 ; BUS_TYPE_8_SINGLE |
---|
165 | ALIGN JUMP_ALIGN |
---|
166 | .NextPush: |
---|
167 | |
---|
168 | ;-------------------------------------------------------------------- |
---|
169 | ; BootMenuPrintCfg_PushBlockMode |
---|
170 | ; Parameters: |
---|
171 | ; DS:DI: Ptr to DPT |
---|
172 | ; ES:BX: Ptr to BOOTNFO |
---|
173 | ; CS:SI: Ptr to IDEVARS |
---|
174 | ; Returns: |
---|
175 | ; Nothing (falls to next push below) |
---|
176 | ; Corrupts registers: |
---|
177 | ; AX |
---|
178 | ;-------------------------------------------------------------------- |
---|
179 | BootMenuPrintCfg_PushBlockMode: |
---|
180 | eMOVZX ax, BYTE [di+DPT.bSetBlock] |
---|
181 | push ax |
---|
182 | |
---|
183 | ;-------------------------------------------------------------------- |
---|
184 | ; BootMenuPrintCfg_PushAddressingMode |
---|
185 | ; Parameters: |
---|
186 | ; DS:DI: Ptr to DPT |
---|
187 | ; ES:BX: Ptr to BOOTNFO |
---|
188 | ; CS:SI: Ptr to IDEVARS |
---|
189 | ; Returns: |
---|
190 | ; Nothing (jumps to next push below) |
---|
191 | ; Corrupts registers: |
---|
192 | ; AX, DX |
---|
193 | ;-------------------------------------------------------------------- |
---|
194 | BootMenuPrintCfg_PushAddressingMode: |
---|
195 | mov dx, bx ; Backup BX to DX |
---|
196 | mov bx, MASK_DPT_ADDR ; Load addressing mode mask |
---|
197 | and bl, [di+DPT.bFlags] ; Addressing mode now in BX |
---|
198 | push WORD [cs:bx+.rgszAddressingModeString] |
---|
199 | mov bx, dx |
---|
200 | jmp SHORT .NextPush |
---|
201 | ALIGN WORD_ALIGN |
---|
202 | .rgszAddressingModeString: |
---|
203 | dw g_szLCHS |
---|
204 | dw g_szPCHS |
---|
205 | dw g_szLBA28 |
---|
206 | dw g_szLBA48 |
---|
207 | ALIGN JUMP_ALIGN |
---|
208 | .NextPush: |
---|
209 | |
---|
210 | ;-------------------------------------------------------------------- |
---|
211 | ; Prints formatted configuration string from parameters pushed to stack. |
---|
212 | ; |
---|
213 | ; BootMenuPrintCfg_ValuesFromStack |
---|
214 | ; Parameters: |
---|
215 | ; Stack: All formatting parameters |
---|
216 | ; Returns: |
---|
217 | ; Nothing |
---|
218 | ; Corrupts registers: |
---|
219 | ; AX, CX, DX, SI |
---|
220 | ;-------------------------------------------------------------------- |
---|
221 | BootMenuPrintCfg_ValuesFromStack: |
---|
222 | mov si, g_szCfgFormat |
---|
223 | mov dh, 14 ; 14 bytes pushed to stack |
---|
224 | jmp PrintString_JumpToFormat |
---|