From 2300d2813a524cbfeabac794335e7abe99263df6 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 29 Dec 2015 23:10:50 -0500 Subject: initial commit --- convfont.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 convfont.c (limited to 'convfont.c') diff --git a/convfont.c b/convfont.c new file mode 100644 index 0000000..a2a2418 --- /dev/null +++ b/convfont.c @@ -0,0 +1,146 @@ +#include +#include +#include + +#include +#include + +/* usage: + # extract the 1K atari ROM font: + dd if=atariosb.rom of=romfont bs=256 skip=8 count=4 + + # extract the Apple II Taipan font: + dd if=taipan.dsk of=font bs=256 skip=54 count=3 + + # create the Atari 8-bit Taipan font: + cat romfont font | ./convfont > taifont.raw + + # or, create the Atari 8-bit Taipan font as a binary load: + cat romfont font | ./convfont -x > taifont.xex + */ + +/* + taipan font file order: + 0-31: `a-z{|}" block + 32-63: @A-Z[\]^_ + 64-95: space !"#$%&'()*+,-./0-9:;>== 0); +} + +void clear0bits(unsigned char *b, int lim) { + do { + *b++ &= 0xfe; + } while(--lim > 0); +} + +int main(int argc, char **argv) { + int i, j; + unsigned char font[1024], xex[6]; + + read(0, font, 1024); + read(0, font + (96 * 8), 32 * 8); + bitswap(font + (96 * 8), 32 * 8); + read(0, font + (32 * 8), 32 * 8); + bitswap(font + (32 * 8), 32 * 8); + read(0, font + (0 * 8), 32 * 8); + bitswap(font + (0 * 8), 32 * 8); + + /* this stuff is from visual inspection via bitmapdump.pl */ + clear0bits(font + 0x1f8, 7); + clear0bits(font + 0x301, 7); + clear0bits(font + 0x308, 8); + clear0bits(font + 0x330, 8); + clear0bits(font + 0x3a0, 8); + clear0bits(font + 0x3d8, 8); + clear0bits(font + 0x3e8, 8); + clear0bits(font + 0x040, 16); + clear0bits(font + 0x1e8, 8); + + /* fix the vertical bar */ + font[0x3e0] = + font[0x3e1] = + font[0x3e2] = + font[0x3e3] = + font[0x3e4] = + font[0x3e5] = + font[0x3e6] = + font[0x3e7] = 0x18; + + /* stick ship data where it goes */ + for(i=0; shipdata[i][0]; i++) { + for(j=0; j<8; j++) { + font[ shipdata[i][0] * 8 + j ] = shipdata[i][j+1]; + } + } + + if(argc > 1) { + xex[0] = xex[1] = 0xff; + xex[2] = 0x00; xex[3] = 0xb8; /* load address $B800 */ + xex[4] = 0xff; xex[5] = 0xbb; /* end address $bbff */ + write(1, xex, 6); + } + write(1, font, 1024); + + i = open("LORCHA.DAT", O_WRONLY | O_CREAT); + write(i, shipshape, sizeof(shipshape)); + close(i); + + return 0; +} -- cgit v1.2.3