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

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

Changes to XTIDE Universal BIOS:

  • Optimized few bytes.
File size: 4.7 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: Segment to DPT
15; Stack: Offset to DPT
16; Returns:
17; Nothing
18; Corrupts registers:
19; AX, BX, CX, DX, SI, DI
20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22BootMenuPrintCfg_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;--------------------------------------------------------------------
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; CS:SI: Ptr to IDEVARS
50; Returns:
51; Nothing (jumps to next push below)
52; Corrupts registers:
53; AX
54;--------------------------------------------------------------------
55PushAddressingMode:
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;--------------------------------------------------------------------
69PushBlockMode:
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;--------------------------------------------------------------------
87PushBusType:
88 xchg ax, bx ; Store BX to AX
89 eMOVZX bx, BYTE [cs:si+IDEVARS.bDevice]
90 mov bx, [cs:bx+rgwBusTypeValues] ; Char to BL, Int to BH
91 eMOVZX dx, bh
92 push bx ; Push character
93 push dx ; Push 1, 8, 16 or 32
94 xchg bx, ax ; Restore BX
95
96;--------------------------------------------------------------------
97; PushIRQ
98; Parameters:
99; DS:DI: Ptr to DPT
100; CS:SI: Ptr to IDEVARS
101; Returns:
102; Nothing (falls to next push below)
103; Corrupts registers:
104; AX, DX
105;--------------------------------------------------------------------
106PushIRQ:
107 mov dl, ' ' ; Load space to DL
108 mov al, [cs:si+IDEVARS.bIRQ]
109 test al, al ; Interrupts disabled?
110 jz SHORT .PushIrqDisabled
111 add al, '0' ; Digit to ASCII
112 cmp al, '9' ; Only one digit needed?
113 jbe SHORT .PushCharacters
114
115 ; Two digits needed
116 sub al, 10 ; Limit to single digit ASCII
117 mov dl, '1' ; Load '1 to DX
118 jmp SHORT .PushCharacters
119ALIGN JUMP_ALIGN
120.PushIrqDisabled:
121 mov al, '-' ; Load line to AL
122 xchg ax, dx ; Space to AL, line to DL
123ALIGN JUMP_ALIGN
124.PushCharacters:
125 push dx
126 push ax
127
128;--------------------------------------------------------------------
129; PushResetStatus
130; Parameters:
131; DS:DI: Ptr to DPT
132; CS:SI: Ptr to IDEVARS
133; Returns:
134; Nothing (falls to next push below)
135; Corrupts registers:
136; AX
137;--------------------------------------------------------------------
138PushResetStatus:
139 mov al, [di+DPT.bFlagsHigh]
140 and ax, MASKH_DPT_RESET
141 push ax
142
143;--------------------------------------------------------------------
144; PrintValuesFromStack
145; Parameters:
146; Stack: All formatting parameters
147; Returns:
148; Nothing
149; Corrupts registers:
150; AX, SI, DI
151;--------------------------------------------------------------------
152PrintValuesFromStack:
153 mov si, g_szCfgFormat
154 jmp BootMenuPrint_FormatCSSIfromParamsInSSBP
155
156
157ALIGN WORD_ALIGN
158rgszAddressingModeString:
159 dw g_szLCHS
160 dw g_szPCHS
161 dw g_szLBA28
162 dw g_szLBA48
163
164rgwBusTypeValues:
165 db 'D', 8 ; DEVICE_8BIT_DUAL_PORT_XTIDE
166 db 'X', 8 ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
167 db 'S', 8 ; DEVICE_8BIT_SINGLE_PORT
168 db ' ', 16 ; DEVICE_16BIT_ATA
169 db ' ', 32 ; DEVICE_32BIT_ATA
170 db ' ', 1 ; DEVICE_SERIAL_PORT
Note: See TracBrowser for help on using the repository browser.