Fonts for PicoMite on the PicoCalc

I created a few fonts a while back which I forgot to share. I was thinking about how an 8x8 font would perfectly fit on the PicoCalc screen at 40 character wide by 40 characters tall, rather than the more awkward default font for the console and editor which is at 8x12 or 40 characters wide by 26 (and some extra unused space) characters tall.

Originally I thought it might be interesting to use this as the default font, but that would require a fair bit of work since there are a lot of asumptions made that the default font will be 8x12, and I’m not sure it’s worth it just to fit a few more (14) characters vertically. It also makes the special extended symbols look worse since they often depend on the full 8x12 pixel grid to look descent.

This all started when I noticed @tabemann’s 5x8 font for zeptoforth and decided to adapt it to PicoMite, as seen below. I didn’t create the special extended symbols for it given the character size, so it’s only the usual 95 characters. It was interesting to me since it fits 64 character columns by 40 character rows on the PicoCalc display. I originally considered it might be a good default font, but it’s rather small, and my eyes are getting old. (Not to mention the lack of extended characters.)

' simple_font_5x8.bas
' Font type    : Full (95 characters)
' Font size    : 5x8 pixels
' Memory usage : 479 bytes
' Font adapted from: https://github.com/tabemann/zeptoforth/blob/picocalc-devel/extra/common/simple_font_5x8.fs

DefineFont #10
  5F200805 00000000 40082100 80520010 03000000 0030CF3C 30ED9865 47884F00
  A62200C8 2100B8C8 00000000 08821011 22044100 3E210020 010080A8 0010F209
  08000000 E0000080 00000000 11001000 00408408 30A9AD64 42282300 8464007C
  640078C8 00304984 10E22923 C120F400 A1640070 F00030C9 00204488 30C92403
  E1A46400 08000070 00001000 00110008 10041101 071C0000 08020000 64002022
  00104084 3068AD64 E9A56400 B9E40048 64007029 003009A1 602A25C5 083DF400
  3DF40078 64004008 003069A1 4829BD94 42087100 84100038 95003029 00488A31
  78082184 29AD9700 B5960048 6400486B 003029A5 40C8A5E4 29A56400 A5E44030
  640048CA 00304990 104208F1 29A59400 A4940030 940010C6 00306FA5 48C51895
  42989400 88F00010 72007888 00388410 08421082 21847000 24230038 00000000
  00780000 00008822 EB040700 39840028 03007029 00300925 38299D10 E8250300
  3C320038 03002084 80092725 48293984 42182000 18200078 84001342 00488AA9
  188410C2 5A350000 290000D4 000048A9 00302919 422E3900 271D0000 29004008
  030040A8 0070C1A0 10841047 2B250000 22000028 000010A5 00306725 48C62400
  A2240000 3C000022 0100786C 00188491 10420801 62080600 19000060 00000053
End DefineFont

print "simple_font_5x8"
font 10, 1
for i = 32 to 126
  if i mod 16 = 0 then print
  print chr$(i);
next i
print

This 8x8 font was mostly adapted from a font I found on github, but I did some custom work on a few of the characters and I created a lot from scratch, most notably the extended characters to bring it to the full 255 set. The original default PicoMite 8x12 font still does a better job with those extended characters, but this would at least work if you want to have 40 rows and 40 columns of characters.

' font-8x8new.bas
' Font type    : Full (224 characters)
' Font size    : 8x8 pixels
' Memory usage : 1796 bytes
' Font adapted from: https://github.com/idispatch/raster-fonts/blob/master/font-8x8.c

