Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert XGP fonts to... something modern #87

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ lodepng.c
tito
dart
od10
font
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 $@

Expand Down
72 changes: 72 additions & 0 deletions font.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* Copyright (C) 2021 Lars Brinkhoff <lars@nocrew.org>

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 <http://www.gnu.org/licenses/>. */

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#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;
}