Changeset 294 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs


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.
Location:
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
Files:
3 edited

Legend:

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

    r262 r294  
    1818;   Returns:
    1919;       DL:     Drive number for new drive
    20 ;       DS:DI:  Ptr to Disk Parameter Table (if succesfull)
     20;       DS:DI:  Ptr to Disk Parameter Table (if successful)
    2121;       CF:     Cleared if DPT created successfully
    2222;               Set if any error
     
    202202;----------------------------------------------------------------------
    203203; Update drive counts (hard and floppy)
    204 ;---------------------------------------------------------------------- 
    205        
     204;----------------------------------------------------------------------
     205
    206206%ifdef MODULE_SERIAL_FLOPPY
    207207;
    208208; These two instructions serve two purposes:
    209209; 1. If the drive is a floppy drive (CF set), then we effectively increment the counter.
    210 ; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is 
     210; 2. If this is a hard disk, and there have been any floppy drives previously added, then the hard disk is
    211211;    effectively discarded.  This is more of a safety check then code that should ever normally be hit (see below).
    212 ;    Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT, 
     212;    Since the floppy DPT's come after the hard disk DPT's, without expensive (code size) code to relocate a DPT,
    213213;    this was necessary.  Now, this situation shouldn't happen in normal operation, for a couple of reasons:
    214 ;       A. xtidecfg always puts configured serial ports at the end fo the IDEVARS list
     214;       A. xtidecfg always puts configured serial ports at the end of the IDEVARS list
    215215;       B. the auto serial code is always executed last
    216216;       C. the serial server always returns floppy drives last
    217217;
    218218    adc     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt], 0
    219     jnz     .AllDone   
     219    jnz     .AllDone
    220220%else
    221221;
    222222; Even without floppy support enabled, we shouldn't try to mount a floppy image as a hard disk, which
    223 ; could lead to unpredictable results since no MBR will be present, etc.  The server doesn't know that 
     223; could lead to unpredictable results since no MBR will be present, etc.  The server doesn't know that
    224224; floppies are supported, so it is important to still fail here if a floppy is seen during the drive scan.
    225225;
     
    228228
    229229    inc     BYTE [RAMVARS.bDrvCnt]      ; Increment drive count to RAMVARS
    230        
    231 .AllDone:               
     230
     231.AllDone:
    232232    clc
    233233    ret
  • 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:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm

    r270 r294  
    125125ALIGN JUMP_ALIGN
    126126RamVars_GetHardDiskCountFromBDAtoAX:
    127     push    es
    128 
    129     LOAD_BDA_SEGMENT_TO es, ax
    130127    call    RamVars_GetCountOfKnownDrivesToAX
    131     mov     cl, [es:BDA.bHDCount]
     128    push    ds
     129    LOAD_BDA_SEGMENT_TO ds, cx
     130    mov     cl, [BDA.bHDCount]
    132131    MAX_U   al, cl
    133        
    134     pop     es
     132    pop     ds
    135133    ret
    136134
     
    151149    cbw
    152150    ret
    153    
     151
    154152;--------------------------------------------------------------------
    155153; RamVars_GetIdeControllerCountToCX
     
    163161ALIGN JUMP_ALIGN
    164162RamVars_GetIdeControllerCountToCX:
    165     eMOVZX  cx, BYTE [cs:ROMVARS.bIdeCnt]
     163    eMOVZX  cx, [cs:ROMVARS.bIdeCnt]
    166164    ret
    167165
     
    177175;   Corrupts registers:
    178176;       Nothing
    179 ;--------------------------------------------------------------------       
     177;--------------------------------------------------------------------
    180178ALIGN JUMP_ALIGN
    181179RamVars_UnpackFlopCntAndFirstToAL:
    182180    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst]
    183     sar     al, 1       
     181    sar     al, 1
    184182    ret
    185183%endif
Note: See TracChangeset for help on using the changeset viewer.