Changeset 242 in xtideuniversalbios for trunk/Tools
- Timestamp:
- Feb 10, 2012, 3:12:40 AM (13 years ago)
- google:author:
- krille_n_@hotmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/StringsCompress.pl
r241 r242 6 6 # gregli@hotmail.com 7 7 # 8 # Description : Script for compiling and compressing strings for 8 # Description : Script for compiling and compressing strings for 9 9 # use by DisplayFormatCompressed.asm. See the header of that file 10 10 # for a description of the compression scheme. 11 11 # 12 # Usage : stdin: Listing of strings.asm, 12 # Usage : stdin: Listing of strings.asm, 13 13 # assembled with MODULE_STRINGS_COMPRESSED_PRECOMPRESS. 14 14 # We used the listing so that the assembler can take care of … … 28 28 # 1. Those in the Translate associative array 29 29 # 2. Those in the Format associative array 30 # 3. Characters between $normal_base and $normal_base+0x40 31 # (typically covers upper and lowe case alphabets)30 # 3. Characters between $normal_base and $normal_base+0x40 31 # (typically covers upper and lower case alphabets) 32 32 # 4. Null characters (marking the end of strings) 33 33 # 5. The special string LF,CR 34 34 # 35 # If a character or format read at the input cannot be found in one of the above categories, 36 # it must be added here before this script will accept it (and DisplayFormatCompressed can 35 # If a character or format read at the input cannot be found in one of the above categories, 36 # it must be added here before this script will accept it (and DisplayFormatCompressed can 37 37 # display it). 38 38 # 39 39 # Tables for the above categories are expected in the input stream, before string to be 40 # compressed are provided. Note that these tables are not present in DisplayFormatCompressed, 41 # and do not need to updated there. Needed information is put in the compression output40 # compressed are provided. Note that these tables are not present in DisplayFormatCompressed, 41 # and do not need to be updated there. Needed information is put in the compression output 42 42 # that it reads. 43 43 # … … 61 61 print ";;;\n"; 62 62 print ";;; This file is generated by StringsCompress.pl from source in Strings.asm\n"; 63 print ";;; DO NOT EDIT DIRECTLY - See the ma ekfile for how to rebuild this file.\n";63 print ";;; DO NOT EDIT DIRECTLY - See the makefile for how to rebuild this file.\n"; 64 64 print ";;; This file only needs to be rebuilt if Strings.asm is changed.\n"; 65 65 print ";;;\n"; … … 68 68 69 69 # 70 # On a first pass, look for our table directives. $translate{...}, $format{...}, etc. 71 # are expect d in the input stream.70 # On a first pass, look for our table directives. $translate{...}, $format{...}, etc. 71 # are expected in the input stream. 72 72 # 73 73 $processed = " [StringsCompress Processed]"; … … 115 115 116 116 # 117 # On the second pass, loop through lines of the listing, looking for 'db' lines 117 # On the second pass, loop through lines of the listing, looking for 'db' lines 118 118 # (and dealing with continuations) and compressing each line as it is encountered. 119 119 # … … 157 157 &processString( $bytes, $label.$spacing, $db ); 158 158 } 159 160 # 159 160 # 161 161 # everything else, copy to the output as is 162 162 # … … 208 208 print "\n"; 209 209 210 # 210 # 211 211 # Ensure that branch targets are within reach 212 212 # … … 280 280 $orig .= sprintf( ($v[$i] > 0x9f ? ", %03xh" : ", %02xh"), $v[$i] ); 281 281 } 282 $v[length($chars)/2] = 0xff; # guard byte to avoid thinking going past the end of 282 $v[length($chars)/2] = 0xff; # guard byte to avoid thinking going past the end of 283 283 # the string is a null 284 284 … … 336 336 $used{$v[$g]}++; 337 337 } 338 338 339 339 # 340 340 # "normal" characters (alphabet, and ASCII characters around the alphabet) … … 350 350 # 351 351 # Not found 352 # 352 # 353 353 else 354 354 { … … 378 378 if( $v[$g+1] == 0x20 && $v[$g+2] != 0 ) 379 379 { 380 # can't take this optimization if the next byte is a null, 380 # can't take this optimization if the next byte is a null, 381 381 # since we can't have both a postfix space and null 382 382 $g++;
Note:
See TracChangeset
for help on using the changeset viewer.