Quick iPXE script:
params && param vram ${vram} && chain -a http://b800.org##params && echo b800.org/${b800id} usage detailsConverting raw B800 vram to human readable format
See The technical page for information about the raw format.Example using awk converting B800 to text:
awk '{
# loop over chars, skip attribute
for(i=1;i<=length;i+=2) {
printf substr($0, i, 1);
# after column 80 end the line
if(i%160 == 159) print ""
}
}' | iconv -f CP437 -t UTF-8
Example using awk converting B800 to ansi:
awk '{
# Color conversion table, Ansi only have 7 colors + intensity but bit 1 and 3 is switched between ansi and b800
_c[0]=0; # black ==
_c[1]=4; # blue 001 vs 100
_c[2]=2; # green ==
_c[3]=6; # cyan 011 vs 110
_c[4]=1; # red 100 vs 001
_c[5]=5; # magenta ==
_c[6]=3; # yellow 110 vs 011
_c[7]=7; # white ==
# initialize conversion table from char to number
for(i=0;i<=255;i++)
_ord_[sprintf("%c",i)]=i;
oattr=-1
# loop over chars, skip attribute
for(i=1;i<=length;i+=2) {
# the first char is data the other is attribute
attr=_ord_[substr($0, i+1, 1)];
# if attr changed create new ansi code
sgr=""
if(oattr!=attr) {
oattr=attr;
# create basic ansi code for (foreground 30-37, background 40-47) colors from attribute
# extract them bitwise, convert to ansi colors and add the right base number
sgr=(_c[and(attr, 0x7)] + 30) ";" (_c[rshift(and(attr, 0x70), 4)] + 40);
# check the high intensity for foreground and prepend to ansi sequence
if(and(attr, 0x8)) sgr="1;" sgr;
# check for blink from background and prepend to ansi sequence
# some b800 implementations show this as high intensity background instead
if(and(attr, 0x80)) sgr="5;" sgr;
# Ansi escape char followed by ansi reset and the rest defined above
sgr="\x1b[0;" sgr "m";
}
# print Ansi code if set followed by the printable char
printf sgr substr($0, i, 1);
# after column 80 end the line (reset ansi)
if(i%160 == 159) {
printf "\x1b[0m\n";
# since we reset ansi we need to reset attr as well so we get a new on next line
oattr=-1
}
}
}' | iconv -f CP437 -t UTF-8