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

Last change on this file since 305 was 294, checked in by krille_n_@…, 13 years ago

Commit 2/2 (BIOS):

  • Fixed a bug in AH1h_HStatus.asm.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File size: 2.9 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 .rgBootNfo: ; Array containing BOOTNFO structs
22endstruc
23
24
25;--------------------------------------------------------------------
26; Stores POST stack pointer to BOOTVARS.
27;
28; STORE_POST_STACK_POINTER
29; Parameters:
30; ES: BDA and Interrupt Vector segment (zero)
31; Returns:
32; Nothing
33; Corrupts registers:
34; Nothing
35;--------------------------------------------------------------------
36%macro STORE_POST_STACK_POINTER 0
37 mov [es:BOOTVARS.dwPostStack], sp
38 mov [es:BOOTVARS.dwPostStack+2], ss
39%endmacro
40
41
42;--------------------------------------------------------------------
43; Initializes stack for boot menu usage.
44; POST stack is not large enough when DPTs are stored to 30:0h.
45;
46; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
47; then you also have to unconditionally enable the CLI/STI pair.
48; The reason for this is that only some buggy 808x CPU:s need the
49; CLI/STI instruction pair when changing stacks. Other CPU:s disable
50; interrupts automatically when SS is modified for the duration of
51; the immediately following instruction to give time to change SP.
52;
53; SWITCH_TO_BOOT_MENU_STACK
54; Parameters:
55; Nothing
56; Returns:
57; SS:SP: Pointer to top of Boot Menu stack
58; Corrupts registers:
59; Nothing
60;--------------------------------------------------------------------
61%macro SWITCH_TO_BOOT_MENU_STACK 0
62%ifndef USE_186
63 cli ; Disable interrupts
64%endif
65 LOAD_BDA_SEGMENT_TO ss, sp
66 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
67%ifndef USE_186
68 sti ; Enable interrupts
69%endif
70%endmacro
71
72
73;--------------------------------------------------------------------
74; Restores SS and SP to initial boot loader values.
75;
76; Note! Must return with AX=0 and CF preserved.
77; See Int19hMenu_JumpToBootSector_or_RomBoot.
78;
79; SWITCH_BACK_TO_POST_STACK
80; Parameters:
81; AX: BDA and Interrupt Vector segment (zero)
82; Returns:
83; SS:SP: Ptr to POST stack
84; Corrupts registers:
85; Nothing (not even FLAGS)
86;--------------------------------------------------------------------
87%macro SWITCH_BACK_TO_POST_STACK 0
88%ifndef USE_386
89 cli
90 mov ss, ax
91 mov sp, [ss:BOOTVARS.dwPostStack]
92 mov ss, [ss:BOOTVARS.dwPostStack+2]
93 sti
94%else
95 mov ss, ax
96 lss sp, [ss:BOOTVARS.dwPostStack]
97%endif
98%endmacro
99
100
101%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.