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

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

Changes to XTIDE Universal BIOS:

  • Now uses new libraries (untested)
  • Non-working since code size is too large
File size: 6.1 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 call BootMenuPrintCfg_HeaderAndChangeLine
23 call BootMenuPrintCfg_GetPointers
24 call BootMenuPrintCfg_PushAndFormatCfgString
25 jmp BootMenuPrint_Newline
26
27
28;--------------------------------------------------------------------
29; Prints configuration header and changes for printing values.
30;
31; BootMenuPrintCfg_HeaderAndChangeLine
32; Parameters:
33; Nothing
34; Returns:
35; Nothing
36; Corrupts registers:
37; AX, SI, DI
38;--------------------------------------------------------------------
39ALIGN JUMP_ALIGN
40BootMenuPrintCfg_HeaderAndChangeLine:
41 mov si, g_szCfgHeader
42 call PrintNullTerminatedStringFromCSSIandSetCF
43 jmp BootMenuPrint_Newline
44
45
46;--------------------------------------------------------------------
47; Return all necessary pointers to drive information structs.
48;
49; BootMenuPrintCfg_GetPointers
50; Parameters:
51; DS:DI: Ptr to DPT
52; Returns:
53; DS:DI: Ptr to DPT
54; ES:BX: Ptr to BOOTNFO
55; CS:SI: Ptr to IDEVARS
56; Corrupts registers:
57; AX, DL
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60BootMenuPrintCfg_GetPointers:
61 mov dl, [di+DPT.bDrvNum] ; Load Drive number to DL
62 call BootInfo_GetOffsetToBX ; ES:BX now points...
63 LOAD_BDA_SEGMENT_TO es, ax ; ...to BOOTNFO
64 mov al, [di+DPT.bIdeOff]
65 xchg si, ax ; CS:SI now points to IDEVARS
66 ret
67
68
69;--------------------------------------------------------------------
70; Pushes all string formatting parameters and prints
71; formatted configuration string.
72;
73; BootMenuPrintCfg_PushAndFormatCfgString
74; Parameters:
75; DS:DI: Ptr to DPT
76; ES:BX: Ptr to BOOTNFO
77; CS:SI: Ptr to IDEVARS
78; Returns:
79; Nothing
80; Corrupts registers:
81; AX, DX, SI, DI
82;--------------------------------------------------------------------
83ALIGN JUMP_ALIGN
84BootMenuPrintCfg_PushAndFormatCfgString:
85 push bp
86
87 mov bp, sp
88 ; Fall to first push below
89
90;--------------------------------------------------------------------
91; PushAddressingMode
92; Parameters:
93; DS:DI: Ptr to DPT
94; ES:BX: Ptr to BOOTNFO
95; CS:SI: Ptr to IDEVARS
96; Returns:
97; Nothing (jumps to next push below)
98; Corrupts registers:
99; AX, DX
100;--------------------------------------------------------------------
101PushAddressingMode:
102 mov dx, bx ; Backup BX to DX
103 mov bx, MASK_DPT_ADDR ; Load addressing mode mask
104 and bl, [di+DPT.bFlags] ; Addressing mode now in BX
105 push WORD [cs:bx+.rgszAddressingModeString]
106 mov bx, dx
107 jmp SHORT .NextPush
108ALIGN WORD_ALIGN
109.rgszAddressingModeString:
110 dw g_szLCHS
111 dw g_szPCHS
112 dw g_szLBA28
113 dw g_szLBA48
114ALIGN JUMP_ALIGN
115.NextPush:
116
117;--------------------------------------------------------------------
118; PushBlockMode
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
127;--------------------------------------------------------------------
128PushBlockMode:
129 eMOVZX ax, BYTE [di+DPT.bSetBlock]
130 push ax
131
132;--------------------------------------------------------------------
133; PushBusType
134; Parameters:
135; DS:DI: Ptr to DPT
136; ES:BX: Ptr to BOOTNFO
137; CS:SI: Ptr to IDEVARS
138; Returns:
139; Nothing (jumps to next push below)
140; Corrupts registers:
141; AX, DX
142;--------------------------------------------------------------------
143PushBusType:
144 xchg ax, bx ; Store BX to AX
145 eMOVZX bx, BYTE [cs:si+IDEVARS.bBusType]
146 mov bx, [cs:bx+.rgwBusTypeValues] ; Char to BL, Int to BH
147 eMOVZX dx, bh
148 push bx ; Push character
149 push dx ; Push 8, 16 or 32
150 xchg bx, ax ; Restore BX
151 jmp SHORT .NextPush
152ALIGN WORD_ALIGN
153.rgwBusTypeValues:
154 db 'D', 8 ; BUS_TYPE_8_DUAL
155 db ' ', 16 ; BUS_TYPE_16
156 db ' ', 32 ; BUS_TYPE_32
157 db 'S', 8 ; BUS_TYPE_8_SINGLE
158ALIGN JUMP_ALIGN
159.NextPush:
160
161;--------------------------------------------------------------------
162; PushIRQ
163; Parameters:
164; DS:DI: Ptr to DPT
165; ES:BX: Ptr to BOOTNFO
166; CS:SI: Ptr to IDEVARS
167; Returns:
168; Nothing (falls to next push below)
169; Corrupts registers:
170; AX, DX
171;--------------------------------------------------------------------
172PushIRQ:
173 mov dl, ' ' ; Load space to DL
174 mov al, [cs:si+IDEVARS.bIRQ]
175 test al, al ; Interrupts disabled?
176 jz SHORT .PushIrqDisabled
177 add al, '0' ; Digit to ASCII
178 cmp al, '9' ; Only one digit needed?
179 jbe SHORT .PushCharacters
180
181 ; Two digits needed
182 sub al, 10 ; Limit to single digit ASCII
183 mov dl, '1' ; Load '1 to DX
184 jmp SHORT .PushCharacters
185ALIGN JUMP_ALIGN
186.PushIrqDisabled:
187 mov al, '-' ; Load line to AL
188 xchg ax, dx ; Space to AL, line to DL
189ALIGN JUMP_ALIGN
190.PushCharacters:
191 push dx
192 push ax
193
194;--------------------------------------------------------------------
195; PushResetStatus
196; Parameters:
197; DS:DI: Ptr to DPT
198; ES:BX: Ptr to BOOTNFO
199; CS:SI: Ptr to IDEVARS
200; Returns:
201; Nothing (falls to next push below)
202; Corrupts registers:
203; AX
204;--------------------------------------------------------------------
205PushResetStatus:
206 eMOVZX ax, BYTE [di+DPT.bReset]
207 push ax
208
209;--------------------------------------------------------------------
210; Prints formatted configuration string from parameters pushed to stack.
211;
212; BootMenuPrintCfg_ValuesFromStack
213; Parameters:
214; Stack: All formatting parameters
215; Returns:
216; Nothing
217; Corrupts registers:
218; AX, SI, DI
219;--------------------------------------------------------------------
220BootMenuPrintCfg_ValuesFromStack:
221 mov si, g_szCfgFormat
222 jmp PrintNullTerminatedStringFromCSSIandSetCF
Note: See TracBrowser for help on using the repository browser.