PruGen

v1.5

This page lets you load an image, resizes it to be 280px by 192px, converts it in monochrome, applies dithering and generates APPLESOFT code that will let you print it on devices such as the Apple2 computer

What's new in version 1.5?
Version 1.0 was prone to issues with images that generated bigger program. I changed the original "compression" algorithm with a decent encoding.
The challenge of decoding in APPLESOFT is that everything becomes unbearably slow and there is no support for boolean algebra.

Why and how this page exists?
This code generator has been developed in my spare time. My family preserved an old Apple 2e, and I've spent a weekend with my father to clean it and start it up. Once I've started it up, i've been curious on what it was capable of, and I've been reading APPLESOFT documentation (mainly the official manual and quick reference). I've been playing with the graphics mode and I decided that an interesting challenge would have been to display a picture. The solution I found is composed by three parts:

1) I wrote an APPLESOFT program that is capable of drawing an image using the HGR2 mode (280*192). The image is represented by 192 strings, one per row. Working with limited amounts of memory some basic compression tricks are used to reduce the size of these strings. I used the AppleWin Apple 2 emulator to test and debug the code.
2) I wrote some vanilla javascript code (with a couple of pieces extracted from open source projects, specifically the dithering algorithm and the file load capability) to generate the 192 strings that represent an image. This JS code is not perfect (it's not even good), but I like the fact that it lives in this HTML page and does not need any server. It's all in the browser. This page should work on your computer without internet if you save it locally. I like the idea of this being minimal and self contained, thus this page has no styling at all.
3) Once I had everything working in the emulator, i wanted to run in on my phisical system. This has been achieved maily through the ingenuity of my father: he used the AppleWin emulator to copy and paste the code generated by this page. He then saved it to a DSK file. He then used a second emulator (Agat) that does not support copy and paste, but can read DSK files and can generate audio files that emulate the tape output of the real Apple 2 computer. He then loaded the audio file on a phone with a 3.5 jack output, connected the phone with the Apple 2e through a 3.5mm jack cable, and used the "LOAD" command on the computer and played the audio from the phone. At this point the program was in memory, and just by typing "RUN" could be executed.

A couple of final notes: if you run this program on a real or emulated device, it assumes you have a monochorome monitor. This page is available on my public github. The name "PruGen" has been suggested by my wife, it has no real meaning but sounded right for a code generator.