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

Last change on this file since 394 was 392, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

  • Greatly improved Hotkey Bar is displayed during drive detection.
  • 8k builds no longer include boot menu.
  • Boot menu is displayed only if F2 is pressed during drive detection.
  • Some changes to directory structure.


File size: 4.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-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
21%ifndef BOOTVARS_INC
22%define BOOTVARS_INC
23
24
25BOOT_READ_RETRY_TIMES EQU 3
26
27
28
29; Pre-boot variables. These do not exist after successful boot to OS.
30; Segment is always 0000h, same as BDA segment
31struc BOOTVARS
32 resb 7C00h
33 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
34 .rgbBootSect resb 512 ; 7C00h, Boot sector
35 resb 256 ; Boot Menu stack
36 .rgbMnuStack:
37 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
38 .hotkeyVars resb HOTKEYVARS_size
39 .rgBootNfo: ; Array containing BOOTNFO structs
40endstruc
41
42struc HOTKEYVARS
43 .bScancode resb 1 ; Function hotkey scancode
44 .bFlags resb 1 ; Must be just before .bHddLetter!
45 .wHddAndFddLetters:
46 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case)
47 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
48endstruc
49
50; Bit defines for HOTKEYVARS.bFlags
51FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
52
53
54
55;--------------------------------------------------------------------
56; Stores POST stack pointer to BOOTVARS.
57;
58; STORE_POST_STACK_POINTER
59; Parameters:
60; ES: BDA and Interrupt Vector segment (zero)
61; Returns:
62; Nothing
63; Corrupts registers:
64; Nothing
65;--------------------------------------------------------------------
66%macro STORE_POST_STACK_POINTER 0
67 mov [es:BOOTVARS.dwPostStack], sp
68 mov [es:BOOTVARS.dwPostStack+2], ss
69%endmacro
70
71
72;--------------------------------------------------------------------
73; Initializes stack for boot menu usage.
74; POST stack is not large enough when DPTs are stored to 30:0h.
75;
76; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
77; then you also have to unconditionally enable the CLI/STI pair.
78; The reason for this is that only some buggy 808x CPU:s need the
79; CLI/STI instruction pair when changing stacks. Other CPU:s disable
80; interrupts automatically when SS is modified for the duration of
81; the immediately following instruction to give time to change SP.
82;
83; SWITCH_TO_BOOT_MENU_STACK
84; Parameters:
85; Nothing
86; Returns:
87; SS:SP: Pointer to top of Boot Menu stack
88; Corrupts registers:
89; Nothing
90;--------------------------------------------------------------------
91%macro SWITCH_TO_BOOT_MENU_STACK 0
92%ifndef USE_186
93 cli ; Disable interrupts
94%endif
95 LOAD_BDA_SEGMENT_TO ss, sp
96 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
97%ifndef USE_186
98 sti ; Enable interrupts
99%endif
100%endmacro
101
102
103;--------------------------------------------------------------------
104; Restores SS and SP to initial boot loader values.
105;
106; Note! Must return with AX=0 and CF preserved.
107; See Int19hMenu_JumpToBootSector_or_RomBoot.
108;
109; SWITCH_BACK_TO_POST_STACK
110; Parameters:
111; AX: BDA and Interrupt Vector segment (zero)
112; Returns:
113; SS:SP: Ptr to POST stack
114; Corrupts registers:
115; Nothing (not even FLAGS)
116;--------------------------------------------------------------------
117%macro SWITCH_BACK_TO_POST_STACK 0
118%ifndef USE_386
119 cli
120 mov ss, ax
121 mov sp, [ss:BOOTVARS.dwPostStack]
122 mov ss, [ss:BOOTVARS.dwPostStack+2]
123 sti
124%else
125 mov ss, ax
126 lss sp, [ss:BOOTVARS.dwPostStack]
127%endif
128%endmacro
129
130
131%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.