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

Last change on this file since 597 was 596, checked in by Krister Nordvall, 6 years ago

Changes:

  • Made changes to HotkeyBar.asm to give the Boot Menu and Hotkey Bar a more consistent look. It will probably seem a bit strange at first to people used to the classic theme.
  • Added the missing parts of USE_NEC_V that should have been committed with the rest in r593.
  • Removed DEFINES_ALL_FEATURES from the BIOS makefile. It didn't work anymore and never really made sense anyway. Added all the official builds to 'make unused' instead which actually uncovered some unused code in the Tiny build.
  • XTIDECFG will no longer load color themes from unrecognized versions of the BIOS.
  • Other fixes in comments and some minor optimizations.
File size: 5.9 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 .wTimeWhenDisplayed resb 2 ; System time (ticks) when Hotkey bar was first displayed
43 .wFddAndHddLetters:
44 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
45 .wHddLetterAndFlags:
46 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
47 .bFlags resb 1 ; Must be just after .bHddLetter! (dependency in Hotkeybar.asm)
48 .bScancode resb 1 ; Function hotkey scancode, must be just after .bFlags!
49endstruc
50
51%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
52%if HOTKEYVARS.bFddLetter+1 != HOTKEYVARS.bHddLetter || HOTKEYVARS.bHddLetter+1 != HOTKEYVARS.bFlags || HOTKEYVARS.bFlags+1 != HOTKEYVARS.bScancode
53%error "HOTKEYVARS: bytes need to come in the order .bFddLetter, then .bHddLetter, then .bFlags, then .bScancode"
54%endif
55%endif
56
57; Bit defines for HOTKEYVARS.bFlags
58FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
59
60%endif ; MODULE_HOTKEYS
61
62
63; Pre-boot variables. These do not exist after successful boot to OS.
64; Segment is always 0000h, same as BDA segment
65struc BOOTVARS
66 resb 7C00h
67 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
68 .rgbBootSect resb 512 ; 7C00h, Boot sector
69 resb 256 ; Boot Menu stack
70 .rgbMnuStack:
71 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
72%ifdef MODULE_HOTKEYS
73 .hotkeyVars resb HOTKEYVARS_size ; Must be located just before DRVDETECTINFO structs
74%endif
75 .rgDrvDetectInfo: ; Array containing DRVDETECTINFO structs
76endstruc
77
78
79; MAX_HARD_DISK_NAME_LENGTH must be defined ahead of the DRVDETECTINFO structure to avoid problems with NASM
80MAX_HARD_DISK_NAME_LENGTH EQU 30 ; Bytes reserved for drive name
81
82struc DRVDETECTINFO
83 .StartOfDrvDetectInfo:
84 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH
85 resb 2 ; Zero word (ensures string terminates)
86 .wInitErrorFlags resb 2 ; Errors during initialization
87
88 ; DRVDETECTINFO's size must be an even multiple of DPT's size
89 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
90endstruc
91
92DPT_DRVDETECTINFO_SIZE_MULTIPLIER EQU DRVDETECTINFO_size / LARGEST_DPT_SIZE
93
94%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
95%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
96 %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
97%endif
98%endif
99
100
101;--------------------------------------------------------------------
102; Stores POST stack pointer to BOOTVARS.
103;
104; STORE_POST_STACK_POINTER
105; Parameters:
106; ES: BDA and Interrupt Vector segment (zero)
107; Returns:
108; Nothing
109; Corrupts registers:
110; Nothing
111;--------------------------------------------------------------------
112%macro STORE_POST_STACK_POINTER 0
113 mov [es:BOOTVARS.dwPostStack], sp
114 mov [es:BOOTVARS.dwPostStack+2], ss
115%endmacro
116
117
118;--------------------------------------------------------------------
119; Initializes stack for boot menu usage.
120; POST stack is not large enough when DPTs are stored to 30:0h.
121;
122; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
123; then you also have to unconditionally enable the CLI/STI pair.
124; The reason for this is that only some buggy 808x CPU:s need the
125; CLI/STI instruction pair when changing stacks. Other CPU:s disable
126; interrupts automatically when SS is modified for the duration of
127; the immediately following instruction to give time to change SP.
128;
129; SWITCH_TO_BOOT_MENU_STACK
130; Parameters:
131; Nothing
132; Returns:
133; SS:SP: Pointer to top of Boot Menu stack
134; Corrupts registers:
135; Nothing
136;--------------------------------------------------------------------
137%macro SWITCH_TO_BOOT_MENU_STACK 0
138%ifndef USE_186
139 cli ; Disable interrupts
140%endif
141 LOAD_BDA_SEGMENT_TO ss, sp
142 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
143%ifndef USE_186
144 sti ; Enable interrupts
145%endif
146%endmacro
147
148
149;--------------------------------------------------------------------
150; Restores SS and SP to initial boot loader values.
151;
152; Note! Must return with AX=0 and CF preserved.
153; See Int19hMenu_JumpToBootSector_or_RomBoot.
154;
155; SWITCH_BACK_TO_POST_STACK
156; Parameters:
157; AX: BDA and Interrupt Vector segment (zero)
158; Returns:
159; SS:SP: Ptr to POST stack
160; Corrupts registers:
161; Nothing (not even FLAGS)
162;--------------------------------------------------------------------
163%macro SWITCH_BACK_TO_POST_STACK 0
164%ifndef USE_386
165 cli
166 mov ss, ax
167 mov sp, [ss:BOOTVARS.dwPostStack]
168 mov ss, [ss:BOOTVARS.dwPostStack+2]
169 sti
170%else
171 mov ss, ax
172 lss sp, [ss:BOOTVARS.dwPostStack]
173%endif
174%endmacro
175
176
177%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.