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

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

Changes to XTIDE Universal BIOS:

  • Added Advanced ATA Module (MODULE_ADVANCED_ATA) with native support for QDI Vision QD6500 and QD6580 VLB IDE Controllers.
  • Hopefully optimized IDE transfer functions for 8088 (replaced some memory accesses from WORD to BYTE).
  • XT build does not fit in 8k at the moment!!!
File size: 2.9 KB
Line 
1; Project name  :   XTIDE Universal BIOS
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:           ; unused entrypoint ok
20    pushf
21    push    es
22    push    ds
23    ePUSHA
24
25    LOAD_BDA_SEGMENT_TO es, ax
26    sti                                     ; Enable interrupts
27    test    BYTE [es:BDA.bKBFlgs1], (1<<2)  ; Clears ZF if CTRL is held down
28    jnz     SHORT .SkipRomInitialization
29
30    ; Install INT 19h handler (boot loader) where drives are detected
31    mov     al, BIOS_BOOT_LOADER_INTERRUPT_19h
32    mov     si, Int19h_BootLoaderHandler
33    call    Interrupts_InstallHandlerToVectorInALFromCSSI
34
35.SkipRomInitialization:
36    ePOPA
37    pop     ds
38    pop     es
39    popf
40    retf
41
42
43;--------------------------------------------------------------------
44; Initializes the BIOS variables and detects IDE drives.
45;
46; Initialize_AndDetectDrives
47;   Parameters:
48;       ES:     BDA Segment
49;   Returns:
50;       DS:     RAMVARS segment
51;   Corrupts registers:
52;       All
53;--------------------------------------------------------------------
54Initialize_AndDetectDrives:
55    mov     WORD [es:BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD
56    call    BootMenuPrint_InitializeDisplayContext
57    call    DetectPrint_RomFoundAtSegment
58    call    RamVars_Initialize
59    call    Interrupts_InitializeInterruptVectors
60    call    DetectDrives_FromAllIDEControllers
61    ; Fall to .StoreDptPointersToIntVectors
62
63;--------------------------------------------------------------------
64; .StoreDptPointersToIntVectors
65;   Parameters:
66;       DS:     RAMVARS segment
67;       ES:     BDA and interrupt vector segment (zero)
68;   Returns:
69;       Nothing
70;   Corrupts registers:
71;       DX, DI
72;--------------------------------------------------------------------
73.StoreDptPointersToIntVectors:
74    mov     dl, 80h
75    call    FindDPT_ForDriveNumberInDL   ; DPT to DS:DI
76    jc      SHORT .FindForDrive81h  ; Store nothing if not our drive
77    mov     [es:HD0_DPT_POINTER_41h*4], di
78    mov     [es:HD0_DPT_POINTER_41h*4+2], ds
79.FindForDrive81h:
80    inc     dx
81    call    FindDPT_ForDriveNumberInDL
82    jc      SHORT .ResetDetectedDrives
83    mov     [es:HD1_DPT_POINTER_46h*4], di
84    mov     [es:HD1_DPT_POINTER_46h*4+2], ds
85    ; Fall to .ResetDetectedDrives
86
87;--------------------------------------------------------------------
88; .ResetDetectedDrives
89;   Parameters:
90;       DS:     RAMVARS segment
91;       ES:     BDA and interrupt vector segment (zero)
92;   Returns:
93;       Nothing
94;   Corrupts registers:
95;       All, except DS and ES
96;--------------------------------------------------------------------
97.ResetDetectedDrives:
98    call    Idepack_FakeToSSBP
99    call    AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
100    add     sp, BYTE EXTRA_BYTES_FOR_INTPACK
101    mov     WORD [es:BOOTVARS.wMagicWord], 0
102    ret
Note: See TracBrowser for help on using the repository browser.