Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenu.asm


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/Boot/BootMenu.asm

    r248 r258  
    3737;               Clear: There is no selected menu item, DL is not valid
    3838;   Corrupts registers:
    39 ;       CX, DI
     39;       AX, DI
    4040;--------------------------------------------------------------------
    4141ALIGN JUMP_ALIGN
     
    5050
    5151    mov     dl, cl                          ; Copy menuitem index to DX
    52     call    FloppyDrive_GetCountToCX
    53     cmp     dl, cl                          ; Floppy drive?
     52    call    FloppyDrive_GetCountToAX
     53    cmp     dl, al                          ; Floppy drive?
    5454    jb      SHORT .ReturnFloppyDriveInDX    ; Set CF if branch taken
    55     or      cl, 80h                         ; Or 80h into CL before the sub
     55    or      al, 80h                         ; Or 80h into AL before the sub
    5656                                            ; to cause CF to be set after
    5757                                            ; and result has high order bit set
    58     sub     dl, cl                          ; Remove floppy drives from index
     58    sub     dl, al                          ; Remove floppy drives from index
    5959
    6060.ReturnFloppyDriveInDX:
     
    9494ALIGN JUMP_ALIGN
    9595BootMenu_GetMenuitemCountToAX:
    96     call    RamVars_GetHardDiskCountFromBDAtoCX
     96    call    RamVars_GetHardDiskCountFromBDAtoAX
    9797    xchg    ax, cx
    98     call    FloppyDrive_GetCountToCX
     98    call    FloppyDrive_GetCountToAX
    9999    add     ax, cx
    100100    ret
     
    136136BootMenu_GetMenuitemToAXforAsciiHotkeyInAL:
    137137    call    Char_ALtoUpperCaseLetter
    138     call    BootMenu_GetLetterForFirstHardDiskToCL
    139138    xor     ah, ah
    140     cmp     al, cl                      ; Letter is for Hard Disk?
     139    xchg    ax, cx
     140    call    BootMenu_GetLetterForFirstHardDiskToAL
     141    cmp     cl, al                      ; Letter is for Hard Disk?
    141142    jae     SHORT .StartFromHardDiskLetter
     143    xchg    ax, cx
    142144    sub     al, 'A'                     ; Letter to Floppy Drive menuitem
    143145    ret
    144146ALIGN JUMP_ALIGN
    145147.StartFromHardDiskLetter:
    146     sub     al, cl                      ; Hard Disk index
    147     call    FloppyDrive_GetCountToCX
     148    sub     cl, al                      ; Hard Disk index
     149    call    FloppyDrive_GetCountToAX
    148150    add     ax, cx                      ; Menuitem index
     151                                        ; Note: no need to xchg ax, cx as above, since adding with result to ax
    149152    ret
    150153
     
    160163;       CL:     Upper case letter for first hard disk
    161164;   Corrupts registers:
    162 ;       CH
    163 ;--------------------------------------------------------------------
    164 ALIGN JUMP_ALIGN
    165 BootMenu_GetLetterForFirstHardDiskToCL:
    166     call    FloppyDrive_GetCountToCX
    167     add     cl, 'A'
    168     cmp     cl, 'C'
     165;       AX
     166;--------------------------------------------------------------------
     167ALIGN JUMP_ALIGN
     168BootMenu_GetLetterForFirstHardDiskToAL:
     169    call    FloppyDrive_GetCountToAX
     170    add     al, 'A'
     171    cmp     al, 'C'
    169172    ja      .Return
    170     mov     cl, 'C'
     173    mov     al, 'C'
    171174ALIGN JUMP_ALIGN, ret
    172175.Return:
     
    181184;       DX:     Menuitem index (assuming drive is available)
    182185;   Corrupts registers:
    183 ;       Nothing
     186;       AX
    184187;--------------------------------------------------------------------
    185188ALIGN JUMP_ALIGN
     
    188191    test    dl, dl
    189192    jns     SHORT .ReturnItemIndexInDX  ; Return if floppy drive (HD bit not set)
    190     call    FloppyDrive_GetCountToCX
     193    call    FloppyDrive_GetCountToAX
    191194    and     dl, ~80h                    ; Clear HD bit
    192     add     dx, cx
     195    add     dx, ax
    193196.ReturnItemIndexInDX:
    194197    ret
     
    212215    test    dl, dl                              ; Floppy drive?
    213216    jns     SHORT .IsFloppyDriveInSystem
    214     call    RamVars_GetHardDiskCountFromBDAtoCX ; Hard Disk count to CX
    215     or      cl, 80h                             ; Set Hard Disk bit to CX
     217    call    RamVars_GetHardDiskCountFromBDAtoAX ; Hard Disk count to AX
     218    or      al, 80h                             ; Set Hard Disk bit to AX
    216219    jmp     SHORT .CompareDriveNumberToDriveCount
    217220.IsFloppyDriveInSystem:
    218     call    FloppyDrive_GetCountToCX
     221    call    FloppyDrive_GetCountToAX
    219222.CompareDriveNumberToDriveCount:
    220     cmp     dl, cl                              ; Set CF when DL is smaller
    221     ret
     223    cmp     dl, al                              ; Set CF when DL is smaller
     224    ret
Note: See TracChangeset for help on using the changeset viewer.