source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc @ 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.5 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Defines for BOOTVARS struct used by boot menu
3;                   and drive initialization.
4
5;
6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
8;
9; This program is free software; you can redistribute it and/or modify
10; it under the terms of the GNU General Public License as published by
11; the Free Software Foundation; either version 2 of the License, or
12; (at your option) any later version.
13;
14; This program is distributed in the hope that it will be useful,
15; but WITHOUT ANY WARRANTY; without even the implied warranty of
16; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17; GNU General Public License for more details.
18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19;
20
21%ifndef BOOTVARS_INC
22%define BOOTVARS_INC
23
24; Default drives
25DEFAULT_FLOPPY_DRIVE_LETTER             EQU 'A'
26DEFAULT_HARD_DRIVE_LETTER               EQU 'C'
27
28; Number of times to retry booting before accepting error
29BOOT_READ_RETRY_TIMES       EQU     3
30
31; Pre-boot variables. These do not exist after successful boot to OS.
32; Segment is always 0000h, same as BDA segment
33struc BOOTVARS
34                        resb    7C00h
35    .rgbAtaInfo:                        ; 7C00h, ATA Information for drive detection
36    .rgbBootSect        resb    512     ; 7C00h, Boot sector
37                        resb    256     ; Boot Menu stack
38    .rgbMnuStack:
39    .dwPostStack        resb    4       ; POST stack pointer when entering INT 19h
40%ifdef MODULE_HOTKEYS
41    .hotkeyVars         resb    HOTKEYVARS_size
42%endif
43    .rgDrvDetectInfo:                   ; Array containing DRVDETECTINFO structs
44endstruc
45
46
47%ifdef MODULE_HOTKEYS
48
49struc HOTKEYVARS
50    .wTimeWhenDisplayed resb    2       ; System time (ticks) when Hotkey bar was first displayed
51    .wFddAndHddLetters:
52    .bFddLetter         resb    1       ; Floppy Drive letter hotkey (upper case)
53    .bHddLetter         resb    1       ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
54    .bFlags             resb    1       ; Must be just after .bHddLetter!  (dependency in Hotkeybar.asm)
55    .bScancode          resb    1       ; Function hotkey scancode, must be just after .bFlags!
56endstruc
57
58%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
59%if HOTKEYVARS.bFddLetter+1 != HOTKEYVARS.bHddLetter || HOTKEYVARS.bHddLetter+1 != HOTKEYVARS.bFlags || HOTKEYVARS.bFlags+1 != HOTKEYVARS.bScancode
60%error "HOTKEYVARS: bytes need to come in the order .bFddLetter, then .bHddLetter, then .bFlags, then .bScancode"
61%endif
62%endif
63
64; Bit defines for HOTKEYVARS.bFlags
65FLG_HOTKEY_HD_FIRST         EQU     (1<<0)  ; First try to boot from HDD, then FDD
66
67%endif ; MODULE_HOTKEYS
68
69; MAX_HARD_DISK_NAME_LENGTH must be defined ahead of the DRVDETECTINFO structure to avoid problems with NASM
70MAX_HARD_DISK_NAME_LENGTH   EQU     30      ; Bytes reserved for drive name
71
72struc DRVDETECTINFO
73    .StartOfDrvDetectInfo:
74    .szDrvName              resb    MAX_HARD_DISK_NAME_LENGTH
75                            resb    2   ; Zero word (ensures string terminates)
76    .wInitErrorFlags        resb    2   ; Errors during initialization
77
78    ; DRVDETECTINFO's size must be an even multiple of DPT's size
79    .EndOfDriveDetectInfo:  resb    LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
80endstruc
81
82DPT_DRVDETECTINFO_SIZE_MULTIPLIER   EQU     DRVDETECTINFO_size / LARGEST_DPT_SIZE
83
84%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
85%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
86    %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
87%endif
88%endif
89
90
91;--------------------------------------------------------------------
92; Stores POST stack pointer to BOOTVARS.
93;
94; STORE_POST_STACK_POINTER
95;   Parameters:
96;       ES:     BDA and Interrupt Vector segment (zero)
97;   Returns:
98;       Nothing
99;   Corrupts registers:
100;       Nothing
101;--------------------------------------------------------------------
102%macro STORE_POST_STACK_POINTER 0
103    mov     [es:BOOTVARS.dwPostStack], sp
104    mov     [es:BOOTVARS.dwPostStack+2], ss
105%endmacro
106
107
108;--------------------------------------------------------------------
109; Initializes stack for boot menu usage.
110; POST stack is not large enough when DPTs are stored to 30:0h.
111;
112; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
113; then you also have to unconditionally enable the CLI/STI pair.
114; The reason for this is that only some buggy 808x CPU:s need the
115; CLI/STI instruction pair when changing stacks. Other CPU:s disable
116; interrupts automatically when SS is modified for the duration of
117; the immediately following instruction to give time to change SP.
118;
119; SWITCH_TO_BOOT_MENU_STACK
120;   Parameters:
121;       Nothing
122;   Returns:
123;       SS:SP:  Pointer to top of Boot Menu stack
124;   Corrupts registers:
125;       Nothing
126;--------------------------------------------------------------------
127%macro SWITCH_TO_BOOT_MENU_STACK 0
128%ifndef USE_186
129    cli                                 ; Disable interrupts
130%endif
131    LOAD_BDA_SEGMENT_TO ss, sp
132    mov     sp, BOOTVARS.rgbMnuStack    ; Load offset to stack
133%ifndef USE_186
134    sti                                 ; Enable interrupts
135%endif
136%endmacro
137
138
139;--------------------------------------------------------------------
140; Restores SS and SP to initial boot loader values.
141;
142; Note! Must return with AX=0 and CF preserved.
143; See Int19hMenu_JumpToBootSector_or_RomBoot.
144;
145; SWITCH_BACK_TO_POST_STACK
146;   Parameters:
147;       AX:     BDA and Interrupt Vector segment (zero)
148;   Returns:
149;       SS:SP:  Ptr to POST stack
150;   Corrupts registers:
151;       Nothing (not even FLAGS)
152;--------------------------------------------------------------------
153%macro SWITCH_BACK_TO_POST_STACK 0
154%ifndef USE_386
155    cli
156    mov     ss, ax
157    mov     sp, [ss:BOOTVARS.dwPostStack]
158    mov     ss, [ss:BOOTVARS.dwPostStack+2]
159    sti
160%else
161    mov     ss, ax
162    lss     sp, [ss:BOOTVARS.dwPostStack]
163%endif
164%endmacro
165
166
167%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.