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

Last change on this file since 444 was 422, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Modified ROMVARS for user defined CHS translation mode.
  • Base DPT struct now includes initialization error flags again.
File size: 5.6 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;
6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 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
[3]21%ifndef BOOTVARS_INC
22%define BOOTVARS_INC
23
[397]24; Number of times to retry booting before accepting error
[96]25BOOT_READ_RETRY_TIMES EQU 3
26
27
[3]28
[294]29; Pre-boot variables. These do not exist after successful boot to OS.
[3]30; Segment is always 0000h, same as BDA segment
31struc BOOTVARS
[392]32 resb 7C00h
33 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
34 .rgbBootSect resb 512 ; 7C00h, Boot sector
35 resb 256 ; Boot Menu stack
[221]36 .rgbMnuStack:
[392]37 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
[397]38
39 .clearToZeroFromThisPoint:
40%ifdef MODULE_HOTKEYS
[392]41 .hotkeyVars resb HOTKEYVARS_size
[397]42%endif
43
44 .rgDrvDetectInfo: ; Array containing DRVDETECTINFO structs
[3]45endstruc
46
[397]47%ifdef MODULE_HOTKEYS
[392]48struc HOTKEYVARS
[413]49 .wTimeToClose resb 2 ; Earliest system time when Hotkey Bar can be closed
[392]50 .bScancode resb 1 ; Function hotkey scancode
51 .bFlags resb 1 ; Must be just before .bHddLetter!
52 .wHddAndFddLetters:
53 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case)
54 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
55endstruc
[3]56
[392]57; Bit defines for HOTKEYVARS.bFlags
58FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
59
[397]60%endif ; MODULE_HOTKEY
[392]61
62
[397]63
64struc DRVDETECTINFO
[422]65 .StartOfDrvDetectInfo:
[397]66 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH
67 resb 2 ; Zero word (ensures string terminates)
68 .wInitErrorFlags resb 2 ; Errors during initialization
[421]69
[422]70 ; DRVDETECTINFO's size must be an even multiple of DPT's size
71 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
[397]72endstruc
73
74; Boot Menu Information Table. These are generated for all XTIDE Universal
75; BIOS drives. Available only until boot is successful.
76MAX_HARD_DISK_NAME_LENGTH EQU 30 ; Bytes reserved for drive name
77DPT_DRVDETECTINFO_SIZE_MULTIPLIER EQU DRVDETECTINFO_size / LARGEST_DPT_SIZE
78
79
80%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
81
82%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
83 %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
84%endif
85
86%if DRVDETECTINFO_size % LARGEST_DPT_SIZE <> 0
87 %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."
88%endif
89
90%if DRVDETECTINFO.szDrvName <> 0
91 %error "DRVDETECTINFO.szDrvName is assumed to be the first member of struc DRVDETECTINFO, in BootMenuPrint_RefreshItem"
92%endif
93
94%endif
95
96
[121]97;--------------------------------------------------------------------
98; Stores POST stack pointer to BOOTVARS.
99;
100; STORE_POST_STACK_POINTER
101; Parameters:
[243]102; ES: BDA and Interrupt Vector segment (zero)
[121]103; Returns:
104; Nothing
105; Corrupts registers:
106; Nothing
107;--------------------------------------------------------------------
108%macro STORE_POST_STACK_POINTER 0
[243]109 mov [es:BOOTVARS.dwPostStack], sp
110 mov [es:BOOTVARS.dwPostStack+2], ss
[121]111%endmacro
112
113
114;--------------------------------------------------------------------
115; Initializes stack for boot menu usage.
116; POST stack is not large enough when DPTs are stored to 30:0h.
117;
118; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
119; then you also have to unconditionally enable the CLI/STI pair.
120; The reason for this is that only some buggy 808x CPU:s need the
121; CLI/STI instruction pair when changing stacks. Other CPU:s disable
122; interrupts automatically when SS is modified for the duration of
123; the immediately following instruction to give time to change SP.
124;
125; SWITCH_TO_BOOT_MENU_STACK
126; Parameters:
127; Nothing
128; Returns:
129; SS:SP: Pointer to top of Boot Menu stack
130; Corrupts registers:
131; Nothing
132;--------------------------------------------------------------------
133%macro SWITCH_TO_BOOT_MENU_STACK 0
134%ifndef USE_186
135 cli ; Disable interrupts
136%endif
137 LOAD_BDA_SEGMENT_TO ss, sp
138 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
139%ifndef USE_186
140 sti ; Enable interrupts
141%endif
142%endmacro
143
144
145;--------------------------------------------------------------------
146; Restores SS and SP to initial boot loader values.
147;
[243]148; Note! Must return with AX=0 and CF preserved.
149; See Int19hMenu_JumpToBootSector_or_RomBoot.
[121]150;
151; SWITCH_BACK_TO_POST_STACK
152; Parameters:
[243]153; AX: BDA and Interrupt Vector segment (zero)
[121]154; Returns:
155; SS:SP: Ptr to POST stack
156; Corrupts registers:
[243]157; Nothing (not even FLAGS)
[121]158;--------------------------------------------------------------------
159%macro SWITCH_BACK_TO_POST_STACK 0
160%ifndef USE_386
[243]161 cli
162 mov ss, ax
[121]163 mov sp, [ss:BOOTVARS.dwPostStack]
164 mov ss, [ss:BOOTVARS.dwPostStack+2]
[243]165 sti
[121]166%else
[243]167 mov ss, ax
[121]168 lss sp, [ss:BOOTVARS.dwPostStack]
[294]169%endif
[121]170%endmacro
171
172
[3]173%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.