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

Last change on this file since 184 was 184, checked in by gregli@…, 12 years ago

Space optimization, added a new format character 'I' which is the same as 'u' but shows a dash if the operand is zero. Replaces the PushIRQ functionality in bootmenuprintcfg.asm. This only saves a few bytes now, but saves significantly more with the string compression code.

File size: 5.2 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    mov     al,g_szAddressingModes_Displacement
58    mul     bl
59    add     ax,g_szAddressingModes
60    push    ax
61;
62; Ensure that addressing modes are correctly spaced in memory
63;
64%if g_szLCHS <> g_szAddressingModes
65%error "g_szAddressingModes Displacement Incorrect 1"
66%endif
67%if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
68%error "g_szAddressingModes Displacement Incorrect 2"
69%endif
70%if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement       
71%error "g_szAddressingModes Displacement Incorrect 3"
72%endif
73%if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement       
74%error "g_szAddressingModes Displacement Incorrect 4"
75%endif             
76       
77;--------------------------------------------------------------------
78; PushBlockMode
79;   Parameters:
80;       DS:DI:  Ptr to DPT
81;       CS:SI:  Ptr to IDEVARS
82;   Returns:
83;       Nothing (falls to next push below)
84;   Corrupts registers:
85;       AX
86;--------------------------------------------------------------------
87PushBlockMode:
88    mov     ax, 1
89    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
90    jz      SHORT .PushBlockSizeFromAX
91    mov     al, [di+DPT_ATA.bSetBlock]
92.PushBlockSizeFromAX:
93    push    ax
94
95;--------------------------------------------------------------------
96; PushBusType
97;   Parameters:
98;       DS:DI:  Ptr to DPT
99;       CS:SI:  Ptr to IDEVARS
100;   Returns:
101;       Nothing (jumps to next push below)
102;   Corrupts registers:
103;       AX, DX
104;--------------------------------------------------------------------
105;PushBusType:
106    mov     al,g_szBusTypeValues_Displacement
107    mul     BYTE [cs:si+IDEVARS.bDevice]
108    shr     ax,1
109    add     ax,g_szBusTypeValues
110    push    ax 
111
112;
113; Ensure that bus type strings are correctly spaced in memory
114;
115%if g_szBusTypeValues_8Dual <> g_szBusTypeValues
116%error "g_szBusTypeValues Displacement Incorrect 1"
117%endif
118%if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
119%error "g_szBusTypeValues Displacement Incorrect 2"     
120%endif
121%if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
122%error "g_szBusTypeValues Displacement Incorrect 3"             
123%endif
124%if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement     
125%error "g_szBusTypeValues Displacement Incorrect 4"             
126%endif
127%if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
128%error "g_szBusTypeValues Displacement Incorrect 5"             
129%endif
130%if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
131%error "g_szBusTypeValues Displacement Incorrect 6"             
132%endif             
133               
134;--------------------------------------------------------------------
135; PushIRQ
136;   Parameters:
137;       DS:DI:  Ptr to DPT
138;       CS:SI:  Ptr to IDEVARS
139;   Returns:
140;       Nothing (falls to next push below)
141;   Corrupts registers:
142;       AX, DX
143;--------------------------------------------------------------------
144PushIRQ:
145    eMOVZX  ax, BYTE [cs:si+IDEVARS.bIRQ]
146    push    ax
147
148;--------------------------------------------------------------------
149; PushResetStatus
150;   Parameters:
151;       DS:DI:  Ptr to DPT
152;       CS:SI:  Ptr to IDEVARS
153;   Returns:
154;       Nothing (falls to next push below)
155;   Corrupts registers:
156;       AX
157;--------------------------------------------------------------------
158PushResetStatus:
159    mov     al, [di+DPT.bFlagsHigh]
160    and     ax, MASKH_DPT_RESET
161    push    ax
162
163;--------------------------------------------------------------------
164; PrintValuesFromStack
165;   Parameters:
166;       Stack:  All formatting parameters
167;   Returns:
168;       Nothing
169;   Corrupts registers:
170;       AX, SI, DI
171;--------------------------------------------------------------------
172PrintValuesFromStack:
173    mov     si, g_szCfgFormat
174    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
175
Note: See TracBrowser for help on using the repository browser.