source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc@ 590

Last change on this file since 590 was 589, checked in by Krister Nordvall, 8 years ago

Changes:

  • BIOS: Fixed a purely cosmetic bug from r542 where, in builds containing MODULE_EBIOS, the boot menu would display an incorrect drive size (0.4 kB with MODULE_STRINGS_COMPRESSED or 0.5 kB without) for old drives with no support for LBA.
  • Fixed a bug from r392 where Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent would return the ID in AL instead of AH (if DANGEROUS_DETECTION had been defined).
  • Fixed a bug from r587 in AdvAtaInit.asm that would prevent detection of QDI Vision controllers.
  • Also changed how the QDI Vision IDs are defined (removed the need for shifting) to avoid confusion. This fixed a potential bug from r587 in AdvAtaInit.asm where some IDs were not being shifted.
  • Fixed a bug in PDC20x30.asm from r587 where GetPdcIDtoAX would not return with the IDE base port in DX so DisablePdcProgrammingMode would fail.
  • Made some changes to ModuleDependency.inc and other files so that MODULE_ADVANCED_ATA now requires USE_386. Consequently it is no longer included in the regular AT-builds, only in the 386_8k-build.
  • Moved the UNROLL_SECTORS_IN_CX_TO_xWORDS macros from IDE_8bit.inc to IdeIO.inc which means it's now possible to build a BIOS without MODULE_8BIT_IDE.
  • XTIDECFG: Added a minimum DOS version check (since it needs DOS version 2+) to allow the program to quit gracefully in the unlikely scenario where someone tries to run it under DOS version 1.
  • Made some changes to Drive.asm to improve drive enumeration. The old method using GET_DOS_DRIVE_PARAMETER_BLOCK_FOR_SPECIFIC_DRIVE worked well in Windows XP but not in Windows 98 SE (in Windows or in DOS mode). The two problems were; 1) The function call would access the drives which on single floppy drive systems would cause Windows to swap between A: and B: (throwing a blue screen asking the user to insert a disk etc). 2) Only floppy drives and FAT16 drives would be available in the list of drives, no FAT32/optical/network drives.
  • Improved code in IdeControllerMenu.asm so that the default port addresses for all IDE interfaces are now restored when (re-)selecting the (same) type of IDE device.
  • Also made it impossible to select a device type unless the required module is included in the loaded BIOS.
  • The version check done when loading a BIOS now uses the FLASH_SIGNATURE definition from Version.inc. Any changes affecting RomVars now only requires updating that definition. This means that changes to RomVars must be implemented in both the BIOS and XTIDECFG before being committed to the repository.
  • Added a compatibility fix for 3Com 3C503 cards to the ROM checksumming code in Buffers.asm (Buffers_GenerateChecksum).
  • SerDrive: Made some minor changes to file names and paths to improve compatibility with case sensitive environments.
  • BIOSDRVS: Made a minor size optimization which as a side effect also makes it compatible with all DOS versions including DOS version 1.
  • Library: Renamed the WAIT_RETRACE_IF_NECESSARY_THEN macro to CALL_WAIT_FOR_RETRACE_IF_NECESSARY_THEN and made a tail-call-optimized version of it (JMP_WAIT_FOR_RETRACE_IF_NECESSARY_THEN).
  • A speed optimization to the eRCL_IM macro for 386 and higher. This change breaks emulation in the sense that the macro will fail when given a memory operand as the first parameter.
  • Other minor optimizations and fixes.
