From 0dc63cd797480a5630e54542aeb720186fbd5ce4 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Wed, 8 Sep 2021 21:38:57 +0200 Subject: [PATCH] Convert XGP fonts in KST format. --- .gitignore | 1 + Makefile | 6 ++++- font.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 font.c diff --git a/.gitignore b/.gitignore index dfc4131..a0027a5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ lodepng.c tito dart od10 +font diff --git a/Makefile b/Makefile index 6cb3809..4ba77aa 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ OBJS = pdp10-opc.o info.o dis.o symbols.o \ UTILS = cat36 itsarc magdmp magfrm dskdmp \ macdmp macro-tapes tape-dir harscntopbm palx cross \ - ipak kldcp klfedr scrmbl unscr tvpic tito dart od10 + ipak kldcp klfedr scrmbl unscr tvpic tito dart od10 \ + font all: dis10 $(UTILS) check @@ -72,6 +73,9 @@ od10: od10.o $(OBJS) libwords.a harscntopbm: harscntopbm.o libwords.a $(CC) $(CFLAGS) $^ -o $@ +font: font.o libwords.a + $(CC) $(CFLAGS) $^ -o $@ + palx: palx.o $(OBJS) libwords.a $(CC) $(CFLAGS) $^ -o $@ diff --git a/font.c b/font.c new file mode 100644 index 0000000..bd8b864 --- /dev/null +++ b/font.c @@ -0,0 +1,72 @@ +/* Copyright (C) 2021 Lars Brinkhoff + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include "dis.h" + +static int height; + +static void +character (FILE *f) +{ + int i, width, bytes, words; + word_t user, word; + + user = get_word (f); + fprintf (stderr, "USER ID: %012llo\n", user); + word = get_word (f); + if (user == 0777777777777LL && word == 0777777777777LL) + exit (0); + fprintf (stderr, "LEFT KERN,,CODE: %06llo,,%06llo\n", + word >> 18, word & 0777777); + word = get_word (f); + width = word >> 18; + fprintf (stderr, "RASTER WIDTH,,CHARACTER WIDTH: %06o,,%06llo\n", + width, word & 0777777); + + bytes = (width + 7) / 8; + words = (height * bytes + 3) / 4; + + for (i = 0; i < words; i++) + { + word = get_word (f); + fprintf (stderr, "Data: %012llo\n", word); + } +} + +int +main (int argc, char **argv) +{ + word_t word; + + word = get_word (stdin); + fprintf (stderr, "KSTID: %012llo\n", word); + word = get_word (stdin); + height = word & 0777777; + fprintf (stderr, "Column position adjustment: %03llo\n", word >> 27); + fprintf (stderr, "Base line: %03llo\n", (word >> 18) & 0777); + fprintf (stderr, "Character height: %06o\n", height); + + for (;;) + { + if (feof (stdin)) + exit (0); + character (stdin); + } + + return 0; +}