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
RevLine 
[88]1; Project name  :   XTIDE Universal BIOS
[3]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:
[127]14;       DS:     Segment to DPT
15;       Stack:  Offset to DPT
[3]16;   Returns:
17;       Nothing
18;   Corrupts registers:
[150]19;       AX, BX, CX, DX, SI, DI
[3]20;--------------------------------------------------------------------
21ALIGN JUMP_ALIGN
22BootMenuPrintCfg_ForOurDrive:
[127]23    pop     di
[96]24    mov     si, g_szCfgHeader
25    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[150]26    eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]
27    xchg    si, ax                      ; CS:SI now points to IDEVARS
[96]28    ; Fall to PushAndFormatCfgString
[3]29
30;--------------------------------------------------------------------
[96]31; PushAndFormatCfgString
[3]32;   Parameters:
33;       DS:DI:  Ptr to DPT
34;       CS:SI:  Ptr to IDEVARS
35;   Returns:
36;       Nothing
37;   Corrupts registers:
[88]38;       AX, DX, SI, DI
[3]39;--------------------------------------------------------------------
[96]40PushAndFormatCfgString:
[88]41    push    bp
42    mov     bp, sp
[3]43    ; Fall to first push below
44
45;--------------------------------------------------------------------
[88]46; PushAddressingMode
[3]47;   Parameters:
48;       DS:DI:  Ptr to DPT
49;       CS:SI:  Ptr to IDEVARS
50;   Returns:
[88]51;       Nothing (jumps to next push below)
[3]52;   Corrupts registers:
[96]53;       AX
[3]54;--------------------------------------------------------------------
[88]55PushAddressingMode:
[150]56    call    AccessDPT_GetAddressingModeForWordLookToBX
[182]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       
[3]77;--------------------------------------------------------------------
[88]78; PushBlockMode
[3]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:
[88]85;       AX
[3]86;--------------------------------------------------------------------
[88]87PushBlockMode:
[150]88    mov     ax, 1
[158]89    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
[150]90    jz      SHORT .PushBlockSizeFromAX
91    mov     al, [di+DPT_ATA.bSetBlock]
92.PushBlockSizeFromAX:
[3]93    push    ax
94
95;--------------------------------------------------------------------
[88]96; PushBusType
[3]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;--------------------------------------------------------------------
[181]105;PushBusType:
[182]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 
[3]111
[182]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               
[3]134;--------------------------------------------------------------------
[88]135; PushIRQ
[3]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:
[88]142;       AX, DX
[3]143;--------------------------------------------------------------------
[88]144PushIRQ:
[184]145    eMOVZX  ax, BYTE [cs:si+IDEVARS.bIRQ]
[3]146    push    ax
147
148;--------------------------------------------------------------------
[88]149; PushResetStatus
[3]150;   Parameters:
151;       DS:DI:  Ptr to DPT
152;       CS:SI:  Ptr to IDEVARS
153;   Returns:
[88]154;       Nothing (falls to next push below)
[3]155;   Corrupts registers:
[88]156;       AX
[3]157;--------------------------------------------------------------------
[88]158PushResetStatus:
[158]159    mov     al, [di+DPT.bFlagsHigh]
160    and     ax, MASKH_DPT_RESET
[88]161    push    ax
[3]162
163;--------------------------------------------------------------------
[96]164; PrintValuesFromStack
[3]165;   Parameters:
166;       Stack:  All formatting parameters
167;   Returns:
168;       Nothing
169;   Corrupts registers:
[88]170;       AX, SI, DI
[3]171;--------------------------------------------------------------------
[96]172PrintValuesFromStack:
[3]173    mov     si, g_szCfgFormat
[127]174    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
[96]175
Note: See TracBrowser for help on using the repository browser.