Hi! I just updated my printtok.c cc65 C module online. It is now much smaller in object size and adds an option to use zeropage to store two of its variables. I also bettered its extended memory support but still didn't test this support. The compression techniques didn't change, though. You can find it at c65 additions - Manage /ui at SourceForge.net. Try it out!
cc65 users: printtok.c updated!
May 27, 2023 - 6:20pm
#1
cc65 users: printtok.c updated!
I just updated it again by adding 32 more single-byte tokens and better extended memory support: now, it can read both from main memory and extended memory in the same program. It is at the same location as the previous versions.
I am working on a better version of printtok that can compress literals to 7 bits or 5 bits with extra bits for tokens and to increase support for more available characters. This version will also compress strings automatically. If you have ways to better either or both the current version or the new version, please reply.
Currently, the Win32 executable won't run at all on a Win11/64 laptop and displays an error on the second line of an input on a Win7/64 laptop. :( Should I post the main module here so others can figure out what's wrong?
I can't help you with that because I don't have Windows at all.
At least you resonded. :) The program works better on a Win7/64 laptop, though, and I get the same issue using Open Watcom.
I am running Linux but here's some output ...
$ make clean all
rm -fr io.c include io.o printtok.c printtok
mkdir -p include
printf "#include <stdio.h>\n#define __fastcall__\n" > include/conio.h
#printf "#define char unsigned char\n#define printc putchar\n#define getkey()\n" >> include/conio.h
printf "#include <stdio.h>\nvoid printc(char c){putchar(c);}\nvoid prints (char * s){printf(\"%s\", s);}\n" "%s" > io.c
cc -c -o io.o io.c
sed -e /getkey/d printtok-004.c >printtok.c
cc -Iinclude io.o printtok.c -o printtok
./printtok
Going to Mars?
Microsoft sucks. Harry Potter is cool!
%<Illegal function call.>
-Numbers!
I'm hungry!!
Cool! Thank you! :) So, is it useful? Do you have a purpose for it?
I don't have a purpose for it because I don't usually need much string space. I like the concept—someone writing a text adventure might need lots of string space!
I find the most useful programs are the ones that I use on a regular basis. I like small programs. Thanks for sharing.
what about win 10? my laptop is very slow, I don't know if I can install it or not. Do you know any version lighter?
Provided you have the latest version of printtok, it is pretty efficient and, in fact, if you disable most control characters, such as Clear Acreen and Pause, more efficient than previous versions. Unfortunately, you need to compress the strings yourself. :( Does this help?