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

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

Space optimizations in AccessDPT.asm, transfer one routine to a macro (retaining some encapsulation), and transfer the unique part of another routine to the one place it was being called (which also makes what it was doing more transparent).

File size: 4.1 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:
[96]23    mov     si, g_szCfgHeader
24    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
[186]25    pop     di
[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:
[191]53;       AX, BX
[3]54;--------------------------------------------------------------------
[88]55PushAddressingMode:
[193]56    CustomDPT_GetUnshiftedAddressModeToALZF
57    ;; 
58    ;; This multiply both shifts the addressing mode bits down to low order bits, and 
59    ;; at the same time multiplies by the size of the string displacement.  The result is in AH,
60    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
61    ;; 
62    mov     bl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement
[182]63    mul     bl
[193]64    xchg    al,ah
[182]65    add     ax,g_szAddressingModes
66    push    ax
67       
[3]68;--------------------------------------------------------------------
[88]69; PushBlockMode
[3]70;   Parameters:
71;       DS:DI:  Ptr to DPT
72;       CS:SI:  Ptr to IDEVARS
73;   Returns:
74;       Nothing (falls to next push below)
75;   Corrupts registers:
[88]76;       AX
[3]77;--------------------------------------------------------------------
[88]78PushBlockMode:
[150]79    mov     ax, 1
[158]80    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
[150]81    jz      SHORT .PushBlockSizeFromAX
82    mov     al, [di+DPT_ATA.bSetBlock]
83.PushBlockSizeFromAX:
[3]84    push    ax
85
86;--------------------------------------------------------------------
[88]87; PushBusType
[3]88;   Parameters:
89;       DS:DI:  Ptr to DPT
90;       CS:SI:  Ptr to IDEVARS
91;   Returns:
92;       Nothing (jumps to next push below)
93;   Corrupts registers:
94;       AX, DX
95;--------------------------------------------------------------------
[181]96;PushBusType:
[182]97    mov     al,g_szBusTypeValues_Displacement
98    mul     BYTE [cs:si+IDEVARS.bDevice]
[186]99       
100    shr     ax,1            ; divide by 2 since IDEVARS.bDevice is multiplied by 2
101       
[182]102    add     ax,g_szBusTypeValues
103    push    ax 
104               
[3]105;--------------------------------------------------------------------
[88]106; PushIRQ
[3]107;   Parameters:
108;       DS:DI:  Ptr to DPT
109;       CS:SI:  Ptr to IDEVARS
110;   Returns:
111;       Nothing (falls to next push below)
112;   Corrupts registers:
[88]113;       AX, DX
[3]114;--------------------------------------------------------------------
[88]115PushIRQ:
[184]116    eMOVZX  ax, BYTE [cs:si+IDEVARS.bIRQ]
[3]117    push    ax
118
119;--------------------------------------------------------------------
[88]120; PushResetStatus
[3]121;   Parameters:
122;       DS:DI:  Ptr to DPT
123;       CS:SI:  Ptr to IDEVARS
124;   Returns:
[88]125;       Nothing (falls to next push below)
[3]126;   Corrupts registers:
[88]127;       AX
[3]128;--------------------------------------------------------------------
[88]129PushResetStatus:
[158]130    mov     al, [di+DPT.bFlagsHigh]
131    and     ax, MASKH_DPT_RESET
[88]132    push    ax
[3]133
134;--------------------------------------------------------------------
[96]135; PrintValuesFromStack
[3]136;   Parameters:
137;       Stack:  All formatting parameters
138;   Returns:
139;       Nothing
140;   Corrupts registers:
[88]141;       AX, SI, DI
[3]142;--------------------------------------------------------------------
[96]143PrintValuesFromStack:
[3]144    mov     si, g_szCfgFormat
[192]145    jmp     BootPrint_BootMenuPrint_FormatCSSIfromParamsInSSBP_Relay
[96]146
Note: See TracBrowser for help on using the repository browser.