Changeset 186 in xtideuniversalbios for trunk/Assembly_Library


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/Assembly_Library
Files:
1 added
3 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
Note: See TracChangeset for help on using the changeset viewer.