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

Last change on this file since 204 was 194, checked in by gregli@…, 13 years ago

ifdef'd out more unused code. Also added a tool for looking through the listing and the output of the precompiler to aid in finding dead code. Some changes in the files are to add annotations for the tool to avoid false positives.

File size: 3.2 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 call Initialize_ShouldSkip
27 jnz SHORT .SkipRomInitialization
28
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:
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:
47; ES: BDA segment
48; Returns:
49; ZF: Cleared if ROM initialization is to be skipped
50; Set to continue ROM initialization
51; Corrupts registers:
52; Nothing
53;--------------------------------------------------------------------
54Initialize_ShouldSkip:
55 sti ; Enable interrupts
56 test BYTE [es:BDA.bKBFlgs1], (1<<2) ; Clear ZF if CTRL is held down
57 ret
58
59
60;--------------------------------------------------------------------
61; Initializes the BIOS variables and detects IDE drives.
62;
63; Initialize_AndDetectDrives
64; Parameters:
65; ES: BDA Segment
66; Returns:
67; DS: RAMVARS segment
68; Corrupts registers:
69; All
70;--------------------------------------------------------------------
71Initialize_AndDetectDrives:
72 call BootMenuPrint_InitializeDisplayContext
73 call DetectPrint_RomFoundAtSegment
74 call RamVars_Initialize
75 call Interrupts_InitializeInterruptVectors
76 call DetectDrives_FromAllIDEControllers
77 ; Fall to .StoreDptPointersToIntVectors
78
79;--------------------------------------------------------------------
80; .StoreDptPointersToIntVectors
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;--------------------------------------------------------------------
89.StoreDptPointersToIntVectors:
90 mov dl, 80h
91 call RamVars_IsDriveHandledByThisBIOS
92 jnc SHORT .FindForDrive81h ; Store nothing if not our drive
93 call FindDPT_ForDriveNumber ; DPT to DS:DI
94 mov [es:HD0_DPT_POINTER_41h*4], di
95 mov [es:HD0_DPT_POINTER_41h*4+2], ds
96.FindForDrive81h:
97 inc dx
98 call RamVars_IsDriveHandledByThisBIOS
99 jnc SHORT .ResetDetectedDrives
100 call FindDPT_ForDriveNumber
101 mov [es:HD1_DPT_POINTER_46h*4], di
102 mov [es:HD1_DPT_POINTER_46h*4+2], ds
103 ; Fall to .ResetDetectedDrives
104
105;--------------------------------------------------------------------
106; .ResetDetectedDrives
107; Parameters:
108; DS: RAMVARS segment
109; Returns:
110; Nothing
111; Corrupts registers:
112; All
113;--------------------------------------------------------------------
114.ResetDetectedDrives:
115 call Idepack_FakeToSSBP
116 call AH0h_ResetHardDisksHandledByOurBIOS
117 add sp, BYTE EXTRA_BYTES_FOR_INTPACK
118 ret
Note: See TracBrowser for help on using the repository browser.