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

Last change on this file since 500 was 443, checked in by aitotat@…, 12 years ago

Changes to XTIDE Universal BIOS:

  • Offset to ATA-ID buffer will no longer get corrupted when trying to enable 8-bit mode for XT-CF.
  • Optimized A0<->A3 swapping a bit.
File size: 3.6 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions for initializing the BIOS.
3
4;
5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
12;
13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
19
20; Section containing code
21SECTION .text
22
23;--------------------------------------------------------------------
24; Initializes the BIOS.
25; This function is called from main BIOS ROM search routine.
26;
27; Initialize_FromMainBiosRomSearch
28; Parameters:
29; Nothing
30; Returns:
31; Nothing
32; Corrupts registers:
33; Nothing
34;--------------------------------------------------------------------
35Initialize_FromMainBiosRomSearch: ; unused entrypoint ok
36 pushf ; To store IF
37 push ds
38
39%ifndef USE_186
40 push ax
41 LOAD_BDA_SEGMENT_TO ds, ax
42%else
43 push BYTE 0
44 pop ds
45%endif
46
47 sti ; Enable interrupts for keystrokes
48 test BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
49 jnz SHORT .SkipRomInitialization
50
51 ; Install INT 19h handler (boot loader) where drives are detected
52 mov WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler
53 mov [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
54
55.SkipRomInitialization:
56%ifndef USE_186
57 pop ax
58%endif
59 pop ds
60 popf
61 retf
62
63
64;--------------------------------------------------------------------
65; Initializes the BIOS variables and detects IDE drives.
66;
67; Initialize_AndDetectDrives
68; Parameters:
69; ES: BDA Segment
70; Returns:
71; DS: RAMVARS segment
72; Corrupts registers:
73; All, except ES
74;--------------------------------------------------------------------
75Initialize_AndDetectDrives:
76 call DetectPrint_InitializeDisplayContext
77 call DetectPrint_RomFoundAtSegment
78 call RamVars_Initialize
79 call BootVars_Initialize
80 call DetectDrives_FromAllIDEControllers
81 call Interrupts_InitializeInterruptVectors
82 ; Fall to .StoreDptPointersToIntVectors
83
84;--------------------------------------------------------------------
85; .StoreDptPointersToIntVectors
86; Parameters:
87; DS: RAMVARS segment
88; ES: BDA and interrupt vector segment (zero)
89; Returns:
90; Nothing
91; Corrupts registers:
92; DX, DI
93;--------------------------------------------------------------------
94.StoreDptPointersToIntVectors:
95 mov dl, 80h
96 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
97 jc SHORT .FindForDrive81h ; Store nothing if not our drive
98 mov [es:HD0_DPT_POINTER_41h*4], di
99 mov [es:HD0_DPT_POINTER_41h*4+2], ds
100.FindForDrive81h:
101 inc dx
102 call FindDPT_ForDriveNumberInDL
103 jc SHORT .ResetDetectedDrives
104 mov [es:HD1_DPT_POINTER_46h*4], di
105 mov [es:HD1_DPT_POINTER_46h*4+2], ds
106 ; Fall to .ResetDetectedDrives
107
108;--------------------------------------------------------------------
109; .ResetDetectedDrives
110; Parameters:
111; DS: RAMVARS segment
112; ES: BDA and interrupt vector segment (zero)
113; Returns:
114; Nothing
115; Corrupts registers:
116; All, except DS and ES
117;--------------------------------------------------------------------
118.ResetDetectedDrives:
119 call Idepack_FakeToSSBP
120 call AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
121 add sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK
122 ret
Note: See TracBrowser for help on using the repository browser.