source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm @ 33

Last change on this file since 33 was 33, checked in by aitotat, 14 years ago

Interrupt controllers are now unmasked during drive reset.

File size: 3.2 KB
Line 
1; File name     :   Initialize.asm
2; Project name  :   IDE BIOS
3; Created date  :   23.3.2010
4; Last update   :   23.8.2010
5; Author        :   Tomi Tilli
6; Description   :   Functions for initializing the BIOS.
7
8; Section containing code
9SECTION .text
10
11;--------------------------------------------------------------------
12; Initializes the BIOS.
13; This function is called from main BIOS ROM search routine.
14;
15; Initialize_FromMainBiosRomSearch
16;   Parameters:
17;       Nothing
18;   Returns:
19;       Nothing
20;   Corrupts registers:
21;       Nothing
22;--------------------------------------------------------------------
23ALIGN JUMP_ALIGN
24Initialize_FromMainBiosRomSearch:
25    pushf
26    push    es
27    push    ds
28    ePUSHA
29
30    call    Initialize_ShouldSkip
31    jc      SHORT .ReturnFromRomInit
32
33    ePUSH_T ax, .ReturnFromRomInit      ; Push return address
34    test    BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_LATE
35    jnz     SHORT Initialize_PrepareLateInitialization
36    jmp     SHORT Initialize_AndDetectDrives
37
38ALIGN JUMP_ALIGN
39.ReturnFromRomInit:
40    ePOPA
41    pop     ds
42    pop     es
43    popf
44    retf
45
46
47;--------------------------------------------------------------------
48; Checks if user wants to skip ROM initialization.
49;
50; Initialize_ShouldSkip
51;   Parameters:
52;       Nothing
53;   Returns:
54;       CF:     Set if ROM initialization is to be skipped
55;               Cleared to continue ROM initialization
56;   Corrupts registers:
57;       AX, DS
58;--------------------------------------------------------------------
59ALIGN JUMP_ALIGN
60Initialize_ShouldSkip:
61    sti                         ; Enable interrupts
62    LOAD_BDA_SEGMENT_TO ds, ax
63    mov     al, [BDA.bKBFlgs1]  ; Load shift flags
64    eSHR_IM al, 3               ; Set CF if CTRL is held down
65    ret
66
67
68;--------------------------------------------------------------------
69; Installs INT 19h boot loader handler for late initialization.
70;
71; Initialize_PrepareLateInitialization
72;   Parameters:
73;       Nothing
74;   Returns:
75;       Nothing
76;   Corrupts registers:
77;       BX, SI, ES
78;--------------------------------------------------------------------
79ALIGN JUMP_ALIGN
80Initialize_PrepareLateInitialization:
81    LOAD_BDA_SEGMENT_TO es, bx
82    mov     bl, INTV_BOOTSTRAP
83    mov     si, Int19h_LateInitialization
84    jmp     Interrupts_InstallHandlerToVectorInBXFromCSSI
85
86
87;--------------------------------------------------------------------
88; Initializes the BIOS variables and detects IDE drives.
89;
90; Initialize_AndDetectDrives
91;   Parameters:
92;       Nothing
93;   Returns:
94;       Nothing
95;   Corrupts registers:
96;       All, including segments
97;--------------------------------------------------------------------
98ALIGN JUMP_ALIGN
99Initialize_AndDetectDrives:
100    call    DetectPrint_RomFoundAtSegment
101    call    RamVars_Initialize
102    call    RamVars_GetSegmentToDS
103    LOAD_BDA_SEGMENT_TO es, ax
104    call    Interrupts_InitializeInterruptVectors
105    call    DetectDrives_FromAllIDEControllers
106    call    CompatibleDPT_CreateForDrives80hAnd81h
107    ; Fall to .ResetDetectedDrives
108
109;--------------------------------------------------------------------
110; Resets all hard disks.
111;
112; Initialize_ResetDetectedDrives
113;   Parameters:
114;       DS:     RAMVARS segment
115;   Returns:
116;       Nothing
117;   Corrupts registers:
118;       AX, BX, CX, DX, DI
119;--------------------------------------------------------------------
120;ALIGN JUMP_ALIGN
121.ResetDetectedDrives:
122    jmp     AH0h_ResetHardDisksHandledByOurBIOS
Note: See TracBrowser for help on using the repository browser.