source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm @ 592

Last change on this file since 592 was 592, checked in by krille_n_, 6 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 5.1 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Functions for printing drive configuration
3;                   information on Boot Menu.
4;
5; Included by BootMenuPrint.asm, this routine is to be inserted into
6; BootMenuPrint_HardDiskRefreshInformation.
7;
8
9;
10; XTIDE Universal BIOS and Associated Tools
11; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
12;
13; This program is free software; you can redistribute it and/or modify
14; it under the terms of the GNU General Public License as published by
15; the Free Software Foundation; either version 2 of the License, or
16; (at your option) any later version.
17;
18; This program is distributed in the hope that it will be useful,
19; but WITHOUT ANY WARRANTY; without even the implied warranty of
20; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21; GNU General Public License for more details.
22; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23;
24
25; Section containing code
26SECTION .text
27
28;;; fall-into from BootMenuPrint_HardDiskRefreshInformation.
29
30;--------------------------------------------------------------------
31; Prints Hard Disk configuration for drive handled by our BIOS.
32; Cursor is set to configuration header string position.
33;
34; BootMenuPrintCfg_ForOurDrive
35;   Parameters:
36;       DS:DI:      Pointer to DPT
37;   Returns:
38;       Nothing
39;   Corrupts registers:
40;       AX, BX, CX, DX
41;--------------------------------------------------------------------
42.BootMenuPrintCfg_ForOurDrive:
43    eMOVZX  ax, [di+DPT.bIdevarsOffset]
44    xchg    bx, ax                      ; CS:BX now points to IDEVARS
45    ; Fall to .PushAddressingMode
46
47;--------------------------------------------------------------------
48; .PushAddressingMode
49;   Parameters:
50;       DS:DI:  Ptr to DPT
51;       CS:BX:  Ptr to IDEVARS
52;   Returns:
53;       Nothing (falls to next push below)
54;   Corrupts registers:
55;       AX, CX, DX
56;--------------------------------------------------------------------
57.PushAddressingMode:
58    mov     al, [di+DPT.bFlagsLow]
59    and     ax, BYTE MASKL_DPT_TRANSLATEMODE
60    ;;
61    ;; This multiply both shifts the addressing mode bits down to low order bits, and
62    ;; at the same time multiplies by the size of the string displacement.  The result is in AH,
63    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
64    ;;
65%ifdef USE_186
66    imul    ax, g_szAddressingModes_Displacement << (8-TRANSLATEMODE_FIELD_POSITION)
67%else
68    mov     cx, g_szAddressingModes_Displacement << (8-TRANSLATEMODE_FIELD_POSITION)
69    mul     cx
70%endif
71    xchg    al, ah      ; AL = always zero after above multiplication
72    add     ax, g_szAddressingModes
73    push    ax
74    ; Fall to .PushBlockMode
75
76;--------------------------------------------------------------------
77; .PushBlockMode
78;   Parameters:
79;       DS:DI:  Ptr to DPT
80;       CS:BX:  Ptr to IDEVARS
81;   Returns:
82;       Nothing (falls to next push below)
83;   Corrupts registers:
84;       AX
85;--------------------------------------------------------------------
86.PushBlockMode:
87    mov     ax, 1
88    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_USE_BLOCK_MODE_COMMANDS
89    jz      SHORT .PushBlockSizeFromAX
90    mov     al, [di+DPT_ATA.bBlockSize]
91.PushBlockSizeFromAX:
92    push    ax
93    ; Fall to .PushDeviceType
94
95;--------------------------------------------------------------------
96; .PushDeviceType
97;   Parameters:
98;       DS:DI:  Ptr to DPT
99;       CS:BX:  Ptr to IDEVARS
100;   Returns:
101;       Nothing (falls to next push below)
102;   Corrupts registers:
103;       AX
104;--------------------------------------------------------------------
105.PushDeviceType:
106%ifndef MODULE_SERIAL
107    mov     al, g_szDeviceTypeValues_Displacement
108    mul     BYTE [di+DPT_ATA.bDevice]
109%else
110    mov     ah, [cs:bx+IDEVARS.bDevice]
111    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE    ; Clears CF
112    eCMOVZ  ah, [di+DPT_ATA.bDevice]    ; DPT_ATA contains up to date device information for IDE drives
113%ifdef USE_UNDOC_INTEL
114    salc    ; Clear AL using CF (from TEST above)
115    eAAD    g_szDeviceTypeValues_Displacement
116%else
117    mov     al, g_szDeviceTypeValues_Displacement
118    mul     ah
119%endif ; USE_UNDOC_INTEL
120%endif ; MODULE_SERIAL
121
122%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
123    %if (COUNT_OF_ALL_IDE_DEVICES * 2 * g_szDeviceTypeValues_Displacement) > 255
124        %error "The USE_UNDOC_INTEL block in .PushDeviceType needs to be removed (would cause an overflow)!"
125    %endif
126%endif
127
128    shr     ax, 1   ; Divide by 2 since IDEVARS.bDevice is multiplied by 2
129    add     ax, g_szDeviceTypeValues
130    push    ax
131    ; Fall to .PushIRQ
132
133;--------------------------------------------------------------------
134; .PushIRQ
135;   Parameters:
136;       DS:DI:  Ptr to DPT
137;       CS:BX:  Ptr to IDEVARS
138;   Returns:
139;       Nothing (falls to next push below)
140;   Corrupts registers:
141;       AX
142;--------------------------------------------------------------------
143.PushIRQ:
144    mov     al, [cs:bx+IDEVARS.bIRQ]
145    cbw
146    push    ax
147    ; Fall to .PushResetStatus
148
149;--------------------------------------------------------------------
150; .PushResetStatus
151;   Parameters:
152;       DS:DI:  Ptr to DPT
153;       CS:BX:  Ptr to IDEVARS
154;   Returns:
155;       Nothing (falls to next push below)
156;   Corrupts registers:
157;       AX, BX, DX, ES
158;--------------------------------------------------------------------
159.PushResetStatus:
160    mov     al, [di+DPT.bInitError]
161    push    ax
162
163;;; fall-out to BootMenuPrint_HardDiskRefreshInformation.
Note: See TracBrowser for help on using the repository browser.