Ignore:
Timestamp:
Feb 22, 2012, 7:01:53 PM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Added floppy drive emulation over the serial connection (MODULE_SERIAL_FLOPPY). Along the way, various optimizations were made to stay within the 8K ROM size target. Also, serial code now returns the number of sectors transferred.

File:
1 edited

Legend:

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

    r152 r258  
    2222    eMOVZX  bx, dl                      ; Copy requested drive to BL, zero BH to assume no errors
    2323    call    ResetFloppyDrivesWithInt40h
    24     test    bl, bl
    25     jns     SHORT .SkipHardDiskReset
    2624    call    ResetForeignHardDisks
    2725    call    AH0h_ResetHardDisksHandledByOurBIOS
     
    6462    xor     ah, ah                      ; Disk Controller Reset
    6563    call    Int13h_CallPreviousInt13hHandler
    66     jmp     SHORT BackupErrorCodeFromTheRequestedDriveToBH
    67 
     64;;; fall-through to BackupErrorCodeFromTheRequestedDriveToBH
     65
     66
     67;--------------------------------------------------------------------
     68; BackupErrorCodeFromTheRequestedDriveToBH
     69;   Parameters:
     70;       AH:     Error code from the last resetted drive
     71;       DL:     Drive last resetted
     72;       BL:     Requested drive (DL when entering AH=00h)
     73;   Returns:
     74;       BH:     Backuped error code
     75;   Corrupts registers:
     76;       Nothing
     77;--------------------------------------------------------------------
     78ALIGN JUMP_ALIGN
     79BackupErrorCodeFromTheRequestedDriveToBH:
     80    cmp     dl, bl              ; Requested drive?
     81    eCMOVE  bh, ah
     82    ret
     83       
    6884
    6985;--------------------------------------------------------------------
     
    8298    mov     dl, bl
    8399    call    RamVars_IsDriveHandledByThisBIOS
    84     jnc     SHORT .Return               ; Return what was in BL unmodified
     100    jc      SHORT .Return               ; Return what was in BL unmodified
    85101    mov     dl, 80h
    86102.Return:
     
    101117ALIGN JUMP_ALIGN
    102118AH0h_ResetHardDisksHandledByOurBIOS:
    103     mov     dh, [RAMVARS.bDrvCnt]       ; Load drive count to DH
     119    mov     dx, [RAMVARS.wDrvCntAndFirst]   ; DL = drive number, DH = drive count
    104120    test    dh, dh
    105121    jz      SHORT .AllDrivesReset       ; Return if no drives
    106     mov     dl, [RAMVARS.bFirstDrv]     ; Load number of our first drive
    107122    add     dh, dl                      ; DH = one past last drive to reset
    108123ALIGN JUMP_ALIGN
     
    114129    jb      SHORT .DriveResetLoop       ;  If not, reset next drive
    115130.AllDrivesReset:
    116     ret
    117 
     131%ifdef MODULE_SERIAL_FLOPPY
     132;
     133; "Reset" emulatd serial floppy drives, if any.  There is nothing to actually do for this reset,
     134; but record the proper error return code if one of these floppy drives is the drive requested.
     135;
     136    call    RamVars_UnpackFlopCntAndFirstToAL
     137
     138    cbw                                                 ; Clears AH (there are flop drives) or ffh (there are not)
     139                                                        ; Either AH has success code (flop drives are present)
     140                                                        ; or it doesn't matter because we won't match drive ffh
     141
     142    cwd                                                 ; clears DX (there are flop drives) or ffffh (there are not)
     143
     144    adc     dl, al                                      ; second drive (CF set) if present
     145                                                        ; If no drive is present, this will result in ffh which
     146                                                        ; won't match a drive
     147    call    BackupErrorCodeFromTheRequestedDriveToBH
     148    mov     dl, al                                      ; We may end up doing the first drive twice (if there is
     149    jmp     BackupErrorCodeFromTheRequestedDriveToBH    ; only one drive), but doing it again is not harmful.
     150%else
     151    ret
     152%endif
     153       
    118154;--------------------------------------------------------------------
    119155; .BackupErrorCodeFromMasterOrSlaveToBH
     
    144180    ret
    145181
     182       
    146183;--------------------------------------------------------------------
    147184; GetBasePortToCX
     
    167204
    168205
    169 ;--------------------------------------------------------------------
    170 ; BackupErrorCodeFromTheRequestedDriveToBH
    171 ;   Parameters:
    172 ;       AH:     Error code from the last resetted drive
    173 ;       DL:     Drive last resetted
    174 ;       BL:     Requested drive (DL when entering AH=00h)
    175 ;   Returns:
    176 ;       BH:     Backuped error code
    177 ;   Corrupts registers:
    178 ;       Nothing
    179 ;--------------------------------------------------------------------
    180 ALIGN JUMP_ALIGN
    181 BackupErrorCodeFromTheRequestedDriveToBH:
    182     cmp     dl, bl              ; Requested drive?
    183     eCMOVE  bh, ah
    184     ret
Note: See TracChangeset for help on using the changeset viewer.