Changeset 39 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization


Ignore:
Timestamp:
Sep 13, 2010, 11:16:42 AM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:
  • Better INT 40h handler detection to fix floppy drive detection with AMI 286 BIOS.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/FloppyDrive.asm

    r27 r39  
    22; Project name  :   IDE BIOS
    33; Created date  :   25.3.2010
    4 ; Last update   :   28.7.2010
     4; Last update   :   13.9.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Various floppy drive related functions that
     
    2222;       BX, CX, DI
    2323;--------------------------------------------------------------------   
    24 ALIGN JUMP_ALIGN
     24;ALIGN JUMP_ALIGN
    2525FloppyDrive_IsInt40hInstalled:
    2626    cmp     WORD [es:INTV_FLOPPY_FUNC*4+2], 0C000h  ; Any ROM segment?
     27    jb      SHORT .Int40hHandlerIsNotInstalled
     28    call    .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h
     29.Int40hHandlerIsNotInstalled:
    2730    cmc
     31    ret
     32
     33;--------------------------------------------------------------------
     34; .VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h
     35;   Parameters:
     36;       Nothing
     37;   Returns:
     38;       CF:     Cleared if INT 40h is installed
     39;               Set if INT 40h is not installed
     40;   Corrupts registers:
     41;       BX, CX, DI
     42;--------------------------------------------------------------------   
     43;ALIGN JUMP_ALIGN
     44.VerifyInt40hHandlerSinceSomeBiosesSimplyReturnFromInt40h:
     45    push    es
     46    push    dx
     47    push    ax
     48
     49    call    .LoadInt40hVerifyParameters
     50    int     INTV_DISK_FUNC
     51    jc      SHORT .AH08hNotSupported    ; AH=08h not supported on XTs but that doesn't
     52    push    es                          ; matter since INT 40h does not need to be verified
     53    push    di                          ; on XTs
     54
     55    call    .LoadInt40hVerifyParameters
     56    int     INTV_FLOPPY_FUNC
     57
     58    pop     dx
     59    pop     cx
     60    cmp     dx, di                      ; Difference in offsets?
     61    jne     SHORT .Int40hNotInstalled
     62    mov     dx, es
     63    cmp     cx, dx                      ; Difference in segments?
     64    jne     SHORT .Int40hNotInstalled
     65.AH08hNotSupported:
     66    clc
     67    jmp     SHORT .Int40hIsInstalled
     68.Int40hNotInstalled:
     69    stc
     70.Int40hIsInstalled:
     71    pop     ax
     72    pop     dx
     73    pop     es
     74    ret
     75
     76;--------------------------------------------------------------------
     77; .LoadInt40hVerifyParameters
     78;   Parameters:
     79;       Nothing
     80;   Returns:
     81;       AH:     08h (Get Drive Parameters)
     82;       DL:     00h (floppy drive)
     83;       ES:DI:  0:0h (to guard against BIOS bugs)
     84;   Corrupts registers:
     85;       DH
     86;--------------------------------------------------------------------   
     87;ALIGN JUMP_ALIGN
     88.LoadInt40hVerifyParameters:
     89    xor     dx, dx              ; Floppy drive 0
     90    mov     di, dx
     91    mov     es, dx              ; ES:DI = 0000:0000h to guard against BIOS bugs
     92    mov     ah, 08h             ; Get Drive Parameters
    2893    ret
    2994
Note: See TracChangeset for help on using the changeset viewer.