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

Last change on this file since 594 was 593, checked in by Tomi Tilli, 6 years ago

Flashing now works again.
Hack to get Windows 95 to work properly (MODULE_WIN95_CMOS_HACK included for 386 builds by default).
Edited makefile to produce large 386 build.
Fixed recovery time for QDI Vision VLB-IDE controllers.
No more warnings with Nasm 2.13.xx and later.
File dialog now properly restores default drive when file selection is cancelled.

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