Changeset 505 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers


Ignore:
Timestamp:
Feb 25, 2013, 4:23:09 PM (11 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Changes:

  • Reverted the changes to MenuEvents.inc done in r492 since they broke the F1 key function in XTIDECFG.
  • Added a tail-call optimized variant of the CALL_DISPLAY_LIBRARY macro (JMP_DISPLAY_LIBRARY).
  • Put a block size limit in AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL. I think it's needed but if not, it's easy to remove.
  • Other optimizations and fixes.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH0h_HReset.asm

    r503 r505  
    3939AH0h_HandlerForDiskControllerReset:
    4040    ; Reset foreign Floppy and Hard Drives (those handled by other BIOSes)
    41     xor     bx, bx                                      ; Zero BH to assume no errors
    42     or      bl, dl                                      ; Copy requested drive to BL
     41    eMOVZX  bx, dl                                      ; Copy requested drive to BL and zero BH to assume no errors
     42
    4343    xor     ah, ah                                      ; Disk Controller Reset
    4444    call    Int13h_CallPreviousInt13hHandler            ; Reset floppy drives only or floppy drives and foreign hard disks
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH1Eh_XTCF.asm

    r491 r505  
    102102    out     dx, al
    103103
     104    ; We always need to enable 8-bit mode since 16-bit mode is restored
     105    ; when controller is reset (AH=00h or 0Dh)
     106    ePUSH_T bx, AH23h_Enable8bitPioMode
     107
    104108    ; Convert Control Register Contents to device code
    105109    test    al, al
     
    108112    jae     SHORT .SetMemoryMappedMode
    109113
     114; We need to limit block size here. Consider this scenario;
     115; 1. While in PIO mode or memory mapped mode, the drive is set to do
     116;    block transfers larger than XTCF_DMA_MODE_MAX_BLOCK_SIZE.
     117; 2. A call is subsequently made to change device mode to DEVICE_8BIT_XTCF_DMA.
     118; 3. The call to AH24h_SetBlockSize fails but the change in device mode has been made.
     119
    110120    ; Set DMA Mode
    111121    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    112122    mov     al, [di+DPT_ATA.bBlockSize]
    113     call    AH24h_SetBlockSize  ; AH=24h limits block size if necessary
    114     jmp     SHORT .Enable8bitPioMode
     123    MIN_U   al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     124    jmp     SHORT AH24h_SetBlockSize    ; Returns via AH23h_Enable8bitPioMode
    115125
    116126.SetMemoryMappedMode:
    117     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
    118     jmp     SHORT .Enable8bitPioMode
     127    mov     al, DEVICE_8BIT_XTCF_MEMMAP
     128    SKIP2B  bx
    119129
    120130.Set8bitPioMode:
    121     mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8
    122     ; Fall to .Enable8bitPioMode
    123 
    124     ; We always need to enable 8-bit mode since 16-bit mode is restored
    125     ; when controller is reset (AH=00h or 0Dh)
    126 .Enable8bitPioMode:
    127     jmp     AH23h_Enable8bitPioMode
     131    mov     al, DEVICE_8BIT_XTCF_PIO8
     132    mov     [di+DPT_ATA.bDevice], al
     133    ret     ; Via AH23h_Enable8bitPioMode
    128134
    129135
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r493 r505  
    101101    call    Device_SelectDrive
    102102    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SELECT_DRIVE
     103%ifdef USE_386
     104    jc      .ReturnWithErrorCodeInAH
     105%else
    103106    jnc     SHORT .ContinueInitializationSinceDriveSelectedSuccesfully
    104107    jmp     .ReturnWithErrorCodeInAH
    105108.ContinueInitializationSinceDriveSelectedSuccesfully:
     109%endif
    106110
    107111
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h.asm

    r493 r505  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 ; GNU General Public License for more details.     
     16; GNU General Public License for more details.
    1717; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    18 ;       
     18;
    1919
    2020; Section containing code
     
    107107; The following macro could be easily inlined below.  Why a macro?  Depending on the combination
    108108; of MODULE_HOTKEYS or MODULE_BOOT_MENU, this code needs to either come before or after the
    109 ; call to the boot menu. 
     109; call to the boot menu.
    110110;
    111111%macro TRY_TO_BOOT_DL_AND_DH_DRIVES 0
    112112    push    dx                                  ; it's OK if this is left on the stack, if we are
    113                                                 ; are successful, the following call does not return
     113                                                ; successful, the following call does not return
    114114    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    115115    pop     dx
     
    117117    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    118118%endmacro
    119                
    120 %ifdef MODULE_HOTKEYS
    121     call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars       
     119
     120%ifdef MODULE_HOTKEYS
     121    call    HotkeyBar_ScanHotkeysFromKeyBufferAndStoreToBootvars
    122122    cmp     al, ROM_BOOT_HOTKEY_SCANCODE
    123     jz      .RomBoot                            ; CF clear so ROM boot
     123    je      .RomBoot                            ; CF clear so ROM boot
    124124%ifdef MODULE_BOOT_MENU
    125125    cmp     al, BOOT_MENU_HOTKEY_SCANCODE
    126     jz      .BootMenu
     126    je      .BootMenu
    127127%endif
    128128    call    HotkeyBar_GetBootDriveNumbersToDX
     
    130130    TRY_TO_BOOT_DL_AND_DH_DRIVES
    131131    ;; falls through to boot menu, if it is present.  If not present, falls through to rom boot.
    132 %endif
     132%endif ; MODULE_HOTKEYS
    133133
    134134%ifdef MODULE_BOOT_MENU
    135 .BootMenu:     
     135.BootMenu:
    136136    call    BootMenu_DisplayAndReturnDriveInDLRomBootClearCF
    137137    jnc     .RomBoot                            ; CF clear so ROM boot
    138138
    139139    mov     dh, dl                              ; Setup for secondary drive
    140     not     dh                                  ; Floppy goes to HD, or vice veras
    141     and     dh, 080h                            ; Go to first drive of the floppy or HD set
     140    not     dh                                  ; Floppy goes to HD, or vice versa
     141    and     dh, 80h                             ; Go to first drive of the floppy or HD set
    142142
    143143%ifdef MODULE_HOTKEYS
    144144    jmp     .TryUsingHotKeysCode
    145145%else
    146     TRY_TO_BOOT_DL_AND_DH_DRIVES       
     146    TRY_TO_BOOT_DL_AND_DH_DRIVES
    147147    jmp     .BootMenu
    148148%endif
    149 %endif
    150 
    151 %ifndef MODULE_HOTKEYS
    152 %ifndef MODULE_BOOT_MENU
     149%endif ; MODULE_BOOT_MENU
     150
     151%ifndef MODULE_HOTKEYS OR MODULE_BOOT_MENU
    153152    xor     dl, dl          ; Try to boot from Floppy Drive A
    154153    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    155154    mov     dl, 80h         ; Try to boot from Hard Drive C
    156155    call    TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    157 %endif
    158156%endif
    159157
     
    162160    call    DriveXlate_Reset                    ; Clean up any drive mappings before Rom Boot
    163161%endif
    164     clc     
     162    clc
    165163    ;; fall through to JumpToBootSector_or_RomBoot
    166164
     
    174172;   Parameters:
    175173;       DL:     Drive to boot from (translated, 00h or 80h)
    176 ;       CF:     Set for Boot Sector Boot 
     174;       CF:     Set for Boot Sector Boot
    177175;               Clear for ROM Boot
    178176;       ES:BX:  (if CF set) Ptr to boot sector
     
    187185
    188186; clear segment registers before boot sector or rom call
    189     mov     ds, ax     
     187    mov     ds, ax
    190188    mov     es, ax
    191189%ifdef USE_386
     
    202200; Boot by calling INT 18h (ROM Basic of ROM DOS)
    203201.romboot:
    204     int     BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns 
    205 
    206 
    207 ;--------------------------------------------------------------------
    208 ; TryToBootFromPrimaryOrSecondaryBootDevice
     202    int     BIOS_BOOT_FAILURE_INTERRUPT_18h ; Never returns
     203
     204
     205;--------------------------------------------------------------------
     206; TryToBootFromPrimaryOrSecondaryBootDevice_AndBoot
    209207;   Parameters
    210208;       DL:     Drive selected as boot device
     
    229227
    230228TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot:
    231 ; fall through to BootSector_TryToLoadFromDriveDL_AndBoot               
    232 %endif
    233        
    234 
     229; fall through to BootSector_TryToLoadFromDriveDL_AndBoot
     230%endif
     231
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int19h/BootSector.asm

    r492 r505  
    33
    44;
    5 ; XTIDE Universal BIOS and Associated Tools 
     5; XTIDE Universal BIOS and Associated Tools
    66; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2012 by XTIDE Universal BIOS Team.
    77;
     
    1010; the Free Software Foundation; either version 2 of the License, or
    1111; (at your option) any later version.
    12 ; 
     12;
    1313; This program is distributed in the hope that it will be useful,
    1414; but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1616; GNU General Public License for more details.
    17 ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html               
    18 ;       
     17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     18;
    1919
    2020; Section containing code
     
    2222
    2323;--------------------------------------------------------------------
    24 ; BootSector_TryToLoadFromDriveDL
     24; BootSector_TryToLoadFromDriveDL_AndBoot
    2525;   Parameters:
    2626;       DL:     Drive to boot from (translated, 00h or 80h)
     
    3636    call    DetectPrint_TryToBootFromDL
    3737    call    LoadFirstSectorFromDriveDL
     38%ifndef USE_386
    3839    jc      SHORT .FailedToLoadFirstSector
     40%else
     41    jc      DetectPrint_FailedToLoadFirstSector
     42%endif
    3943
    4044    test    dl, dl
     
    4448.AlwaysBootFromFloppyDriveForBooterGames:
    4549    stc
    46     jmp     SHORT JumpToBootSector_or_RomBoot       
     50    jmp     SHORT JumpToBootSector_or_RomBoot
     51
     52%ifndef USE_386
    4753.FailedToLoadFirstSector:
    48     call    DetectPrint_FailedToLoadFirstSector
    49     ret
     54    jmp     DetectPrint_FailedToLoadFirstSector
     55%endif
     56
    5057.FirstHardDiskSectorNotBootable:
    5158    mov     si, g_szBootSectorNotFound
    52     call    DetectPrint_NullTerminatedStringFromCSSIandSetCF
    53     ret
     59    jmp     DetectPrint_NullTerminatedStringFromCSSIandSetCF
    5460
    55 %ifndef CHECK_FOR_UNUSED_ENTRYPOINTS       
     61%ifndef CHECK_FOR_UNUSED_ENTRYPOINTS
    5662  %ifdef MODULE_DRIVEXLATE
    5763    %if TryToBoot_FallThroughTo_BootSector_TryToLoadFromDriveDL_AndBoot <> BootSector_TryToLoadFromDriveDL_AndBoot
     
    7985
    8086.ReadRetryLoop:
    81     call    .LoadFirstSectorFromDLtoESBX
    82     jnc     SHORT .Return
     87    mov     ax, 0201h                       ; Read 1 sector
     88    mov     cx, 1                           ; Cylinder 0, Sector 1
     89    xor     dh, dh                          ; Head 0
     90    int     BIOS_DISK_INTERRUPT_13h
     91    jc      SHORT .FailedToLoadFirstSector
     92.Return:
     93    ret
     94
     95.FailedToLoadFirstSector:
    8396    dec     di                              ; Decrement retry counter (preserve CF)
    8497    jz      SHORT .Return                   ; Loop while retries left
    8598
    8699    ; Reset drive and retry
    87     xor     ax, ax                          ; AH=0h, Disk Controller Reset
     100    xor     ax, ax                          ; AH=00h, Disk Controller Reset
    88101    test    dl, dl                          ; Floppy drive?
    89     eCMOVS  ah, RESET_HARD_DISK             ; AH=Dh, Reset Hard Disk (Alternate reset)
     102    eCMOVS  ah, RESET_HARD_DISK             ; AH=0Dh, Reset Hard Disk (Alternate reset)
    90103    int     BIOS_DISK_INTERRUPT_13h
    91104    jmp     SHORT .ReadRetryLoop
    92105
    93 
    94 ;--------------------------------------------------------------------
    95 ; .LoadFirstSectorFromDLtoESBX
    96 ;   Parameters:
    97 ;       DL:     Drive to boot from (translated, 00h or 80h)
    98 ;       ES:BX:  Destination buffer for boot sector
    99 ;   Returns:
    100 ;       AH:     INT 13h error code
    101 ;       ES:BX:  Ptr to boot sector
    102 ;       CF:     Cleared if read successful
    103 ;               Set if any error
    104 ;   Corrupts registers:
    105 ;       AL, CX, DH
    106 ;--------------------------------------------------------------------
    107 .LoadFirstSectorFromDLtoESBX:
    108     mov     ax, 0201h                       ; Read 1 sector
    109     mov     cx, 1                           ; Cylinder 0, Sector 1
    110     xor     dh, dh                          ; Head 0
    111     int     BIOS_DISK_INTERRUPT_13h
    112 .Return:
    113     ret
Note: See TracChangeset for help on using the changeset viewer.