[phpBB Debug] PHP Warning: in file /mnt/forum-shared/ext/sitesplat/BBCore/event/listener.php on line 70: in_array() expects parameter 2 to be array, boolean given
Commodore 64 Font for MicroView - SparkFun Electronics

SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion area - What have you built with your Micro View

Moderators: Help@GeekAmmo, marcus@geekammo

By Schema
A bit of whimsy for the new year, I've converted the Commodore 64 "PETSCII" font for use on the MicroView!


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:
Code: Select all
// 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[]={
To use them, simply call uView.setFontType(7); in your sketch and print as normal.

By Schema
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:
Code: Select all
if ((c<fontStartChar) || (c>(fontStartChar+fontTotalChar-1)))		// no bitmap for the required c
to this:
Code: Select all
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: )