On Sat, Sep 18, 2004 at 10:33:32AM -0400, Raj Wurttemberg wrote: > A little weirdness here. I told cc65 to use $73 but the .byte line in the > assembly shows it was converted to a $53: [...] > Why did that happen? Am I doing something wrong? If I edit the assembly and > change the $53 back to a $73 it works properly and displays the heart > character. As others have already explained, cc65 does a translation from the source character set into the target character set for all character and string literals. If cc65 wouldn't do that, things like printf ("Hello world!\n"); would not work as expected. There are several ways to work around it, if you don't like what cc65 does: 1. Use #pragma charmap() to redefine entries in the character translation table. 2. Don't specifiy a target system when compiling (please note that this disables *all* character translation). 3. Don't use string literals, use char arrays instead: const char foo [] = { 'H', 'e', 'l', 'l', 'o', 0x73, 0x00 }; 4. Move the strings into an assembler module. When a target system is specified, ca65 will also do character set translation, but it is easier to use string literals and numeric values together: .byte "Hello world! ", $73, $00 Which method is better depends on the actual code. You can also use the method shown by groepaz, but it will only work when using a printf like function. Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Sun Sep 19 22:44:57 2004
This archive was generated by hypermail 2.1.8 : 2004-09-19 22:45:05 CEST