DefineFont #10
  E0200808 00000000 00000000 18181818 00180018 006C6C6C 00000000 6CFE6C6C
  006C6CFE 7CC07E18 0018FC06 18CCC600 00C66630 76386C38 0076CCDC 00603030
  00000000 3030180C 000C1830 0C0C1830 0030180C FF3C6600 0000663C 7E181800
  00001818 00000000 30181800 7E000000 00000000 00000000 00181800 30180C06
  0080C060 F6DECE7C 007CC6E6 18183818 007E1818 7C06C67C 00FEC0C0 3C0606FC
  00FC0606 CCCCCC0C 000C0CFE 06FCC0FE 007CC606 FCC0C07C 007CC6C6 0C0606FE
  00303018 7CC6C67C 007CC6C6 7EC6C67C 007C0606 00181800 00181800 00181800
  30181800 6030180C 000C1830 007E0000 0000007E 060C1830 0030180C 180C663C
  00180018 DEDEC67C 007EC0DE C6C66C38 00C6C6FE FCC6C6FC 00FCC6C6 C0C0C67C
  007CC6C0 C6C6CCF8 00F8CCC6 F8C0C0FE 00FEC0C0 F8C0C0FE 00C0C0C0 C0C0C67C
  007CC6CE FEC6C6C6 00C6C6C6 1818187E 007E1818 06060606 007CC606 F0D8CCC6
  00C6CCD8 C0C0C0C0 00FEC0C0 FEFEEEC6 00C6C6D6 DEF6E6C6 00C6C6CE C6C6C67C
  007CC6C6 FCC6C6FC 00C0C0C0 C6C6C67C 067CDED6 FCC6C6FC 00C6CCD8 7CC0C67C
  007CC606 181818FF 00181818 C6C6C6C6 00FEC6C6 C6C6C6C6 00387CC6 C6C6C6C6
  006CFED6 386CC6C6 00C6C66C 7CC6C6C6 00E03018 180C06FE 00FE6030 3030303C
  003C3030 183060C0 0002060C 0C0C0C3C 003C0C0C C66C3810 00000000 00000000
  FF000000 386C6C38 00000000 067C0000 007EC67E FCC0C0C0 00FCC6C6 C67C0000
  007CC6C0 7E060606 007EC6C6 C67C0000 007CC0FE 7830361C 00783030 C67E0000
  FC067EC6 C6FCC0C0 00C6C6C6 18380018 003C1818 06060006 7CC60606 D8CCC0C0
  00C6CCF8 18181838 003C1818 FECC0000 00D6D6FE C6FC0000 00C6C6C6 C67C0000
  007CC6C6 C6FC0000 C0C0FCC6 C67E0000 06067EC6 C6FC0000 00C0C0C0 C07E0000
  00FC067C 187E1818 000E1818 C6C60000 007EC6C6 C6C60000 00387CC6 C6C60000
  006CFED6 6CC60000 00C66C38 C6C60000 FC067EC6 0CFE0000 00FE6038 7018180E
  000E1818 00181818 00181818 0E181870 00701818 0000DC76 00000000 6C381000
  00FEC6C6 818181FF FF818181 858581FF FF8191A9 99A581FF FF81A599 998181FF
  FF818199 818181FF FF81BD81 999981FF FF819981 A59981FF FF818989 FED6FE7C
  7CFEEED6 82AA827C 7C8292AA FE7C3810 0010387C FE387C38 7C1010FE 7E3C1800
  7E187EFF FEFEFE6C 0010387C BD99C3FF FFC399BD 3C180000 0000183C 303E323E
  60F07030 187E3C18 183C7E18 FF662400 00002466 187E3C18 00181818 18181818
  00183C7E FE0C0800 00080CFE 7F301000 0010307F 92541000 007C8282 BA824438
  38003854 3C001818 1818183C D3BFCEFC FFF395E5 42422418 24247E7E 7E7E3C18
  24247E7E E5E96224 2462E9E5 3B4B4B3F 000B0B0B 6648447E 60502824 3C1E3621
  10101BFE AA824438 384482AA 9A924438 3844929A BA824438 384482BA 48483000
  0103063C 207C201C 1C207C20 8142261A 7E424242 FE283800 7C444444 42663C00
  00242466 8282FE00 7C38FE82 38383810 00100010 83415628 20100CFE 4A4A4830
  0002324A 7E662418 38183818 FF00FF00 FF00FF00 55555555 55555555 3333CCCC
  3333CCCC 92244992 49922449 AA55AA55 AA55AA55 B6DB6DB6 6DB6DB6D 18181818
  18181818 18181818 181818F8 18F81818 181818F8 36363636 363636F6 00000000
  363636FE 18F80000 181818F8 06F63636 363636F6 36363636 36363636 06FE0000
  363636F6 06F63636 000000FE 36363636 000000FE 18F81818 000000F8 00000000
  181818F8 18181818 0000001F 18181818 000000FF 00000000 181818FF 18181818
  1818181F 00000000 000000FF 18181818 181818FF 181F1818 1818181F 36363636
  36363637 30373636 0000003F 303F0000 36363637 00F73636 000000FF 00FF0000
  363636F7 30373636 36363637 00FF0000 000000FF 00F73636 363636F7 00FF1818
  000000FF 36363636 000000FF 00FF0000 181818FF 00000000 363636FF 36363636
  0000003F 181F1818 0000001F 181F0000 1818181F 00000000 3636363F 36363636
  363636FF 18FF1818 181818FF 18181818 000000F8 00000000 1818181F FFFFFFFF
  FFFFFFFF 00000000 FFFFFFFF F0F0F0F0 F0F0F0F0 0F0F0F0F 0F0F0F0F FFFFFFFF
  00000000 DC760000 0076DCC8 786C6C38 606C666C C0C6FE00 00C0C0C0 6CFE0000
  006C6C6C 183060FE 00FE6030 D87E0000 0070D8D8 66666600 C0607C66 18DC7600
  00181818 663C187E 7E183C66 FFC3663C 003C66C3 C3C3663C 00E76666 7E0C180E
  007CC6C6 DB7E0000 00007EDB DB7E0C06 C0607EDB F8C06038 003860C0 CCCCCC78
  00CCCCCC 7E007E00 00007E00 187E1818 007E0018 30183060 00FC0060 30603018
  00FC0018 2C504844 1E088452 2C544844 04049E54 7E001818 00181800 00DC7600
  0000DC76 000C1818 00000000 18000000 00000018 00000000 00000018 0C0C0C0F
  1C3C6CEC 6C6C6C78 0000006C 607C0C7C 0000007C 3C3C0000 00003C3C E73C5A99
  995A3CE7 
