diff options
-rw-r--r-- | a8xd.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -16,7 +16,7 @@ const char *byte_format = "%02x"; int verbose = 0, color = 1, disp_offset = 0, maxlen = 0; int seek_whence = 0, seekpos = 0, filepos = 0, limit = 0; -int graphics = 0; +int graphics = 0, screencodes = 0; const char *self; @@ -161,6 +161,16 @@ char *get_graphics(unsigned char c) { return result; } +unsigned char screen2ata(unsigned char c) { + unsigned char c7 = c & 0x7f; + + if(c7 < 0x40) + return c + 0x20; + if(c7 >= 0x40 && c7 < 0x60) + return c - 0x40; + return c; +} + void fake_seek(FILE *input) { char junkbuf[1024]; int pos = 0, chunksize; @@ -212,6 +222,7 @@ void dump_line(const unsigned char *buf, int len) { while(len) { c = *buf; + if(screencodes) c = screen2ata(c); inv = !graphics && (c & 0x80); if(color) hpos += sprintf(hex + hpos, "%s", get_color(c)); @@ -283,7 +294,7 @@ int main(int argc, char **argv) { exit(0); } - while( (opt = getopt(argc, argv, "vhimus:o:l:g")) != -1) { + while( (opt = getopt(argc, argv, "vhimus:o:l:ga")) != -1) { switch(opt) { case 'v': verbose = 1; break; case 'h': print_help(); exit(0); break; @@ -294,6 +305,7 @@ int main(int argc, char **argv) { case 'o': disp_offset = parse_offset_arg(optarg); break; case 'l': limit = parse_limit_arg(optarg); break; case 'g': graphics = 1; break; + case 'a': screencodes = 1; break; default: print_help(); exit(1); break; } } |