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

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

Changes to XTIDE Universal BIOS:

  • All builds now initialize drives on boot loader (INT 19h).
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 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 bx, BIOS_BOOT_LOADER_INTERRUPT_19h
32 mov si, HandlerForLateInitialization
33 call Interrupts_InstallHandlerToVectorInBXFromCSSI
34
35.SkipRomInitialization:
36 ePOPA
37 pop ds
38 pop es
39 popf
40 retf
41
42
43;--------------------------------------------------------------------
44; HandlerForLateInitialization
45; Parameters:
46; Nothing
47; Returns:
48; Never returns
49;--------------------------------------------------------------------
50HandlerForLateInitialization:
51 LOAD_BDA_SEGMENT_TO es, ax
52 call Initialize_AndDetectDrives ; Installs new boot menu loader
53 int BIOS_BOOT_LOADER_INTERRUPT_19h ; Display boot menu
54
55
56;--------------------------------------------------------------------
57; Initializes the BIOS variables and detects IDE drives.
58;
59; Initialize_AndDetectDrives
60; Parameters:
61; ES: BDA Segment
62; Returns:
63; DS: RAMVARS segment
64; Corrupts registers:
65; All
66;--------------------------------------------------------------------
67Initialize_AndDetectDrives:
68 call BootMenuPrint_InitializeDisplayContext
69 call DetectPrint_RomFoundAtSegment
70 call RamVars_Initialize
71 call Interrupts_InitializeInterruptVectors
72 call DetectDrives_FromAllIDEControllers
73 ; Fall to .StoreDptPointersToIntVectors
74
75;--------------------------------------------------------------------
76; .StoreDptPointersToIntVectors
77; Parameters:
78; DS: RAMVARS segment
79; ES: BDA and interrupt vector segment (zero)
80; Returns:
81; Nothing
82; Corrupts registers:
83; DX, DI
84;--------------------------------------------------------------------
85.StoreDptPointersToIntVectors:
86 mov dl, 80h
87 call RamVars_IsDriveHandledByThisBIOS
88 jnc SHORT .FindForDrive81h ; Store nothing if not our drive
89 call FindDPT_ForDriveNumber ; DPT to DS:DI
90 mov [es:HD0_DPT_POINTER_41h*4], di
91 mov [es:HD0_DPT_POINTER_41h*4+2], ds
92.FindForDrive81h:
93 inc dx
94 call RamVars_IsDriveHandledByThisBIOS
95 jnc SHORT .ResetDetectedDrives
96 call FindDPT_ForDriveNumber
97 mov [es:HD1_DPT_POINTER_46h*4], di
98 mov [es:HD1_DPT_POINTER_46h*4+2], ds
99 ; Fall to .ResetDetectedDrives
100
101;--------------------------------------------------------------------
102; .ResetDetectedDrives
103; Parameters:
104; DS: RAMVARS segment
105; Returns:
106; Nothing
107; Corrupts registers:
108; All
109;--------------------------------------------------------------------
110.ResetDetectedDrives:
111 call Idepack_FakeToSSBP
112 call AH0h_ResetHardDisksHandledByOurBIOS
113 add sp, BYTE EXTRA_BYTES_FOR_INTPACK
114 ret
Note: See TracBrowser for help on using the repository browser.