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

Last change on this file since 569 was 567, checked in by krille_n_@…, 10 years ago

Changes:

  • Renamed MODULE_FEATURE_SETS to MODULE_POWER_MANAGEMENT.
  • Renamed MODULE_VERY_LATE_INITIALIZATION to MODULE_VERY_LATE_INIT and removed it from the official builds.
  • Removed the code that skips detection of slave drives on XT-CF controllers since slave drives can be used with Lo-tech ISA CompactFlash boards.
  • Added autodetection of the SVC ADP50L controller to XTIDECFG.
  • The autodetection of XT-CF controllers now requires MODULE_8BIT_IDE_ADVANCED in the loaded BIOS.
  • Fixed a bug in XTIDECFG from r502 where the "Base (cmd block) address" menu option would be displayed when a serial device was selected as the IDE controller.
  • XTIDECFG would display the "Enable interrupt" menu option for the XTIDE r1 but not for the XTIDE r2. It's now displayed for both controller types.
  • Disabled the "Internal Write Cache" menu option in the Master/Slave Drive menus for serial device type drives.
  • Optimizations and other fixes.
File size: 4.0 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-2013 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 sti ; Enable interrupts for keystrokes
38 push ds
39 push ax ; We use AX to install very late init handler
40 LOAD_BDA_SEGMENT_TO ds, ax
41
42 test BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
43 jnz SHORT .SkipRomInitialization
44
45 ; Install INT 19h handler (boot loader) where drives are detected
46 mov WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler
47 mov [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
48
49%ifdef MODULE_VERY_LATE_INIT
50 push es
51 ; Install special INT 13h handler that initializes XTIDE Universal BIOS
52 ; when our INT 19h is not called
53 les ax, [BIOS_DISK_INTERRUPT_13h*4] ; Load system INT 13h handler
54 mov WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
55 mov [BIOS_DISK_INTERRUPT_13h*4+2], cs
56 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4], ax
57 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4+2], es
58 pop es
59%endif
60
61.SkipRomInitialization:
62 pop ax
63 pop ds
64 popf
65 retf
66
67
68;--------------------------------------------------------------------
69; Initializes the BIOS variables and detects IDE drives.
70;
71; Initialize_AndDetectDrives
72; Parameters:
73; ES: BDA Segment
74; Returns:
75; DS: RAMVARS segment
76; Corrupts registers:
77; All, except ES
78;--------------------------------------------------------------------
79Initialize_AndDetectDrives:
80 call DetectPrint_InitializeDisplayContext
81 call DetectPrint_RomFoundAtSegment
82 call RamVars_Initialize
83 call BootVars_Initialize
84 call Interrupts_InitializeInterruptVectors ; HotkeyBar requires INT 40h so install handlers before drive detection
85 call DetectDrives_FromAllIDEControllers
86 mov [RAMVARS.wDrvDetectSignature], es ; No longer in drive detection mode (set normal timeouts)
87 ; Fall to .StoreDptPointersToIntVectors
88
89;--------------------------------------------------------------------
90; .StoreDptPointersToIntVectors
91; Parameters:
92; DS: RAMVARS segment
93; ES: BDA and interrupt vector segment (zero)
94; Returns:
95; Nothing
96; Corrupts registers:
97; AX, BX, CX, DX, SI, DI
98;--------------------------------------------------------------------
99%ifdef MODULE_COMPATIBLE_TABLES
100.StoreDptPointersToIntVectors:
101%ifndef USE_AT
102 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
103 jz SHORT .SkipToReturn ; Only Full operating mode has extra RAM to spare
104%endif
105
106 mov bx, HD0_DPT_POINTER_41h * 4
107 mov dl, 80h
108.FindForNextDrive:
109 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
110 jc SHORT .NextDrive ; Store nothing if not our drive
111
112 push dx
113 call CompatibleDPT_CreateToAXSIforDriveDL
114 pop dx
115
116 mov [es:bx], si
117 mov [es:bx+2], ax
118
119.NextDrive:
120 inc dx
121 add bx, (HD1_DPT_POINTER_46h - HD0_DPT_POINTER_41h) * 4
122 cmp dl, 82h
123 jb SHORT .FindForNextDrive
124
125.SkipToReturn:
126%endif ; MODULE_COMPATIBLE_TABLES
127 ret
Note: See TracBrowser for help on using the repository browser.