source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootVars.asm@ 109

Last change on this file since 109 was 96, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • Cleaned boot loader code some more.
File size: 1.9 KB
RevLine 
[90]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions to access BOOTVARS struct.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Stores POST stack pointer to BOOTVARS.
9;
10; BootVars_StorePostStackPointer
11; Parameters:
12; DS: BDA and Interrupt Vector segment (zero)
13; Returns:
14; Nothing
15; Corrupts registers:
16; AX
17;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19BootVars_StorePostStackPointer:
20 pop ax ; Pop return address
21 mov [BOOTVARS.dwPostStack], sp
22 mov [BOOTVARS.dwPostStack+2], ss
23 jmp ax
24
25
26;--------------------------------------------------------------------
27; Initializes stack for boot menu usage.
28; POST stack is not large enough when DPTs are stored to 30:0h.
29;
30; BootVars_SwitchToBootMenuStack
31; Parameters:
32; Nothing
33; Returns:
34; SS:SP: Pointer to top of Boot Menu stack
35; Corrupts registers:
36; AX
37;--------------------------------------------------------------------
38ALIGN JUMP_ALIGN
39BootVars_SwitchToBootMenuStack:
40 pop ax ; Pop return address
41 cli ; Disable interrupts
42 LOAD_BDA_SEGMENT_TO ss, sp
43 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
44 sti ; Enable interrupts
45 jmp ax
46
47
48;--------------------------------------------------------------------
49; Restores SS and SP to initial boot loader values.
50;
51; BootVars_SwitchBackToPostStack
52; Parameters:
53; Nothing
54; Returns:
55; SS:SP: Ptr to POST stack
56; Corrupts registers:
57; AX
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60BootVars_SwitchBackToPostStack:
61 pop ax ; Pop return address
62 cli ; Disable interrupts
63 LOAD_BDA_SEGMENT_TO ss, sp
[84]64%ifndef USE_386
65 mov sp, [ss:BOOTVARS.dwPostStack]
66 mov ss, [ss:BOOTVARS.dwPostStack+2]
67%else
68 lss sp, [ss:BOOTVARS.dwPostStack]
69%endif
[3]70 sti ; Enable interrupts
71 jmp ax
Note: See TracBrowser for help on using the repository browser.