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

Last change on this file since 559 was 558, checked in by krille_n_@…, 11 years ago

Changes:

  • Building the BIOS Drive Information Tool now works again.
  • Moved all XT-CF related code to MODULE_8BIT_IDE_ADVANCED. I don't see how an XT-CF card could work without *_ADVANCED anyway but if I'm wrong, feel free to undo this. Note! The autodetection code in XTIDECFG has NOT been changed to reflect this (still relies on MODULE_8BIT_IDE).
  • Optimizations and fixes in general.
File size: 4.2 KB
RevLine 
[90]1; Project name : XTIDE Universal BIOS
[3]2; Description : Functions for initializing the BIOS.
3
[376]4;
[526]5; XTIDE Universal BIOS and Associated Tools
6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]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.
[526]12;
[376]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
[526]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[526]18;
[376]19
[3]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;--------------------------------------------------------------------
[413]35Initialize_FromMainBiosRomSearch: ; unused entrypoint ok
36 pushf ; To store IF
[558]37 sti ; Enable interrupts for keystrokes
[3]38 push ds
39
[556]40%ifdef USE_AT
[413]41 push BYTE 0
42 pop ds
[556]43%else
44 push ax ; We use AX to install very late init handler
45 LOAD_BDA_SEGMENT_TO ds, ax
[413]46%endif
47
48 test BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
[90]49 jnz SHORT .SkipRomInitialization
[3]50
[229]51 ; Install INT 19h handler (boot loader) where drives are detected
[413]52 mov WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler
53 mov [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
[229]54
[556]55 ; Very late initialization for XT builds only
56%ifndef USE_AT
57 push es
[553]58 ; Install special INT 13h hander that initializes XTIDE Universal BIOS
[552]59 ; when our INT 19h is not called
60 les ax, [BIOS_DISK_INTERRUPT_13h*4] ; Load system INT 13h handler
61 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4], ax
62 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4+2], es
63 mov WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
64 mov [BIOS_DISK_INTERRUPT_13h*4+2], cs
[556]65 pop es
66%endif
[552]67
[90]68.SkipRomInitialization:
[556]69%ifndef USE_AT
[413]70 pop ax
71%endif
[3]72 pop ds
73 popf
74 retf
75
76
77;--------------------------------------------------------------------
78; Initializes the BIOS variables and detects IDE drives.
79;
80; Initialize_AndDetectDrives
81; Parameters:
[90]82; ES: BDA Segment
[3]83; Returns:
[97]84; DS: RAMVARS segment
[3]85; Corrupts registers:
[413]86; All, except ES
[3]87;--------------------------------------------------------------------
88Initialize_AndDetectDrives:
[392]89 call DetectPrint_InitializeDisplayContext
[3]90 call DetectPrint_RomFoundAtSegment
91 call RamVars_Initialize
[392]92 call BootVars_Initialize
[551]93 call Interrupts_InitializeInterruptVectors ; HotkeyBar requires INT 40h so install handlers before drive detection
[431]94 call DetectDrives_FromAllIDEControllers
[555]95 mov [RAMVARS.wDrvDetectSignature], es ; No longer in drive detection mode (set normal timeouts)
[541]96 ; Fall to .StoreDptPointersToIntVectors
97
98;--------------------------------------------------------------------
99; .StoreDptPointersToIntVectors
100; Parameters:
101; DS: RAMVARS segment
102; ES: BDA and interrupt vector segment (zero)
103; Returns:
104; Nothing
105; Corrupts registers:
106; AX, CX, DX, SI, DI
107;--------------------------------------------------------------------
[555]108%ifdef MODULE_COMPATIBLE_TABLES
[541]109.StoreDptPointersToIntVectors:
[542]110%ifndef USE_AT
111 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
112 jz SHORT .CompatibleDPTsCreated ; Only Full operating mode has extra RAM to spare
113%endif
114
[541]115 mov dl, 80h
116 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
117 jc SHORT .FindForDrive81h ; Store nothing if not our drive
118
119 call CompatibleDPT_CreateToAXSIforDriveDL
120 mov [es:HD0_DPT_POINTER_41h*4], si
121 mov [es:HD0_DPT_POINTER_41h*4+2], ax
122
123.FindForDrive81h:
124 mov dl, 81h
125 call FindDPT_ForDriveNumberInDL
126 jc SHORT .CompatibleDPTsCreated
127
128 call CompatibleDPT_CreateToAXSIforDriveDL
129 mov [es:HD1_DPT_POINTER_46h*4], si
130 mov [es:HD1_DPT_POINTER_46h*4+2], ax
131.CompatibleDPTsCreated:
[550]132%endif ; MODULE_COMPATIBLE_TABLES
[150]133 ret
Note: See TracBrowser for help on using the repository browser.