Skip to content

Instantly share code, notes, and snippets.

@bes-internal
Created September 20, 2021 15:08
Show Gist options
  • Save bes-internal/df06317d426e159fdca29320897a6ab0 to your computer and use it in GitHub Desktop.
Save bes-internal/df06317d426e159fdca29320897a6ab0 to your computer and use it in GitHub Desktop.
Raw EGA data viewer
#!/usr/bin/perl
use feature 'say';
print "Content-type: text/html; charset=UTF-8\n\n";
say "<!DOCTYPE html><style>body {white-space:nowrap;line-height:0} div {width:6px;height:6px;display:inline-block;} </style> ";
# open(F,'<:raw',"CASTLE.16"); # bits 0 4 res 320
open(F,'<:raw',"ENEMY.PIC"); # bits - res 96
# open(F,'<:raw',"ARMY4.PIC"); # bits - res 96
# open(F,'<:raw',"TITL.PIC"); # bit ? res ?
# open(F,'<:raw',"YOULOSE.PIC"); # bit ? res ?
$file=join "", <F>;
foreach $b (split //, $file) {
$c=unpack("B*", $b);
# $c=~s/^(\d)\d\d\d(\d)\d\d\d/$1$2/;
$bits.=$c;
}
for $w (96) {
$i=0; $iw=0;
foreach $b (split //, $bits) {
$i++;
if ($i>$w*200*16) {next;}
$c = $b ? 155 : 0;
print "<div style='background:rgba( @{[ $c || 0 ]}, 20, 20,1 )'></div>";
$iw++; if ($iw>=$w) {print "<br>"; $iw=0;}
}
}
@bes-internal
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment