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

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

Space optimizations in the Boot Menu and BootInfo routines, taking advantage of nested %s. Optimization in the init of RamVars to avoid writing the signature twice. Preparing for addition of serial floppy support, starting to break the assumption that our drives are always 80h or higher.

File size: 3.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:DI:      Pointer to DPT
15;   Returns:
16;       Nothing
17;   Corrupts registers:
18;       AX, BX, CX, DX, SI, DI
19;--------------------------------------------------------------------
20ALIGN JUMP_ALIGN
21BootMenuPrintCfg_ForOurDrive:
22    eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]
23    xchg    si, ax                      ; CS:SI now points to IDEVARS
24    ; Fall to .PushAndFormatCfgString
25
26;--------------------------------------------------------------------
27; PushAddressingMode
28;   Parameters:
29;       DS:DI:  Ptr to DPT
30;       CS:SI:  Ptr to IDEVARS
31;   Returns:
32;       Nothing (jumps to next push below)
33;   Corrupts registers:
34;       AX, BX
35;--------------------------------------------------------------------
36.PushAddressingMode:
37    AccessDPT_GetUnshiftedAddressModeToALZF
38    ;; 
39    ;; This multiply both shifts the addressing mode bits down to low order bits, and 
40    ;; at the same time multiplies by the size of the string displacement.  The result is in AH,
41    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
42    ;; 
43    mov     bl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement
44    mul     bl
45    xchg    al,ah
46    add     ax,g_szAddressingModes
47    push    ax
48       
49;--------------------------------------------------------------------
50; PushBlockMode
51;   Parameters:
52;       DS:DI:  Ptr to DPT
53;       CS:SI:  Ptr to IDEVARS
54;   Returns:
55;       Nothing (falls to next push below)
56;   Corrupts registers:
57;       AX
58;--------------------------------------------------------------------
59.PushBlockMode:
60    mov     ax, 1
61    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
62    jz      SHORT .PushBlockSizeFromAX
63    mov     al, [di+DPT_ATA.bSetBlock]
64.PushBlockSizeFromAX:
65    push    ax
66
67;--------------------------------------------------------------------
68; PushBusType
69;   Parameters:
70;       DS:DI:  Ptr to DPT
71;       CS:SI:  Ptr to IDEVARS
72;   Returns:
73;       Nothing (jumps to next push below)
74;   Corrupts registers:
75;       AX, DX
76;--------------------------------------------------------------------
77.PushBusType:
78    mov     al,g_szBusTypeValues_Displacement
79    mul     BYTE [cs:si+IDEVARS.bDevice]
80       
81    shr     ax,1            ; divide by 2 since IDEVARS.bDevice is multiplied by 2
82       
83    add     ax,g_szBusTypeValues
84    push    ax 
85               
86;--------------------------------------------------------------------
87; PushIRQ
88;   Parameters:
89;       DS:DI:  Ptr to DPT
90;       CS:SI:  Ptr to IDEVARS
91;   Returns:
92;       Nothing (falls to next push below)
93;   Corrupts registers:
94;       AX, DX
95;--------------------------------------------------------------------
96.PushIRQ:
97    mov     al, BYTE [cs:si+IDEVARS.bIRQ]
98    cbw
99    push    ax
100
101;--------------------------------------------------------------------
102; PushResetStatus
103;   Parameters:
104;       DS:DI:  Ptr to DPT
105;       CS:SI:  Ptr to IDEVARS
106;   Returns:
107;       Nothing (falls to next push below)
108;   Corrupts registers:
109;       AX
110;--------------------------------------------------------------------
111.PushResetStatus:
112    mov     al, [di+DPT.bFlagsHigh]
113    and     al, MASKH_DPT_RESET         ;  ah already zero from last push
114    push    ax
115
116;--------------------------------------------------------------------
117; PrintValuesFromStack
118;   Parameters:
119;       Stack:  All formatting parameters
120;   Returns:
121;       Nothing
122;   Corrupts registers:
123;       AX, SI, DI
124;--------------------------------------------------------------------
125.PrintValuesFromStack:
126    jmp     BootMenuPrint_HardDiskRefreshInformation.output
127
Note: See TracBrowser for help on using the repository browser.