source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm@ 102

Last change on this file since 102 was 96, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • Cleaned boot loader code some more.
File size: 5.3 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for printing drive configuration
3; information on Boot Menu.
4
5; Section containing code
6SECTION .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:DI: Ptr to DPT
15; Returns:
16; Nothing
17; Corrupts registers:
18; AX, BX, CX, DX, SI, DI, ES
19;--------------------------------------------------------------------
20ALIGN JUMP_ALIGN
21BootMenuPrintCfg_ForOurDrive:
22 mov si, g_szCfgHeader
23 call BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
24 call BootMenuPrintCfg_GetPointers
25 ; Fall to PushAndFormatCfgString
26
27
28;--------------------------------------------------------------------
29; PushAndFormatCfgString
30; Parameters:
31; DS:DI: Ptr to DPT
32; ES:BX: Ptr to BOOTNFO
33; CS:SI: Ptr to IDEVARS
34; Returns:
35; Nothing
36; Corrupts registers:
37; AX, DX, SI, DI
38;--------------------------------------------------------------------
39ALIGN JUMP_ALIGN
40PushAndFormatCfgString:
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; ES:BX: Ptr to BOOTNFO
50; CS:SI: Ptr to IDEVARS
51; Returns:
52; Nothing (jumps to next push below)
53; Corrupts registers:
54; AX
55;--------------------------------------------------------------------
56PushAddressingMode:
57 xchg ax, bx
58 mov bx, MASK_DPT_ADDR ; Load addressing mode mask
59 and bl, [di+DPT.bFlags] ; Addressing mode now in BX
60 push WORD [cs:bx+.rgszAddressingModeString]
61 xchg bx, ax
62 jmp SHORT .NextPush
63ALIGN WORD_ALIGN
64.rgszAddressingModeString:
65 dw g_szLCHS
66 dw g_szPCHS
67 dw g_szLBA28
68 dw g_szLBA48
69ALIGN JUMP_ALIGN
70.NextPush:
71
72;--------------------------------------------------------------------
73; PushBlockMode
74; Parameters:
75; DS:DI: Ptr to DPT
76; ES:BX: Ptr to BOOTNFO
77; CS:SI: Ptr to IDEVARS
78; Returns:
79; Nothing (falls to next push below)
80; Corrupts registers:
81; AX
82;--------------------------------------------------------------------
83PushBlockMode:
84 eMOVZX ax, BYTE [di+DPT.bSetBlock]
85 push ax
86
87;--------------------------------------------------------------------
88; PushBusType
89; Parameters:
90; DS:DI: Ptr to DPT
91; ES:BX: Ptr to BOOTNFO
92; CS:SI: Ptr to IDEVARS
93; Returns:
94; Nothing (jumps to next push below)
95; Corrupts registers:
96; AX, DX
97;--------------------------------------------------------------------
98PushBusType:
99 xchg ax, bx ; Store BX to AX
100 eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType]
101 mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH
102 eMOVZX dx, bh
103 push bx ; Push character
104 push dx ; Push 8, 16 or 32
105 xchg bx, ax ; Restore BX
106 jmp SHORT .NextPush
107ALIGN WORD_ALIGN
108.rgwBusTypeValues:
109 db 'D', 8 ; BUS_TYPE_8_DUAL
110 db ' ', 16 ; BUS_TYPE_16
111 db ' ', 32 ; BUS_TYPE_32
112 db 'S', 8 ; BUS_TYPE_8_SINGLE
113ALIGN JUMP_ALIGN
114.NextPush:
115
116;--------------------------------------------------------------------
117; PushIRQ
118; Parameters:
119; DS:DI: Ptr to DPT
120; ES:BX: Ptr to BOOTNFO
121; CS:SI: Ptr to IDEVARS
122; Returns:
123; Nothing (falls to next push below)
124; Corrupts registers:
125; AX, DX
126;--------------------------------------------------------------------
127PushIRQ:
128 mov dl, ' ' ; Load space to DL
129 mov al, [cs:si+IDEVARS.bIRQ]
130 test al, al ; Interrupts disabled?
131 jz SHORT .PushIrqDisabled
132 add al, '0' ; Digit to ASCII
133 cmp al, '9' ; Only one digit needed?
134 jbe SHORT .PushCharacters
135
136 ; Two digits needed
137 sub al, 10 ; Limit to single digit ASCII
138 mov dl, '1' ; Load '1 to DX
139 jmp SHORT .PushCharacters
140ALIGN JUMP_ALIGN
141.PushIrqDisabled:
142 mov al, '-' ; Load line to AL
143 xchg ax, dx ; Space to AL, line to DL
144ALIGN JUMP_ALIGN
145.PushCharacters:
146 push dx
147 push ax
148
149;--------------------------------------------------------------------
150; PushResetStatus
151; Parameters:
152; DS:DI: Ptr to DPT
153; ES:BX: Ptr to BOOTNFO
154; CS:SI: Ptr to IDEVARS
155; Returns:
156; Nothing (falls to next push below)
157; Corrupts registers:
158; AX
159;--------------------------------------------------------------------
160PushResetStatus:
161 eMOVZX ax, BYTE [di+DPT.bReset]
162 push ax
163
164;--------------------------------------------------------------------
165; PrintValuesFromStack
166; Parameters:
167; Stack: All formatting parameters
168; Returns:
169; Nothing
170; Corrupts registers:
171; AX, SI, DI
172;--------------------------------------------------------------------
173PrintValuesFromStack:
174 mov si, g_szCfgFormat
175 jmp BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
176
177
178;--------------------------------------------------------------------
179; BootMenuPrintCfg_GetPointers
180; Parameters:
181; DS:DI: Ptr to DPT
182; Returns:
183; DS:DI: Ptr to DPT
184; ES:BX: Ptr to BOOTNFO
185; CS:SI: Ptr to IDEVARS
186; Corrupts registers:
187; AX, DL
188;--------------------------------------------------------------------
189ALIGN JUMP_ALIGN
190BootMenuPrintCfg_GetPointers:
191 mov dl, [di+DPT.bDrvNum] ; Load Drive number to DL
192 call BootInfo_GetOffsetToBX ; ES:BX now points...
193 LOAD_BDA_SEGMENT_TO es, ax ; ...to BOOTNFO
194 mov al, [di+DPT.bIdeOff]
195 xchg si, ax ; CS:SI now points to IDEVARS
196 ret
Note: See TracBrowser for help on using the repository browser.