From 2973d0c78e9b8eed3c5af239927c6bd36af64604 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 13 Mar 2019 02:50:42 -0400 Subject: initial commit --- src/col80_modified/xbm2font.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/col80_modified/xbm2font.pl (limited to 'src/col80_modified/xbm2font.pl') diff --git a/src/col80_modified/xbm2font.pl b/src/col80_modified/xbm2font.pl new file mode 100644 index 0000000..758d57e --- /dev/null +++ b/src/col80_modified/xbm2font.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl -w + +use bytes; + +$c = 0; + +while(<>) { + next unless @bytes = (/0x([0-9a-fA-F]{2})/g); + for(@bytes) { + if(!($c % 8)) { + print " .byte "; + } + + printf "\$%02X", reverse_bits(hex $_); + + if(($c % 8 == 7) || ($c == $#bytes)) { + print "\n"; + $c = 0; + } else { + print ","; + $c++; + } + } +} + +sub reverse_bits { + my $bitstr = reverse sprintf("%08b", $_[0]); + return eval "0b$bitstr"; +} -- cgit v1.2.3