Changeset 193 in xtideuniversalbios


Ignore:
Timestamp:
Nov 17, 2011, 2:59:13 AM (11 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Space optimizations in AccessDPT.asm, transfer one routine to a macro (retaining some encapsulation), and transfer the unique part of another routine to the one place it was being called (which also makes what it was doing more transparent).

Location:
trunk/XTIDE_Universal_BIOS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r175 r193  
    6565ADDRESSING_MODE_LBA48           EQU     3   ; 48-bit LBA Addressing Mode
    6666
     67%macro CustomDPT_GetUnshiftedAddressModeToALZF 0
     68    mov     al, [di+DPT.bFlagsLow]
     69    and     al, MASKL_DPT_ADDRESSING_MODE
     70%endmacro
     71
    6772; Number of Sectors per Track is fixed to 63 for LBA assist calculation.
    6873; 1024 cylinders, 256 heads, 63 sectors = 8.4 GB limit (but DOS does not support more than 255 heads)
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r192 r193  
    5454;--------------------------------------------------------------------
    5555PushAddressingMode:
    56     call    AccessDPT_GetAddressingModeToAXZF
    57     mov     bl,g_szAddressingModes_Displacement
     56    CustomDPT_GetUnshiftedAddressModeToALZF
     57    ;;
     58    ;; This multiply both shifts the addressing mode bits down to low order bits, and
     59    ;; at the same time multiplies by the size of the string displacement.  The result is in AH,
     60    ;; with AL clear, and so we exchange AL and AH after the multiply for the final result.
     61    ;;
     62    mov     bl,(1<<(8-ADDRESSING_MODE_FIELD_POSITION)) * g_szAddressingModes_Displacement
    5863    mul     bl
     64    xchg    al,ah
    5965    add     ax,g_szAddressingModes
    6066    push    ax
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm

    r191 r193  
    8686Address_OldInt13hAddressToIdeAddress:
    8787    call    Address_ExtractLCHSparametersFromOldInt13hAddress
    88     call    AccessDPT_GetAddressingModeToAXZF
     88       
     89    CustomDPT_GetUnshiftedAddressModeToALZF
    8990    jz      DoNotConvertLCHS    ; 0, ADDR_DPT_LCHS
    90     dec     ax
     91       
     92    ;;
     93    ;; Since we are only checking for zero, we can do our math in the high order bits,
     94    ;; in this case effectively subtracting 1 from the address mode.
     95    ;;
     96    sub     al,(1<<ADDRESSING_MODE_FIELD_POSITION)
    9197    jz      ConvertLCHStoPCHS   ; 1, ADDR_DPT_PCHS
     98       
    9299;; Fall-through                 ; 2, ADDR_DPT_LBA28 and 3, ADDR_DPT_LBA48
    93100       
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm

    r191 r193  
    4040    ret
    4141
    42 
    43 ;--------------------------------------------------------------------
    44 ; AccessDPT_GetAddressingModeToAXZF
    45 ;   Parameters:
    46 ;       DS:DI:  Ptr to Disk Parameter Table
    47 ;   Returns:
    48 ;       AX:     Addressing Mode (L-CHS, P-CHS, LBA28, LBA48)
    49 ;       ZF:     Set if AX=0
    50 ;   Corrupts registers:
    51 ;       Nothing
    52 ;--------------------------------------------------------------------
    53 ALIGN JUMP_ALIGN
    54 AccessDPT_GetAddressingModeToAXZF:
    55     mov     al, [di+DPT.bFlagsLow]
    56     and     ax, BYTE MASKL_DPT_ADDRESSING_MODE
    57     eSHR_IM ax, ADDRESSING_MODE_FIELD_POSITION
    58     ret
    59 
    60 
     42       
    6143;--------------------------------------------------------------------
    6244; AccessDPT_GetLCHS
     
    121103    ret
    122104
    123 
    124 ;--------------------------------------------------------------------
    125 ; AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive
    126 ;   Parameters:
    127 ;       AX:     Bitmask to test DRVPARAMS.wFlags
    128 ;       DS:DI:  Ptr to Disk Parameter Table
    129 ;   Returns:
    130 ;       ZF:     Set if tested bit was zero
    131 ;               Cleared if tested bit was non-zero
    132 ;       CF:     0
    133 ;   Corrupts registers:
    134 ;       BX
    135 ;--------------------------------------------------------------------
    136 ALIGN JUMP_ALIGN
    137 AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive:
    138     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    139     test    [cs:bx+DRVPARAMS.wFlags], ax
    140     ret
    141 
     105       
    142106;--------------------------------------------------------------------
    143107; Returns pointer to DRVPARAMS for master or slave drive.
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r181 r193  
    8686.StoreAddressing:
    8787    ; Check if CHS defined in ROMVARS
    88     mov     al, FLG_DRVPARAMS_USERCHS   ; User specified CHS?
    89     call    AccessDPT_TestIdeVarsFlagsForMasterOrSlaveDrive
     88    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
     89    test    byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS    ; User specified CHS?
    9090    jnz     SHORT .StoreUserDefinedCHSaddressing
    9191
Note: See TracChangeset for help on using the changeset viewer.