Changeset 182 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm


Ignore:
Timestamp:
Nov 14, 2011, 11:09:06 AM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

General code size optimizations, preparing for string compression, consolidating all strings into strings.asm. Note that some changes resulted in slightly larger size now uncompressed, but will be net win when compressed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm

    r162 r182  
    186186    call    BootMenuPrint_ClearInformationArea
    187187    call    FloppyDrive_GetType         ; Get Floppy Drive type to BX
    188     test    bx, bx                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)
    189     push    bp
    190     mov     bp, sp
    191     jz      SHORT .PrintXTFloppyType
     188
     189    push    bp
     190    mov     bp, sp
     191    ePUSH_T ax, g_szCapacity
     192       
     193    mov     si, g_szFddSizeOr           ; .PrintXTFloppyType
     194    test    bx, bx                      ; Two possibilities? (FLOPPY_TYPE_525_OR_35_DD)     
     195    jz      SHORT .output
     196
     197    mov     si, g_szFddUnknown          ; .PrintUnknownFloppyType
    192198    cmp     bl, FLOPPY_TYPE_35_ED
    193     ja      SHORT .PrintUnknownFloppyType
     199    ja      SHORT .output
     200       
    194201    ; Fall to .PrintKnownFloppyType
    195202
     
    203210;   Corrupts registers:
    204211;       AX, BX, SI, DI
     212;
     213; Floppy Drive Types:
     214;
     215;   0  Handled above
     216;   1  FLOPPY_TYPE_525_DD          5 1/4   360K
     217;   2  FLOPPY_TYPE_525_HD          5 1/4   1.2M
     218;   3  FLOPPY_TYPE_35_DD           3 1/2   720K
     219;   4  FLOPPY_TYPE_35_HD           3 1/2   1.44M
     220;   5  3.5" ED on some BIOSes      3 1/2   2.88M
     221;   6  FLOPPY_TYPE_35_ED           3 1/2   2.88M
     222;   >6 Unknwon, handled above
     223;
    205224;--------------------------------------------------------------------
    206225.PrintKnownFloppyType:
    207226    mov     si, g_szFddSize
    208     ePUSH_T ax, g_szCapacity
    209     dec     bx                      ; Cannot be 0 (FLOPPY_TYPE_525_OR_35_DD)
    210     shl     bx, 1                   ; Shift for WORD lookup
    211     mov     ax, [cs:bx+FloppyTypes.rgwPhysicalSize]
    212     push    ax                      ; '5' or '3'
    213     mov     al, ah
    214     push    ax                      ; '1/4' or '1/2'
    215     push    WORD [cs:bx+FloppyTypes.rgwCapacity]
     227       
     228    mov     ax, g_szFddThreeHalf
     229    cmp     bl, FLOPPY_TYPE_525_HD
     230    ja      .ThreeHalf
     231    add     ax, g_szFddThreeFive_Displacement
     232.ThreeHalf:     
     233    push    ax                      ; "5 1/4" or "3 1/2"
     234
     235    mov     al,FloppyTypes.rgbCapacityMultiplier
     236    mul     byte [cs:bx+FloppyTypes.rgbCapacity - 1]    ; -1 since 0 is handled above and not in the table
     237    push    ax
     238
     239ALIGN JUMP_ALIGN       
     240.output:       
    216241    jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
    217 
    218 
    219 ;--------------------------------------------------------------------
    220 ; .PrintXTFloppyType
    221 ; .PrintUnknownFloppyType
    222 ;   Parameters:
    223 ;       Nothing
    224 ;   Returns:
    225 ;       CF:     Set since menu event was handled successfully
    226 ;   Corrupts registers:
    227 ;       AX, SI, DI
    228 ;--------------------------------------------------------------------
    229 ALIGN JUMP_ALIGN
    230 .PrintXTFloppyType:
    231     mov     si, g_szFddSizeOr
    232     jmp     SHORT .FormatXTorUnknownTypeFloppyDrive
    233 ALIGN JUMP_ALIGN
    234 .PrintUnknownFloppyType:
    235     mov     si, g_szFddUnknown
    236 .FormatXTorUnknownTypeFloppyDrive:
    237     ePUSH_T ax, g_szCapacity
    238     jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
    239 
    240 
     242       
     243FloppyTypes:
     244.rgbCapacityMultiplier equ 20           ; Multiplier to reduce word sized values to byte size
     245.rgbCapacity:
     246    db      360   / FloppyTypes.rgbCapacityMultiplier    ;  type 1
     247    db      1200  / FloppyTypes.rgbCapacityMultiplier    ;  type 2
     248    db      720   / FloppyTypes.rgbCapacityMultiplier    ;  type 3
     249    db      1440  / FloppyTypes.rgbCapacityMultiplier    ;  type 4
     250    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 5
     251    db      2880  / FloppyTypes.rgbCapacityMultiplier    ;  type 6
     252
     253%if g_szFddFiveQuarter <> g_szFddThreeHalf+g_szFddThreeFive_Displacement
     254%error "FddThreeFive_Displacement incorrect"
     255%endif
     256               
    241257;--------------------------------------------------------------------
    242258; Prints Hard Disk Menuitem information strings.
     
    480496    jmp     SHORT BootMenuPrint_FormatCSSIfromParamsInSSBP
    481497
    482 ALIGN WORD_ALIGN
    483 FloppyTypes:
    484 .rgwCapacity:
    485     dw      360
    486     dw      1200
    487     dw      720
    488     dw      1440
    489     dw      2880
    490     dw      2880
    491 .rgwPhysicalSize:
    492     db      '5', 172    ; 1, FLOPPY_TYPE_525_DD
    493     db      '5', 172    ; 2, FLOPPY_TYPE_525_HD
    494     db      '3', 171    ; 3, FLOPPY_TYPE_35_DD
    495     db      '3', 171    ; 4, FLOPPY_TYPE_35_HD
    496     db      '3', 171    ; 5, 3.5" ED on some BIOSes
    497     db      '3', 171    ; 6, FLOPPY_TYPE_35_ED
     498
Note: See TracChangeset for help on using the changeset viewer.