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/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:
Note: See TracChangeset for help on using the changeset viewer.