Ignore:
Timestamp:
Apr 29, 2011, 7:04:13 PM (13 years ago)
Author:
aitotat
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Redesigned Disk Parameter Tables.
  • Code generalizations for supporting non-IDE devices in the future.
File:
1 edited

Legend:

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

    r148 r150  
    1313;       DL:     Translated Drive number
    1414;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    15 ;       SS:BP:  Ptr to INTPACK
    16 ;   Parameters on INTPACK in SS:BP:
     15;       SS:BP:  Ptr to IDEPACK
     16;   Parameters on INTPACK:
    1717;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
    18 ;   Returns with INTPACK in SS:BP:
     18;   Returns with INTPACK:
    1919;       AH:     Int 13h return status
    2020;       CF:     0 if succesfull, 1 if error
     
    2222ALIGN JUMP_ALIGN
    2323AH24h_HandlerForSetMultipleBlocks:
     24    test    WORD [di+DPT.wFlags], FLG_DPT_BLOCK_MODE_SUPPORTED
     25    jnz     SHORT .TryToSetBlockMode
     26    stc
     27    mov     ah, RET_HD_INVALID
     28    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
     29
     30ALIGN JUMP_ALIGN
     31.TryToSetBlockMode:
    2432%ifndef USE_186
    2533    call    AH24h_SetBlockSize
     
    3240
    3341;--------------------------------------------------------------------
    34 ; Sets block size for block mode transfers.
    35 ;
    3642; AH24h_SetBlockSize
    3743;   Parameters:
    3844;       AL:     Number of Sectors per Block (1, 2, 4, 8, 16, 32, 64 or 128)
    3945;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     46;       SS:BP:  Ptr to IDEPACK
    4047;   Returns:
    4148;       AH:     Int 13h return status
     
    4653ALIGN JUMP_ALIGN
    4754AH24h_SetBlockSize:
    48     ; Select Master or Slave and wait until ready
    49     mov     bl, al                              ; Backup block size
    50     call    HDrvSel_SelectDriveAndDisableIRQ    ; Select drive and wait until ready
    51     jc      SHORT .ReturnWithErrorCodeInAH      ; Return if error
    52 
    53     ; Output block size and command
    54     mov     al, bl                              ; Restore block size to AL
    55     mov     ah, HCMD_SET_MUL                    ; Load command to AH
    56     mov     dx, [RAMVARS.wIdeBase]              ; Load base port address
    57     add     dx, BYTE REG_IDE_CNT
    58     call    HCommand_OutputSectorCountAndCommand
    59     call    HStatus_WaitBsyDefTime              ; Wait until drive not busy
     55    MIN_U   al, MAX_SUPPORTED_BLOCK_SIZE_IN_SECTORS
     56    push    ax
     57    xchg    dx, ax          ; DL = Block size (Sector Count Register)
     58    mov     al, COMMAND_SET_MULTIPLE_MODE
     59    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
     60    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
     61    pop     bx
    6062    jc      SHORT .DisableBlockMode
    6163
    6264    ; Store new block size to DPT and return
    63     mov     [di+DPT.bSetBlock], bl              ; Store new block size
    64     xor     ah, ah                              ; Zero AH and CF since success
     65    mov     [di+DPT_ATA.bSetBlock], bl              ; Store new block size
    6566    ret
    6667.DisableBlockMode:
    67     mov     BYTE [di+DPT.bSetBlock], 1          ; Disable block mode
    68 .ReturnWithErrorCodeInAH:
     68    mov     BYTE [di+DPT_ATA.bSetBlock], 1          ; Disable block mode
    6969    ret
Note: See TracChangeset for help on using the changeset viewer.