Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS_Configurator_v2


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.

Location:
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/ConfigurationMenu.asm

    r206 r258  
    276276    CALL_MENU_LIBRARY RefreshItemFromAX
    277277    pop     es
    278     ret
     278    ; Fall to ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
     279
     280;----------------------------------------------------------------------
     281; ConfigurationMenu_CheckAndMoveSerialDrivesToBottom
     282;
     283; Checks to ensure that serial adapters are at the end of the
     284; IDEVARS structures list, as serial floppies (if present) need to be
     285; the last drives detected by the BIOS.  If there are other controllers
     286; after a serial controller, the other controllers are moved up on the list
     287; and the serial controller is placed at the end of the list.
     288;
     289;   Parameters:
     290;       SS:BP:  Menu handle
     291;   Returns:
     292;       Nothing
     293;   Corrupts registers:
     294;       All
     295;----------------------------------------------------------------------     
     296ConfigurationMenu_CheckAndMoveSerialDrivesToBottom:     
     297    push    es
     298    push    ds
     299    push    di
     300    push    si
     301
     302    call    Buffers_GetIdeControllerCountToCX   ; will also set ES:DI to point to file buffer
     303    push    es
     304    pop     ds
     305    mov     ch, 0                       ; clearing high order of CX and notification flag
     306    mov     dx, cx                      ; (probably unncessary, CX should be less than 127, but just to be sure)
     307    jcxz    .done                       ; probably unnecessary, but make sure there is at least one controller     
     308
     309    add     di, ROMVARS.ideVars0        ; add in offset of first idevars
     310    mov     bx, di
     311
     312.outerLoop:
     313    mov     di, bx                      ; start of idevars
     314    xor     si, si                      ; first serial found
     315    xor     ax, ax                      ; first non-serial found
     316    mov     cl, dl                      ; idevars count
     317    mov     ch, 0
     318
     319.loop:
     320    cmp     byte [di+IDEVARS.bDevice], DEVICE_SERIAL_PORT
     321    jnz     .notSerial
     322
     323    test    si, si                      ; record the first serial controllert that we find
     324    jnz     .next   
     325    mov     si, di
     326    jmp     .next
     327
     328.notSerial:
     329    mov     ax, di                      ; record the *last* non-serial controller that we find
     330
     331.next: 
     332    add     di, IDEVARS_size
     333    loop    .loop
     334
     335    test    si,si                       ; no serial drives, nothing to do
     336    jz      .done
     337    cmp     si,ax                       ; serial port is already later on the list than any other controllers
     338    ja      .done                       ; (also takes care of the case where ther are no other controllers)
     339
     340;
     341; move serial to end of list, others up
     342;
     343    cld
     344
     345    mov     ax, di                      ; save end pointer of list after scan
     346
     347    sub     sp, IDEVARS_size            ; copy serial to temporary space on stack
     348
     349    mov     di, sp
     350
     351    mov     cx, IDEVARS_size
     352    push    ss
     353    pop     es
     354
     355    rep movsb
     356
     357    mov     di, si                      ; move up all the idevars below the serial, by one slot
     358    sub     di, IDEVARS_size
     359
     360    mov     cx, ax                      ; restore end pointer of list, subtract off end of serial idevars
     361    sub     cx, si
     362
     363    push    ds
     364    pop     es
     365
     366    rep movsb
     367
     368    mov     si, sp                      ; place serial (currently on the stack) at bottom of list
     369    push    ss
     370    pop     ds
     371    mov     cx, IDEVARS_size
     372    ; di is already at last IDEVARS position
     373   
     374    rep movsb
     375
     376    add     sp, IDEVARS_size           
     377
     378    push    es
     379    pop     ds
     380
     381    mov     dh, 1                       ; set flag that we have done a relocation
     382   
     383    jmp     .outerLoop
     384
     385.done:
     386    pop     si
     387    pop     di
     388    pop     ds
     389    pop     es
     390
     391    test    dh, dh
     392    jz      .noWorkDone
     393       
     394    mov     dx, g_szSerialMoved
     395    call    Dialogs_DisplayNotificationFromCSDX
     396
     397.noWorkDone:       
     398    ret
  • trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Strings.asm

    r242 r258  
    9797g_szNfoCfgIdeCnt:       db  "Number of IDE controllers to manage.",NULL
    9898
     99g_szSerialMoved:        db  "A Serial Controller has been moved to the end of the Controller list. No further action is required. Serial Controllers must be placed at the end of the list.",NULL
     100
    99101g_szHelpCfgFullMode:    incbin  "Configuration_FullMode.txt"
    100102                        db  NULL
    101103g_szHelpCfgStealSize:   incbin  "Configuration_StealSize.txt"
    102104                        db  NULL
    103 
    104105
    105106; Strings for IDE Controller menu
Note: See TracChangeset for help on using the changeset viewer.