Changeset 182 in xtideuniversalbios


Ignore:
Timestamp:
Nov 14, 2011, 11:09:06 AM (13 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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Src/Menu/MenuBorders.asm

    r105 r182  
    385385    push    bp
    386386    mov     bp, sp
    387     mov     si, .szSelectionTimeout
     387    mov     si, g_szSelectionTimeout
    388388    push    ax          ; Push attribute
    389389    push    di          ; Push seconds
     
    391391    pop     bp
    392392    ret
    393 .szSelectionTimeout:
    394     db      DOUBLE_BOTTOM_LEFT_CORNER
    395     db      DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL
    396     db      "%ASelection in %2u s",NULL
    397 
    398393
    399394; Lookup tables for border characters
  • 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
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r181 r182  
    5555PushAddressingMode:
    5656    call    AccessDPT_GetAddressingModeForWordLookToBX
    57     push    WORD [cs:bx+rgszAddressingModeString]
    58 
     57    mov     al,g_szAddressingModes_Displacement
     58    mul     bl
     59    add     ax,g_szAddressingModes
     60    push    ax
     61;
     62; Ensure that addressing modes are correctly spaced in memory
     63;
     64%if g_szLCHS <> g_szAddressingModes
     65%error "g_szAddressingModes Displacement Incorrect 1"
     66%endif
     67%if g_szPCHS <> g_szLCHS + g_szAddressingModes_Displacement
     68%error "g_szAddressingModes Displacement Incorrect 2"
     69%endif
     70%if g_szLBA28 <> g_szPCHS + g_szAddressingModes_Displacement       
     71%error "g_szAddressingModes Displacement Incorrect 3"
     72%endif
     73%if g_szLBA48 <> g_szLBA28 + g_szAddressingModes_Displacement       
     74%error "g_szAddressingModes Displacement Incorrect 4"
     75%endif             
     76       
    5977;--------------------------------------------------------------------
    6078; PushBlockMode
     
    86104;--------------------------------------------------------------------
    87105;PushBusType:
    88     cwd                 ; Clear DX using sign extension
    89     xchg    ax, bx      ; Store BX to AX
    90     eMOVZX  bx, BYTE [cs:si+IDEVARS.bDevice]
    91     mov     bx, [cs:bx+rgwBusTypeValues]    ; Char to BL, Int to BH
    92     mov     dl, bh
    93     push    bx          ; Push character
    94     push    dx          ; Push 1, 8, 16 or 32
    95     xchg    bx, ax      ; Restore BX
     106    mov     al,g_szBusTypeValues_Displacement
     107    mul     BYTE [cs:si+IDEVARS.bDevice]
     108    shr     ax,1
     109    add     ax,g_szBusTypeValues
     110    push    ax 
    96111
     112;
     113; Ensure that bus type strings are correctly spaced in memory
     114;
     115%if g_szBusTypeValues_8Dual <> g_szBusTypeValues
     116%error "g_szBusTypeValues Displacement Incorrect 1"
     117%endif
     118%if g_szBusTypeValues_8Reversed <> g_szBusTypeValues + g_szBusTypeValues_Displacement
     119%error "g_szBusTypeValues Displacement Incorrect 2"     
     120%endif
     121%if g_szBusTypeValues_8Single <> g_szBusTypeValues_8Reversed + g_szBusTypeValues_Displacement
     122%error "g_szBusTypeValues Displacement Incorrect 3"             
     123%endif
     124%if g_szBusTypeValues_16 <> g_szBusTypeValues_8Single + g_szBusTypeValues_Displacement     
     125%error "g_szBusTypeValues Displacement Incorrect 4"             
     126%endif
     127%if g_szBusTypeValues_32 <> g_szBusTypeValues_16 + g_szBusTypeValues_Displacement
     128%error "g_szBusTypeValues Displacement Incorrect 5"             
     129%endif
     130%if g_szBusTypeValues_Serial <> g_szBusTypeValues_32 + g_szBusTypeValues_Displacement
     131%error "g_szBusTypeValues Displacement Incorrect 6"             
     132%endif             
     133               
    97134;--------------------------------------------------------------------
    98135; PushIRQ
     
    155192    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
    156193
    157 
    158 ALIGN WORD_ALIGN
    159 rgszAddressingModeString:
    160     dw      g_szLCHS
    161     dw      g_szPCHS
    162     dw      g_szLBA28
    163     dw      g_szLBA48
    164 
    165 rgwBusTypeValues:
    166     db      'D', 8      ; DEVICE_8BIT_DUAL_PORT_XTIDE
    167     db      'X', 8      ; DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0
    168     db      'S', 8      ; DEVICE_8BIT_SINGLE_PORT
    169     db      ' ', 16     ; DEVICE_16BIT_ATA
    170     db      ' ', 32     ; DEVICE_32BIT_ATA
    171     db      ' ', 1      ; DEVICE_SERIAL_PORT
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r150 r182  
    3636g_szSizeDual:   db  "%s%4-u.%u %ciB / %4-u.%u %ciB",LF,CR,NULL
    3737g_szCfgHeader:  db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",LF,CR,NULL
    38 g_szCfgFormat:  db  "%s"   ,SINGLE_VERTICAL,"%5-u", SINGLE_VERTICAL,"%c%2u",SINGLE_VERTICAL," %c%c",SINGLE_VERTICAL,"%5-x",  NULL
     38g_szCfgFormat:  db  "%s"   ,SINGLE_VERTICAL,"%5-u", SINGLE_VERTICAL,"%s",SINGLE_VERTICAL," %c%c",SINGLE_VERTICAL,"%5-x",  NULL
     39       
     40g_szAddressingModes:                   
    3941g_szLCHS:       db  "L-CHS",NULL
    4042g_szPCHS:       db  "P-CHS",NULL
    4143g_szLBA28:      db  "LBA28",NULL
    4244g_szLBA48:      db  "LBA48",NULL
     45g_szAddressingModes_Displacement equ 6
     46       
    4347g_szFddUnknown: db  "%sUnknown",NULL
    4448g_szFddSizeOr:  db  "%s5",ONE_QUARTER,QUOTATION_MARK," or 3",ONE_HALF,QUOTATION_MARK," DD",NULL
    45 g_szFddSize:    db  "%s%c%c",QUOTATION_MARK,", %u kiB",NULL ; 3½", 1440 kiB
     49g_szFddSize:    db  "%s%s",QUOTATION_MARK,", %u kiB",NULL   ; 3½", 1440 kiB
     50
     51g_szFddThreeHalf:       db  "3",ONE_HALF,NULL
     52g_szFddFiveQuarter:     db  "5",ONE_QUARTER,NULL       
     53g_szFddThreeFive_Displacement equ 3
     54
     55g_szBusTypeValues:     
     56g_szBusTypeValues_8Dual:        db      "D8 ",NULL
     57g_szBusTypeValues_8Reversed:    db      "X8 ",NULL
     58g_szBusTypeValues_8Single:      db      "S8 ",NULL
     59g_szBusTypeValues_16:           db      " 16",NULL
     60g_szBusTypeValues_32:           db      " 32",NULL
     61g_szBusTypeValues_Serial:       db      "SER",NULL
     62g_szBusTypeValues_Displacement equ 4
     63       
     64g_szSelectionTimeout:   db      DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2u s",NULL
     65
Note: See TracChangeset for help on using the changeset viewer.