End DefineFont

print "font-8x8new"
font 10, 1
for i = 32 to 255
  if i mod 16 = 0 then print
  print chr$(i);
next i
print

I was reminded of these when I posted the Pico8 font I adapted over on this other thread…

It’s so ridculously tiny, but it’s proven itself to be useful in Pico-8, and it’s arguably the smallest legible font on the PicoCalc, at least if you have very good eyes or a way to magnify the screen.

' pico8.bas
' Font type    : Full (96 characters)
' Font size    : 4x6 pixels
' Memory usage : 292 bytes
' Font adapted from: https://www.lexaloffle.com/bbs/?tid=3760

DefineFont #10
  60200604 44000000 00AA4040 A0AEAE00 A2406EEC EACCA048 000048E0 42408848
  E4A44022 00E404A0 00800400 000000E0 80442440 C4E0AAEA E8E2E044 E062E2E0
  E820E2AA EAE8E0E2 2022E2E0 EAE0EAEA 040420E2 80040400 0E208424 2484000E
  4060E280 4A60A84A CAEAA0EA 608868E0 E8E0AACA C8E8E0C8 E08A6880 E4A0EAAA
  44E4E044 A0CAAAC0 EEE08888 AACAA0AA C0AA6AA0 4A80E8EA CAEA60AC C0E268A0
  AA4044E4 AEAA60AA E0AEAA40 AAA04AAA 48E2E0E2 C088C8E0 62204484 004A6022
  E0000000 0E000042 CA0CA0AE E0880EE0 0EC0AA0C C80EE0C8 E08A0E80 0EA0AE0A
  440EE044 A0CA0AC0 0EE08808 AA0CA0EA C0AA06A0 0480AE0E AC0E60AC C08206A0
  0A40440E AE0A60AA E0AE0A40 0AA04A0A 280EE0E2 60C464E0 C4404444 802EC064
  E0AA0400 
