I am looking for a good toolkit to auto-generate C64 basic code, which eventually prints different PETSCII graphics. I am wondering, if there is a good workflow for this, e.g. using a graphical PETSCII editor, copying the content (as fake ASCII?) in a Python script, processing it, writing C64 BASIC from python as text file, and converting into a BASIC program file, keeping PETSCII codes intact.
It does not necessarily need to be Python, other languages would also work.
Some more background, in case it is relevant:
The code generator should run on Linux or Windows, compressing a bigger number of PETSCII graphics by finding common strings, then generating C64 BASIC code containing these strings, plus some kind of mapping table to assemble the original images from partial strings.
Are the any documented viable approaches to use PETSCII as Python encoding?
I'll give an example how I expect this to look like. However, I'll use ASCII art here instead of PETSCII to make this render nicely. The real thing will use PETSCII, not ASCII.
Assuming I have ~100 images like:
[[]]-[[]]-[[]]-[[]]-[[]]-[[]]-[[]]-[[]]-[[]]-[[]]-[[]]
.-.`| `-/-.__/.-'\_.-._,'/`-._'\_.-._`-'_/-._.'|/.-'\-
\_.-`./`-._'\__.-`-.__.-`--._/--.`-._\`-._\__.-)`-'._/
`._-'.\_.---._-.\_`-..`\_.---._`-.__.-`'._.--./`-'._,'
__/`.-/ `.'_`./`.' '.\__.-`.' (_.-\_,-.
`._-/' |._.-| |.'`.| `(_.`-._
.-',`) | /`.| |`-/`| ;.-'_/
`\,-/ |\.-'| |\-'`| ;\_,-
-./`._ [[[[[[[[ [[[[[[[[ .',-'
`.`--.~~-^_~-/.`-._`-.\^~-_~-^/`-.'-,.'\^~-~_^"'`-.'_
-,.'"-"~^-~_~- - - _- -~^-_.~ - -_ - - -~- . "'"-"-""
""-'"-""-"~- _~.^-~-^.-^_.- .^~.- ~-. ~^_-""-""-"'-"
""-'"-" ~- ^. - ~ -~^ - ~ ^~- ~ ""-"'-'
First, I need to draw those in an editor, where PETSCII characters are accessible (preferrably graphical, as my PC keyboard does not have the characters printed).
Then, I want to copy those images as text into some script file like Python.
img[0] = """[[]]-[[]]-[[]]-[[]] ...
...
..."
Probably, at that point, at least by the script interpreter, this will be interpreted as ASCII. I assume, setting the encoding to something strictly 8-bit, it will not be damaged on binary level though.
Then I would run a string analysis on these, determing strings of a certain length (let's assume, 6 characters each), that can be used to reproduce that image (all images have a symmetry that aligns nicely with that fixed length).
At the end of this step, I have an array of fixed-length strings and a list for every image, with indexes into that string array, to reproduce the image. Now I want to generate a BASIC program to reproduce this data in the C64.
I assume, the most BASIC-like and still compact approach would be to temporarily change the screen RAM pointer, then have a list of print commands, that print all these string segments on screen, then move the screen RAM pointer back.
So, the generated code would look like
PRINT"[[]]-[.-.`| .---._...."
All with PETSCII graphical characters.
print('10 PRINT "HELLO"\n20 GOTO 10')
?