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

Last change on this file since 150 was 150, checked in by aitotat, 13 years ago

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
File size: 3.1 KB
RevLine 
[90]1; Project name  :   XTIDE Universal BIOS
[3]2; Description   :   Functions for initializing the BIOS.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Initializes the BIOS.
9; This function is called from main BIOS ROM search routine.
10;
11; Initialize_FromMainBiosRomSearch
12;   Parameters:
13;       Nothing
14;   Returns:
15;       Nothing
16;   Corrupts registers:
17;       Nothing
18;--------------------------------------------------------------------
19Initialize_FromMainBiosRomSearch:
20    pushf
21    push    es
22    push    ds
23    ePUSHA
24
[90]25    LOAD_BDA_SEGMENT_TO es, ax
[3]26    call    Initialize_ShouldSkip
[90]27    jnz     SHORT .SkipRomInitialization
[3]28
[90]29%ifdef USE_AT   ; Early initialization on AT build
30    call    Initialize_AndDetectDrives
31%else           ; Late initialization on XT builds
32    call    Int19hLate_InitializeInt19h
33%endif
34.SkipRomInitialization:
[3]35    ePOPA
36    pop     ds
37    pop     es
38    popf
39    retf
40
41
42;--------------------------------------------------------------------
43; Checks if user wants to skip ROM initialization.
44;
45; Initialize_ShouldSkip
46;   Parameters:
[90]47;       ES:     BDA segment
[3]48;   Returns:
[90]49;       ZF:     Cleared if ROM initialization is to be skipped
50;               Set to continue ROM initialization
[3]51;   Corrupts registers:
[90]52;       Nothing
[3]53;--------------------------------------------------------------------
54Initialize_ShouldSkip:
[90]55    sti                                     ; Enable interrupts
56    test    BYTE [es:BDA.bKBFlgs1], (1<<2)  ; Clear ZF if CTRL is held down
[3]57    ret
58
59
60;--------------------------------------------------------------------
61; Initializes the BIOS variables and detects IDE drives.
62;
63; Initialize_AndDetectDrives
64;   Parameters:
[90]65;       ES:     BDA Segment
[3]66;   Returns:
[97]67;       DS:     RAMVARS segment
[3]68;   Corrupts registers:
[97]69;       All
[3]70;--------------------------------------------------------------------
71Initialize_AndDetectDrives:
[130]72    call    BootMenuPrint_InitializeDisplayContext
[3]73    call    DetectPrint_RomFoundAtSegment
74    call    RamVars_Initialize
[33]75    call    Interrupts_InitializeInterruptVectors
[3]76    call    DetectDrives_FromAllIDEControllers
[98]77    ; Fall to .StoreDptPointersToIntVectors
[97]78
79;--------------------------------------------------------------------
[98]80; .StoreDptPointersToIntVectors
[97]81;   Parameters:
82;       DS:     RAMVARS segment
83;       ES:     BDA and interrupt vector segment (zero)
84;   Returns:
85;       Nothing
86;   Corrupts registers:
87;       DX, DI
88;--------------------------------------------------------------------
[98]89.StoreDptPointersToIntVectors:
[97]90    mov     dl, 80h
91    call    FindDPT_ForDriveNumber  ; DPT to DS:DI
92    jnc     SHORT .FindForDrive81h  ; Store nothing if not our drive
93    mov     [es:INTV_HD0DPT*4], di
94    mov     [es:INTV_HD0DPT*4+2], ds
95.FindForDrive81h:
96    inc     dx
97    call    FindDPT_ForDriveNumber
98    jnc     SHORT .ResetDetectedDrives
99    mov     [es:INTV_HD1DPT*4], di
100    mov     [es:INTV_HD1DPT*4+2], ds
[33]101    ; Fall to .ResetDetectedDrives
[3]102
103;--------------------------------------------------------------------
[97]104; .ResetDetectedDrives
[3]105;   Parameters:
106;       DS:     RAMVARS segment
107;   Returns:
108;       Nothing
109;   Corrupts registers:
[150]110;       All
[3]111;--------------------------------------------------------------------
[33]112.ResetDetectedDrives:
[150]113    call    Idepack_FakeToSSBP
114    call    AH0h_ResetHardDisksHandledByOurBIOS
115    add     sp, BYTE SIZE_OF_FAKE_IDEPACK
116    ret
Note: See TracBrowser for help on using the repository browser.