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

Last change on this file since 252 was 252, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Boot menu now shows only one capacity.
  • Added "strings" makefile target to compress strings.
File size: 3.8 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; Boot Menu Information Table. These are generated for all XTIDE Universal
12; BIOS drives. Available only until boot is successfull.
13LEN_BOOTNFO_DRV     EQU     26      ; Bytes reserved for drive name
14struc BOOTNFO
15    .szDrvName      resb    LEN_BOOTNFO_DRV     ; Drive name
16                    resb    2       ; Zero word (ensures string terminates)
17                    resb    8       ; padding to make BOOTNFO size an even multiple of DPT size
18endstruc
19
20DPT_BOOTNFO_SIZE_MULTIPLIER  equ    BOOTNFO_size / LARGEST_DPT_SIZE
21
22%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS               
23
24%if BOOTNFO_size % LARGEST_DPT_SIZE <> 0
25%error "BOOTNFO's size must be an even multiple of DPT's size.  Add or remove padding at the bottom of BOOTNFO to bring the two sizes into alignment.  As BOOTNFO is only used at boot time, with plenty of memory to consume, it is OK to waste some space here."
26%endif
27
28%if BOOTNFO.szDrvName <> 0
29%error "BOOTNFO.szDrvName is assumed to be the first member of struc BOOTNFO, in BootMenuPrint_RefreshItem"
30%endif
31
32%endif
33
34
35; Pre-boot variables. These do not exist after successfull boot to OS.
36; Segment is always 0000h, same as BDA segment
37struc BOOTVARS
38                    resb    7C00h
39    .rgbAtaInfo:                    ; 7C00h, ATA Information for drive detection
40    .rgbBootSect    resb    512     ; 7C00h, Boot sector
41                    resb    256     ; Boot Menu stack
42    .rgbMnuStack:
43    .dwPostStack    resb    4       ; POST stack pointer when entering INT 19h
44    .rgBootNfo:                     ; Array containing BOOTNFO structs
45endstruc
46
47
48;--------------------------------------------------------------------
49; Stores POST stack pointer to BOOTVARS.
50;
51; STORE_POST_STACK_POINTER
52;   Parameters:
53;       ES:     BDA and Interrupt Vector segment (zero)
54;   Returns:
55;       Nothing
56;   Corrupts registers:
57;       Nothing
58;--------------------------------------------------------------------
59%macro STORE_POST_STACK_POINTER 0
60    mov     [es:BOOTVARS.dwPostStack], sp
61    mov     [es:BOOTVARS.dwPostStack+2], ss
62%endmacro
63
64
65;--------------------------------------------------------------------
66; Initializes stack for boot menu usage.
67; POST stack is not large enough when DPTs are stored to 30:0h.
68;
69; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
70; then you also have to unconditionally enable the CLI/STI pair.
71; The reason for this is that only some buggy 808x CPU:s need the
72; CLI/STI instruction pair when changing stacks. Other CPU:s disable
73; interrupts automatically when SS is modified for the duration of
74; the immediately following instruction to give time to change SP.
75;
76; SWITCH_TO_BOOT_MENU_STACK
77;   Parameters:
78;       Nothing
79;   Returns:
80;       SS:SP:  Pointer to top of Boot Menu stack
81;   Corrupts registers:
82;       Nothing
83;--------------------------------------------------------------------
84%macro SWITCH_TO_BOOT_MENU_STACK 0
85%ifndef USE_186
86    cli                                 ; Disable interrupts
87%endif
88    LOAD_BDA_SEGMENT_TO ss, sp
89    mov     sp, BOOTVARS.rgbMnuStack    ; Load offset to stack
90%ifndef USE_186
91    sti                                 ; Enable interrupts
92%endif
93%endmacro
94
95
96;--------------------------------------------------------------------
97; Restores SS and SP to initial boot loader values.
98;
99; Note! Must return with AX=0 and CF preserved.
100; See Int19hMenu_JumpToBootSector_or_RomBoot.
101;
102; SWITCH_BACK_TO_POST_STACK
103;   Parameters:
104;       AX:     BDA and Interrupt Vector segment (zero)
105;   Returns:
106;       SS:SP:  Ptr to POST stack
107;   Corrupts registers:
108;       Nothing (not even FLAGS)
109;--------------------------------------------------------------------
110%macro SWITCH_BACK_TO_POST_STACK 0
111%ifndef USE_386
112    cli
113    mov     ss, ax
114    mov     sp, [ss:BOOTVARS.dwPostStack]
115    mov     ss, [ss:BOOTVARS.dwPostStack+2]
116    sti
117%else
118    mov     ss, ax
119    lss     sp, [ss:BOOTVARS.dwPostStack]
120%endif 
121%endmacro
122
123
124%endif ; BOOTVARS_INC
Note: See TracBrowser for help on using the repository browser.