End DefineFont

print "pico8"
font 10, 1
for i = 32 to 127
  if i mod 16 = 0 then print
  print chr$(i);
next i
print

This got me thinking, would it hard to make custom fonts to do color petscii art for mmbasic programs?

The difficulty is kind of … relative and subjective.

For the fonts I made, I spent a fair bit of time using FontTweak (and cursing its user experience issues) manually turning individual pixels on and off. (By the way, FontTweak is a Windows appplication, so that may be an issue too. Seems to be pretty standard WIn32 looking stuff, so it may work with Wine, but I haven’t tried that.) So it can be tedious and probably isn’t for everyone. That said, it’s not difficult as much as it is mindnumbing boring. And it does make it pretty easy to do some simple and useful transformations (mirror/flip/etc.) :wink:

I’m not sure how the default font in PicoMite compares to PETSCII, but there’s definitely overlap with many of the extended characters. So you might be able to copy the default font #1 and then throw out the non-PETSCII stuff, and use those slots to create what is missing. I’m not sure the default number of charactrers would be enough to contain all of it though. So that means there would be other choices… Do you also toss out letters? Or instead, do you simply use the PETSCII characters in the default font #1 and create a new font to supply only the missing characters? And what would be the best/sanest way to map all that out? Is it important to be able to port existing code referring to the characters, or do the original codes and ordering not matter except to just have some idea of what is where?

Anyhow, here’s the default PicoMite font, grabbed from the manual:

1 Like

Thank you for the detailed reply. I don’t necessarily need petscii per se. I’ve received my picocalc and would like to make a game with a little production value. I’m trying to figure out my options to make splash screens, cut scenes, menus, stat screen etc using the text based options.

My Basic knowledge caps out at with the TI-83 functions. I’m still reading through the picomite manual and just got to the embedded fonts section :slightly_smiling_face:.

1 Like

I need to do another update to this, but check out some of the links to github projects, forum posts, and where included the embedded source code here:

There are lots of examples of text mode games that have been ported from classic BASIC programs, and some new ones as well. Most of the graphics examples I’ve found have been mathematical “art” plots or animations, but the graphics functions of MMBasic seem powerful enough to do some nice things in full color on the 320x320 PicoCalc display. I’m not sure how well it can handle a 30+ FPS “arcade” game in PicoMite, but I imagine plenty of older, turn/choice based classic BASIC games could be “modernized” with graphics and sounds (by playing MP3 files for sound effects and/or music). Something I’ve been considering myself is taking the ported Drug Wars text mode game and re-creating the Palm UI (which coincidentally scales perfectly to 320x320) for a more modern interface. The original port required a touchsceen, but with some tweaks I think it could be adapted to arrows for selection and enter/esc (or maybe enter/backspace) for select and cancel. Still might be a nice way to get some extra quality of life features like maxing out purchases instead of having to type in amounts every time, and it would just offer an alternative, yet still retro, interface. Could also “port” some of the newer features over like extra drugs and so on.

The more action oriented (higher frame rate rquiring, and less turn-based) games on TheBackShed seem to all require a lot of code features available only on HDMI/VGA/USB devices. It’s possible to port these over with rewrites of the input handling, sound/music handling, and some display tweaks (since most weren’t meant for LCD displays, not to mention the 320x320 display size instead of the seemingly expected 640x480 or higher display size.) I haven’t gotten around to experimenting with these yet, but I plan too.

You might be interested in this space invaders clone:

Should be possible to get it mostly running by ripping out all the input code and unsupported hardware commands, and then you’d need to get it working with proper PicoCalc keyboard input. While not a text based game, per se, it uses the old arcade style of character based displays instead of drawing pixels and sprites. I haven’t found any nice simple examples of games that could be adapted to the PicoCalc and used as a template for new games, but this one seems somewhat more organized than most.

1 Like

I forgot to tag this in the PicoCalc category, so… I just did that. :slight_smile:

I noticed the missing tag, but wasn’t sure if it was something you could change after posting.

