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

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

WIDE checkin... Added copyright and license information to sorce files, as per the GPL instructions for usage.

File size: 3.5 KB
Line 
1; Project name  :   XTIDE Universal BIOS
2; Description   :   Functions for initializing the BIOS.
3
4;
5; XTIDE Universal BIOS and Associated Tools 
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12; 
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16; GNU General Public License for more details.     
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;       
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Initializes the BIOS.
25; This function is called from main BIOS ROM search routine.
26;
27; Initialize_FromMainBiosRomSearch
28;   Parameters:
29;       Nothing
30;   Returns:
31;       Nothing
32;   Corrupts registers:
33;       Nothing
34;--------------------------------------------------------------------
35Initialize_FromMainBiosRomSearch:           ; unused entrypoint ok
36    pushf
37    push    es
38    push    ds
39    ePUSHA
40
41    LOAD_BDA_SEGMENT_TO es, ax
42    sti                                     ; Enable interrupts
43    test    BYTE [es:BDA.bKBFlgs1], (1<<2)  ; Clears ZF if CTRL is held down
44    jnz     SHORT .SkipRomInitialization
45
46    ; Install INT 19h handler (boot loader) where drives are detected
47    mov     al, BIOS_BOOT_LOADER_INTERRUPT_19h
48    mov     si, Int19h_BootLoaderHandler
49    call    Interrupts_InstallHandlerToVectorInALFromCSSI
50
51.SkipRomInitialization:
52    ePOPA
53    pop     ds
54    pop     es
55    popf
56    retf
57
58
59;--------------------------------------------------------------------
60; Initializes the BIOS variables and detects IDE drives.
61;
62; Initialize_AndDetectDrives
63;   Parameters:
64;       ES:     BDA Segment
65;   Returns:
66;       DS:     RAMVARS segment
67;   Corrupts registers:
68;       All
69;--------------------------------------------------------------------
70Initialize_AndDetectDrives:
71    call    BootMenuPrint_InitializeDisplayContext
72    call    DetectPrint_RomFoundAtSegment
73    call    RamVars_Initialize
74    call    Interrupts_InitializeInterruptVectors
75    call    DetectDrives_FromAllIDEControllers
76    ; Fall to .StoreDptPointersToIntVectors
77
78;--------------------------------------------------------------------
79; .StoreDptPointersToIntVectors
80;   Parameters:
81;       DS:     RAMVARS segment
82;       ES:     BDA and interrupt vector segment (zero)
83;   Returns:
84;       Nothing
85;   Corrupts registers:
86;       DX, DI
87;--------------------------------------------------------------------
88.StoreDptPointersToIntVectors:
89    mov     dl, 80h
90    call    FindDPT_ForDriveNumberInDL   ; DPT to DS:DI
91    jc      SHORT .FindForDrive81h  ; Store nothing if not our drive
92    mov     [es:HD0_DPT_POINTER_41h*4], di
93    mov     [es:HD0_DPT_POINTER_41h*4+2], ds
94.FindForDrive81h:
95    inc     dx
96    call    FindDPT_ForDriveNumberInDL
97    jc      SHORT .ResetDetectedDrives
98    mov     [es:HD1_DPT_POINTER_46h*4], di
99    mov     [es:HD1_DPT_POINTER_46h*4+2], ds
100    ; Fall to .ResetDetectedDrives
101
102;--------------------------------------------------------------------
103; .ResetDetectedDrives
104;   Parameters:
105;       DS:     RAMVARS segment
106;       ES:     BDA and interrupt vector segment (zero)
107;   Returns:
108;       Nothing
109;   Corrupts registers:
110;       All, except DS and ES
111;--------------------------------------------------------------------
112.ResetDetectedDrives:
113    call    Idepack_FakeToSSBP
114    call    AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
115    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
116    ret
Note: See TracBrowser for help on using the repository browser.