Changeset 258 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.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/BootMenuPrint.asm

    r255 r258  
    2424
    2525    call    RamVars_IsDriveHandledByThisBIOS               
    26     jnc     .notOurs
     26    jc      .notOurs
    2727
    2828    call    FindDPT_ForDriveNumber                  ; if it is one of ours, print the string in bootnfo
     
    4747    push    ax                                      ; the hard disks don't ever use it, but it does no harm)
    4848       
    49     jmp     short BootMenuPrint_FormatCSSIfromParamsInSSBP
     49    jmp     short BootMenuPrint_RefreshInformation.FormatRelay
    5050
    5151;--------------------------------------------------------------------
     
    8787    push    bp
    8888    mov     bp,sp
    89     jmp     short BootMenuPrint_FormatCSSIfromParamsInSSBP
     89    jmp     short BootMenuPrint_RefreshInformation.FormatRelay
    9090
    9191       
     
    110110    mov     bp, sp
    111111
     112    mov     si, g_szCapacity                            ; Setup print string now, carries through to print call
     113
     114    xor     di, di
     115    call    RamVars_IsDriveHandledByThisBIOS
     116    jc      SHORT .notours
     117    call    FindDPT_ForDriveNumber                      ; DS:DI to point DPT
     118.notours:       
     119       
    112120    test    dl, dl                                      ; are we a hard disk?
    113121    js      BootMenuPrint_HardDiskRefreshInformation       
    114        
     122
     123    test    di,di
     124    jnz     .ours
    115125    call    FloppyDrive_GetType                         ; Get Floppy Drive type to BX
     126    jmp     .around
     127.ours:
     128    call    AH8h_GetDriveParameters
     129.around:               
    116130
    117131    mov     ax, g_szFddSizeOr                           ; .PrintXTFloppyType
    118     test    bx, bx                                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)     
     132    test    bl, bl                                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)     
    119133    jz      SHORT .PushAXAndOutput
    120134
     
    158172
    159173    mov     al,FloppyTypes.rgbCapacityMultiplier
     174    mov     bh, 0
    160175    mul     byte [cs:bx+FloppyTypes.rgbCapacity - 1]    ; -1 since 0 is handled above and not in the table
    161176
     
    163178    push    ax
    164179
    165     jmp     short BootMenuPrint_HardDiskRefreshInformation.output
     180.FormatRelay:
     181    jmp     short BootMenuPrint_FormatCSSIfromParamsInSSBP
    166182
    167183
     
    180196ALIGN JUMP_ALIGN
    181197BootMenuPrint_HardDiskRefreshInformation:       
    182     call    RamVars_IsDriveHandledByThisBIOS
    183     jnc     SHORT .HardDiskMenuitemInfoForForeignDrive
    184     call    FindDPT_ForDriveNumber                      ; DS:DI to point DPT
    185     ; Fall to .HardDiskMenuitemInfoForOurDrive
    186 
    187 ;--------------------------------------------------------------------
    188 ; .HardDiskMenuitemInfoForOurDrive
    189 ;   Parameters:
    190 ;       DL:     Untranslated Hard Disk number
    191 ;       DS:DI:  Ptr to DPT
    192 ;   Returns:
    193 ;       Nothing
    194 ;   Corrupts registers:
    195 ;       AX, BX, CX, DX, SI, DI, ES
    196 ;--------------------------------------------------------------------
     198    test    di,di
     199    jz      .HardDiskMenuitemInfoForForeignDrive       
     200
    197201.HardDiskMenuitemInfoForOurDrive:
    198202    ePUSH_T ax, g_szInformation
     
    200204    ; Get and push total LBA size
    201205    call    BootMenuInfo_GetTotalSectorCount
    202     call    ConvertSectorCountInBXDXAXtoSizeAndPushForFormat       
    203     jmp     BootMenuPrintCfg_ForOurDrive
    204 
    205 ;--------------------------------------------------------------------
    206 ; .HardDiskMenuitemInfoForForeignDrive
    207 ;   Parameters:
    208 ;       DL:     Untranslated Hard Disk number
    209 ;       DS:     RAMVARS segment
    210 ;   Returns:
    211 ;       CF:     Set since menu event was handled successfully
    212 ;   Corrupts registers:
    213 ;       AX, BX, CX, DX, SI, DI
    214 ;--------------------------------------------------------------------
    215 ALIGN JUMP_ALIGN
     206    jmp     .ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
     207       
    216208.HardDiskMenuitemInfoForForeignDrive:
    217209    call    DriveXlate_ToOrBack
    218210    call    AH15h_GetSectorCountFromForeignDriveToDXAX
    219     call    ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
    220 
    221 ALIGN JUMP_ALIGN       
    222 .output:
    223     mov     si, g_szCapacity
    224 ;;; fall-through
     211
     212.ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
     213    ePUSH_T cx, g_szCapacityNum     ; Push format substring
     214    call    Size_ConvertSectorCountInBXDXAXtoKiB
     215    mov     cx, BYTE_MULTIPLES.kiB
     216    call    Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
     217    push    ax                      ; Size in magnitude
     218    push    cx                      ; Tenths
     219    push    dx                      ; Magnitude character       
     220               
     221    test    di,di
     222    jz      short BootMenuPrint_FormatCSSIfromParamsInSSBP
     223
     224%include "BootMenuPrintCfg.asm"         ; inline of code to fill out remainder of information string
     225
     226;;; fall-through to BootMenuPrint_FormatCSSIfromParamsInSSBP
     227
    225228
    226229;--------------------------------------------------------------------
     
    273276ALIGN JUMP_ALIGN
    274277BootMenuPrint_TheBottomOfScreen:
    275     call    FloppyDrive_GetCountToCX
    276     mov     bl, cl                  ; Floppy Drive count to BL
    277     call    RamVars_GetHardDiskCountFromBDAtoCX
    278     mov     bh, cl                  ; Hard Disk count to BH
     278    call    FloppyDrive_GetCountToAX
     279    xchg    bx, ax                  ; Floppy Drive count to BL
     280    call    RamVars_GetHardDiskCountFromBDAtoAX
     281    mov     bh, al                  ; Hard Disk count to BH
    279282    ; Fall to .MoveCursorToHotkeyStrings
    280283
     
    321324    test    bh, bh      ; Any Hard Drives?
    322325    jz      SHORT .SkipHardDriveHotkeys
    323     xchg    ax, cx      ; Store Key Attribute
    324     call    BootMenu_GetLetterForFirstHardDiskToCL
    325     mov     ch, ANGLE_QUOTE_RIGHT
    326     xchg    ax, cx
     326    call    BootMenu_GetLetterForFirstHardDiskToAL
     327    mov     ah, ANGLE_QUOTE_RIGHT
    327328    mov     si, g_szHDD
    328329    call    PushHotkeyParamsAndFormat
     
    390391    CALL_DISPLAY_LIBRARY InitializeDisplayContext
    391392    ret
    392 
    393 
    394 ;--------------------------------------------------------------------
    395 ; ConvertSectorCountInBXDXAXtoSizeAndPushForFormat
    396 ;   Parameters:
    397 ;       BX:DX:AX:   Sector count
    398 ;   Returns:
    399 ;       Size in stack
    400 ;   Corrupts registers:
    401 ;       AX, BX, CX, DX, SI
    402 ;--------------------------------------------------------------------
    403 ALIGN JUMP_ALIGN
    404 ConvertSectorCountInBXDXAXtoSizeAndPushForFormat:
    405     pop     si                      ; Pop return address
    406     ePUSH_T cx, g_szCapacityNum     ; Push format substring
    407     call    Size_ConvertSectorCountInBXDXAXtoKiB
    408     mov     cx, BYTE_MULTIPLES.kiB
    409     call    Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
    410     push    ax                      ; Size in magnitude
    411     push    cx                      ; Tenths
    412     push    dx                      ; Magnitude character
    413     jmp     si
    414393
    415394
Note: See TracChangeset for help on using the changeset viewer.