On Tue, 10 Jun 1997 07:52:35 -0700 Scott Dattalo writes: >Dwayne Reid wrote: >> I posted a set of routines to the list back in March: HEXASCII (hex >to >> Ascii), ASCIIHEX (ascii to hex) and UPCASE. I dug them out when I >read >> Eric's challange and like Scott, I'll repost my version of toascii >without >> comments. > > >> skpndc > > Oh yeah! The 'used-once-in-a-blue-moon-digit-carry'. If the ASCII code for 'A' were 0x40 rather than 0x41, then the DC could be used to write a 3 instruction (plus return) toascii. But it isn't, and using DC has no advantage over the 8th-bit Carry. >BTW. Does anyone have a good explanation why > ADDLW -('z'+1) ==> -('z'+1) evaluates correctly to 0x85 >assembles differently than > ADDLW -'z'-1 ==> -'z'-1 evaluates incorrectly to 0x87 > >(I'm using the pre-historic version 3.12.00 of MPLAB) A couple of clues: Ver. 3.22.00 does the same thing, but ADDLW 0-'z'-1 will evaluate to 0x85. My "good explanation" is that the - sign with nothing on the left is negation, and it (at least unconventionally, if not mistakenly) has lower priority than subtraction. Writing the negation as a subtraction from zero increases the priority so the expression evaluates from left to right as expected. -'z'-1 --> -('z'-1), not -('z') + -(1) 0-'z'-1 --> (0-'z')-1 Some of the early MPALCs did really strange things with compile-time expressions. They are getting better...