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
RevLine 
[90]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Functions for initializing the BIOS.
3
[376]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
[3]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;--------------------------------------------------------------------
[229]35Initialize_FromMainBiosRomSearch:           ; unused entrypoint ok
[3]36    pushf
37    push    es
38    push    ds
39    ePUSHA
40
[90]41    LOAD_BDA_SEGMENT_TO es, ax
[229]42    sti                                     ; Enable interrupts
43    test    BYTE [es:BDA.bKBFlgs1], (1<<2)  ; Clears ZF if CTRL is held down
[90]44    jnz     SHORT .SkipRomInitialization
[3]45
[229]46    ; Install INT 19h handler (boot loader) where drives are detected
[258]47    mov     al, BIOS_BOOT_LOADER_INTERRUPT_19h
[243]48    mov     si, Int19h_BootLoaderHandler
[258]49    call    Interrupts_InstallHandlerToVectorInALFromCSSI
[229]50
[90]51.SkipRomInitialization:
[3]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:
[90]64;       ES:     BDA Segment
[3]65;   Returns:
[97]66;       DS:     RAMVARS segment
[3]67;   Corrupts registers:
[97]68;       All
[3]69;--------------------------------------------------------------------
70Initialize_AndDetectDrives:
[130]71    call    BootMenuPrint_InitializeDisplayContext
[3]72    call    DetectPrint_RomFoundAtSegment
73    call    RamVars_Initialize
[33]74    call    Interrupts_InitializeInterruptVectors
[3]75    call    DetectDrives_FromAllIDEControllers
[98]76    ; Fall to .StoreDptPointersToIntVectors
[97]77
78;--------------------------------------------------------------------
[98]79; .StoreDptPointersToIntVectors
[97]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;--------------------------------------------------------------------
[98]88.StoreDptPointersToIntVectors:
[97]89    mov     dl, 80h
[262]90    call    FindDPT_ForDriveNumberInDL   ; DPT to DS:DI
[258]91    jc      SHORT .FindForDrive81h  ; Store nothing if not our drive
[152]92    mov     [es:HD0_DPT_POINTER_41h*4], di
93    mov     [es:HD0_DPT_POINTER_41h*4+2], ds
[97]94.FindForDrive81h:
95    inc     dx
[262]96    call    FindDPT_ForDriveNumberInDL
[258]97    jc      SHORT .ResetDetectedDrives
[152]98    mov     [es:HD1_DPT_POINTER_46h*4], di
99    mov     [es:HD1_DPT_POINTER_46h*4+2], ds
[33]100    ; Fall to .ResetDetectedDrives
[3]101
102;--------------------------------------------------------------------
[97]103; .ResetDetectedDrives
[3]104;   Parameters:
105;       DS:     RAMVARS segment
[243]106;       ES:     BDA and interrupt vector segment (zero)
[3]107;   Returns:
108;       Nothing
109;   Corrupts registers:
[243]110;       All, except DS and ES
[3]111;--------------------------------------------------------------------
[33]112.ResetDetectedDrives:
[150]113    call    Idepack_FakeToSSBP
[271]114    call    AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
[158]115    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
[150]116    ret
Note: See TracBrowser for help on using the repository browser.