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

Last change on this file since 620 was 605, checked in by Krister Nordvall, 4 years ago

Changes:

  • The "Remove other hard drives" option in the Boot settings menu in XTIDECFG is now exposed in all BIOS builds. This is needed because the system BIOS in at least two Zenith computer models (Z-161 and Z-171) does not clear the BDA HD count which causes it to increment on warm boot. Running "Auto Configure" in XTIDECFG now also tries to identify these machines by doing a CRC check on the system BIOS and sets the option to YES if a match is found.
  • WORD_ALIGN is now 2 for XT builds. This should benefit XT class machines with 8086 and NEC V30 CPU:s and the cost is negligible (1 byte for the XT BIOS builds and 12 bytes for XTIDECFG.COM).
  • Other minor optimizations.
File size: 6.0 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
25; Temporary locations for system interrupt handlers. Stored during ROM initialization
26; and needed when we do full initialization and drive detection on INT 19h
27TEMPORARY_VECTOR_FOR_SYSTEM_INT13h EQU 32h ; Unused by BIOS (reserved for DOS)
28TEMPORARY_VECTOR_FOR_SYSTEM_INT19h EQU 33h ; Unused by BIOS (reserved for DOS)
29
30
31; Default drives
32DEFAULT_FLOPPY_DRIVE_LETTER EQU 'A'
33DEFAULT_HARD_DRIVE_LETTER EQU 'C'
34
35; Number of times to retry booting before accepting error
36BOOT_READ_RETRY_TIMES EQU 3
37
38
39%ifdef MODULE_HOTKEYS
40
41struc HOTKEYVARS
42 .fpPrevTimerHandler resb 4 ; Previous 08h timer handler
43 .wTimeWhenDisplayed resb 2 ; System time (ticks) when Hotkey bar was first displayed
44 .wFddAndHddLetters:
45 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
46 .wHddLetterAndFlags:
47 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
48 .bFlags resb 1 ; Must be just after .bHddLetter! (dependency in Hotkeybar.asm)
49 .bScancode resb 1 ; Function hotkey scancode, must be just after .bFlags!
50endstruc
51
52%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
53%if HOTKEYVARS.bFddLetter+1 != HOTKEYVARS.bHddLetter || HOTKEYVARS.bHddLetter+1 != HOTKEYVARS.bFlags || HOTKEYVARS.bFlags+1 != HOTKEYVARS.bScancode
54%error "HOTKEYVARS: bytes need to come in the order .bFddLetter, then .bHddLetter, then .bFlags, then .bScancode"
55%endif
56%endif
57
58; Bit defines for HOTKEYVARS.bFlags
59FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
60
61%endif ; MODULE_HOTKEYS
62
63
64; Pre-boot variables. These do not exist after successful boot to OS.
65; Segment is always 0000h, same as BDA segment
66struc BOOTVARS
67 resb 7C00h
68 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
69 .rgbBootSect resb 512 ; 7C00h, Boot sector
70 resb 256 ; Boot Menu stack
71 .rgbMnuStack:
72 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
73%ifdef MODULE_HOTKEYS
74 .hotkeyVars resb HOTKEYVARS_size ; Must be located just before DRVDETECTINFO structs
75%endif
76 .rgDrvDetectInfo: ; Array containing DRVDETECTINFO structs
77endstruc
78
79
80; MAX_HARD_DISK_NAME_LENGTH must be defined ahead of the DRVDETECTINFO structure to avoid problems with NASM
81MAX_HARD_DISK_NAME_LENGTH EQU 30 ; Bytes reserved for drive name
82
83struc DRVDETECTINFO
84 .StartOfDrvDetectInfo:
85 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH
86 resb 2 ; Zero word (ensures string terminates)
87 .wInitErrorFlags resb 2 ; Errors during initialization
88
89 ; DRVDETECTINFO's size must be an even multiple of DPT's size
90 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
91endstruc
92
93DPT_DRVDETECTINFO_SIZE_MULTIPLIER EQU DRVDETECTINFO_size / LARGEST_DPT_SIZE
94
95%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
96%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
97 %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
98%endif
99%endif
100
101
102;--------------------------------------------------------------------
103; Stores POST stack pointer to BOOTVARS.
104;
105; STORE_POST_STACK_POINTER
106; Parameters:
107; ES: BDA and Interrupt Vector segment (zero)
108; Returns:
109; Nothing
110; Corrupts registers:
111; Nothing
112;--------------------------------------------------------------------
113%macro STORE_POST_STACK_POINTER 0
114 mov [es:BOOTVARS.dwPostStack], sp
115 mov [es:BOOTVARS.dwPostStack+2], ss
116%endmacro
117
118
119;--------------------------------------------------------------------
120; Initializes stack for boot menu usage.
121; POST stack is not large enough when DPTs are stored to 30:0h.
122;
123; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
124; then you also have to unconditionally enable the CLI/STI pair.
125; The reason for this is that only some buggy 808x CPU:s need the
126; CLI/STI instruction pair when changing stacks. Other CPU:s disable
127; interrupts automatically when SS is modified for the duration of
128; the immediately following instruction to give time to change SP.
129;
130; SWITCH_TO_BOOT_MENU_STACK
131; Parameters:
132; Nothing
133; Returns:
134; SS:SP: Pointer to top of Boot Menu stack
135; Corrupts registers:
136; Nothing
137;--------------------------------------------------------------------
138%macro SWITCH_TO_BOOT_MENU_STACK 0
139%ifndef USE_186
140 cli ; Disable interrupts
141%endif
142 LOAD_BDA_SEGMENT_TO ss, sp
143 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
144%ifndef USE_186
145 sti ; Enable interrupts
146%endif
147%endmacro
148
149
150;--------------------------------------------------------------------
151; Restores SS and SP to initial boot loader values.
152;
153; Note! Must return with AX=0 and CF preserved.
154; See Int19hMenu_JumpToBootSector_or_RomBoot.
155;
156; SWITCH_BACK_TO_POST_STACK
157; Parameters:
158; AX: BDA and Interrupt Vector segment (zero)
159; Returns:
160; SS:SP: Ptr to POST stack
161; Corrupts registers:
162; Nothing (not even FLAGS)
163;--------------------------------------------------------------------
164%macro SWITCH_BACK_TO_POST_STACK 0
165%ifndef USE_386
166 cli
167 mov ss, ax
168 mov sp, [ss:BOOTVARS.dwPostStack]
169 mov ss, [ss:BOOTVARS.dwPostStack+2]
170 sti
171%else
172 mov ss, ax
173 lss sp, [ss:BOOTVARS.dwPostStack]
174%endif
175%endmacro
176
177
178%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.