- Timestamp:
- Nov 20, 2011, 1:24:41 AM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/StringsCompress.pl
r196 r197 23 23 #---------------------------------------------------------------------- 24 24 # 25 # Translated and Formatcharacters25 # Translated, Format, and "Normal" characters 26 26 # 27 27 # DisplayFormatCompressed can only deal with characters in one of the following categories: 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 30 # 3. Characters between $normal_base and $normal_base+0x40 31 # (typically covers upper and lowe case alphabets) 31 32 # 4. Null characters (marking the end of strings) 32 33 # 5. The special string LF,CR … … 36 37 # display it). 37 38 # 38 # Note that these tables are not present in DisplayFormatCompressed, and do not need to 39 # updated there. Needed information is put in the compression output that it reads. 40 # 41 $translate{ord(' ')} = 0; 42 $translate{172} = 1; # ONE_QUARTER 43 $translate{171} = 2; # ONE_HALF 44 $translate{179} = 3; # SINGLE_VERTICAL 45 $translate{175} = 4; # ANGLE_QUOTE_RIGHT 46 $translate{ord('!')} = 5; 47 $translate{ord('"')} = 6; 48 $translate{ord(',')} = 7; 49 $translate{ord('-')} = 8; 50 $translate{ord('.')} = 9; 51 $translate{ord('/')} = 10; 52 $translate{ord('1')} = 11; 53 $translate{ord('2')} = 12; 54 $translate{ord('3')} = 13; 55 $translate{ord('4')} = 14; 56 $translate{ord('5')} = 15; 57 $translate{ord('6')} = 16; 58 $translate{ord('8')} = 17; 59 $translate{200} = 18; # DOUBLE_BOTTOM_LEFT_CORNER 60 $translate{181} = 19; # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL 61 62 # 63 # Formats begin immediately after the last Translated character (they are in the same table) 64 # 65 $format_begin = 20; 66 67 $format{"s"} = 20; # n/a 68 $format{"c"} = 21; # n/a 69 $format{"2-I"} = 22; # must be even 70 $format{"u"} = 23; # must be odd 71 $format{"5-u"} = 24; # must be even 72 $format{"x"} = 25; # must be odd 73 $format{"5-x"} = 26; # must be even 74 $format{"nl"} = 27; # n/a 75 $format{"2-u"} = 28; # must be even 76 $format{"A"} = 29; # n/a 77 78 # NOTE: The last $format cannot exceed 31 (stored in a 5-bit quantity). 79 80 # 81 # Starting point for the "normal" range, typically around 0x40 to cover upper and lower case 82 # letters. If lower case 'z' is not used, 0x3a can be a good choice as it adds ':' to the 83 # front end. 84 # 85 $normal_base = 0x3a; 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 output 42 # that it reads. 43 # 86 44 87 45 # … … 108 66 print ";;;======================================================================\n\n"; 109 67 110 # 111 # Loop through lines of the listing, looking for 'db' lines (and dealing with continuations) 112 # and compressing each line as it is encountered. 113 # 68 69 # 70 # On a first pass, look for our table directives. $translate{...}, $format{...}, etc. 71 # are expectd in the input stream. 72 # 73 $processed = " [StringsCompress Processed]"; 114 74 while(<>) 115 75 { 76 chop; 77 $o = $_; 78 79 # 80 # Table entries for this script 81 # 82 if( /^\s*\d+\s*(\;\$translate\{\s*ord\(\s*'(.)'\s*\)\s*\}\s*=\s*([0-9]+).*$)/ ) 83 { 84 $translate{ord($2)} = int($3); 85 $o .= $processed; 86 } 87 elsif( /^\s*\d+\s*(\;\$translate\{\s*([0-9]+)\s*\}\s*=\s*([0-9]+).*$)/ ) 88 { 89 $translate{int($2)} = int($3); 90 $o .= $processed; 91 } 92 elsif( /^\s*\d+\s*(\;\$format_begin\s*=\s*([0-9]+).*$)/ ) 93 { 94 $format_begin = int($2); 95 $o .= $processed; 96 } 97 elsif( /^\s*\d+\s*(\;\$format\{\s*\"([^\"]+)\"\s*\}\s*=\s*([0-9]+).*$)/ ) 98 { 99 $format{$2} = int($3); 100 $o .= $processed; 101 } 102 elsif( /^\s*\d+\s*(\;\$normal_base\s*=\s*0x([0-9a-fA-F]+).*$)/ ) 103 { 104 $normal_base = hex($2); 105 $o .= $processed; 106 } 107 elsif( /^\s*\d+\s*(\;\$normal_base\s*=\s*([0-9]+).*$)/ ) 108 { 109 $normal_base = int($2); 110 $o .= $processed; 111 } 112 113 push( @lines, $o ); 114 } 115 116 # 117 # On the second pass, loop through lines of the listing, looking for 'db' lines 118 # (and dealing with continuations) and compressing each line as it is encountered. 119 # 120 for( $l = 0; $l < $#lines; $l++ ) 121 { 122 $_ = $lines[$l]; 123 116 124 # 117 125 # The <number> indicates a line from an include file, do not include in the output … … 139 147 do 140 148 { 141 $_ = <>;142 /^\s*\d+\s[0-9A-F]+\s([0-9A-F]+)(\-?)/i || die "parse error on continuation ";149 $_ = $lines[++$l]; 150 /^\s*\d+\s[0-9A-F]+\s([0-9A-F]+)(\-?)/i || die "parse error on continuation: '".$_."'"; 143 151 $bytes .= $1; 144 152 $continuation = $2; … … 159 167 } 160 168 161 print ";;; end of strings.asm\n\n";169 print ";;; end of input stream\n\n"; 162 170 163 171 #-------------------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Strings.asm
r196 r197 111 111 112 112 g_szDashForZero: db "- ",NULL 113 114 115 ;------------------------------------------------------------------------------------------ 116 ; 117 ; Tables for StringsCompress.pl 118 ; 119 ;$translate{ord(' ')} = 0; 120 ;$translate{172} = 1; # ONE_QUARTER 121 ;$translate{171} = 2; # ONE_HALF 122 ;$translate{179} = 3; # SINGLE_VERTICAL 123 ;$translate{175} = 4; # ANGLE_QUOTE_RIGHT 124 ;$translate{ord('!')} = 5; 125 ;$translate{ord('"')} = 6; 126 ;$translate{ord(',')} = 7; 127 ;$translate{ord('-')} = 8; 128 ;$translate{ord('.')} = 9; 129 ;$translate{ord('/')} = 10; 130 ;$translate{ord('1')} = 11; 131 ;$translate{ord('2')} = 12; 132 ;$translate{ord('3')} = 13; 133 ;$translate{ord('4')} = 14; 134 ;$translate{ord('5')} = 15; 135 ;$translate{ord('6')} = 16; 136 ;$translate{ord('8')} = 17; 137 ;$translate{200} = 18; # DOUBLE_BOTTOM_LEFT_CORNER 138 ;$translate{181} = 19; # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL 139 ; 140 ; Formats begin immediately after the last Translated character (they are in the same table) 141 ; 142 ;$format_begin = 20; 143 ; 144 ;$format{"s"} = 20; # n/a 145 ;$format{"c"} = 21; # n/a 146 ;$format{"2-I"} = 22; # must be even 147 ;$format{"u"} = 23; # must be odd 148 ;$format{"5-u"} = 24; # must be even 149 ;$format{"x"} = 25; # must be odd 150 ;$format{"5-x"} = 26; # must be even 151 ;$format{"nl"} = 27; # n/a 152 ;$format{"2-u"} = 28; # must be even 153 ;$format{"A"} = 29; # n/a 154 ; 155 ; NOTE: The last $format cannot exceed 31 (stored in a 5-bit quantity). 156 ; 157 ; Starting point for the "normal" range, typically around 0x40 to cover upper and lower case 158 ; letters. If lower case 'z' is not used, 0x3a can be a good choice as it adds ':' to the 159 ; front end. 160 ; 161 ;$normal_base = 0x3a; 162 ; 163 ; End of StringsCompress.pl information 164 ; 165 ;------------------------------------------------------------------------------------------ 166 167 168 169 -
trunk/XTIDE_Universal_BIOS/Src/StringsCompressed.asm
r196 r197 239 239 db 28h, 00h ; compressed 240 240 241 ;;; end of strings.asm 241 242 243 ;------------------------------------------------------------------------------------------ 244 ; 245 ; Tables for StringsCompress.pl 246 ; 247 ;$translate{ord(' ')} = 0; [StringsCompress Processed] 248 ;$translate{172} = 1; # ONE_QUARTER [StringsCompress Processed] 249 ;$translate{171} = 2; # ONE_HALF [StringsCompress Processed] 250 ;$translate{179} = 3; # SINGLE_VERTICAL [StringsCompress Processed] 251 ;$translate{175} = 4; # ANGLE_QUOTE_RIGHT [StringsCompress Processed] 252 ;$translate{ord('!')} = 5; [StringsCompress Processed] 253 ;$translate{ord('"')} = 6; [StringsCompress Processed] 254 ;$translate{ord(',')} = 7; [StringsCompress Processed] 255 ;$translate{ord('-')} = 8; [StringsCompress Processed] 256 ;$translate{ord('.')} = 9; [StringsCompress Processed] 257 ;$translate{ord('/')} = 10; [StringsCompress Processed] 258 ;$translate{ord('1')} = 11; [StringsCompress Processed] 259 ;$translate{ord('2')} = 12; [StringsCompress Processed] 260 ;$translate{ord('3')} = 13; [StringsCompress Processed] 261 ;$translate{ord('4')} = 14; [StringsCompress Processed] 262 ;$translate{ord('5')} = 15; [StringsCompress Processed] 263 ;$translate{ord('6')} = 16; [StringsCompress Processed] 264 ;$translate{ord('8')} = 17; [StringsCompress Processed] 265 ;$translate{200} = 18; # DOUBLE_BOTTOM_LEFT_CORNER [StringsCompress Processed] 266 ;$translate{181} = 19; # DOUBLE_LEFT_HORIZONTAL_TO_SINGLE_VERTICAL [StringsCompress Processed] 267 ; 268 ; Formats begin immediately after the last Translated character (they are in the same table) 269 ; 270 ;$format_begin = 20; [StringsCompress Processed] 271 ; 272 ;$format{"s"} = 20; # n/a [StringsCompress Processed] 273 ;$format{"c"} = 21; # n/a [StringsCompress Processed] 274 ;$format{"2-I"} = 22; # must be even [StringsCompress Processed] 275 ;$format{"u"} = 23; # must be odd [StringsCompress Processed] 276 ;$format{"5-u"} = 24; # must be even [StringsCompress Processed] 277 ;$format{"x"} = 25; # must be odd [StringsCompress Processed] 278 ;$format{"5-x"} = 26; # must be even [StringsCompress Processed] 279 ;$format{"nl"} = 27; # n/a [StringsCompress Processed] 280 ;$format{"2-u"} = 28; # must be even [StringsCompress Processed] 281 ;$format{"A"} = 29; # n/a [StringsCompress Processed] 282 ; 283 ; NOTE: The last $format cannot exceed 31 (stored in a 5-bit quantity). 284 ; 285 ; Starting point for the "normal" range, typically around 0x40 to cover upper and lower case 286 ; letters. If lower case 'z' is not used, 0x3a can be a good choice as it adds ':' to the 287 ; front end. 288 ; 289 ;$normal_base = 0x3a; [StringsCompress Processed] 290 ; 291 ; End of StringsCompress.pl information 292 ; 293 ;------------------------------------------------------------------------------------------ 294 295 296 297 ;;; end of input stream 242 298 243 299 StringsCompressed_NormalBase equ 58 … … 315 371 ;; format usage stats 316 372 ;; A:4 317 ;; c:8318 ;; s:15319 373 ;; 2-u:1 320 ;; u:6321 374 ;; 5-u:3 322 ;; 2-I:1323 375 ;; x:6 324 376 ;; 5-x:1 377 ;; s:15 325 378 ;; nl:6 379 ;; 2-I:1 380 ;; c:8 381 ;; u:6 326 382 ;; total format: 10 327 383 -
trunk/XTIDE_Universal_BIOS/makefile
r194 r197 140 140 @echo Deleted "(*.*)" from "$(BUILD_DIR)/" 141 141 142 src\StringsCompressed.asm: src\Strings.asm src\StringsCompress.pl142 src\StringsCompressed.asm: src\Strings.asm 143 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.asm144 perl ..\tools\StringsCompress.pl < build\StringsPrecompress.lst > src\StringsCompressed.asm 145 145 146 146 $(SRC_ASM): src\StringsCompressed.asm
Note:
See TracChangeset
for help on using the changeset viewer.