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

Last change on this file since 230 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
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;--------------------------------------------------------------------
[229]19Initialize_FromMainBiosRomSearch: ; unused entrypoint ok
[3]20 pushf
21 push es
22 push ds
23 ePUSHA
24
[90]25 LOAD_BDA_SEGMENT_TO es, ax
[229]26 sti ; Enable interrupts
27 test BYTE [es:BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
[90]28 jnz SHORT .SkipRomInitialization
[3]29
[229]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
[90]35.SkipRomInitialization:
[3]36 ePOPA
37 pop ds
38 pop es
39 popf
40 retf
41
42
43;--------------------------------------------------------------------
[229]44; HandlerForLateInitialization
[3]45; Parameters:
[229]46; Nothing
[3]47; Returns:
[229]48; Never returns
[3]49;--------------------------------------------------------------------
[229]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
[3]54
55
56;--------------------------------------------------------------------
57; Initializes the BIOS variables and detects IDE drives.
58;
59; Initialize_AndDetectDrives
60; Parameters:
[90]61; ES: BDA Segment
[3]62; Returns:
[97]63; DS: RAMVARS segment
[3]64; Corrupts registers:
[97]65; All
[3]66;--------------------------------------------------------------------
67Initialize_AndDetectDrives:
[130]68 call BootMenuPrint_InitializeDisplayContext
[3]69 call DetectPrint_RomFoundAtSegment
70 call RamVars_Initialize
[33]71 call Interrupts_InitializeInterruptVectors
[3]72 call DetectDrives_FromAllIDEControllers
[98]73 ; Fall to .StoreDptPointersToIntVectors
[97]74
75;--------------------------------------------------------------------
[98]76; .StoreDptPointersToIntVectors
[97]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;--------------------------------------------------------------------
[98]85.StoreDptPointersToIntVectors:
[97]86 mov dl, 80h
[152]87 call RamVars_IsDriveHandledByThisBIOS
88 jnc SHORT .FindForDrive81h ; Store nothing if not our drive
[97]89 call FindDPT_ForDriveNumber ; DPT to DS:DI
[152]90 mov [es:HD0_DPT_POINTER_41h*4], di
91 mov [es:HD0_DPT_POINTER_41h*4+2], ds
[97]92.FindForDrive81h:
93 inc dx
[152]94 call RamVars_IsDriveHandledByThisBIOS
95 jnc SHORT .ResetDetectedDrives
[97]96 call FindDPT_ForDriveNumber
[152]97 mov [es:HD1_DPT_POINTER_46h*4], di
98 mov [es:HD1_DPT_POINTER_46h*4+2], ds
[33]99 ; Fall to .ResetDetectedDrives
[3]100
101;--------------------------------------------------------------------
[97]102; .ResetDetectedDrives
[3]103; Parameters:
104; DS: RAMVARS segment
105; Returns:
106; Nothing
107; Corrupts registers:
[150]108; All
[3]109;--------------------------------------------------------------------
[33]110.ResetDetectedDrives:
[150]111 call Idepack_FakeToSSBP
112 call AH0h_ResetHardDisksHandledByOurBIOS
[158]113 add sp, BYTE EXTRA_BYTES_FOR_INTPACK
[150]114 ret
Note: See TracBrowser for help on using the repository browser.