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/DetectDrives.asm

    r254 r258  
    4343
    4444%ifdef MODULE_SERIAL
     45;----------------------------------------------------------------------
    4546;
    4647; if serial drive detected, do not scan (avoids duplicate drives and isn't needed - we already have a connection)
     
    5758%endif
    5859
    59 .done:
     60.done: 
     61%ifdef MODULE_SERIAL_FLOPPY
     62;----------------------------------------------------------------------
     63;
     64; Add in any emulated serial floppy drives.
     65;
     66    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFlopCreateCnt]
     67    dec     al
     68    mov     cl, al
     69    js      .NoFloppies                     ; if no drives are present, we store 0ffh
     70
     71    call    FloppyDrive_GetCountFromBIOS_or_BDA
     72
     73    push    ax
     74
     75    add     al, cl                          ; Add our drives to existing drive count
     76    cmp     al, 3                           ; For BDA, max out at 4 drives (ours is zero based)
     77    jl      .MaxBDAFloppiesExceeded
     78    mov     al, 3                           
     79.MaxBDAFloppiesExceeded:
     80    eROR_IM al, 2                           ; move to bits 6-7
     81    inc     ax                              ; low order bit, indicating floppy drive exists
     82
     83    mov     ah, [es:BDA.wEquipment]         ; Load Equipment WORD low byte 
     84    and     ah, 03eh                        ; Mask off drive number and drives present bit
     85    or      al, ah                          ; Or in new values
     86    mov     [es:BDA.wEquipment], al         ; and store
     87
     88    mov     al, 1eh                         ; BDA pointer to Floppy DPT
     89    mov     si, AH8h_FloppyDPT
     90    call    Interrupts_InstallHandlerToVectorInALFromCSSI
     91
     92    pop     ax
     93
     94    shr     cl, 1                           ; number of drives, 1 or 2 only, to CF flag (clear=1, set=2)
     95    rcl     al, 1                           ; starting drive number in upper 7 bits, number of drives in low bit
     96.NoFloppies:   
     97    mov     [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], al
     98%endif
     99       
    60100    ret
    61101
Note: See TracChangeset for help on using the changeset viewer.