Changeset 530 in xtideuniversalbios


Ignore:
Timestamp:
Mar 28, 2013, 1:36:23 PM (8 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • AT builds again copy old INT 13h handler to 40h. It turned out it is needed, by XTIDE Universal BIOS at least (fixes disappearing floppy drive hotkey button when booting starts).
  • AH=48h no longer returns P-CHS parameteres for drives with more than 15,482,880 sectors (now works like described on Phoenix specification).
Location:
trunk/XTIDE_Universal_BIOS
Files:
4 edited

Legend:

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

    r526 r530  
    5858.SkipEddConfigurationParameters:
    5959    mov     [si+EDRIVE_INFO.wSize], cx
    60     mov     WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS | FLG_CHS_INFORMATION_IS_VALID
     60    mov     WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS
    6161
    6262    ; Store total sector count
    6363    mov     [si+EDRIVE_INFO.qwTotalSectors], ax
    64     xor     ax, ax                                  ; Return with success
    6564    mov     [si+EDRIVE_INFO.qwTotalSectors+2], dx
    6665    mov     [si+EDRIVE_INFO.qwTotalSectors+4], bx
    67     mov     [si+EDRIVE_INFO.qwTotalSectors+6], ax   ; Always zero
     66    xor     cx, cx
     67    mov     [si+EDRIVE_INFO.qwTotalSectors+6], cx   ; Always zero
    6868    mov     WORD [si+EDRIVE_INFO.wSectorSize], 512
    6969
    70     ; Store P-CHS
     70    ; Store P-CHS. Based on phoenix specification this is returned only if
     71    ; total sector count is 15,482,880 or less.
     72    sub     ax, 4001h
     73    sbb     dx, 0ECh
     74    sbb     bx, cx      ; Zero
     75    jnc     SHORT .ReturnWithSuccess    ; More than EC4000h
     76    or      WORD [si+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID
     77
    7178    eMOVZX  dx, BYTE [es:di+DPT.bPchsHeads]
    72     xor     ax, ax                                  ; Also a return code
    7379    mov     [si+EDRIVE_INFO.dwHeads], dx
    74     mov     [si+EDRIVE_INFO.dwHeads+2], ax
     80    mov     [si+EDRIVE_INFO.dwHeads+2], cx
    7581
    7682    mov     dl, [es:di+DPT.bPchsSectorsPerTrack]
    7783    mov     [si+EDRIVE_INFO.dwSectorsPerTrack], dx
    78     mov     [si+EDRIVE_INFO.dwSectorsPerTrack+2], ax
     84    mov     [si+EDRIVE_INFO.dwSectorsPerTrack+2], cx
    7985
    8086    mov     dx, [es:di+DPT.wPchsCylinders]
    8187    mov     [si+EDRIVE_INFO.dwCylinders], dx
    82     mov     [si+EDRIVE_INFO.dwCylinders+2], ax
     88    mov     [si+EDRIVE_INFO.dwCylinders+2], cx
    8389
     90.ReturnWithSuccess:
     91    xor     ax, ax
    8492.ReturnWithError:
    8593    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r526 r530  
    2222SECTION .text
    2323
    24 %ifdef COPY_13H_HANDLER_TO_40H
    2524;--------------------------------------------------------------------
    2625; Checks is floppy drive handler installed to interrupt vector 40h.
     
    3635;--------------------------------------------------------------------
    3736FloppyDrive_IsInt40hInstalled:
    38     cmp     WORD [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], 0C000h   ; Any ROM segment?
    39 %ifdef USE_AT   ; No need to verify on XT systems.
    40     jb      SHORT .Int40hHandlerIsNotInstalled
    41     call    .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h
    42 .Int40hHandlerIsNotInstalled:
    43 %endif
    44     cmc
    45     ret
    46 
    47 ;--------------------------------------------------------------------
    48 ; .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h
    49 ;   Parameters:
    50 ;       Nothing
    51 ;   Returns:
    52 ;       CF:     Cleared if INT 40h is installed
    53 ;               Set if INT 40h is not installed
    54 ;   Corrupts registers:
    55 ;       BX, CX, DI
    56 ;--------------------------------------------------------------------
    5737%ifdef USE_AT
    58 .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h:
    5938    push    es
    6039    push    dx
    6140    push    ax
    6241
    63     call    .LoadInt40hVerifyParameters
     42    call    LoadInt40hVerifyParameters
    6443    int     BIOS_DISK_INTERRUPT_13h
    6544    jc      SHORT .Int40hIsInstalled    ; Maybe there are not any floppy drives at all
    66     push    es
    67     push    di
     45    push    es                          ; Drive Parameter Table segment
     46    push    di                          ; Drive Parameter Table offset
    6847
    69     call    .LoadInt40hVerifyParameters
     48    call    LoadInt40hVerifyParameters
    7049    int     BIOS_DISKETTE_INTERRUPT_40h
    7150
     
    8362    pop     dx
    8463    pop     es
     64
     65%else ; if XT build
     66    cmp     WORD [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], 0C000h   ; Any ROM segment? (set CF if not)
     67%endif ; USE_AT
     68    cmc
    8569    ret
    8670
    8771;--------------------------------------------------------------------
    88 ; .LoadInt40hVerifyParameters
     72; LoadInt40hVerifyParameters
    8973;   Parameters:
    9074;       Nothing
     
    9680;       DH
    9781;--------------------------------------------------------------------
    98 .LoadInt40hVerifyParameters:
    99     mov     ah, 08h             ; Get Drive Parameters
    100     cwd                         ; Floppy drive 0
     82%ifdef USE_AT
     83LoadInt40hVerifyParameters:
     84    mov     ah, GET_DRIVE_PARAMETERS
     85    cwd                     ; Floppy drive 0
    10186    mov     di, dx
    102     mov     es, dx              ; ES:DI = 0000:0000h to guard against BIOS bugs
     87    mov     es, dx          ; ES:DI = 0000:0000h to guard against BIOS bugs
    10388    ret
    10489%endif
    105 
    106 %endif ; COPY_13H_HANDLER_TO_40H
    10790
    10891
     
    130113%ifdef MODULE_BOOT_MENU
    131114FloppyDrive_GetType:
    132     mov     ah, 08h         ; Get Drive Parameters
     115    mov     ah, GET_DRIVE_PARAMETERS
    133116    xor     bx, bx          ; FLOPPY_TYPE_525_OR_35_DD when function not supported
    134117    int     BIOS_DISKETTE_INTERRUPT_40h
     
    151134    js      .UseBIOSorBDA               ; We didn't add in any drives, counts here are not valid
    152135
    153     adc     al,1                        ; adds in the drive count bit, and adds 1 for count vs. 0-index,
     136    adc     al ,1                       ; adds in the drive count bit, and adds 1 for count vs. 0-index,
    154137    jmp     .FinishCalc                 ; need to clear AH on the way out, and add in minimum drive numbers
    155138
     
    165148    ret
    166149
    167 FloppyDrive_GetCountFromBIOS_or_BDA:
    168     push    es
    169150
    170151;--------------------------------------------------------------------
    171 ; Reads Floppy Drive Count from BIOS.
    172 ; Does not work on most XT systems. Call .GetCountFromBDA
    173 ; if this function fails.
    174 ;
    175 ; .GetCountFromBIOS
     152; FloppyDrive_GetCountFromBIOS_or_BDA
    176153;   Parameters:
    177154;       Nothing
     
    181158;               Set if BIOS function not supported
    182159;   Corrupts registers:
    183 ;       ES
     160;       AH, ES
    184161;--------------------------------------------------------------------
     162FloppyDrive_GetCountFromBIOS_or_BDA:
     163    push    es
     164
     165; Reads Floppy Drive Count from BIOS.
     166; Does not work on most XT systems. Call .GetCountFromBDA
     167; if this function fails.
    185168%ifdef USE_AT
    186 .GetCountFromBIOS:
    187169    push    di
    188170    push    bx
     
    190172    push    dx
    191173
    192     mov     ah, 08h                 ; Get Drive Parameters
     174    mov     ah, GET_DRIVE_PARAMETERS
    193175    cwd                             ; Floppy Drive 00h
    194176    int     BIOS_DISKETTE_INTERRUPT_40h
     
    199181    pop     bx
    200182    pop     di
    201 %endif
    202183
    203 ;--------------------------------------------------------------------
    204184; Reads Floppy Drive Count (0...4) from BIOS Data Area.
    205185; This function should be used only if .GetCountFromBIOS fails.
    206 ;
    207 ; .GetCountFromBDA
    208 ;   Parameters:
    209 ;       Nothing
    210 ;   Returns:
    211 ;       AL:     Number of Floppy Drives
    212 ;   Corrupts registers:
    213 ;       AH, ES
    214 ;--------------------------------------------------------------------
    215 %ifndef USE_AT
    216 .GetCountFromBDA:
     186%else ; ifndef USE_AT
    217187    LOAD_BDA_SEGMENT_TO es, ax
    218     mov     al, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
    219     mov     ah, al                          ; Copy it to AH
    220     and     ax, 0C001h                      ; Leave bits 15..14 and 0
    221     eROL_IM ah, 2                           ; EW low byte bits 7..6 to 1..0
    222     add     al, ah                          ; AL = Floppy Drive count
     188    mov     al, [es:BDA.wEquipment] ; Load Equipment WORD low byte
     189    mov     ah, al                  ; Copy it to AH
     190    and     ax, 0C001h              ; Leave bits 15..14 and 0
     191    eROL_IM ah, 2                   ; EW low byte bits 7..6 to 1..0
     192    add     al, ah                  ; AL = Floppy Drive count
    223193%endif
    224194
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Interrupts.asm

    r526 r530  
    6464    mov     [RAMVARS.fpOldI13h], ax             ; Store old INT 13h offset
    6565
    66 %ifdef COPY_13H_HANDLER_TO_40H
    6766    ; Only store INT 13h handler to 40h if 40h is not already installed.
    6867    ; At least AMI BIOS for 286 stores 40h handler by itself and calls
    69     ; 40h from 13h. That system locks to infinite loop if we copy 13h to 40h.
     68    ; 40h from 13h. That system locks to infinite loop if we blindly copy 13h to 40h.
    7069    call    FloppyDrive_IsInt40hInstalled
    7170    jc      SHORT .Int40hAlreadyInstalled
     
    7372    mov     [es:BIOS_DISKETTE_INTERRUPT_40h*4+2], dx    ; Store old INT 13h segment
    7473.Int40hAlreadyInstalled:
    75 %endif ; COPY_13H_HANDLER_TO_40H
    7674
    7775    mov     al, BIOS_DISK_INTERRUPT_13h         ; INT 13h interrupt vector offset
  • trunk/XTIDE_Universal_BIOS/makefile

    r524 r530  
    2929#                                                                                                  #
    3030# Not modules but these affect the assembly:                                                       #
    31 # COPY_13H_HANDLER_TO_40H     Copies existing INT 13h handler to 40h if necessary                  #
    3231# ELIMINATE_CGA_SNOW          Prevents CGA snowing at the cost of a few bytes                      #
    3332# RELOCATE_INT13H_STACK **    Relocates INT 13h stack to beginning of stolen conventional memory   #
     
    102101DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_8BIT_IDE_ADVANCED
    103102
    104 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED COPY_13H_HANDLER_TO_40H
     103DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE_ADVANCED
    105104DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186
    106105DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_ADVANCED_ATA
     
    114113
    115114DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS
    116 DEFINES_ALL_FEATURES += COPY_13H_HANDLER_TO_40H ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER
     115DEFINES_ALL_FEATURES += ELIMINATE_CGA_SNOW RELOCATE_INT13H_STACK RESERVE_DIAGNOSTIC_CYLINDER
    117116
    118117
Note: See TracChangeset for help on using the changeset viewer.