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/Initialization/FloppyDrive.asm

    r181 r258  
    120120; Returns number of Floppy Drives in system.
    121121;
    122 ; FloppyDrive_GetCountToCX
    123 ;   Parameters:
    124 ;       Nothing
    125 ;   Returns:
    126 ;       CX:     Number of Floppy Drives
    127 ;   Corrupts registers:
    128 ;       Nothing
    129 ;--------------------------------------------------------------------
    130 ALIGN JUMP_ALIGN
    131 FloppyDrive_GetCountToCX:
     122; FloppyDrive_GetCountToAX
     123;   Parameters:
     124;       DS:     RAMVARS Segment
     125;   Returns:
     126;       AX:     Number of Floppy Drives
     127;--------------------------------------------------------------------
     128ALIGN JUMP_ALIGN
     129FloppyDrive_GetCountToAX:       
     130%ifdef MODULE_SERIAL_FLOPPY
     131    call    RamVars_UnpackFlopCntAndFirstToAL
     132    adc     al,1                        ; adds in the drive count bit, and adds 1 for count vs. 0-index,
     133                                        ; but still won't impact SF
     134    jns     .UseInternalNumber          ; need to clear CH on the way out, and add in additional drive numbers
     135
     136%endif
     137    call    FloppyDrive_GetCountFromBIOS_or_BDA
     138       
     139.UseInternalNumber:
     140    mov     ah, [cs:ROMVARS.bMinFddCnt]
     141    MAX_U   al, ah
     142    cbw
     143       
     144    ret
     145
     146ALIGN JUMP_ALIGN       
     147FloppyDrive_GetCountFromBIOS_or_BDA:
    132148    push    es
    133 %ifdef USE_AT
    134     call    GetCountFromBIOS
    135 %else
    136     call    GetCountFromBDA
    137 %endif
    138     mov     ch, [cs:ROMVARS.bMinFddCnt]
    139     MAX_U   cl, ch
    140     pop     es
    141     xor     ch, ch
    142     ret
    143 
    144149
    145150;--------------------------------------------------------------------
     
    160165%ifdef USE_AT
    161166ALIGN JUMP_ALIGN
    162 GetCountFromBIOS:
     167.GetCountFromBIOS:
    163168    push    di
    164169    push    dx
    165170    push    bx
    166     push    ax
    167171
    168172    mov     ah, 08h                 ; Get Drive Parameters
    169173    cwd                             ; Floppy Drive 00h
    170174    int     BIOS_DISKETTE_INTERRUPT_40h
    171     mov     cl, dl                  ; Number of Floppy Drives to CL
    172 
    173     pop     ax
     175    mov     al, dl                  ; Number of Floppy Drives to AL
     176
    174177    pop     bx
    175178    pop     dx
    176179    pop     di
    177     ret
    178 %endif
    179 
     180%endif
    180181
    181182;--------------------------------------------------------------------
     
    193194%ifndef USE_AT
    194195ALIGN JUMP_ALIGN
    195 GetCountFromBDA:
    196     LOAD_BDA_SEGMENT_TO es, cx
    197     mov     cl, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
    198     mov     ch, cl                          ; Copy it to CH
    199     and     cx, 0C001h                      ; Leave bits 15..14 and 0
    200     eROL_IM ch, 2                           ; EW low byte bits 7..6 to 1..0
    201     add     cl, ch                          ; CL = Floppy Drive count
    202     ret
    203 %endif
     196.GetCountFromBDA:
     197    LOAD_BDA_SEGMENT_TO es, ax
     198    mov     al, [es:BDA.wEquipment]         ; Load Equipment WORD low byte
     199    mov     ah, al                          ; Copy it to CH
     200    and     ax, 0C001h                      ; Leave bits 15..14 and 0
     201    eROL_IM ah, 2                           ; EW low byte bits 7..6 to 1..0
     202    add     al, ah                          ; CL = Floppy Drive count
     203%endif
     204
     205    pop     es
     206    ret
     207       
Note: See TracChangeset for help on using the changeset viewer.