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

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

Changes to XTIDE Universal BIOS:

  • Added Advanced ATA Module (MODULE_ADVANCED_ATA) with native support for QDI Vision QD6500 and QD6580 VLB IDE Controllers.
  • Hopefully optimized IDE transfer functions for 8088 (replaced some memory accesses from WORD to BYTE).
  • XT build does not fit in 8k at the moment!!!
File size: 3.0 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Defines for BOOTVARS struct used by boot menu
3; and drive initialization.
4%ifndef BOOTVARS_INC
5%define BOOTVARS_INC
6
7
8BOOT_READ_RETRY_TIMES EQU 3
9
10
11
12; Pre-boot variables. These do not exist after successful boot to OS.
13; Segment is always 0000h, same as BDA segment
14struc BOOTVARS
15 resb 7C00h
16 .rgbAtaInfo: ; 7C00h, ATA Information for drive detection
17 .rgbBootSect resb 512 ; 7C00h, Boot sector
18 resb 256 ; Boot Menu stack
19 .rgbMnuStack:
20 .dwPostStack resb 4 ; POST stack pointer when entering INT 19h
21 .wMagicWord resb 2 ; I wish we didn't need this
22 .rgBootNfo: ; Array containing BOOTNFO structs
23endstruc
24
25; Magic WORD to detect when BOOTVARS is available.
26BOOTVARS_MAGIC_WORD EQU 1110011001100111b
27
28
29
30;--------------------------------------------------------------------
31; Stores POST stack pointer to BOOTVARS.
32;
33; STORE_POST_STACK_POINTER
34; Parameters:
35; ES: BDA and Interrupt Vector segment (zero)
36; Returns:
37; Nothing
38; Corrupts registers:
39; Nothing
40;--------------------------------------------------------------------
41%macro STORE_POST_STACK_POINTER 0
42 mov [es:BOOTVARS.dwPostStack], sp
43 mov [es:BOOTVARS.dwPostStack+2], ss
44%endmacro
45
46
47;--------------------------------------------------------------------
48; Initializes stack for boot menu usage.
49; POST stack is not large enough when DPTs are stored to 30:0h.
50;
51; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
52; then you also have to unconditionally enable the CLI/STI pair.
53; The reason for this is that only some buggy 808x CPU:s need the
54; CLI/STI instruction pair when changing stacks. Other CPU:s disable
55; interrupts automatically when SS is modified for the duration of
56; the immediately following instruction to give time to change SP.
57;
58; SWITCH_TO_BOOT_MENU_STACK
59; Parameters:
60; Nothing
61; Returns:
62; SS:SP: Pointer to top of Boot Menu stack
63; Corrupts registers:
64; Nothing
65;--------------------------------------------------------------------
66%macro SWITCH_TO_BOOT_MENU_STACK 0
67%ifndef USE_186
68 cli ; Disable interrupts
69%endif
70 LOAD_BDA_SEGMENT_TO ss, sp
71 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
72%ifndef USE_186
73 sti ; Enable interrupts
74%endif
75%endmacro
76
77
78;--------------------------------------------------------------------
79; Restores SS and SP to initial boot loader values.
80;
81; Note! Must return with AX=0 and CF preserved.
82; See Int19hMenu_JumpToBootSector_or_RomBoot.
83;
84; SWITCH_BACK_TO_POST_STACK
85; Parameters:
86; AX: BDA and Interrupt Vector segment (zero)
87; Returns:
88; SS:SP: Ptr to POST stack
89; Corrupts registers:
90; Nothing (not even FLAGS)
91;--------------------------------------------------------------------
92%macro SWITCH_BACK_TO_POST_STACK 0
93%ifndef USE_386
94 cli
95 mov ss, ax
96 mov sp, [ss:BOOTVARS.dwPostStack]
97 mov ss, [ss:BOOTVARS.dwPostStack+2]
98 sti
99%else
100 mov ss, ax
101 lss sp, [ss:BOOTVARS.dwPostStack]
102%endif
103%endmacro
104
105
106%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.