← Preprocessor abusesOric graphics in details →
Thu 17th September 2015   
If there is one thing that can make a game look like it was professionally produced, it's definitely using a different character set than the one provided by the system.

Let's take a look at some existing games to show what I mean.

Some examples

First a recent game, Athanor, released in 2014.

Originally the game looked like that:

Athanor - System font
Athanor - System font

Nothing particularly wrong, it's a classic adventure game with a graphical view of the location on the top, and some descriptive text under it.

After some talks, the author agreed to use a different font, so I spent a bit of time to try to design a custom character set that would look more 'ancient'.

Here is the result:

Athanor - Custom font
Athanor - Custom font

It's definitely not as easy to read as the standard charset, but the point of a game is to forget normality for a while, so anything that helps the immersion will make the game feel better.

Here are some more examples of games using customized character sets:

Defence Force
Defence Force

I hope these examples will have convinced you, if not, then please go take a look at The Hobbit1 or L'Aigle d'Or2, and try to imagine how much better they would look if they had a different font.

Let's do it

There's not much to know about the character sets to be able to play with them:
6x8 font
  • each character is 6 pixels wide and 8 pixels tall
  • there are 96 displayable characters in each character set following the ASCII standard sequence
  • there are two different character sets: The STDandard one and the ALTernate one
  • the character sets are present in the Oric ROM, and copied into RAM during the boot sequence
  • the location is different in TEXT from in HIRES (to accommodate for the different screen memory size) and they are accordingly moved around when switching between the two video modes
So, knowing that the base location is $B400 in TEXT and $9800 in HIRES, and that all you have to do is to poke around to modify the graphics, you see that it's indeed very easy to do.

The magic formula is:

Address of the character=base location+(ASCII code * 8)

A simple way would be to have the character set in your program, and then just read the values and poke them in the character set area, which is indeed what many BASIC programs are doing using a DATA section.

The main problem with that is that you are wasting a lot of memory: You don't need to keep the original data after it was transferred to the character set memory area!

The easiest way to solve the problem is to just load the charset in the area in question, and that's it!

So let's say we have this very basic font on the right with the 26 uppercase letters.

Simply by using this small set of commands you can convert a PNG picture to a TAP file that can be loaded directly at the right address in memory.

%OSDK%\bin\pictconv -m0 -f0 -o2 font_6x8.png font_6x8.bin
%OSDK%\bin\header -a0 -h1 font_6x8.bin font_6x8.tap $b608

The first command uses PictConv3 to load the PNG file and convert it a headerless binary file (which could also be converted to a C or assembler source code).

The second command uses Header4 to add a TAP header specifying the load address to be $B608 (which is $B400+65*8, B400 being the base memory address, 65 the ASCII code of the letter A, and 8 the number of lines in a character).

That's it

For something as basic as using a fancy font, really that's all there is to know.

After of course you can do some more advanced things, use the two character sets at the same time to get different fonts simultaneously (or have a normal one and a BOLD or Italics one?), or even more advanced use up to four charsets simultaneously by alternating between TEXT and HIRES on the same screen.

By the time you need that, you will not need to read these tutorials anymore, you will be already a true Oric Ninja Master :)

comments powered by Disqus

Coverity Scan Build Status