Changeset 392 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers
- Timestamp:
- Apr 17, 2012, 2:42:54 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm
r376 r392 81 81 ; CX 82 82 ;-------------------------------------------------------------------- 83 %ifdef MODULE_BOOT_MENU 83 84 AH15h_GetSectorCountFromForeignDriveToDXAX: 84 85 mov ah, GET_DRIVE_PARAMETERS 85 86 call Int13h_CallPreviousInt13hHandler 86 87 jmp SHORT ConvertAH08hReturnValuesToSectorCount 88 %endif 87 89 88 90 AH15h_GetSectorCountToBXDXAX: -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm
r386 r392 22 22 23 23 ;-------------------------------------------------------------------- 24 ; INT 19h handler that properly reboots the computer when25 ; INT 19h is called.26 ;27 ; Int19h_ResetHandler28 ; Parameters:29 ; Nothing30 ; Returns:31 ; Never returns (reboots computer)32 ;--------------------------------------------------------------------33 Int19h_ResetHandler:34 mov ax, BOOT_FLAG_WARM ; Skip memory tests35 jmp Reboot_ComputerWithBootFlagInAX36 37 38 ;--------------------------------------------------------------------39 24 ; Int19h_BootLoaderHandler 40 25 ; Parameters: … … 44 29 ;-------------------------------------------------------------------- 45 30 Int19h_BootLoaderHandler: 46 sti 47 ; Install INT 19h handler for proper reboot 48 LOAD_BDA_SEGMENT_TO es, ax 49 mov al, BIOS_BOOT_LOADER_INTERRUPT_19h ; INT 19h interrupt vector offset 50 mov si, Int19h_ResetHandler ; INT 19h handler to reboot the system 51 call Interrupts_InstallHandlerToVectorInALFromCSSI 52 call Initialize_AndDetectDrives ; Installs new boot menu loader 53 ; Fall to .PrepareStackAndSelectDriveFromBootMenu 31 sti ; Allow timer interrupts 32 LOAD_BDA_SEGMENT_TO es, ax ; Load BDA segment (zero) to ES 33 ; Fall to .PrepareBootLoaderStack 34 54 35 55 36 ;-------------------------------------------------------------------- 56 ; .PrepareStackAndSelectDriveFromBootMenu 37 ; Drive detection and boot menu use lots of stack so it is 38 ; wise to relocate stack. Otherwise something important from 39 ; interrupt vectors are likely corrupted, likely our own DPTs if 40 ; they are located to 30:0h. 41 ; 42 ; .PrepareBootLoaderStack 57 43 ; Parameters: 58 44 ; ES: BDA and interrupt vector segment (zero) … … 60 46 ; Never returns (loads operating system) 61 47 ;-------------------------------------------------------------------- 62 .Prepare StackAndSelectDriveFromBootMenu:48 .PrepareBootLoaderStack: 63 49 STORE_POST_STACK_POINTER 64 50 SWITCH_TO_BOOT_MENU_STACK 65 51 ; Fall to .InitializeDisplay 66 52 53 67 54 ;-------------------------------------------------------------------- 68 55 ; .InitializeDisplay 69 56 ; Parameters: 70 ; Nothing57 ; ES: BDA and interrupt vector segment (zero) 71 58 ; Returns: 72 59 ; Never returns (loads operating system) … … 79 66 int BIOS_VIDEO_INTERRUPT_10h 80 67 .InitializeDisplayLibrary: 81 call BootMenuPrint_InitializeDisplayContext 82 ; Fall to .SelectDriveToBootFrom 68 call DetectPrint_InitializeDisplayContext 69 ; Fall to .InitializeBiosAndDetectDrives 70 83 71 84 72 ;-------------------------------------------------------------------- 85 ; . SelectDriveToBootFrom73 ; .InitializeBiosAndDetectDrives 86 74 ; Parameters: 87 ; Nothing 75 ; ES: BDA and interrupt vector segment (zero) 76 ; Returns: 77 ; DS: RAMVARS segment 78 ;-------------------------------------------------------------------- 79 call Initialize_AndDetectDrives 80 ; Fall to SelectDriveToBootFrom 81 82 83 ;-------------------------------------------------------------------- 84 ; SelectDriveToBootFrom 85 ; Parameters: 86 ; DS: RAMVARS segment 87 ; ES: BDA and interrupt vector segment (zero) 88 88 ; Returns: 89 89 ; Never returns (loads operating system) 90 90 ;-------------------------------------------------------------------- 91 .SelectDriveToBootFrom: 92 call RamVars_GetSegmentToDS 91 SelectDriveToBootFrom: 92 call HotkeyBar_UpdateDuringDriveDetection 93 93 94 %ifdef MODULE_BOOT_MENU 94 cmp WORD [cs:ROMVARS.wfDisplayBootMenu], BYTE 0 95 jne SHORT ProcessBootMenuSelectionsUntilBootableDriveSelected ; Display boot menu 95 mov di, BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode 96 cmp BYTE [es:di], BOOT_MENU_HOTKEY_SCANCODE 97 jne SHORT .DoNotDisplayBootMenu 98 99 ; Stop blinking the Boot Menu hotkey and display menu 100 mov BYTE [es:di], 0 101 call HotkeyBar_DrawToTopOfScreen 102 call BootMenu_DisplayAndStoreSelectionAsHotkey 103 .DoNotDisplayBootMenu: 96 104 %endif 97 ; Fall to BootFromDriveAthenTryDriveC 105 106 ; Check if ROM boot (INT 18h) wanted 107 cmp BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], ROM_BOOT_HOTKEY_SCANCODE 108 je SHORT JumpToBootSector_or_RomBoot ; CF clear so ROM boot 109 110 ; Try to boot from Primary boot drive (00h by default) 111 call HotkeyBar_GetPrimaryBootDriveNumberToDL 112 call TryToBootFromPrimaryOrSecondaryBootDevice 113 jc SHORT JumpToBootSector_or_RomBoot 114 115 ; Try to boot from Secondary boot device (80h by default) 116 call HotkeyBar_GetSecondaryBootDriveNumberToDL 117 call TryToBootFromPrimaryOrSecondaryBootDevice 118 119 %ifdef MODULE_BOOT_MENU 120 ; Force Boot Menu hotkey to display boot menu 121 mov BYTE [es:BOOTVARS.hotkeyVars+HOTKEYVARS.bScancode], BOOT_MENU_HOTKEY_SCANCODE 122 jnc SHORT SelectDriveToBootFrom 123 %endif 124 ; Fall to JumpToBootSector_or_RomBoot 125 98 126 99 127 ;-------------------------------------------------------------------- 100 ; BootFromDriveAthenTryDriveC 101 ; Parameters: 102 ; DS: RAMVARS segment 103 ; Returns: 104 ; Never returns (loads operating system) 105 ;-------------------------------------------------------------------- 106 BootFromDriveAthenTryDriveC: 107 xor dx, dx ; DL = 00h = Floppy Drive A 108 call BootSector_TryToLoadFromDriveDL 109 jc SHORT Int19hMenu_JumpToBootSector_or_RomBoot 110 mov dl, 80h ; DL = 80h = First Hard Drive (usually C) 111 call BootSector_TryToLoadFromDriveDL 112 jmp SHORT Int19hMenu_JumpToBootSector_or_RomBoot ; ROM Boot if error 113 114 115 %ifdef MODULE_BOOT_MENU 116 ;-------------------------------------------------------------------- 117 ; ProcessBootMenuSelectionsUntilBootableDriveSelected 118 ; Parameters: 119 ; DS: RAMVARS segment 120 ; Returns: 121 ; Never returns 122 ;-------------------------------------------------------------------- 123 ProcessBootMenuSelectionsUntilBootableDriveSelected: 124 call BootMenu_DisplayAndReturnSelectionInDX 125 call DriveXlate_ToOrBack ; Translate drive number 126 call BootSector_TryToLoadFromDriveDL 127 jnc SHORT ProcessBootMenuSelectionsUntilBootableDriveSelected ; Boot failure, show menu again 128 ; Fall to Int19hMenu_JumpToBootSector_or_RomBoot 129 ; (CF is set or we wouldn't be here, see "jnc" immediately above) 130 %endif 131 132 ;-------------------------------------------------------------------- 133 ; Int19hMenu_JumpToBootSector_or_RomBoot 128 ; JumpToBootSector_or_RomBoot 134 129 ; 135 130 ; Switches back to the POST stack, clears the DS and ES registers, … … 140 135 ; DL: Drive to boot from (translated, 00h or 80h) 141 136 ; CF: Set for Boot Sector Boot 142 ; Clear for R omBoot137 ; Clear for ROM Boot 143 138 ; ES:BX: (if CF set) Ptr to boot sector 144 139 ; … … 146 141 ; Never returns 147 142 ;-------------------------------------------------------------------- 148 Int19hMenu_JumpToBootSector_or_RomBoot:143 JumpToBootSector_or_RomBoot: 149 144 mov cx, es ; Preserve MBR segment (can't push because of stack change) 150 145 mov ax, 0 ; NOTE: can't use XOR (LOAD_BDA_SEGMENT_TO) as it impacts CF … … 167 162 ; Boot by calling INT 18h (ROM Basic of ROM DOS) 168 163 .romboot: 169 int BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns 164 int BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns 165 166 167 ;-------------------------------------------------------------------- 168 ; TryToBootFromPrimaryOrSecondaryBootDevice 169 ; Parameters 170 ; DL: Drive selected as boot device 171 ; DS: RAMVARS segment 172 ; ES: BDA and interrupt vector segment (zero) 173 ; Returns: 174 ; DL: Drive to boot from (translated, 00h or 80h) 175 ; CF: Set for Boot Sector Boot 176 ; Clear for ROM Boot 177 ; ES:BX: (if CF set) Ptr to boot sector 178 ; Corrupts registers: 179 ; AX, CX, DH, SI, DI, (DL if failed to read boot sector) 180 ;-------------------------------------------------------------------- 181 TryToBootFromPrimaryOrSecondaryBootDevice: 182 call DriveXlate_SetDriveToSwap 183 call DriveXlate_ToOrBack 184 jmp BootSector_TryToLoadFromDriveDL
Note:
See TracChangeset
for help on using the changeset viewer.