From b2cad8050e2077f09535607a829183a842023da7 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 22 Sep 2017 16:09:17 -0400 Subject: initial commit --- dumpfont.pl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 dumpfont.pl (limited to 'dumpfont.pl') diff --git a/dumpfont.pl b/dumpfont.pl new file mode 100755 index 0000000..2d2e448 --- /dev/null +++ b/dumpfont.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w + +use bytes; + +# dump rom as 4-color bitmap, each byte is 4 pixels wide +$/ = \1; +$addr = 0x8000; +#@chars = (" ", "X", "o", "."); +@chars = ("\x1b[30;40m ", "\x1b[30;42m ", "\x1b[30;41m ", "\x1b[30;47m "); + +$start = hex(shift) || 0x950a; +$end = hex(shift) || 0x9641; +@ARGV="defender.rom" unless @ARGV; + +my $pos = 0; +my $count = 0; +while(<>) { + my $str = ""; + my @pairs; + my $byte = ord($_); + my $tmp = $byte; + for(my $i = 0; $i < 4; $i++) { + my $pixel = $tmp & 3; + $str = $chars[$pixel] . $str; + $str = $chars[$pixel] . $str; + $tmp >>= 2; + } + $str .= "\x1b[0m"; + if($addr >= $start && $addr <= $end) { + printf "%04x: %02x |%s|\n", $addr, $byte, $str; + $count++; + print ("\n"), $count = 0 if $count == 8; + } + $addr++; +} -- cgit v1.2.3