Jump to content

Tools: Fnt2Data Font Converter (Atari 8-bit)


Torq

122 views

FNT2DATA - Converts Atari 8-bit .FNT files to data blocks for various Assemblers

 

As I started my thinking around how I would build "The Woebegone Trail" (my homebrew homage to "The Oregon Trail"), it quickly became apparent that I would be doing a lot of work with custom character sets (both as actual readable character sets, and as "tiles" for ANTIC MODE 4 displays).  Creating those is one thing, which I'll come back to below, but using them is another matter entirely.  And I wasn't (still aren't, at least not 100%) sure whether I'd be loading them from "disk" or "files" as needed, or just putting them inline with my source code.

 

I was already aware of a number of tools that could output character sets/.FNT files (mine, and those created by others), but there were some specific capabilities, and behavior I wanted, as well as needing it to run natively under macOS, so I decided to spend a few hours to create exactly the tool I wanted for this.

 

That resulted in this tool, "fnt2data", which can do two primary things:

 

1. Display the character set in a .FNT file on the terminal - at various numbers of characters per line, and with or without bounding boxes (for when characters are not 6x6 ... since I often used to do 8x7 and add a blank scan-line or two to my Display List for vertical spacing:

 

image.thumb.png.f9fa8dd383bc74d4c9a61cbb8b642411.png

 

This was an ability I wanted so I could quickly explore existing .FNT files, without having to run visual/GUI applications and navigate file structures, to get a quick/dirty look at the thing from the terminal.  

 

---

 

2. Convert a .FNT file into data statements/directives for various Assemblers - (.BYTE, .HE, dat) and for Atari BASIC (DATA), using various number formats, separators and, again, number of characters per line:

 

Usage: fnt2data.py convert [OPTIONS] COMMAND [ARGS]...

  Convert .FNT file to data statements for various Assemblers.

Options:
  --help  Show this message and exit.

Commands:
  atari  Convert .FNT file to .BYTE statements for the Atari Assembler.
  atasm  Convert .FNT file to .BYTE statements for the ATASM Assembler.
  basic  Convert .FNT file to DATA statements for Atari BASIC.
  ca65   Convert .FNT file to .BYTE statements for the CA65 Assembler.
  mac65  Convert .FNT file to .BYTE statements for the OSS MAC/65 Assembler.
  mads   Convert .FNT file to .BYTE/.HE/DTA statements for MADS Assembler.

 

To yield output like (truncated ... just for illustration):

 

.BYTE $00, $00, $00, $00, $00, $00, $00, $00, $3C, $3C, $3C, $3C, $00, $3C, $3C, $00
.BYTE $EE, $EE, $EE, $00, $00, $00, $00, $00, $74, $FE, $FE, $FE, $74, $FE, $74, $00
.BYTE $10, $FE, $FE, $F0, $FE, $02, $FE, $10, $F3, $F6, $BC, $FF, $3F, $6D, $CF, $00
.BYTE $F8, $F8, $F8, $F2, $7E, $F2, $FE, $00, $3C, $3C, $3C, $00, $00, $00, $00, $00
.BYTE $3E, $7E, $FE, $F0, $F0, $70, $3E, $00, $F8, $FC, $FE, $1E, $1E, $1C, $F8, $00
.BYTE $00, $3C, $FF, $7E, $FF, $3C, $00, $00, $00, $3C, $3C, $FF, $FF, $3C, $3C, $00
.BYTE $00, $00, $00, $00, $00, $00, $3C, $78, $00, $00, $00, $FE, $FE, $00, $00, $00
.BYTE $00, $00, $00, $00, $00, $00, $3C, $00, $07, $0F, $1F, $3E, $7C, $F8, $F0, $00

...

 

Or, as I'm likely to do it, using the .HE directive in MADS:

 

.HE 00 00 00 00 00 00 00 00 3C 3C 3C 3C 00 3C 3C 00
.HE EE EE EE 00 00 00 00 00 74 FE FE FE 74 FE 74 00
.HE 10 FE FE F0 FE 02 FE 10 F3 F6 BC FF 3F 6D CF 00
.HE F8 F8 F8 F2 7E F2 FE 00 3C 3C 3C 00 00 00 00 00
.HE 3E 7E FE F0 F0 70 3E 00 F8 FC FE 1E 1E 1C F8 00
.HE 00 3C FF 7E FF 3C 00 00 00 3C 3C FF FF 3C 3C 00
.HE 00 00 00 00 00 00 3C 78 00 00 00 FE FE 00 00 00
.HE 00 00 00 00 00 00 3C 00 07 0F 1F 3E 7C F8 F0 00

...

 

And since I may do some quick experiments on such things in BASIC, I wanted it to be able to output DATA statements, and fit as many bytes into each as possible, so it has that ability too (as well as being able to deal with Assemblers that require line numbers, such as the Atari Assembler Editor and MAC/65).

 

Hope it's useful ...

 

Character Set Editing

 

I spent a good deal of today, and a chunk of yesterday looking at various character set editor programs, including those native to the Atari 8-bit computers, various non-Atari specific macOS and Windows character/tile/map editors.  None work exactly as I want them too.  The closest was the "SFONTPLS.BAS" (SuperFont+) tool from Compute's "Third Book of Atari Graphics" (scroll down to the listing and there's a link to download the .BAS file), which is Atari 8-bit native.  "Graph2Font", which I expect many here are familiar with, looks like it'll be very useful, also, but (so far) it works to do the opposite of what I want (which may just require more experimentation on my part).

 

So, I may wind up working in one of my iPad-based (pencil interface) pixel-editors, then pushing the bitmap to something like Graph2Font, or just my own slicer/tiler, and then using non-Atari specific tileset editor/mappers.  We'll see ... and I'll cover the specifics in my "Woebegone" DevLogl

 

Very much open to other ideas here ... 

 

But I am very much inclined, after I get done with this project to build a macOS native retro-character/graphics/tileset/map editor.  Which is about the 4th major retro-computing project I've come up with since deciding to go down this path ... so it may be a while ...

 

 

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...