File size: 6.1 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]2; Description : Defines for BOOTVARS struct used by boot menu
3; and drive initialization.
[376]4
5;
[526]6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[526]13;
[376]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
[526]17; GNU General Public License for more details.
[376]18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19;
20
[3]21%ifndef BOOTVARS_INC
22%define BOOTVARS_INC
23
[492]24; Default drives
25DEFAULT_FLOPPY_DRIVE_LETTER EQU 'A'
26DEFAULT_HARD_DRIVE_LETTER EQU 'C'
27
[397]28; Number of times to retry booting before accepting error
[96]29BOOT_READ_RETRY_TIMES EQU 3
30
31
[3]32
[294]33; Pre-boot variables. These do not exist after successful boot to OS.
[3]34; Segment is always 0000h, same as BDA segment
35struc BOOTVARS
[392]36 resb 7C00h
37 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
38 .rgbBootSect resb 512 ; 7C00h, Boot sector
39 resb 256 ; Boot Menu stack
[221]40 .rgbMnuStack:
[392]41 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
[397]42%ifdef MODULE_HOTKEYS
[589]43 .hotkeyVars resb HOTKEYVARS_size
[397]44%endif
45 .rgDrvDetectInfo: ; Array containing DRVDETECTINFO structs
[3]46endstruc
47
[520]48
[397]49%ifdef MODULE_HOTKEYS
[492]50
[392]51struc HOTKEYVARS
[524]52 .wTimeWhenDisplayed resb 2 ; System time (ticks) when Hotkey bar was first displayed
[500]53 .wFddAndHddLetters:
[492]54 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
[528]55 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
[492]56 .bFlags resb 1 ; Must be just after .bHddLetter! (dependency in Hotkeybar.asm)
57 .bScancode resb 1 ; Function hotkey scancode, must be just after .bFlags!
[392]58endstruc
[3]59
[492]60%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
[526]61%if HOTKEYVARS.bFddLetter+1 != HOTKEYVARS.bHddLetter || HOTKEYVARS.bHddLetter+1 != HOTKEYVARS.bFlags || HOTKEYVARS.bFlags+1 != HOTKEYVARS.bScancode
[492]62%error "HOTKEYVARS: bytes need to come in the order .bFddLetter, then .bHddLetter, then .bFlags, then .bScancode"
63%endif
64%endif
65
[524]66; Bit defines for HOTKEYVARS.bFlags
67FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
[392]68
[492]69%endif ; MODULE_HOTKEYS
[392]70
[397]71struc DRVDETECTINFO
[422]72 .StartOfDrvDetectInfo:
[397]73 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH
74 resb 2 ; Zero word (ensures string terminates)
75 .wInitErrorFlags resb 2 ; Errors during initialization
[421]76
[422]77 ; DRVDETECTINFO's size must be an even multiple of DPT's size
78 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
[397]79endstruc
80
81; Boot Menu Information Table. These are generated for all XTIDE Universal
82; BIOS drives. Available only until boot is successful.
83MAX_HARD_DISK_NAME_LENGTH EQU 30 ; Bytes reserved for drive name
84DPT_DRVDETECTINFO_SIZE_MULTIPLIER EQU DRVDETECTINFO_size / LARGEST_DPT_SIZE
85
86
87%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
88
89%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
90 %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
91%endif
92
93%if DRVDETECTINFO_size % LARGEST_DPT_SIZE <> 0
94 %error "DRVDETECTINFO's size must be an even multiple of DPT's size. Add or remove padding at the bottom of DRVDETECTINFO to bring the two sizes into alignment. As DRVDETECTINFO is only used at boot time, with plenty of memory to consume, it is OK to waste some space here."
95%endif
96
97%if DRVDETECTINFO.szDrvName <> 0
98 %error "DRVDETECTINFO.szDrvName is assumed to be the first member of struc DRVDETECTINFO, in BootMenuPrint_RefreshItem"
99%endif
100
101%endif
102
103
[121]104;--------------------------------------------------------------------
105; Stores POST stack pointer to BOOTVARS.
106;
107; STORE_POST_STACK_POINTER
108; Parameters:
[243]109; ES: BDA and Interrupt Vector segment (zero)
[121]110; Returns:
111; Nothing
112; Corrupts registers:
113; Nothing
114;--------------------------------------------------------------------
115%macro STORE_POST_STACK_POINTER 0
[243]116 mov [es:BOOTVARS.dwPostStack], sp
117 mov [es:BOOTVARS.dwPostStack+2], ss
[121]118%endmacro
119
120
121;--------------------------------------------------------------------
122; Initializes stack for boot menu usage.
123; POST stack is not large enough when DPTs are stored to 30:0h.
124;
125; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
126; then you also have to unconditionally enable the CLI/STI pair.
127; The reason for this is that only some buggy 808x CPU:s need the
128; CLI/STI instruction pair when changing stacks. Other CPU:s disable
129; interrupts automatically when SS is modified for the duration of
130; the immediately following instruction to give time to change SP.
131;
132; SWITCH_TO_BOOT_MENU_STACK
133; Parameters:
134; Nothing
135; Returns:
136; SS:SP: Pointer to top of Boot Menu stack
137; Corrupts registers:
138; Nothing
139;--------------------------------------------------------------------
140%macro SWITCH_TO_BOOT_MENU_STACK 0
141%ifndef USE_186
142 cli ; Disable interrupts
143%endif
144 LOAD_BDA_SEGMENT_TO ss, sp
145 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
146%ifndef USE_186
147 sti ; Enable interrupts
148%endif
149%endmacro
150
151
152;--------------------------------------------------------------------
153; Restores SS and SP to initial boot loader values.
154;
[243]155; Note! Must return with AX=0 and CF preserved.
156; See Int19hMenu_JumpToBootSector_or_RomBoot.
[121]157;
158; SWITCH_BACK_TO_POST_STACK
159; Parameters:
[243]160; AX: BDA and Interrupt Vector segment (zero)
[121]161; Returns:
162; SS:SP: Ptr to POST stack
163; Corrupts registers:
[243]164; Nothing (not even FLAGS)
[121]165;--------------------------------------------------------------------
166%macro SWITCH_BACK_TO_POST_STACK 0
167%ifndef USE_386
[243]168 cli
169 mov ss, ax
[121]170 mov sp, [ss:BOOTVARS.dwPostStack]
171 mov ss, [ss:BOOTVARS.dwPostStack+2]
[243]172 sti
[121]173%else
[243]174 mov ss, ax
[121]175 lss sp, [ss:BOOTVARS.dwPostStack]
[294]176%endif
[121]177%endmacro
178
179
[3]180%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.