On Freitag, 14. Mai 2021 21:35:46 CEST groepaz_at_gmx.net wrote: > Am Freitag, 14. Mai 2021, 21:28:13 CEST schrieb afachat_at_gmx.de: > > Hi there, > > > > I am trying to build and run a small program for the PET using cc65. > > > > However, this line gives me woes: > > cprintf("Hello (%d)!\n\r", strlen(s->name)); > > > > The only thing it prints is "Hello ()!", so it seems no format > > substitution > > takes place, even though the man page says all formats from printf are > > supported. > > > > It's actually from a uIP 1.0 distribution and built like: > > cc65 -g -I../uip -I. -I../apps/hello-world ../apps/hello-world/ > > > > hello-world.c -o obj/hello-world.s > > > > ca65 -o obj/hello-world.o obj/hello-world.s > > ar65 a apps.a obj/hello-world.o > > ld65 -t pet obj/main.o obj/clock-arch.o obj/enceth.o apps.a uip.a / > > > > usr/local/share/cc65/lib/pet.lib -o uip > > > > I also tried using %s instead of %d, but this also does not substitute. > > > > Any ideas? > > It should work. Try giving -t to each step, not just the linker. My guess > would be that somehow the character encoding isnt the same in your program > and the library containing printf. Thanks, that seems to have done it. At least adding "-t pet" on the cc65 stage. Unfortunately now the text is mangled because it tries to convert between PETSCII and ASCII ... which is not nice if you're trying to talk to an internet client in ASCII and print the text on screen - in PETSCII, but that would have been ok, as at least numbers should be all right, right? Not doing _any_ format conversion sounds not good to me... I guess I would have preferred to stay without the "-t pet" and convert the text to PETSCII myself, but: - removing "-t pet" from the linker stage complains about missing memory configuration and - only using "-t pet" on the linker results in no format substitution.... I think I'll open up an issue with cc65, see what they recommend. Thanks again AndréReceived on 2021-05-14 23:00:03
Archive generated by hypermail 2.3.0.