Ver 39 - optimize PrintStrA

This commit is contained in:
Michaelangel007 2016-02-21 19:09:32 -07:00
parent f93bfeefe0
commit def41ba95f

143
printm.s
View File

@ -5,7 +5,7 @@
.feature leading_dot_in_identifiers
.PC02 ; 65C02
/* Version 38
/* Version 39
printm - a modular micro printf replacement for 65C02
Michael Pohoreski
Copyleft {c} Feb, 2016
@ -99,7 +99,7 @@ don't need "every" feature. Seriously, when was the last time
you _needed_ octal? :-)
printm() has manually been optimized for size. In gcc parlance, `-Os`.
With everything enabled printm() takes up $1B6 = 438 bytes
With everything enabled printm() takes up $1B5 = 437 bytes
(Plus 2 bytes in zero page.)
Whoa! I thought you said this was micro!?
@ -153,7 +153,7 @@ With all 15 features turned OFF the core routines use $49 = 73 bytes.
With the common setting (default) features:
BinAsc, Dec2, Dec3, Dec5, Hex2, Hex4, and StrA
the size is $11A = 282 bytes
the size is $117 = 279 bytes
To toggle features on / off change USE_* to 0 or 1:
@ -168,20 +168,20 @@ To toggle features on / off change USE_* to 0 or 1:
;
; Feature Size Bytes Total Notes
USE_BIN_ASC = 1 ; $78 120 \. $7E (126 bytes)
USE_BIN_INV = 1 ; $78 119 /
USE_BIN_INV = 0 ; $78 119 /
USE_DEC_2 = 1 ; $C5 197 \
USE_DEC_3 = 1 ; $C5 197 \.$EF (239 bytes)
USE_DEC_5 = 1 ; $C5 197 /
USE_DEC_BYTE = 1 ; $DE 222 / sets ENABLE_DEC
USE_DEC_BYTE = 0 ; $DE 222 / sets ENABLE_DEC
USE_HEX_2 = 1 ; $93 147 \. $96 (150 bytes)
USE_HEX_4 = 1 ; $92 146 /
USE_OCT_3 = 1 ; $8C 140 \. $92 (146 bytes)
USE_OCT_6 = 1 ; $8C 140 /
USE_PTR_2 = 1 ; $A2 162 \. $A5 (165 bytes) sets ENABLE_HEX
USE_PTR_4 = 1 ; $A1 161 /
USE_STR_A = 1 ; $72 114 \
USE_STR_C = 1 ; $72 114 > $9F (159 bytes)
USE_STR_PASCAL = 1 ; $74 116 /
USE_OCT_3 = 0 ; $8C 140 \. $92 (146 bytes)
USE_OCT_6 = 0 ; $8C 140 /
USE_PTR_2 = 0 ; $A2 162 \. $A5 (165 bytes) sets ENABLE_HEX
USE_PTR_4 = 0 ; $A1 161 /
USE_STR_A = 1 ; $71 113 \
USE_STR_C = 0 ; $72 114 > $9F (159 bytes)
USE_STR_PASCAL = 0 ; $74 116 /
/*
@ -228,21 +228,21 @@ Demo (All features) + Library text dump:
4130:A2 F1 A0 42 20 8E 41 A2
4138:0F 86 FE 64 FF 8A 20 DA
4140:FD 20 AA 41 20 4C 41 A9
4148:8D 4C ED FD 9C 8F 44 9C
4150:90 44 9C 91 44 A2 10 F8
4158:06 FE 26 FF A0 FD B9 92
4160:43 79 92 43 99 92 43 C8
4148:8D 4C ED FD 9C 8E 44 9C
4150:8F 44 9C 90 44 A2 10 F8
4158:06 FE 26 FF A0 FD B9 91
4160:43 79 91 43 99 91 43 C8
4168:D0 F4 CA D0 EB D8 A2 05
4170:88 B9 92 43 4A 4A 4A 4A
4170:88 B9 91 43 4A 4A 4A 4A
4178:18 69 B0 20 ED FD CA B9
4180:92 43 29 0F 18 69 B0 20
4180:91 43 29 0F 18 69 B0 20
4188:ED FD CA 10 E3 60 86 FC
4190:84 FD A0 00 B1 FC F0 06
4198:20 ED FD C8 D0 F6 60 A2
41A0:08 85 FE 06 FE 6A CA D0
41A8:FA 60 A9 A0 4C ED FD 98
41B0:20 C1 FB A6 28 A4 29 8E
41B8:89 44 8C 8A 44 60 D8 BD
41B8:88 44 8C 89 44 60 D8 BD
41C0:23 A0 D9 BD 64 A0 A4 BD
41C8:78 BA 40 A0 25 FE 3F 00
41D0:BE 41 27 00 BF 00 DE C0
@ -284,62 +284,62 @@ Demo (All features) + Library text dump:
42F0:00 A0 E2 F9 F4 E5 F3 8D
42F8:A0 A0 A0 A0 AE E6 E5 E1
4300:F4 F5 F2 E5 F3 A0 BD A0
4308:A4 A0 A0 00 B6 01 8E 24
4308:A4 A0 A0 00 B5 01 8E 24
4310:43 8C 25 43 20 1F 43 8E
4318:74 43 8C 75 43 80 54 20
4318:73 43 8C 74 43 80 53 20
4320:23 43 AA AD DE C0 EE 24
4328:43 D0 03 EE 25 43 A8 86
4330:FE 84 FF 60 18 20 1F 43
4338:90 03 20 63 44 8A 20 63
4340:44 80 28 18 20 1F 43 A0
4338:90 03 20 62 44 8A 20 62
4340:44 80 27 18 20 1F 43 A0
4348:00 B1 FE 90 F1 AA C8 B1
4350:FE 80 E7 20 1F 43 A0 00
4358:B1 FE 10 0A 20 88 44 C8
4360:D0 F6 E6 FF 80 F2 09 80
4368:20 88 44 EE 74 43 D0 03
4370:EE 75 43 AD DE C0 F0 BB
4378:30 EE A2 2D CA CA CA 30
4380:EA DD 97 44 D0 F6 7C 98
4388:44 A9 02 2C A9 01 2C A9
4390:00 8D BA 43 20 1F 43 9C
4398:8F 44 9C 90 44 9C 91 44
43A0:A2 10 F8 06 FE 26 FF A0
43A8:FD B9 92 43 79 92 43 99
43B0:92 43 C8 D0 F4 CA D0 EB
43B8:D8 A0 03 F0 0A B9 8F 44
43C0:20 70 44 20 88 44 88 B9
43C8:8F 44 20 63 44 88 10 F7
43D0:80 99 20 1F 43 8A 10 0A
43D8:A9 AD 20 88 44 8A 49 FF
43E0:AA E8 86 FE 64 FF A9 01
43E8:8D BA 43 80 AA A9 31 2C
43F0:A9 B1 8D 02 44 20 1F 43
43F8:A0 08 8A 0A AA A9 B0 90
4400:02 A9 B1 20 88 44 88 D0
4408:F1 80 C5 A9 06 2C A9 03
4410:8D 2D 44 20 1F 43 A2 00
4418:A5 FE 29 07 18 69 B0 9D
4420:8F 44 A0 03 46 FF 66 FE
4428:88 D0 F9 E8 E0 06 D0 E8
4430:CA 30 9D BD 8F 44 20 88
4438:44 80 F5 20 1F 43 A0 00
4440:B1 FE F0 8C 20 88 44 C8
4448:D0 F6 E6 FF 80 F2 20 1F
4450:43 A0 00 B1 FE F0 B2 AA
4458:C8 B1 FE 20 88 44 CA D0
4460:F7 F0 A6 20 70 44 A5 FE
4468:20 88 44 A5 FF 4C 88 44
4470:48 4A 4A 4A 4A 20 7B 44
4478:85 FE 68 29 0F C9 0A 90
4480:02 69 06 69 B0 85 FF 60
4488:8D DE C0 EE 89 44 60 00
4490:00 00 00 00 00 00 00 3F
4498:ED 43 25 F0 43 62 D2 43
44A0:75 89 43 64 8C 43 23 8F
44A8:43 78 35 43 24 34 43 26
44B0:44 43 40 43 43 4F 0B 44
44B8:6F 0E 44 70 4E 44 73 3B
44C0:44 61 53 43
4350:FE 80 E7 20 1F 43 B1 FE
4358:10 0B 20 87 44 E6 FE D0
4360:F5 E6 FF 80 F1 09 80 20
4368:87 44 EE 73 43 D0 03 EE
4370:74 43 AD DE C0 F0 BC 30
4378:EE A2 2D CA CA CA 30 EA
4380:DD 96 44 D0 F6 7C 97 44
4388:A9 02 2C A9 01 2C A9 00
4390:8D B9 43 20 1F 43 9C 8E
4398:44 9C 8F 44 9C 90 44 A2
43A0:10 F8 06 FE 26 FF A0 FD
43A8:B9 91 43 79 91 43 99 91
43B0:43 C8 D0 F4 CA D0 EB D8
43B8:A0 03 F0 0A B9 8E 44 20
43C0:6F 44 20 87 44 88 B9 8E
43C8:44 20 62 44 88 10 F7 80
43D0:99 20 1F 43 8A 10 0A A9
43D8:AD 20 87 44 8A 49 FF AA
43E0:E8 86 FE 64 FF A9 01 8D
43E8:B9 43 80 AA A9 31 2C A9
43F0:B1 8D 01 44 20 1F 43 A0
43F8:08 8A 0A AA A9 B0 90 02
4400:A9 B1 20 87 44 88 D0 F1
4408:80 C5 A9 06 2C A9 03 8D
4410:2C 44 20 1F 43 A2 00 A5
4418:FE 29 07 18 69 B0 9D 8E
4420:44 A0 03 46 FF 66 FE 88
4428:D0 F9 E8 E0 06 D0 E8 CA
4430:30 9D BD 8E 44 20 87 44
4438:80 F5 20 1F 43 A0 00 B1
4440:FE F0 8C 20 87 44 C8 D0
4448:F6 E6 FF 80 F2 20 1F 43
4450:A0 00 B1 FE F0 B2 AA C8
4458:B1 FE 20 87 44 CA D0 F7
4460:F0 A6 20 6F 44 A5 FE 20
4468:87 44 A5 FF 4C 87 44 48
4470:4A 4A 4A 4A 20 7A 44 85
4478:FE 68 29 0F C9 0A 90 02
4480:69 06 69 B0 85 FF 60 8D
4488:DE C0 EE 88 44 60 00 00
4490:00 00 00 00 00 00 3F EC
4498:43 25 EF 43 62 D1 43 75
44A0:88 43 64 8B 43 23 8E 43
44A8:78 35 43 24 34 43 26 44
44B0:43 40 43 43 4F 0A 44 6F
44B8:0D 44 70 4D 44 73 3A 44
44C0:61 53 43
*/
@ -1103,12 +1103,11 @@ DEBUG .sprintf( "PrintStrA() @ %X", * )
PrintStrA:
JSR NxtArgToTemp
LDY #$0
_PrintStrA:
LDA (_temp),Y
BPL @_LastChar
JSR PutChar
INY
INC _temp+0
BNE _PrintStrA
INC _temp+1
BRA _PrintStrA