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

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

Changes:

  • XTIDECFG: Fixed a bug from r459 where the menu option for selection of default boot drive would be missing if the BIOS had been built without MODULE_HOTKEYS. The menu option is now visible if either or both of MODULE_HOTKEYS and MODULE_BOOT_MENU is available.
  • BIOS: Disabled ATA-ID validation by adding a new define (NO_ATAID_VALIDATION) and making it the default for all builds since at least two WD Caviar drive models are incompatible with it.
  • Fixed the "No Fixed Disk Present in FDISK"-bug introduced in r551 which means the Tiny build now works without including MODULE_DRIVEXLATE.
  • Fixed a bug from r528 where pressing hotkey F6 would not initiate detection of serial drives.
  • Fixed a bug from r186 in DisplayFormatCompressed.asm where the boot menu would print the IRQ in hexadecimal format when it should be in decimal format.
  • Optimizations and fixes.
File size: 4.7 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
[556]39 push ax ; We use AX to install very late init handler
40 LOAD_BDA_SEGMENT_TO ds, ax
[413]41
42 test BYTE [BDA.bKBFlgs1], (1<<2) ; Clears ZF if CTRL is held down
[90]43 jnz SHORT .SkipRomInitialization
[3]44
[229]45 ; Install INT 19h handler (boot loader) where drives are detected
[413]46 mov WORD [BIOS_BOOT_LOADER_INTERRUPT_19h*4], Int19h_BootLoaderHandler
47 mov [BIOS_BOOT_LOADER_INTERRUPT_19h*4+2], cs
[229]48
[567]49%ifdef MODULE_VERY_LATE_INIT
[556]50 push es
[567]51 ; Install special INT 13h handler that initializes XTIDE Universal BIOS
[552]52 ; when our INT 19h is not called
53 les ax, [BIOS_DISK_INTERRUPT_13h*4] ; Load system INT 13h handler
[561]54 mov WORD [BIOS_DISK_INTERRUPT_13h*4], Int13hBiosInit_Handler
55 mov [BIOS_DISK_INTERRUPT_13h*4+2], cs
[552]56 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4], ax
57 mov [TEMPORARY_VECTOR_FOR_SYSTEM_INT13h*4+2], es
[556]58 pop es
59%endif
[552]60
[90]61.SkipRomInitialization:
[413]62 pop ax
[3]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:
[90]73; ES: BDA Segment
[3]74; Returns:
[97]75; DS: RAMVARS segment
[3]76; Corrupts registers:
[413]77; All, except ES
[3]78;--------------------------------------------------------------------
79Initialize_AndDetectDrives:
[392]80 call DetectPrint_InitializeDisplayContext
[3]81 call DetectPrint_RomFoundAtSegment
82 call RamVars_Initialize
[392]83 call BootVars_Initialize
[580]84%ifdef MODULE_HOTKEYS
85 ; This is a simple fix for the so called "No Fixed Disk Present in FDISK"-bug introduced in r551. MODULE_HOTKEYS includes the internal
86 ; module MODULE_DRIVEXLATE which is needed if interrupt handlers are installed before drive detection. The reason for this is that
87 ; Interrupts_InitializeInterruptVectors won't install our interrupt 13h handler if no drives were detected (unless MODULE_DRIVEXLATE is included).
88 ; Since the drive detection hasn't been done yet, the handler will not be installed, causing the above mentioned bug.
[551]89 call Interrupts_InitializeInterruptVectors ; HotkeyBar requires INT 40h so install handlers before drive detection
[431]90 call DetectDrives_FromAllIDEControllers
[580]91%else
92 ; Without MODULE_HOTKEYS (or actually MODULE_DRIVEXLATE) we *must* use this call order.
93 call DetectDrives_FromAllIDEControllers
94 call Interrupts_InitializeInterruptVectors
95%endif
[555]96 mov [RAMVARS.wDrvDetectSignature], es ; No longer in drive detection mode (set normal timeouts)
[541]97 ; Fall to .StoreDptPointersToIntVectors
98
99;--------------------------------------------------------------------
100; .StoreDptPointersToIntVectors
101; Parameters:
102; DS: RAMVARS segment
103; ES: BDA and interrupt vector segment (zero)
104; Returns:
105; Nothing
106; Corrupts registers:
[567]107; AX, BX, CX, DX, SI, DI
[541]108;--------------------------------------------------------------------
[555]109%ifdef MODULE_COMPATIBLE_TABLES
[541]110.StoreDptPointersToIntVectors:
[542]111%ifndef USE_AT
112 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE
[567]113 jz SHORT .SkipToReturn ; Only Full operating mode has extra RAM to spare
[542]114%endif
115
[567]116 mov bx, HD0_DPT_POINTER_41h * 4
[541]117 mov dl, 80h
[567]118.FindForNextDrive:
119 call FindDPT_ForDriveNumberInDL ; DPT to DS:DI
120 jc SHORT .NextDrive ; Store nothing if not our drive
[541]121
[567]122 push dx
[541]123 call CompatibleDPT_CreateToAXSIforDriveDL
[567]124 pop dx
[541]125
[567]126 mov [es:bx], si
127 mov [es:bx+2], ax
[541]128
[567]129.NextDrive:
130 inc dx
131 add bx, (HD1_DPT_POINTER_46h - HD0_DPT_POINTER_41h) * 4
132 cmp dl, 82h
133 jb SHORT .FindForNextDrive
134
135.SkipToReturn:
[550]136%endif ; MODULE_COMPATIBLE_TABLES
[150]137 ret
Note: See TracBrowser for help on using the repository browser.