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/VariablesAndDPTs/FindDPT.asm

    r233 r258  
    1414;       DS:DI:  Ptr to first unused DPT
    1515;   Corrupts registers:
    16 ;       DL
     16;       DX
    1717;--------------------------------------------------------------------
    1818ALIGN JUMP_ALIGN
    1919FindDPT_ForNewDriveToDSDI:
    20     mov     dl, [RAMVARS.bFirstDrv]
    21     add     dl, [RAMVARS.bDrvCnt]
     20    mov     ax, [RAMVARS.wDrvCntAndFirst]
     21    add     al, ah
     22%ifdef MODULE_SERIAL_FLOPPY
     23    add     al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt]
     24%endif
     25    xchg    ax, dx     
    2226    ; Fall to FindDPT_ForDriveNumber
    2327
     
    4145    xchg    di, ax  ; Save the contents of AX in DI
    4246
     47%ifdef MODULE_SERIAL_FLOPPY
     48    mov     ax, [RAMVARS.wDrvCntAndFirst]
     49       
     50    test    dl, dl
     51    js      .harddisk
     52
     53    call    RamVars_UnpackFlopCntAndFirstToAL
     54    add     dl, ah                      ; add in end of hard disk DPT list, floppies start immediately after
     55.harddisk:
     56    sub     dl, al                      ; subtract off beginning of either hard disk or floppy list (as appropriate)
     57%else
     58    sub     dl, [RAMVARS.bFirstDrv]     ; subtract off beginning of hard disk list
     59%endif
     60       
    4361    mov     al, LARGEST_DPT_SIZE
    44     sub     dl, [RAMVARS.bFirstDrv]
     62       
    4563    mul     dl
    4664    add     ax, BYTE RAMVARS_size
    4765
    48     xchg    di, ax  ; Restore AX and put result in DI
     66    xchg    di, ax                      ; Restore AX and put result in DI
    4967    pop     dx
    5068    ret
     
    89107; IterateToMasterAtPortCallback
    90108;   Parameters:
    91 ;       CH:     Drive number
    92109;       DX:     IDE Base Port address
    93110;       DS:DI:  Ptr to DPT to examine
    94111;   Returns:
    95 ;       DL:     Drive number if correct DPT
    96112;       CF:     Set if wanted DPT found
    97113;               Cleared if wrong DPT
     
    116132    pop     bx
    117133    jne     SHORT ReturnWrongDPT
    118     mov     dl, ch                              ; Return drive number in DL
    119134
    120135ReturnRightDPT:
     
    187202;   Returns:
    188203;       DS:DI:      Ptr to wanted DPT (if found)
     204;                   If not found, points to first empty DPT
    189205;       CF:         Set if wanted DPT found
    190206;                   Cleared if DPT not found, or no DPTs present
     
    195211IterateAllDPTs:
    196212    push    cx
    197     mov     cx, [RAMVARS.wDrvCntAndFirst]
     213
     214    mov     cl, [RAMVARS.bDrvCnt]       
     215    mov     ch, 0
     216       
     217    mov     di, RAMVARS_size            ; Point DS:DI to first DPT
     218       
    198219    jcxz    .NotFound                   ; Return if no drives
    199     mov     di, RAMVARS_size            ; Point DS:DI to first DPT
     220       
    200221ALIGN JUMP_ALIGN
    201222.LoopWhileDPTsLeft:
    202223    call    si                          ; Is wanted DPT?
    203224    jc      SHORT .AllDptsIterated      ;  If so, return
    204     inc     ch                          ; Increment drive number
    205225    add     di, BYTE LARGEST_DPT_SIZE   ; Point to next DPT
    206     dec     cl                          ; Decrement drives left
    207     jnz     SHORT .LoopWhileDPTsLeft
     226    loop    .LoopWhileDPTsLeft
     227       
    208228.NotFound:     
    209229    clc                                 ; Clear CF since DPT not found
     230       
    210231ALIGN JUMP_ALIGN
    211232.AllDptsIterated:
Note: See TracChangeset for help on using the changeset viewer.