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

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

Changes to XTIDE Universal BIOS:

  • AH=0h (Reset) should now work but our drives are no longer reset if DL belongs to foreign drive.
File size: 2.8 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 call BootMenuPrint_InitializeDisplayContext
56 call DetectPrint_RomFoundAtSegment
57 call RamVars_Initialize
58 call Interrupts_InitializeInterruptVectors
59 call DetectDrives_FromAllIDEControllers
60 ; Fall to .StoreDptPointersToIntVectors
61
62;--------------------------------------------------------------------
63; .StoreDptPointersToIntVectors
64; Parameters:
65; DS: RAMVARS segment
66; ES: BDA and interrupt vector segment (zero)
67; Returns:
68; Nothing
69; Corrupts registers:
70; DX, DI
71;--------------------------------------------------------------------
72.StoreDptPointersToIntVectors:
73 mov dl, 80h
74 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
75 jc SHORT .FindForDrive81h ; Store nothing if not our drive
76 mov [es:HD0_DPT_POINTER_41h*4], di
77 mov [es:HD0_DPT_POINTER_41h*4+2], ds
78.FindForDrive81h:
79 inc dx
80 call FindDPT_ForDriveNumberInDL
81 jc SHORT .ResetDetectedDrives
82 mov [es:HD1_DPT_POINTER_46h*4], di
83 mov [es:HD1_DPT_POINTER_46h*4+2], ds
84 ; Fall to .ResetDetectedDrives
85
86;--------------------------------------------------------------------
87; .ResetDetectedDrives
88; Parameters:
89; DS: RAMVARS segment
90; ES: BDA and interrupt vector segment (zero)
91; Returns:
92; Nothing
93; Corrupts registers:
94; All, except DS and ES
95;--------------------------------------------------------------------
96.ResetDetectedDrives:
97 call Idepack_FakeToSSBP
98 call AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
99 add sp, BYTE EXTRA_BYTES_FOR_INTPACK
100 ret
Note: See TracBrowser for help on using the repository browser.