Shaving a Yak for Christmas
A few months ago I acquired a Commodore128 computer. An old 8 bit computer from the 80’s. It came with a Star NX-10C dot matrix printer, which I didn’t really know what to do with.
But with the coming holidays I thought it would be fun to print some Christmas greeting cards with it.
I thought it would be easiest if I made the drawing in PETSCII so I could use BASIC PRINT commands to print the card.
I have an editor to create PETSCII drawings. It’s pretty easy to use, although I don’t know how to chose the background color.
The program spews out an array of byte values, that you can use to create a screen on a Commodore64/128. I thought I could convert the values to printable PETSCII codes (so screen code 1 would end up as PRINT CHR$(65)).
I knew PETSCII isn’t the same as screen bytes, but I thought that there was bound to be a program that would convert it.
Well, maybe there is, but I couldn’t find it.
And I realised that converting isn’t as simple as I thought. Although there are 256 PETSCII codes and 256 screen codes, they can’t be mapped one on one. Some values don’t exist in PETSCII, that do exist in screen codes.
Some PETSCII codes, just like ASCII codes are control codes that can be used for PRINT commands, like ‘change color to yellow’, ‘clear screen’ or ‘move cursor position up’.
You can still put everything in PETSCII, because the second 128 of all screen codes are just inverted versions of the first 128 are (zeros are ones and vice versa).
But it does mean, that you have to print a ‘reverse on’ PETSCII command followed by the regular character followed by a ‘reverse off’ command.
And to make things worse: you are still left with a few characters that if you PRINT them they will issue a command in stead of printing a character. So you have to figure out (by seeing what’s not printed) which characters are missing and then replace them with some combination of PETSCII codes that would print the character.
But I made some headway, created an Excelsheet with some VB code that would do the conversion and create some BASIC lines with the data.
In CBM PRG Studio I created a BASIC program that would read the data and create a program that would be runnable on Commodore computer.
Then I had to put the program on a USB disk, put that in my 1541 Ultimate cartridge (what a great device!) in my Commodore computer and I was good to go.
It worked pretty good and after finding out how I could send the PRINT output to a printer in stead of a screen, I did my first test on a real printer. I heard the bits rattling out of the matrix printer. Boy are those things noisy!
SO! The Commodore screen has 40 columns, but logically there are 80 columns and that is what the printer expects, so the printer prints two lines one the same line. I have to add some CR/LF commands after each line.
I fixed it, but then came the moment I realised the printer uses a line spacing that results in blank lines between the picture lines.
I didn’t have a manual of the printer and started to search online. Finally I found the manual for the Star NX-10 printer (without the C) that looked pretty similar. It mentioned the control codes needed to change the line spacing, so I tried it with my printer.
To bad, peanut butter! No dice! No worky! Fail! End of the line!
I had no idea how to fix this, it was no use trying commands at random. So this idea will never be realised.
After this fiasco I tried to make a drawing in GEOS, because I knew I had a printer driver for that. Eventually that worked but that story will have to wait for another time.
I did end up with a few programs that do output to screen so I can post them here and say:
Happy holidays , and may all your Yaks be shaven!