Commodore 64 Font for MicroView

A bit of whimsy for the new year, I’ve converted the Commodore 64 “PETSCII” font for use on the MicroView!

http://i.imgur.com/rdSOq50.jpg

Note that there are actually two fonts, one for the C64’s Lowercase mode and one for the Uppercase mode. I rearranged the LowerCase one a bit so you can directly use it with uView.print(). You might have to hunt around a bit to find all the characters.

You can get them here.

https://github.com/LeifBloomquist/Micro … ts/C64Font

To install, follow the directions at http://learn.microview.io/font/creating … oview.html .

My modded MicroView.cpp looks like this:

...
// Add header of the fonts here.  Remove as many as possible to conserve FLASH memory.
#include <C64FontLower.h>
#include <C64FontUpper.h>
#include <font5x7.h>
#include <font8x16.h>
#include <fontlargenumber.h>
#include <7segment.h>
#include <space01.h>
#include <space02.h>
#include <space03.h>


// Change the total fonts included
#define TOTALFONTS		9
#define recvLEN			100
char serInStr[recvLEN];		// TODO - need to fix a value so that this will not take up too much memory.
uint8_t serCmd[recvLEN];

// Add the font name as declared in the header file.  Remove as many as possible to get conserve FLASH memory.
const unsigned char *MicroView::fontsPointer[]={
   font5x7
	,font8x16
	,sevensegment
	,fontlargenumber
	,space01
	,space02
	,space03
  ,C64FontLower
  ,C64FontUpper
};
...

To use them, simply call uView.setFontType(7); in your sketch and print as normal.

Enjoy!

Note that there’s a subtle bug in the MicroView library that prevents you from using the final character. The number of characters in the font is defined as a byte (max 255), but there are actually 256 characters in the font (0-255). It looks like the stock fonts are affected by this too.

Anyway, to fix it, try changing this line in MicroView.cpp in MicroView::drawChar(), around line 787:

if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar-1))) // no bitmap for the required c

to this:

if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar))) // no bitmap for the required c

Not sure if there are unintended consequences to this change though. (This assumes that displaying a reversed back-arrow is important to you :wink: )