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

Last change on this file since 38 was 3, checked in by Tomi Tilli, 15 years ago
File size: 3.1 KB
Line 
1; File name : BootVars.asm
2; Project name : IDE BIOS
3; Created date : 1.4.2010
4; Last update : 12.4.2010
5; Author : Tomi Tilli
6; Description : Functions to access BOOTVARS struct.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Stores POST stack pointer to BOOTVARS.
13;
14; BootVars_StorePostStackPointer
15; Parameters:
16; DS: BDA and Interrupt Vector segment (zero)
17; Returns:
18; Nothing
19; Corrupts registers:
20; AX
21;--------------------------------------------------------------------
22ALIGN JUMP_ALIGN
23BootVars_StorePostStackPointer:
24 pop ax ; Pop return address
25 mov [BOOTVARS.dwPostStack], sp
26 mov [BOOTVARS.dwPostStack+2], ss
27 jmp ax
28
29
30;--------------------------------------------------------------------
31; Initializes stack for boot menu usage.
32; POST stack is not large enough when DPTs are stored to 30:0h.
33;
34; BootVars_SwitchToBootMenuStack
35; Parameters:
36; Nothing
37; Returns:
38; SS:SP: Pointer to top of Boot Menu stack
39; Corrupts registers:
40; AX
41;--------------------------------------------------------------------
42ALIGN JUMP_ALIGN
43BootVars_SwitchToBootMenuStack:
44 pop ax ; Pop return address
45 cli ; Disable interrupts
46 LOAD_BDA_SEGMENT_TO ss, sp
47 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
48 sti ; Enable interrupts
49 jmp ax
50
51
52;--------------------------------------------------------------------
53; Restores SS and SP to initial boot loader values.
54;
55; BootVars_SwitchBackToPostStack
56; Parameters:
57; Nothing
58; Returns:
59; SS:SP: Ptr to POST stack
60; Corrupts registers:
61; AX
62;--------------------------------------------------------------------
63ALIGN JUMP_ALIGN
64BootVars_SwitchBackToPostStack:
65 pop ax ; Pop return address
66 cli ; Disable interrupts
67 LOAD_BDA_SEGMENT_TO ss, sp
68 eLSS sp, ss:BOOTVARS.dwPostStack
69 sti ; Enable interrupts
70 jmp ax
71
72
73;--------------------------------------------------------------------
74; Backups system INT 18h ROM Boot / Boot Failure handler and
75; installs our own for boot menu INT 18h callbacks.
76;
77; BootVars_StoreSystemInt18hAndInstallOurs
78; Parameters:
79; DS: BDA and Interrupt Vector segment (zero)
80; Returns:
81; Nothing
82; Corrupts registers:
83; AX, BX, ES
84;--------------------------------------------------------------------
85ALIGN JUMP_ALIGN
86BootVars_StoreSystemInt18hAndInstallOurs:
87 mov bx, INTV_BOOT_FAILURE*4 ; Offset to INT 18h vector
88 les ax, [bx] ; Load system INT 18h
89 mov [BOOTVARS.dwSys18h], ax
90 mov [BOOTVARS.dwSys18h+2], es
91 mov WORD [bx], Int18h_BootError ; Install our INT 18h
92 mov WORD [bx+2], cs
93 ret
94
95
96;--------------------------------------------------------------------
97; Restores system INT 18h ROM Boot or Boot Error handler.
98;
99; BootVars_RestoreSystemInt18h
100; Parameters:
101; Nothing
102; Returns:
103; Nothing
104; Corrupts registers:
105; AX, DS, ES
106;--------------------------------------------------------------------
107ALIGN JUMP_ALIGN
108BootVars_RestoreSystemInt18h:
109 LOAD_BDA_SEGMENT_TO ds, ax
110 les ax, [BOOTVARS.dwSys18h]
111 mov [INTV_BOOT_FAILURE*4], ax
112 mov [INTV_BOOT_FAILURE*4+2], es
113 ret
Note: See TracBrowser for help on using the repository browser.