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

Last change on this file since 592 was 592, checked in by Krister Nordvall, 7 years ago

Changes:

  • The problem with NASM in the previous revision (r591) has been fixed.
  • The colors used by the boot menu and hotkey bar can now be customized by selecting one of a number of pre-defined color themes. Suggestions for additional themes are more than welcome!
  • Large builds are now 10 KB. Small builds are still 8 KB with the exception of the Tiny build which is now 4 KB. In other words, builds are now as small as possible to make it easier to combine them with other BIOSes.
  • Added code to the library to improve drive error handling. XTIDECFG can now handle "Drive Not Ready" errors.
  • Fixed a couple of potential bugs in AtaID.asm (AtaID_GetMaxPioModeToAXandMinCycleTimeToCX); 1) ATA1.bPioMode was treated as a WORD variable. 2) ATA2.bPIOSupp was assumed to be non-zero which would result in PIO mode 3 being returned if the assumption was wrong.
  • Made the same changes in the equivalent function used by BIOSDRVS (DisplayPioModeInformationUsingAtaInfoFromDSBX in AtaInfo.asm).
  • Fixed a bug from r587 in PDC20x30.asm in PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX.
  • Fixed a bug from r523 in XTIDECFG where Auto Configure would only set the IRQ on one IDE interface on AT-builds.
  • XTIDECFG will now restore the default settings for the "Serial port virtual device" when reselecting it in the list of device types. This makes it behave consistently for all device types.
  • The eAAM macro is now used regardless if USE_UNDOC_INTEL is defined or not because it is apparently supported on all processors including the NEC V20/V30 CPUs.
  • Renamed the EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS define to EXCLUDE_FROM_XUB.
  • Added a define to exclude unused library code from BIOSDRVS (EXCLUDE_FROM_BIOSDRVS). This makes it a lot smaller than in previous revisions.
  • All unnecessary CLD-instructions are now under a new define 'CLD_NEEDED' which is only enabled for the BIOS. It is disabled for XTIDECFG and BIOSDRVS but can be enabled if needed by adding this define to the respective makefile. This change was made because these unnecessary instructions are wasteful and should never be needed. In fact, they only serve to hide bugs (in other peoples code) which I strongly believe should be avoided. I recommend people making their own BIOSes from source to not use this define as it's extremely unlikely to be needed.
  • Updated the copyright info in SerDrive and changed an URL to point to the new site.
  • Updated the copyright info and version number in BIOSDRVS.
  • Updated the copyright info in XTIDECFG.
  • Optimizations in general.
