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