I borrowed your code and made a simple font viewer

'fontview.bas to view fonts and sizes
Print "font viewer"
Input "font number 1 - 16:", fontid
Input "font size 1 - 8:", fontsize

Font fontid, fontsize
For i = 32 To 255
  If i Mod 16 = 0 Then Print
  Print Chr$(i);
Next i
Print

I’m working to figure out how to make a program that can load up text art and color from a file like ANSI on an old BBS. Would a program that loads text files into an array then running the array through a loop of the Text command be a reasonable approach?

One some of the questions you posed on the 6/15 about dealing with missing characters, or two fonts I’m still not really sure, once I figure a bit more how to work with making the output I’ll try and figure out a scheme.

Do you know if DefineFont can supports characters added to the range of chr$( 0 - 31 )?

Nice – that was smart to break out the font viewer code. :slight_smile:

Although I haven’t used them yet, you may want to look into using LONGSTRING and the related functions for manipulating large string data. (There’s a section on page 80 of the manual, along with the commands and other references scattered around.) The limitations on regular strings might be too much to do what you want to do, especially if you’re working with entire screens of text, or even multiple screens if scrolling.

It’s been a while since I messed with ANSI stuff, but maybe you could write a parser that reads in ANSI from a text file and then decodes it and shows the proper character and color(s) to match? I’d have to look into the ANSI encoding format, but I’m not sure if it would be better to treat it as binary data or as string data. You’d want to be able to get the character code you need as well as the foreground color and background color (both colors were stored separately in ANSI, right? I’m just going from vague memories here…) Once you got the character and the color info then you could draw that on the PicoCalc display however you like, either using text mode (probably the easiest) or graphics mode with TEXT calls. Pretty sure there was a limited color pallette to ANSI as well, so that’s probably helpful.

So I think I’d personally try to decode the ANSI data first, and once I could get the character codes out and colors codes, then think more about how to display them. According to one reference I looked at, ANSI characters exist from 128-159 and 160-255. So it seems like they’d fit with the regular ASCII characters from 0-127? The font would need to be changed to match for some of them, I’m sure, but it seems like there’s enough space at least for DOS/Windows ANSI. Extended characters on some other “retro” computing platforms might take up more space though and not entirely fit in one font (or maybe they could at the expense of regular ASCII characters).

I’m not sure what the limitations on DefineFont are… Technically those lower characters are non-printable control codes, but I don’t think there’s anything preventing it from assigning characters to 0-31. I haven’t seen examples though, and none of the built in fonts (including the default editor font) assign anything to 0-31. So… it might work? Nothing horrible should happen if it doesn’t – I’m guessing it would throw some kind of error.

Is it possible to load a font from a file with the PicoCalc?

In the MMBasic 4.5 manual, there’s a command:

FONT LOAD file$ AS [#]nbr

…but I don’t see it in the PicoMite Ver 6.00.02 manual.

Is there a way to load a font file?
Or does all code and resources need to be in one single file?

Apologies, if I just need to read the documentation more closely! I will take a short walk, reheat my cup of coffee and have another go…

I haven’t looked at the MMBasic manual, but I don’t remember seeing any mention of loading fonts from a file on PicoMite, so it was probably one of the things they removed. I’ve only ever seen examples of font usage with the definition included in the .bas file.

It might have been something they decided to do given then limited memory on the Pico platform. For other platforms it might make more sense to keep fonts loaded in memory across program runs?

Something I’ve considered, but I’m not sure is a good idea… Are all the default (built in) PicoMite fonts actually useful on PicoCalc? Some are meant for much larger HDMI and VGA displays. It would break compatibility with the main PicoMite build, but it might make sense to consider deleting some of the default fonts and replacing them with smaller, or more suitable fonts for the PicoCalc. Breaking compatibility seems like a bad idea since documentation would be wrong, but on the other hand we wouldn’t be wasting space with fonts that may never be used on the PicoCalc. They dont take up a ton of space anyway, but it seems like it might be nice to have other small legible font options, or maybe more graphical font options like the extended Commodore symbols and so on.