Changeset 186 in xtideuniversalbios


Ignore:
Timestamp:
Nov 15, 2011, 10:35:17 AM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Initial string compression checkin. All changes are under MODULE_STRINGS_COMPRESSED, and this can still be turned off. With this checkin, the serial and ebios code can both be turned on at the same time and still we remain below the 8K boundary (barely). I still need to chekin StringsCompress.pl after some more code cleanup. The output, in StringsCompressed.asm is checked in here, and should continue be to checkin when Strings.asm is changed, for those who do not have/want to run the Perl script to recreate it.

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Assembly_Library/Inc/Display.inc

    r177 r186  
    44%define DISPLAY_INC
    55
     6%ifndef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
    67;--------------------------------------------------------------------
    78; Display Library users need to use this macro since it will provide
     
    197198CGA_STATUS_REGISTER             EQU     3DAh
    198199
     200%endif ; MODULE_STRINGS_COMPRESS_PRECOMPRESS
    199201
    200202; Control characters for teletype output
  • trunk/Assembly_Library/Src/AssemblyLibrary.asm

    r172 r186  
    1313    %include "DisplayCursor.asm"
    1414    %include "DisplayPage.asm"
    15     %include "DisplayPrint.asm"
    16     %include "DisplayFormat.asm"
     15    %include "DisplayPrint.asm"                 ; must come before DisplayFormat/DisplayFormatCompressed           
     16%ifdef MODULE_STRINGS_COMPRESSED
     17    %include "DisplayFormatCompressed.asm"
     18%else
     19    %include "DisplayFormat.asm"       
     20%endif
    1721%endif
    1822
  • trunk/Assembly_Library/Src/Display/DisplayPrint.asm

    r181 r186  
    55SECTION .text
    66
     7               
    78;--------------------------------------------------------------------
    89; Supports following formatting types:
     
    6162    pop     si
    6263    pop     bp
     64
    6365    ret
    6466
     
    102104;       AX, DX
    103105;--------------------------------------------------------------------
     106       
     107%ifndef MODULE_STRINGS_COMPRESSED
     108       
    104109ALIGN JUMP_ALIGN
    105110DisplayPrint_WordFromAXWithBaseInBX:
     
    131136.rgcDigitToCharacter:   db  "0123456789ABCDEF"
    132137
     138%endif  ; MODULE_STRINGS_COMPRESSED
     139
    133140
    134141;--------------------------------------------------------------------
     
    165172
    166173
    167 ;--------------------------------------------------------------------
    168 ; DisplayPrint_NullTerminatedStringFromCSSI
    169 ;   Parameters:
    170 ;       CS:SI:  Ptr to NULL terminated string
    171 ;       DS:     BDA segment (zero)
    172 ;       ES:DI:  Ptr to cursor location in video RAM
    173 ;   Returns:
    174 ;       DI:     Updated offset to video RAM
    175 ;   Corrupts registers:
    176 ;       AX, DX
    177 ;--------------------------------------------------------------------
    178 ALIGN JUMP_ALIGN
    179 DisplayPrint_NullTerminatedStringFromCSSI:
    180     push    bx
    181     mov     bx, cs
    182     call    DisplayPrint_NullTerminatedStringFromBXSI
    183     pop     bx
    184     ret
    185 
    186 
    187 ;--------------------------------------------------------------------
    188 ; DisplayPrint_NullTerminatedStringFromBXSI
    189 ;   Parameters:
    190 ;       DS:     BDA segment (zero)
    191 ;       BX:SI:  Ptr to NULL terminated string
    192 ;       ES:DI:  Ptr to cursor location in video RAM
    193 ;   Returns:
    194 ;       DI:     Updated offset to video RAM
    195 ;   Corrupts registers:
    196 ;       AX, DX
    197 ;--------------------------------------------------------------------
    198 ALIGN JUMP_ALIGN
    199 DisplayPrint_NullTerminatedStringFromBXSI:
    200     push    si
    201     push    cx
    202 
    203     xor     cx, cx
    204 ALIGN JUMP_ALIGN
    205 .PrintNextCharacter:
    206     mov     ds, bx              ; String segment to DS
    207     lodsb
    208     mov     ds, cx              ; BDA segment to DS
    209     test    al, al              ; NULL?
    210     jz      SHORT .EndOfString
    211     call    DisplayPrint_CharacterFromAL
    212     jmp     SHORT .PrintNextCharacter
    213 
    214 ALIGN JUMP_ALIGN
    215 .EndOfString:
    216     pop     cx
    217     pop     si
    218     ret
    219174
    220175
     
    320275    pop     cx
    321276.NothingToRepeat:
    322     ret
    323 
     277
     278    ret
     279
     280;--------------------------------------------------------------------
     281; DisplayPrint_NullTerminatedStringFromCSSI
     282;   Parameters:
     283;       CS:SI:  Ptr to NULL terminated string
     284;       DS:     BDA segment (zero)
     285;       ES:DI:  Ptr to cursor location in video RAM
     286;   Returns:
     287;       DI:     Updated offset to video RAM
     288;   Corrupts registers:
     289;       AX, DX
     290;--------------------------------------------------------------------
     291
     292%ifndef MODULE_STRINGS_COMPRESSED
     293;;;
     294;;; Take care when using this routine with compressed strings (which is why it is disabled).
     295;;; All strings in CSSI should go through the DisplayFormatCompressed code to be decoded.
     296;;;
     297ALIGN JUMP_ALIGN
     298DisplayPrint_NullTerminatedStringFromCSSI:
     299    push    bx
     300    mov     bx, cs
     301    call    DisplayPrint_NullTerminatedStringFromBXSI
     302    pop     bx
     303
     304    ret
     305%endif
     306
     307       
     308
     309
     310;;;
     311;;; Note that the following routines need to be at the bottom of this file
     312;;; to accomodate short jumps from the next file (DisplayFormat/DisplayFormatCompressed)
     313;;;
    324314
    325315;--------------------------------------------------------------------
     
    333323;       AX, DX
    334324;--------------------------------------------------------------------
    335 ALIGN JUMP_ALIGN
     325%ifdef MODULE_STRINGS_COMPRESSED
     326ALIGN JUMP_ALIGN
     327DisplayPrint_Newline_FormatAdjustBP:
     328    inc     bp                  ; we didn't need a parameter after all, readjust BP
     329    inc     bp
     330;;; fall-through
     331%endif
     332
     333ALIGN JUMP_ALIGN
     334       
    336335DisplayPrint_Newline:
    337336    mov     al, LF
     
    344343;   Parameters:
    345344;       AL:     Character to display
     345;               Zero value is ignored (no characer is printed)
    346346;       DS:     BDA segment (zero)
    347347;       ES:DI:  Ptr to cursor location in video RAM
     
    353353ALIGN JUMP_ALIGN
    354354DisplayPrint_CharacterFromAL:
     355%ifdef MODULE_STRINGS_COMPRESSED
     356    test    al,al
     357    jz      DisplayPrint_Ret
     358%endif
    355359    mov     ah, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute]
    356360    jmp     [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut]
     361
     362
     363       
     364;--------------------------------------------------------------------
     365; DisplayPrint_NullTerminatedStringFromBXSI
     366;   Parameters:
     367;       DS:     BDA segment (zero)
     368;       BX:SI:  Ptr to NULL terminated string
     369;       ES:DI:  Ptr to cursor location in video RAM
     370;   Returns:
     371;       DI:     Updated offset to video RAM
     372;   Corrupts registers:
     373;       AX, DX
     374;--------------------------------------------------------------------
     375ALIGN JUMP_ALIGN
     376DisplayPrint_NullTerminatedStringFromBXSI:
     377    push    si
     378    push    cx
     379
     380    xor     cx, cx
     381ALIGN JUMP_ALIGN
     382.PrintNextCharacter:
     383    mov     ds, bx              ; String segment to DS
     384    lodsb
     385    mov     ds, cx              ; BDA segment to DS
     386    test    al, al              ; NULL?
     387    jz      SHORT .EndOfString
     388    call    DisplayPrint_CharacterFromAL
     389    jmp     SHORT .PrintNextCharacter
     390
     391ALIGN JUMP_ALIGN
     392.EndOfString:
     393    pop     cx
     394    pop     si
     395       
     396DisplayPrint_Ret:               ; random ret to jump to                 
     397    ret
     398
     399
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrint.asm

    r182 r186  
    6666;       CF:     Set since menu event was handled successfully
    6767;   Corrupts registers:
    68 ;       AX
     68;       AX, DI
    6969;--------------------------------------------------------------------
    7070ALIGN JUMP_ALIGN
    7171BootMenuPrint_NullTerminatedStringFromCSSIandSetCF:
    72     push    di
    73     CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
    74     pop     di
    75     stc
    76     ret
    77 
     72;
     73; We send all CSSI strings through the Format routine for the case of
     74; compressed strings, but this doesn't hurt in the non-compressed case either
     75; (perhaps a little slower, but shouldn't be noticeable to the user)
     76; and results in smaller code size.
     77;
     78    push    bp
     79    mov     bp,sp
     80    jmp     BootMenuPrint_FormatCSSIfromParamsInSSBP
    7881
    7982;--------------------------------------------------------------------
     
    229232    cmp     bl, FLOPPY_TYPE_525_HD
    230233    ja      .ThreeHalf
     234%if g_szFddThreeFive_Displacement = 2       
     235    inc     ax                      ; compressed string case
     236    inc     ax
     237%else
    231238    add     ax, g_szFddThreeFive_Displacement
     239%endif
    232240.ThreeHalf:     
    233241    push    ax                      ; "5 1/4" or "3 1/2"
  • trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm

    r185 r186  
    2121ALIGN JUMP_ALIGN
    2222BootMenuPrintCfg_ForOurDrive:
    23     pop     di
    2423    mov     si, g_szCfgHeader
    2524    call    BootMenuPrint_NullTerminatedStringFromCSSIandSetCF
     25    pop     di
    2626    eMOVZX  ax, BYTE [di+DPT.bIdevarsOffset]
    2727    xchg    si, ax                      ; CS:SI now points to IDEVARS
     
    9191    mov     al,g_szBusTypeValues_Displacement
    9292    mul     BYTE [cs:si+IDEVARS.bDevice]
    93     shr     ax,1
     93       
     94    shr     ax,1            ; divide by 2 since IDEVARS.bDevice is multiplied by 2
     95       
    9496    add     ax,g_szBusTypeValues
    9597    push    ax 
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r183 r186  
    153153    ; Libraries and data
    154154    %include "AssemblyLibrary.asm"
     155%ifdef MODULE_STRINGS_COMPRESSED
     156    %include "StringsCompressed.asm"
     157%else
    155158    %include "Strings.asm"          ; For BIOS message strings
     159%endif
    156160
    157161    ; Initialization and drive detection
  • trunk/XTIDE_Universal_BIOS/Src/Strings.asm

    r185 r186  
    11; Project name  :   XTIDE Universal BIOS
    22; Description   :   Strings and equates for BIOS messages.
     3
     4%ifdef MODULE_STRINGS_COMPRESSED_PRECOMPRESS
     5%include "Display.inc"
     6%endif
    37
    48; Section containing code
     
    1923
    2024; Boot menu bottom of screen strings
    21 g_szFDD:        db  "FDD",NULL
    22 g_szHDD:        db  "HDD",NULL
     25g_szFDD:        db  "FDD     ",NULL
     26g_szHDD:        db  "HDD     ",NULL
    2327g_szRomBoot:    db  "ROM Boot",NULL
    24 g_szHotkey:     db  "%A%c%c%A%8s%A ",NULL
     28g_szHotkey:     db  "%A%c%c%A%s%A ",NULL
    2529
    2630
     
    3438g_szCapacity:   db  "Capacity : ",NULL
    3539g_szSizeSingle: db  "%s%u.%u %ciB",NULL
    36 g_szSizeDual:   db  "%s%4-u.%u %ciB / %4-u.%u %ciB",LF,CR,NULL
     40g_szSizeDual:   db  "%s%5-u.%u %ciB /%5-u.%u %ciB",LF,CR,NULL
    3741g_szCfgHeader:  db  "Addr.",SINGLE_VERTICAL,"Block",SINGLE_VERTICAL,"Bus",  SINGLE_VERTICAL,"IRQ",  SINGLE_VERTICAL,"Reset",LF,CR,NULL
    3842g_szCfgFormat:  db  "%s"   ,SINGLE_VERTICAL,"%5-u", SINGLE_VERTICAL,"%s",SINGLE_VERTICAL," %2-I",SINGLE_VERTICAL,"%5-x",  NULL
     
    98102%endif             
    99103       
    100 g_szSelectionTimeout:   db      DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2u s",NULL
     104g_szSelectionTimeout:   db      DOUBLE_BOTTOM_LEFT_CORNER,DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL,"%ASelection in %2-u s",NULL
    101105
    102106g_szDashForZero:        db      "- ",NULL
  • trunk/XTIDE_Universal_BIOS/makefile

    r181 r186  
    6565# Assembler preprocessor defines.                               #
    6666#################################################################
    67 DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL
     67DEFINES = INCLUDE_MENU_LIBRARY EXCLUDE_FROM_XTIDE_UNIVERSAL_BIOS MODULE_EBIOS MODULE_SERIAL MODULE_STRINGS_COMPRESSED
    6868DEFINES_XT = ELIMINATE_CGA_SNOW
    6969DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186
     
    139139    @$(RM) $(BUILD_DIR)\*.*
    140140    @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
     141
     142src\StringsCompressed.asm:  src\Strings.asm src\StringsCompress.pl
     143    $(AS) src\Strings.asm $(ASFLAGS) $(DEFS_XT) -DMODULE_STRINGS_COMPRESSED_PRECOMPRESS -o build\Strings.bin -l build\StringsPrecompress.lst
     144    perl src\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm
     145
     146$(SRC_ASM):     src\StringsCompressed.asm
Note: See TracChangeset for help on using the changeset viewer.