Changeset 158 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE


Ignore:
Timestamp:
May 2, 2011, 9:41:51 AM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:

Changes to XTIDE Universal BIOS:

  • Optimized few bytes.
Location:
trunk/XTIDE_Universal_BIOS/Src/Device/IDE
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm

    r157 r158  
    5454    ; Create fake DPT to be able to use Device.asm functions
    5555    call    FindDPT_ForNewDriveToDSDI
    56     xor     ax, ax
     56    eMOVZX  ax, bh
    5757    cmp     BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
    58     eCMOVE  ax, FLG_DPT_REVERSED_A0_AND_A3
    59     or      al, bh
     58    eCMOVE  ah, FLGH_DPT_REVERSED_A0_AND_A3
    6059    mov     [di+DPT.wFlags], ax
    6160    mov     [di+DPT.bIdevarsOffset], bp
     
    6564    cmp     bp, BYTE ROMVARS.ideVars0
    6665    jne     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    67     test    bh, FLG_DRVNHEAD_DRV
     66    test    al, FLG_DRVNHEAD_DRV
    6867    jnz     SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster
    6968    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY)
     
    8281
    8382    ; Clean stack and return
    84     lea     sp, [bp+SIZE_OF_FAKE_IDEPACK]   ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here
     83    lea     sp, [bp+EXTRA_BYTES_FOR_INTPACK]    ; This assumes BP hasn't changed between Idepack_FakeToSSBP and here
    8584    pop     bp
    8685    ret
     
    103102ALIGN JUMP_ALIGN
    104103IdeCommand_OutputWithParameters:
    105     push    bx                          ; Store status register bits to poll
     104    push    bx                      ; Store status register bits to poll
    106105
    107106    ; Select Master or Slave drive and output head number or LBA28 top bits
     
    110109
    111110    ; Output Device Control Byte to enable or disable interrupts
    112     mov     dl, DEVICE_CONTROL_REGISTER_out
    113111    mov     al, [bp+IDEPACK.bDeviceControl]
    114     test    al, FLG_DEVCONTROL_nIEN
     112    test    al, FLG_DEVCONTROL_nIEN ; Interrupts disabled?
    115113    jnz     SHORT .DoNotSetInterruptInServiceFlag
    116     or      WORD [di+DPT.wFlags], FLG_DPT_INTERRUPT_IN_SERVICE
     114
     115    ; Clear Task Flag and set Interrupt In-Service Flag
     116    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INTERRUPT_IN_SERVICE
    117117    push    ds
    118     LOAD_BDA_SEGMENT_TO ds, cx, !       ; Also zero CX
    119     mov     [BDA.bHDTaskFlg], al
     118    LOAD_BDA_SEGMENT_TO ds, dx, !   ; Also zero DX
     119    mov     [BDA.bHDTaskFlg], dl
    120120    pop     ds
    121121.DoNotSetInterruptInServiceFlag:
     122    mov     dl, DEVICE_CONTROL_REGISTER_out
    122123    call    Device_OutputALtoIdeControlBlockRegisterInDL
    123124
     
    143144
    144145    ; Wait until command completed
    145     pop     bx                          ; Pop status and timeout for polling
    146     cmp     bl, FLG_STATUS_DRQ          ; Data transfer started?
    147     je      SHORT .StartDataTransfer
     146    pop     bx                      ; Pop status and timeout for polling
     147    cmp     bl, FLG_STATUS_DRQ      ; Data transfer started?
     148    je      SHORT IdeTransfer_StartWithCommandInAL
    148149    test    BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN
    149150    jz      SHORT .WaitForIrqOrRdy
     
    153154.WaitForIrqOrRdy:
    154155    jmp     IdeWait_IRQorStatusFlagInBLwithTimeoutInBH
    155 ALIGN JUMP_ALIGN
    156 .StartDataTransfer:
    157     jmp     IdeTransfer_StartWithCommandInAL
    158156
    159157.DriveNotReady:
     
    179177    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    180178    cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    181     eCMOVE  bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_BSY)
     179    eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    182180    call    IdeWait_PollStatusFlagInBLwithTimeoutInBH
    183181    jc      SHORT ReturnSinceTimeoutWhenPollingBusy
     
    189187    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    190188    cmp     BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE
    191     eCMOVE  bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_IDENTIFY_DEVICE, FLG_STATUS_DRDY)
     189    eCMOVE  bh, TIMEOUT_IDENTIFY_DEVICE
    192190    jmp     IdeWait_PollStatusFlagInBLwithTimeoutInBH
    193191
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm

    r152 r158  
    114114
    115115    ; Clear Interrupt In-Service Flag from DPT
    116     and     WORD [di+DPT.wFlags], ~FLG_DPT_INTERRUPT_IN_SERVICE
     116    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INTERRUPT_IN_SERVICE
    117117
    118118    ; Set Task Flag
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r157 r158  
    166166; InitializePiovarsInSSBPwithSectorCountInAX
    167167;   Parameters:
    168 ;       AX:     Number of sectors to transfer (0=65536)
     168;       AX:     Number of sectors to transfer (1...65535)
    169169;       BX:     Offset to transfer function lookup table
    170170;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     
    179179    ; Store number of blocks to transfer
    180180    eMOVZX  cx, BYTE [di+DPT_ATA.bSetBlock]     ; Block size in sectors
    181     xor     dx, dx
    182     test    ax, ax
    183     eCMOVZ  dl, 1       ; DX:AX = Sectors to transfer (1...65536)
     181    xor     dx, dx      ; DX:AX = Sectors to transfer (1...65535)
    184182    div     cx          ; AX = Full blocks to transfer
    185183    test    dx, dx
     
    197195
    198196    ; Get transfer function based on bus type
    199     xchg    ax, bx
     197    xchg    ax, bx                              ; Lookup table offset to AX
    200198    eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]    ; CS:BX now points to IDEVARS
    201199    mov     dx, [cs:bx+IDEVARS.wPort]           ; Load IDE Data port address
Note: See TracChangeset for help on using the changeset viewer.