Ignore:
Timestamp:
Mar 4, 2012, 1:35:10 AM (12 years ago)
Author:
krille_n_@…
google:author:
krille_n_@hotmail.com
Message:

Commit 2/2 (BIOS):

  • Fixed a bug in AH1h_HStatus.asm.
  • Minor optimizations.
  • Fixed spelling and did some cleaning.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/FindDPT.asm

    r277 r294  
    88; Checks if drive is handled by this BIOS, and return DPT pointer.
    99;
    10 ; FindDPT_ForDriveNumberInDL       
     10; FindDPT_ForDriveNumberInDL
    1111;   Parameters:
    1212;       DL:     Drive number
     
    2121;--------------------------------------------------------------------
    2222ALIGN JUMP_ALIGN
    23 FindDPT_ForDriveNumberInDL:     
     23FindDPT_ForDriveNumberInDL:
    2424    xchg    di, ax                              ; Save the contents of AX in DI
    2525
    26 ; 
     26;
    2727; Check Our Hard Disks
    2828;
     
    3333    cmp     dl, ah                              ; Above last supported?
    3434    jae     SHORT .HardDiskNotHandledByThisBIOS
    35        
     35
    3636    cmp     dl, al                              ; Below first supported?
    3737    jae     SHORT .CalcDPTForDriveNumber
    3838
    39 ALIGN JUMP_ALIGN               
    40 .HardDiskNotHandledByThisBIOS: 
     39ALIGN JUMP_ALIGN
     40.HardDiskNotHandledByThisBIOS:
    4141;
    4242; Check Our Floppy Disks
    43 ; 
     43;
    4444    call    RamVars_UnpackFlopCntAndFirstToAL
    4545    js      SHORT .DiskIsNotHandledByThisBIOS
    46                
     46
    4747    cbw                                         ; Always 0h (no floppy drive covered above)
    4848    adc     ah, al                              ; Add in first drive number and number of drives
     
    5151    jz      SHORT .CalcDPTForDriveNumber
    5252    cmp     al, dl                              ; Check first drive in all cases, redundant but OK to repeat
    53     jnz     SHORT .DiskIsNotHandledByThisBIOS           
     53    jnz     SHORT .DiskIsNotHandledByThisBIOS
    5454%else
    55     cmp     dl, ah                              ; Above last supported?     
     55    cmp     dl, ah                              ; Above last supported?
    5656    jae     SHORT .DiskIsNotHandledByThisBIOS
    57        
     57
    5858    cmp     dl, al                              ; Below first supported?
    59     jb      SHORT .DiskIsNotHandledByThisBIOS           
     59    jb      SHORT .DiskIsNotHandledByThisBIOS
    6060%endif
    6161    ; fall-through to CalcDPTForDriveNumber
     
    6363;--------------------------------------------------------------------
    6464; Finds Disk Parameter Table for drive number.
    65 ; Note intended to be called except by FindDPT_ForDriveNumber
     65; Not intended to be called except by FindDPT_ForDriveNumberInDL
    6666;
    6767; CalcDPTForDriveNumber
     
    6969;       DL:     Drive number
    7070;       DS:     RAMVARS segment
    71 ;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumber
     71;       DI:     Saved copy of AX from entry at FindDPT_ForDriveNumberInDL
    7272;   Returns:
    7373;       DS:DI:  Ptr to DPT
     
    8282%ifdef MODULE_SERIAL_FLOPPY
    8383    mov     ax, [RAMVARS.wDrvCntAndFirst]
    84        
     84
    8585    test    dl, dl
    8686    js      .harddisk
     
    8888    call    RamVars_UnpackFlopCntAndFirstToAL
    8989    add     dl, ah                      ; add in end of hard disk DPT list, floppies start immediately after
    90        
    91 ALIGN JUMP_ALIGN               
     90
     91ALIGN JUMP_ALIGN
    9292.harddisk:
    9393    sub     dl, al                      ; subtract off beginning of either hard disk or floppy list (as appropriate)
     
    9696%endif
    9797
    98 .CalcDPTForNewDrive:               
     98.CalcDPTForNewDrive:
    9999    mov     al, LARGEST_DPT_SIZE
    100        
     100
    101101    mul     dl
    102     add     ax, BYTE RAMVARS_size       ; Clears CF (will not oveflow)
     102    add     ax, BYTE RAMVARS_size       ; Clears CF (will not overflow)
    103103
    104104    pop     dx
     
    107107    ret
    108108
    109 ALIGN JUMP_ALIGN       
    110 .DiskIsNotHandledByThisBIOS:           
     109ALIGN JUMP_ALIGN
     110.DiskIsNotHandledByThisBIOS:
    111111;
    112112; Drive not found...
    113113;
    114114    xor     ax, ax                              ; Clear DPT pointer
    115     stc                                         ; Is not supported by our BIOS     
    116        
     115    stc                                         ; Is not supported by our BIOS
     116
    117117    xchg    di, ax                              ; Restore AX from save at top
    118118    ret
     
    136136
    137137;--------------------------------------------------------------------
    138 ; Iteration routine for FindDPT_ForIdevarsOffsetInDL, 
     138; Iteration routine for FindDPT_ForIdevarsOffsetInDL,
    139139; for use with IterateAllDPTs
    140 ; 
     140;
    141141; Returns when DPT is found on the controller with Idevars offset in DL
    142142;
     
    148148;               Set if wrong DPT
    149149;--------------------------------------------------------------------
    150 IterateFindFirstDPTforIdevars:     
     150IterateFindFirstDPTforIdevars:
    151151    cmp     dl, [di+DPT.bIdevarsOffset]         ; Clears CF if matched
    152152    je      .done
    153153    stc                                         ; Set CF for not found
    154 .done: 
     154.done:
    155155    ret
    156156
     
    171171FindDPT_ForNewDriveToDSDI:
    172172    push    dx
    173        
     173
    174174%ifdef MODULE_SERIAL_FLOPPY
    175175    mov     dx, [RAMVARS.wDrvCntAndFlopCnt]
     
    178178    mov     dl, [RAMVARS.bDrvCnt]
    179179%endif
    180        
     180
    181181    jmp     short FindDPT_ForDriveNumberInDL.CalcDPTForNewDrive
    182182
     
    185185;   Parameters:
    186186;       DS:DI:  Ptr to DPT to examine
    187 ;       BL:     Bit(s) to test in DPT.bFlagsHigh 
     187;       BL:     Bit(s) to test in DPT.bFlagsHigh
    188188;   Returns:
    189189;       CF:     Clear if wanted DPT found
     
    193193;--------------------------------------------------------------------
    194194ALIGN JUMP_ALIGN
    195 IterateToDptWithFlagsHighInBL:     
    196     test    BYTE [di+DPT.bFlagsHigh], bl        ; Clears CF
     195IterateToDptWithFlagsHighInBL:
     196    test    [di+DPT.bFlagsHigh], bl             ; Clears CF
    197197    jnz     SHORT .ReturnRightDPT
    198198    stc
    199 .ReturnRightDPT:       
     199.ReturnRightDPT:
    200200    ret
    201201
     
    212212;--------------------------------------------------------------------
    213213%ifdef MODULE_SERIAL
    214 ALIGN JUMP_ALIGN       
    215 FindDPT_ToDSDIforSerialDevice:         
     214ALIGN JUMP_ALIGN
     215FindDPT_ToDSDIforSerialDevice:
    216216    mov     bl, FLGH_DPT_SERIAL_DEVICE
    217217; fall-through
    218218%endif
    219                
     219
    220220;--------------------------------------------------------------------
    221221; FindDPT_ToDSDIforFlagsHigh
     
    231231;--------------------------------------------------------------------
    232232ALIGN JUMP_ALIGN
    233 FindDPT_ToDSDIforFlagsHighInBL:     
     233FindDPT_ToDSDIforFlagsHighInBL:
    234234    mov     si, IterateToDptWithFlagsHighInBL
    235235    ; Fall to IterateAllDPTs
     
    257257
    258258    mov     di, RAMVARS_size            ; Point DS:DI to first DPT
    259        
    260     mov     cl, [RAMVARS.bDrvCnt]
    261     xor     ch, ch                      ; Clears CF 
    262        
     259    eMOVZX  cx, [RAMVARS.bDrvCnt]
    263260    jcxz    .NotFound                   ; Return if no drives
    264        
     261
    265262ALIGN JUMP_ALIGN
    266263.LoopWhileDPTsLeft:
Note: See TracChangeset for help on using the changeset viewer.