Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/Serial


Ignore:
Timestamp:
Feb 22, 2012, 7:01:53 PM (13 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.

Location:
trunk/XTIDE_Universal_BIOS/Src/Device/Serial
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r242 r258  
    5656;   Returns:
    5757;       AH:     INT 13h Error Code
     58;       CX:     Number of successfully transferred sectors (for transfer commands)
    5859;       CF:     Cleared if success, Set if error
    5960;   Corrupts registers:
     
    309310        dec     al              ; decrement sector count
    310311        push    ax              ; save
    311         jz      SerialCommand_OutputWithParameters_ReturnCodeInALCF    ; CF=0 from "cmp ax,bp" returning Zero above
     312        jz      SerialCommand_OutputWithParameters_ReturnCodeInAL
    312313
    313314        cli                     ; interrupts back off for ACK byte to host
     
    409410
    410411.clearBufferComplete:
    411         stc
    412         mov     al,1
    413 
    414 ALIGN JUMP_ALIGN
    415 SerialCommand_OutputWithParameters_ReturnCodeInALCF:
     412        mov     al, 3           ;  error return code and CF (low order bit)
     413
     414ALIGN JUMP_ALIGN
     415SerialCommand_OutputWithParameters_ReturnCodeInAL:
    416416%if 0
    417417        sti                     ;  all paths here will already have interrupts turned back on
    418418%endif
    419         mov     ah,al
    420 
    421         pop     bp              ;  recover ax (command and count) from stack, throw away
     419        mov     ah, al          ;  for success, AL will already be zero
     420
     421        pop     bx              ;  recover "ax" (command and count) from stack
    422422
    423423        pop     bp
    424424        pop     di
    425425        pop     si
     426
     427        mov     ch, 0
     428        mov     cl,[bp+IDEPACK.bSectorCount]
     429        sub     cl, bl          ; subtract off the number of sectors that remained
     430       
     431        shr     ah, 1           ; shift down return code and CF
    426432
    427433        ret
     
    632638        call    FindDPT_ToDSDIforSerialDevice
    633639        pop     si
     640%ifdef MODULE_SERIAL_FLOPPY
     641        jc      .founddpt
     642;
     643; If not found above with FindDPT_ToDSDIforSerialDevice, DI will point to the DPT after the last hard disk DPT
     644;
     645        cmp     byte [RAMVARS.xlateVars+XLATEVARS.bFlopCntAndFirst], 0
     646        jz      .notfounddpt
     647.founddpt:
     648%else
    634649        jnc     .notfounddpt
     650%endif
    635651        mov     ax, [di+DPT_SERIAL.wSerialPortAndBaud]
    636652.notfounddpt:
     
    678694; which is read by FinalizeDPT and DetectDrives
    679695;
    680         mov     [es:si+ATA6.wVendor],dx
     696        mov     [es:si+ATA6.wSerialPortAndBaud],dx
    681697
    682698.notFound:
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm

    r242 r258  
    1111;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    1212;   Returns:
    13 ;       Nothing
     13;       CF:     Set, indicates that this is a floppy disk
     14;               Clear, indicates that this is a hard disk
    1415;   Corrupts registers:
    1516;       AX
    1617;--------------------------------------------------------------------
    1718SerialDPT_Finalize:
    18         or      byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
    19         mov     ax, [es:si+ATA6.wVendor]
     19        mov     ax, [es:si+ATA6.wSerialPortAndBaud]
    2020        mov     [di+DPT_SERIAL.wSerialPortAndBaud], ax
     21
     22;
     23; Note that this section is not under %ifdef MODULE_SERIAL_FLOPPY.  It is important to
     24; detect floppy disks presented by the server and not treat them like hard disks, even
     25; if the floppy support is disabled.
     26;
     27        mov     al, [es:si+ATA6.wSerialFloppyFlagAndType]
     28        or      al, FLGH_DPT_SERIAL_DEVICE
     29        or      byte [di+DPT.bFlagsHigh], al
     30
     31        test    al, FLGH_DPT_SERIAL_FLOPPY           ; clears CF
     32        jz      .notfloppy
     33        stc     
     34.notfloppy:     
     35       
    2136        ret
    2237
Note: See TracChangeset for help on using the changeset viewer.