From f586c92b554579b84762401dd20ead61fac95a06 Mon Sep 17 00:00:00 2001 From: Michaelangel007 Date: Sat, 20 Feb 2016 08:10:00 -0800 Subject: [PATCH] Ver 26 --- printm.s | 344 +++++++++++++++++++++++++++---------------------------- 1 file changed, 171 insertions(+), 173 deletions(-) diff --git a/printm.s b/printm.s index da762f3..5c44d4a 100644 --- a/printm.s +++ b/printm.s @@ -5,7 +5,7 @@ .feature leading_dot_in_identifiers .PC02 ; 65C02 -/* Version 25 +/* Version 26 printm - a modular micro printf replacement for 65C02 Michael Pohoreski Copyleft {c} Feb, 2016 @@ -121,186 +121,183 @@ To toggle features on / off change USE_* to 0 or 1: ; ; Feature Size Bytes Total Notes USE_BIN_ASC = 1 ; $7E 126 \. $85 (134 bytes) -USE_BIN_INV = 0 ; $80 128 / +USE_BIN_INV = 1 ; $80 128 / USE_DEC_2 = 1 ; $C7 199 \ USE_DEC_3 = 1 ; $C9 201 \.$F2 (242 bytes) USE_DEC_5 = 1 ; $C9 201 / -USE_DEC_BYTE = 0 ; $DF 223 / sets ENABLE_DEC +USE_DEC_BYTE = 1 ; $DF 223 / sets ENABLE_DEC USE_HEX_2 = 1 ; $A0 160 \. $A7 (167 bytes) USE_HEX_4 = 1 ; $A2 162 / -USE_OCT_3 = 0 ; $97 151 \. $9E (158 bytes) -USE_OCT_6 = 0 ; $99 153 / -USE_PTR_2 = 0 ; $B1 177 \. $B8 (184 bytes) sets ENABLE_HEX -USE_PTR_4 = 0 ; $B3 179 / +USE_OCT_3 = 1 ; $97 151 \. $9E (158 bytes) +USE_OCT_6 = 1 ; $99 153 / +USE_PTR_2 = 1 ; $B1 177 \. $B8 (184 bytes) sets ENABLE_HEX +USE_PTR_4 = 1 ; $B3 179 / USE_STR_A = 1 ; $78 120 \ -USE_STR_C = 0 ; $78 120 > $A6 (166 bytes) -USE_STR_PASCAL = 0 ; $7A 122 / +USE_STR_C = 1 ; $78 120 > $A6 (166 bytes) +USE_STR_PASCAL = 1 ; $7A 122 / /* Demo + Library text dump: 4000:20 58 FC A9 D5 8D 00 20 -4008:A9 AA 8D 01 20 AD E8 41 +4008:A9 AA 8D 01 20 AD D2 41 4010:A2 00 A0 00 20 11 F4 18 -4018:A5 26 6D E6 41 85 26 AA -4020:A4 27 8E EA 41 8C EB 41 -4028:8E EC 41 8C ED 41 AD 00 -4030:20 A0 00 91 26 8D EE 41 -4038:9C EF 41 8D 0A 42 8D 0E -4040:42 20 B3 41 8D F0 41 9C -4048:F1 41 A0 00 20 C3 41 A2 -4050:E4 A0 41 20 22 43 A0 01 -4058:20 C3 41 A2 08 A0 42 20 -4060:22 43 A0 02 20 C3 41 A2 -4068:0C A0 42 20 22 43 A0 03 -4070:20 C3 41 A2 37 A0 42 20 -4078:22 43 A0 04 20 C3 41 A2 -4080:3B A0 42 20 22 43 A0 05 -4088:20 C3 41 A2 3F A0 42 20 -4090:22 43 A0 06 20 C3 41 A2 -4098:43 A0 42 20 22 43 A0 07 -40A0:20 C3 41 A2 73 A0 42 20 -40A8:22 43 A0 08 20 C3 41 A2 -40B0:77 A0 42 20 22 43 A0 09 -40B8:20 C3 41 A2 7B A0 42 20 -40C0:22 43 A0 0A 20 C3 41 A2 -40C8:81 A0 42 20 22 43 A0 0B -40D0:20 C3 41 A2 97 A0 42 20 -40D8:22 43 A0 0C 20 C3 41 A2 -40E0:9B A0 42 20 22 43 A0 0D -40E8:20 C3 41 A2 EB A0 42 20 -40F0:22 43 A0 0E 20 C3 41 A2 -40F8:E5 A0 42 20 22 43 A0 0F -4100:20 C3 41 A2 EF A0 42 20 -4108:22 43 A9 11 20 5B FB A2 -4110:F3 A0 42 20 A2 41 AD 21 -4118:43 85 FF 20 DA FD AD 20 -4120:43 85 FE 20 DA FD 20 BE -4128:41 20 4F 41 A2 05 A0 43 -4130:20 A2 41 AE B4 43 86 FE -4138:64 FF 8A 20 DA FD 20 BE -4140:41 20 4F 41 A9 8D 4C ED -4148:FD 00 00 00 00 00 00 A2 -4150:49 A0 41 86 FC 84 FD 9C -4158:49 41 9C 4A 41 9C 4B 41 -4160:A0 00 A2 10 F8 06 FE 26 -4168:FF B1 FC 71 FC 91 FC C8 -4170:B1 FC 71 FC 91 FC C8 B1 -4178:FC 71 FC 91 FC C8 A0 00 -4180:CA D0 E2 D8 A2 02 BD 49 -4188:41 4A 4A 4A 4A 18 69 B0 -4190:20 ED FD BD 49 41 29 0F -4198:18 69 B0 20 ED FD CA 10 -41A0:E5 60 86 FC 84 FD A0 00 -41A8:B1 FC F0 06 20 ED FD C8 -41B0:D0 F6 60 A2 08 85 FE 06 -41B8:FE 6A CA D0 FA 60 A9 A0 -41C0:4C ED FD 98 20 C1 FB A6 -41C8:28 A4 29 8E B1 44 8C B2 -41D0:44 60 D8 BD 23 A0 D9 BD -41D8:64 A0 A4 BD 78 BA 40 A0 -41E0:25 FE 3F 00 D2 41 27 00 -41E8:BF 00 DE C0 DE C0 1A DA -41F0:1A DA C2 E9 EE A0 C1 D3 -41F8:C3 BA A0 25 00 C2 E9 EE -4200:A0 C9 CE D6 BA A0 3F 00 -4208:F2 41 1A DA FD 41 1A DA -4210:C4 E5 E3 B2 BA A0 23 00 -4218:C4 E5 E3 B3 BA A0 64 00 -4220:C4 E5 E3 B5 BA A0 75 00 -4228:C2 F9 F4 E5 BD 62 A0 62 -4230:A0 62 A0 62 A0 62 00 10 -4238:42 63 00 18 42 E7 03 20 -4240:42 69 FF 28 42 80 00 FF -4248:00 00 00 01 00 7F 00 C8 -4250:E5 F8 B2 BA A0 24 00 C8 -4258:E5 F8 B4 BA A0 78 00 D0 -4260:F4 F2 B2 BA A0 78 BA 40 -4268:00 D0 F4 F2 B4 BA A0 78 -4270:BA 26 00 4F 42 34 12 57 -4278:42 34 12 5F 42 00 20 00 -4280:20 69 42 00 20 00 20 CF -4288:E3 F4 B3 BA A0 6F 00 CF -4290:E3 F4 B6 BA A0 4F 00 87 -4298:42 B6 01 8F 42 DF 32 C8 -42A0:C5 CC CC CF 00 D7 CF D2 -42A8:CC C4 00 C8 CF CD 45 0D -42B0:D0 E1 F3 E3 E1 EC A0 CC -42B8:E5 EE A0 B1 B3 C3 A0 A0 -42C0:A0 A0 A0 BA A0 A7 73 A7 -42C8:AC A7 73 A7 00 C1 F0 F0 -42D0:EC E5 A0 BA A0 A7 61 A7 -42D8:00 D0 E1 F3 E3 E1 EC BA -42E0:A0 A7 70 A7 00 BD 42 9F -42E8:42 A5 42 CD 42 AB 42 D9 -42F0:42 AF 42 F0 F2 E9 EE F4 -42F8:ED A8 A9 AE F3 E9 FA E5 -4300:A0 BD A0 A4 00 A0 E2 F9 -4308:F4 E5 F3 8D A0 A0 A0 A0 -4310:AE E6 E5 E1 F4 F5 F2 E5 -4318:F3 A0 BD A0 A4 A0 A0 00 -4320:E1 01 8E BE 44 8C BF 44 -4328:9C BC 44 20 B7 44 8E AD -4330:43 8C AE 43 80 76 A9 04 -4338:D0 02 A9 02 8D 67 43 20 -4340:B7 44 8E D4 44 8C D5 44 -4348:A2 00 AD D4 44 29 0F C9 -4350:0A 90 02 69 06 69 B0 9D -4358:CE 44 A0 04 4E D5 44 6E -4360:D4 44 88 D0 F7 E8 E0 04 -4368:D0 E0 CA 30 37 BD CE 44 -4370:20 B0 44 80 F5 A9 04 D0 -4378:02 A9 02 8D 67 43 20 B7 -4380:44 A0 00 B1 FE AA C8 B1 -4388:FE A8 80 B6 20 B7 44 A0 -4390:00 B1 FE 10 0A 20 B0 44 -4398:C8 D0 F6 E6 FF 80 F2 09 -43A0:80 20 B0 44 EE AD 43 D0 -43A8:03 EE AE 43 AD DE C0 F0 -43B0:12 30 EE A2 0F CA 30 EC -43B8:DD D6 44 D0 F8 8A 0A AA -43C0:7C E5 44 60 A9 05 D0 06 -43C8:A9 03 D0 02 A9 02 8D 1F -43D0:44 20 B7 44 8E D4 44 8C -43D8:D5 44 9C CE 44 9C CF 44 -43E0:9C D0 44 A2 10 F8 0E D4 -43E8:44 2E D5 44 A0 FD B9 D1 -43F0:43 79 D1 43 99 D1 43 C8 -43F8:D0 F4 CA D0 E9 D8 A2 05 -4400:88 B9 D1 43 4A 4A 4A 4A -4408:18 69 B0 9D CE 44 CA B9 -4410:D1 43 29 0F 18 69 B0 9D -4418:CE 44 88 CA 10 E3 A2 00 -4420:4C 6A 43 A9 31 D0 02 A9 -4428:B1 8D 39 44 20 B7 44 A0 -4430:08 8A 0A AA A9 B0 90 02 -4438:A9 B1 20 B0 44 88 D0 F1 -4440:4C A4 43 20 B7 44 8A 10 -4448:0A A9 AD 20 B0 44 8A 49 -4450:FF AA E8 A0 00 A9 03 8D -4458:1F 44 4C D4 43 A9 06 D0 -4460:02 A9 03 8D 84 44 20 B7 -4468:44 A2 00 A0 03 A5 FE 29 -4470:07 18 69 B0 9D CE 44 46 -4478:FF 66 FE 88 D0 F9 E8 E0 -4480:06 D0 EA A2 06 4C 6A 43 -4488:20 B7 44 A0 00 B1 FE F0 -4490:AF 20 B0 44 C8 D0 F6 E6 -4498:FF 80 F2 20 B7 44 A0 00 -44A0:B1 FE F0 9C AA C8 B1 FE -44A8:20 B0 44 CA D0 F7 F0 90 -44B0:8D DE C0 EE B1 44 60 20 -44B8:BB 44 AA A0 00 B9 DE C0 -44C0:EE BC 44 D0 03 EE BF 44 -44C8:A8 86 FE 84 FF 60 00 00 -44D0:00 00 00 00 00 00 3F 25 -44D8:62 75 64 23 78 24 26 40 -44E0:4F 6F 70 73 61 23 44 27 -44E8:44 43 44 C4 43 C8 43 CC -44F0:43 36 43 3A 43 75 43 79 -44F8:43 5D 44 61 44 9B 44 88 -4500:44 8C 43 +4018:A5 26 6D D0 41 85 26 AA +4020:A4 27 8E D4 41 8C D5 41 +4028:8E D6 41 8C D7 41 AD 00 +4030:20 A0 00 91 26 8D D8 41 +4038:9C D9 41 8D F4 41 8D F8 +4040:41 20 9D 41 8D DA 41 9C +4048:DB 41 A0 00 20 AD 41 A2 +4050:CE A0 41 20 0C 43 A0 01 +4058:20 AD 41 A2 F2 A0 41 20 +4060:0C 43 A0 02 20 AD 41 A2 +4068:F6 A0 41 20 0C 43 A0 03 +4070:20 AD 41 A2 21 A0 42 20 +4078:0C 43 A0 04 20 AD 41 A2 +4080:25 A0 42 20 0C 43 A0 05 +4088:20 AD 41 A2 29 A0 42 20 +4090:0C 43 A0 06 20 AD 41 A2 +4098:2D A0 42 20 0C 43 A0 07 +40A0:20 AD 41 A2 5D A0 42 20 +40A8:0C 43 A0 08 20 AD 41 A2 +40B0:61 A0 42 20 0C 43 A0 09 +40B8:20 AD 41 A2 65 A0 42 20 +40C0:0C 43 A0 0A 20 AD 41 A2 +40C8:6B A0 42 20 0C 43 A0 0B +40D0:20 AD 41 A2 81 A0 42 20 +40D8:0C 43 A0 0C 20 AD 41 A2 +40E0:85 A0 42 20 0C 43 A0 0D +40E8:20 AD 41 A2 D5 A0 42 20 +40F0:0C 43 A0 0E 20 AD 41 A2 +40F8:CF A0 42 20 0C 43 A0 0F +4100:20 AD 41 A2 D9 A0 42 20 +4108:0C 43 A9 11 20 5B FB A2 +4110:DD A0 42 20 8C 41 AD 0B +4118:43 85 FF 20 DA FD AD 0A +4120:43 85 FE 20 DA FD 20 A8 +4128:41 20 49 41 A2 EF A0 42 +4130:20 8C 41 AE 9E 43 86 FE +4138:64 FF 8A 20 DA FD 20 A8 +4140:41 20 49 41 A9 8D 4C ED +4148:FD 9C B8 44 9C B9 44 9C +4150:BA 44 A2 10 F8 06 FE 26 +4158:FF A0 FD B9 BB 43 79 BB +4160:43 99 BB 43 C8 D0 F4 CA +4168:D0 EB D8 A2 05 88 B9 BB +4170:43 4A 4A 4A 4A 18 69 B0 +4178:20 ED FD CA B9 BB 43 29 +4180:0F 18 69 B0 20 ED FD 88 +4188:CA 10 E3 60 86 FC 84 FD +4190:A0 00 B1 FC F0 06 20 ED +4198:FD C8 D0 F6 60 A2 08 85 +41A0:FE 06 FE 6A CA D0 FA 60 +41A8:A9 A0 4C ED FD 98 20 C1 +41B0:FB A6 28 A4 29 8E 9B 44 +41B8:8C 9C 44 60 D8 BD 23 A0 +41C0:D9 BD 64 A0 A4 BD 78 BA +41C8:40 A0 25 FE 3F 00 BC 41 +41D0:27 00 BF 00 DE C0 DE C0 +41D8:1A DA 1A DA C2 E9 EE A0 +41E0:C1 D3 C3 BA A0 25 00 C2 +41E8:E9 EE A0 C9 CE D6 BA A0 +41F0:3F 00 DC 41 1A DA E7 41 +41F8:1A DA C4 E5 E3 B2 BA A0 +4200:23 00 C4 E5 E3 B3 BA A0 +4208:64 00 C4 E5 E3 B5 BA A0 +4210:75 00 C2 F9 F4 E5 BD 62 +4218:A0 62 A0 62 A0 62 A0 62 +4220:00 FA 41 63 00 02 42 E7 +4228:03 0A 42 69 FF 12 42 80 +4230:00 FF 00 00 00 01 00 7F +4238:00 C8 E5 F8 B2 BA A0 24 +4240:00 C8 E5 F8 B4 BA A0 78 +4248:00 D0 F4 F2 B2 BA A0 78 +4250:BA 40 00 D0 F4 F2 B4 BA +4258:A0 78 BA 26 00 39 42 34 +4260:12 41 42 34 12 49 42 00 +4268:20 00 20 53 42 00 20 00 +4270:20 CF E3 F4 B3 BA A0 6F +4278:00 CF E3 F4 B6 BA A0 4F +4280:00 71 42 B6 01 79 42 DF +4288:32 C8 C5 CC CC CF 00 D7 +4290:CF D2 CC C4 00 C8 CF CD +4298:45 0D D0 E1 F3 E3 E1 EC +42A0:A0 CC E5 EE A0 B1 B3 C3 +42A8:A0 A0 A0 A0 A0 BA A0 A7 +42B0:73 A7 AC A7 73 A7 00 C1 +42B8:F0 F0 EC E5 A0 BA A0 A7 +42C0:61 A7 00 D0 E1 F3 E3 E1 +42C8:EC BA A0 A7 70 A7 00 A7 +42D0:42 89 42 8F 42 B7 42 95 +42D8:42 C3 42 99 42 F0 F2 E9 +42E0:EE F4 ED A8 A9 AE F3 E9 +42E8:FA E5 A0 BD A0 A4 00 A0 +42F0:E2 F9 F4 E5 F3 8D A0 A0 +42F8:A0 A0 AE E6 E5 E1 F4 F5 +4300:F2 E5 F3 A0 BD A0 A4 A0 +4308:A0 00 E1 01 8E A8 44 8C +4310:A9 44 9C A6 44 20 A1 44 +4318:8E 97 43 8C 98 43 80 76 +4320:A9 04 D0 02 A9 02 8D 51 +4328:43 20 A1 44 8E BE 44 8C +4330:BF 44 A2 00 AD BE 44 29 +4338:0F C9 0A 90 02 69 06 69 +4340:B0 9D B8 44 A0 04 4E BF +4348:44 6E BE 44 88 D0 F7 E8 +4350:E0 04 D0 E0 CA 30 37 BD +4358:B8 44 20 9A 44 80 F5 A9 +4360:04 D0 02 A9 02 8D 51 43 +4368:20 A1 44 A0 00 B1 FE AA +4370:C8 B1 FE A8 80 B6 20 A1 +4378:44 A0 00 B1 FE 10 0A 20 +4380:9A 44 C8 D0 F6 E6 FF 80 +4388:F2 09 80 20 9A 44 EE 97 +4390:43 D0 03 EE 98 43 AD DE +4398:C0 F0 12 30 EE A2 0F CA +43A0:30 EC DD C0 44 D0 F8 8A +43A8:0A AA 7C CF 44 60 A9 05 +43B0:D0 06 A9 03 D0 02 A9 02 +43B8:8D 09 44 20 A1 44 8E BE +43C0:44 8C BF 44 9C B8 44 9C +43C8:B9 44 9C BA 44 A2 10 F8 +43D0:0E BE 44 2E BF 44 A0 FD +43D8:B9 BB 43 79 BB 43 99 BB +43E0:43 C8 D0 F4 CA D0 E9 D8 +43E8:A2 05 88 B9 BB 43 4A 4A +43F0:4A 4A 18 69 B0 9D B8 44 +43F8:CA B9 BB 43 29 0F 18 69 +4400:B0 9D B8 44 88 CA 10 E3 +4408:A2 00 4C 54 43 A9 31 D0 +4410:02 A9 B1 8D 23 44 20 A1 +4418:44 A0 08 8A 0A AA A9 B0 +4420:90 02 A9 B1 20 9A 44 88 +4428:D0 F1 4C 8E 43 20 A1 44 +4430:8A 10 0A A9 AD 20 9A 44 +4438:8A 49 FF AA E8 A0 00 A9 +4440:03 8D 09 44 4C BE 43 A9 +4448:06 D0 02 A9 03 8D 6E 44 +4450:20 A1 44 A2 00 A5 FE 29 +4458:07 18 69 B0 9D B8 44 A0 +4460:03 46 FF 66 FE 88 D0 F9 +4468:E8 E0 06 D0 E8 A2 06 4C +4470:54 43 20 A1 44 A0 00 B1 +4478:FE F0 AF 20 9A 44 C8 D0 +4480:F6 E6 FF 80 F2 20 A1 44 +4488:A0 00 B1 FE F0 9C AA C8 +4490:B1 FE 20 9A 44 CA D0 F7 +4498:F0 90 8D DE C0 EE 9B 44 +44A0:60 20 A5 44 AA A0 00 B9 +44A8:DE C0 EE A6 44 D0 03 EE +44B0:A9 44 A8 86 FE 84 FF 60 +44B8:00 00 00 00 00 00 00 00 +44C0:3F 25 62 75 64 23 78 24 +44C8:26 40 4F 6F 70 73 61 0D +44D0:44 11 44 2D 44 AE 43 B2 +44D8:43 B6 43 20 43 24 43 5F +44E0:43 63 43 47 44 4B 44 85 +44E8:44 72 44 76 43 */ @@ -308,7 +305,7 @@ Demo + Library text dump: ; Assemble-time diagnostic information .macro DEBUG text -.if 1 +.if 0 .out text .endif .endmacro @@ -1179,7 +1176,7 @@ DEBUG .sprintf( "PrintDec2() @ %X", * ) Dec2BCD: LDX #16 ; 16 bits SED ; "Double Dabble" - _Dec2BCD: ; https://en.wikipedia.org/wiki/Double_dabble + @Dec2BCD: ; https://en.wikipedia.org/wiki/Double_dabble ASL _val+0 ROL _val+1 @@ -1192,7 +1189,7 @@ DEBUG .sprintf( "PrintDec2() @ %X", * ) BNE @DoubleDabble DEX - BNE _Dec2BCD + BNE @Dec2BCD CLD LDX #5 ; was Y @@ -1547,6 +1544,7 @@ MetaFunc __END -DEBUG .sprintf( "Lib Size: %X (%d bytes)", __LIB_SIZE , __LIB_SIZE ) -DEBUG .sprintf( "Total Size: %X (%d bytes)", __END-__MAIN, __END-__MAIN) +DEBUG .sprintf( "Total size: %X (%d bytes)", __END -__MAIN, __END -__MAIN) +DEBUG .sprintf( "Demo size: %X (%d bytes)", __PRINTM-__MAIN, __PRINTM-__MAIN) +DEBUG .sprintf( "printm size: %X (%d bytes)", __LIB_SIZE , __LIB_SIZE )