File size: 5.5 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
[294]31; Pre-boot variables. These do not exist after successful boot to OS.
[3]32; Segment is always 0000h, same as BDA segment
33struc BOOTVARS
[392]34 resb 7C00h
35 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
36 .rgbBootSect resb 512 ; 7C00h, Boot sector
37 resb 256 ; Boot Menu stack
[221]38 .rgbMnuStack:
[392]39 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
[397]40%ifdef MODULE_HOTKEYS
[589]41 .hotkeyVars resb HOTKEYVARS_size
[397]42%endif
43 .rgDrvDetectInfo: ; Array containing DRVDETECTINFO structs
[3]44endstruc
45
[520]46
[397]47%ifdef MODULE_HOTKEYS
[492]48
[392]49struc HOTKEYVARS
[524]50 .wTimeWhenDisplayed resb 2 ; System time (ticks) when Hotkey bar was first displayed
[500]51 .wFddAndHddLetters:
[492]52 .bFddLetter resb 1 ; Floppy Drive letter hotkey (upper case)
[528]53 .bHddLetter resb 1 ; Hard Drive letter hotkey (upper case). Must be after .bFddLetter!
[492]54 .bFlags resb 1 ; Must be just after .bHddLetter! (dependency in Hotkeybar.asm)
55 .bScancode resb 1 ; Function hotkey scancode, must be just after .bFlags!
[392]56endstruc
[3]57
[492]58%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
[526]59%if HOTKEYVARS.bFddLetter+1 != HOTKEYVARS.bHddLetter || HOTKEYVARS.bHddLetter+1 != HOTKEYVARS.bFlags || HOTKEYVARS.bFlags+1 != HOTKEYVARS.bScancode
[492]60%error "HOTKEYVARS: bytes need to come in the order .bFddLetter, then .bHddLetter, then .bFlags, then .bScancode"
61%endif
62%endif
63
[524]64; Bit defines for HOTKEYVARS.bFlags
65FLG_HOTKEY_HD_FIRST EQU (1<<0) ; First try to boot from HDD, then FDD
[392]66
[492]67%endif ; MODULE_HOTKEYS
[392]68
[592]69; MAX_HARD_DISK_NAME_LENGTH must be defined ahead of the DRVDETECTINFO structure to avoid problems with NASM
70MAX_HARD_DISK_NAME_LENGTH EQU 30 ; Bytes reserved for drive name
71
[397]72struc DRVDETECTINFO
[422]73 .StartOfDrvDetectInfo:
[397]74 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH
75 resb 2 ; Zero word (ensures string terminates)
76 .wInitErrorFlags resb 2 ; Errors during initialization
[421]77
[422]78 ; DRVDETECTINFO's size must be an even multiple of DPT's size
79 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE)
[397]80endstruc
81
82DPT_DRVDETECTINFO_SIZE_MULTIPLIER EQU DRVDETECTINFO_size / LARGEST_DPT_SIZE
83
84%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
85%if MAX_HARD_DISK_NAME_LENGTH % 2 <> 0
86 %error "MAX_HARD_DISK_NAME_LENGTH needs to be a multiple of 2, memory is moved with word operations."
87%endif
88%endif
89
90
[121]91;--------------------------------------------------------------------
92; Stores POST stack pointer to BOOTVARS.
93;
94; STORE_POST_STACK_POINTER
95; Parameters:
[243]96; ES: BDA and Interrupt Vector segment (zero)
[121]97; Returns:
98; Nothing
99; Corrupts registers:
100; Nothing
101;--------------------------------------------------------------------
102%macro STORE_POST_STACK_POINTER 0
[243]103 mov [es:BOOTVARS.dwPostStack], sp
104 mov [es:BOOTVARS.dwPostStack+2], ss
[121]105%endmacro
106
107
108;--------------------------------------------------------------------
109; Initializes stack for boot menu usage.
110; POST stack is not large enough when DPTs are stored to 30:0h.
111;
112; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
113; then you also have to unconditionally enable the CLI/STI pair.
114; The reason for this is that only some buggy 808x CPU:s need the
115; CLI/STI instruction pair when changing stacks. Other CPU:s disable
116; interrupts automatically when SS is modified for the duration of
117; the immediately following instruction to give time to change SP.
118;
119; SWITCH_TO_BOOT_MENU_STACK
120; Parameters:
121; Nothing
122; Returns:
123; SS:SP: Pointer to top of Boot Menu stack
124; Corrupts registers:
125; Nothing
126;--------------------------------------------------------------------
127%macro SWITCH_TO_BOOT_MENU_STACK 0
128%ifndef USE_186
129 cli ; Disable interrupts
130%endif
131 LOAD_BDA_SEGMENT_TO ss, sp
132 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
133%ifndef USE_186
134 sti ; Enable interrupts
135%endif
136%endmacro
137
138
139;--------------------------------------------------------------------
140; Restores SS and SP to initial boot loader values.
141;
[243]142; Note! Must return with AX=0 and CF preserved.
143; See Int19hMenu_JumpToBootSector_or_RomBoot.
[121]144;
145; SWITCH_BACK_TO_POST_STACK
146; Parameters:
[243]147; AX: BDA and Interrupt Vector segment (zero)
[121]148; Returns:
149; SS:SP: Ptr to POST stack
150; Corrupts registers:
[243]151; Nothing (not even FLAGS)
[121]152;--------------------------------------------------------------------
153%macro SWITCH_BACK_TO_POST_STACK 0
154%ifndef USE_386
[243]155 cli
156 mov ss, ax
[121]157 mov sp, [ss:BOOTVARS.dwPostStack]
158 mov ss, [ss:BOOTVARS.dwPostStack+2]
[243]159 sti
[121]160%else
[243]161 mov ss, ax
[121]162 lss sp, [ss:BOOTVARS.dwPostStack]
[294]163%endif
[121]164%endmacro
165
166
[3]167%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.