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

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

Changes to XTIDE Universal BIOS:

  • Fixed a bug that allowed EBIOS functions for user defined CHS.
  • Simplified user defined CHS and LBA setup a little.
File size: 4.0 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
[3]37 push ds
38
[413]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
[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
[90]55.SkipRomInitialization:
[413]56%ifndef USE_186
57 pop ax
58%endif
[3]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:
[90]69; ES: BDA Segment
[3]70; Returns:
[97]71; DS: RAMVARS segment
[3]72; Corrupts registers:
[413]73; All, except ES
[3]74;--------------------------------------------------------------------
75Initialize_AndDetectDrives:
[392]76 call DetectPrint_InitializeDisplayContext
[3]77 call DetectPrint_RomFoundAtSegment
78 call RamVars_Initialize
[392]79 call BootVars_Initialize
[431]80 call DetectDrives_FromAllIDEControllers
[33]81 call Interrupts_InitializeInterruptVectors
[541]82 ; Fall to .StoreDptPointersToIntVectors
83
84
85%ifdef CREATE_COMPATIBLE_DPT
86;--------------------------------------------------------------------
87; .StoreDptPointersToIntVectors
88; Parameters:
89; DS: RAMVARS segment
90; ES: BDA and interrupt vector segment (zero)
91; Returns:
92; Nothing
93; Corrupts registers:
94; AX, CX, DX, SI, DI
95;--------------------------------------------------------------------
96.StoreDptPointersToIntVectors:
[542]97%ifndef USE_AT
98 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
99 jz SHORT .CompatibleDPTsCreated ; Only Full operating mode has extra RAM to spare
100%endif
101
[541]102 mov dl, 80h
103 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
104 jc SHORT .FindForDrive81h ; Store nothing if not our drive
105
106 call CompatibleDPT_CreateToAXSIforDriveDL
107 mov [es:HD0_DPT_POINTER_41h*4], si
108 mov [es:HD0_DPT_POINTER_41h*4+2], ax
109
110.FindForDrive81h:
111 mov dl, 81h
112 call FindDPT_ForDriveNumberInDL
113 jc SHORT .CompatibleDPTsCreated
114
115 call CompatibleDPT_CreateToAXSIforDriveDL
116 mov [es:HD1_DPT_POINTER_46h*4], si
117 mov [es:HD1_DPT_POINTER_46h*4+2], ax
118.CompatibleDPTsCreated:
[33]119 ; Fall to .ResetDetectedDrives
[541]120%endif ; CREATE_COMPATIBLE_DPT
[3]121
[541]122
[3]123;--------------------------------------------------------------------
[97]124; .ResetDetectedDrives
[3]125; Parameters:
126; DS: RAMVARS segment
[243]127; ES: BDA and interrupt vector segment (zero)
[3]128; Returns:
129; Nothing
130; Corrupts registers:
[243]131; All, except DS and ES
[3]132;--------------------------------------------------------------------
[33]133.ResetDetectedDrives:
[150]134 call Idepack_FakeToSSBP
[271]135 call AH0h_ResetAllOurHardDisksAtTheEndOfDriveInitialization
[443]136 add sp, BYTE SIZE_OF_IDEPACK_WITHOUT_INTPACK
[150]137 ret
Note: See TracBrowser for help on using the repository browser.