1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Functions for initializing the BIOS.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
19 | ALIGN JUMP_ALIGN
|
---|
20 | Initialize_FromMainBiosRomSearch:
|
---|
21 | pushf
|
---|
22 | push es
|
---|
23 | push ds
|
---|
24 | ePUSHA
|
---|
25 |
|
---|
26 | LOAD_BDA_SEGMENT_TO es, ax
|
---|
27 | call Initialize_ShouldSkip
|
---|
28 | jnz SHORT .SkipRomInitialization
|
---|
29 |
|
---|
30 | %ifdef USE_AT ; Early initialization on AT build
|
---|
31 | call Initialize_AndDetectDrives
|
---|
32 | %else ; Late initialization on XT builds
|
---|
33 | call Int19hLate_InitializeInt19h
|
---|
34 | %endif
|
---|
35 | .SkipRomInitialization:
|
---|
36 | ePOPA
|
---|
37 | pop ds
|
---|
38 | pop es
|
---|
39 | popf
|
---|
40 | retf
|
---|
41 |
|
---|
42 |
|
---|
43 | ;--------------------------------------------------------------------
|
---|
44 | ; Checks if user wants to skip ROM initialization.
|
---|
45 | ;
|
---|
46 | ; Initialize_ShouldSkip
|
---|
47 | ; Parameters:
|
---|
48 | ; ES: BDA segment
|
---|
49 | ; Returns:
|
---|
50 | ; ZF: Cleared if ROM initialization is to be skipped
|
---|
51 | ; Set to continue ROM initialization
|
---|
52 | ; Corrupts registers:
|
---|
53 | ; Nothing
|
---|
54 | ;--------------------------------------------------------------------
|
---|
55 | ALIGN JUMP_ALIGN
|
---|
56 | Initialize_ShouldSkip:
|
---|
57 | sti ; Enable interrupts
|
---|
58 | test BYTE [es:BDA.bKBFlgs1], (1<<2) ; Clear ZF if CTRL is held down
|
---|
59 | ret
|
---|
60 |
|
---|
61 |
|
---|
62 | ;--------------------------------------------------------------------
|
---|
63 | ; Initializes the BIOS variables and detects IDE drives.
|
---|
64 | ;
|
---|
65 | ; Initialize_AndDetectDrives
|
---|
66 | ; Parameters:
|
---|
67 | ; ES: BDA Segment
|
---|
68 | ; Returns:
|
---|
69 | ; Nothing
|
---|
70 | ; Corrupts registers:
|
---|
71 | ; All, including segments
|
---|
72 | ;--------------------------------------------------------------------
|
---|
73 | ALIGN JUMP_ALIGN
|
---|
74 | Initialize_AndDetectDrives:
|
---|
75 | call DetectPrint_RomFoundAtSegment
|
---|
76 | call RamVars_Initialize
|
---|
77 | call RamVars_GetSegmentToDS
|
---|
78 | call Interrupts_InitializeInterruptVectors
|
---|
79 | call DetectDrives_FromAllIDEControllers
|
---|
80 | call CompatibleDPT_CreateForDrives80hAnd81h
|
---|
81 | ; Fall to .ResetDetectedDrives
|
---|
82 |
|
---|
83 | ;--------------------------------------------------------------------
|
---|
84 | ; Resets all hard disks.
|
---|
85 | ;
|
---|
86 | ; Initialize_ResetDetectedDrives
|
---|
87 | ; Parameters:
|
---|
88 | ; DS: RAMVARS segment
|
---|
89 | ; Returns:
|
---|
90 | ; Nothing
|
---|
91 | ; Corrupts registers:
|
---|
92 | ; AX, BX, CX, DX, DI
|
---|
93 | ;--------------------------------------------------------------------
|
---|
94 | ;ALIGN JUMP_ALIGN
|
---|
95 | .ResetDetectedDrives:
|
---|
96 | jmp AH0h_ResetHardDisksHandledByOurBIOS
|
---|