aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-30 04:09:29 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-30 04:09:29 -0400
commitb74ec7755a706b2b512fb83123cea56d274bee42 (patch)
treecb62c30876c0ff1f93b0e51a4a8f46129ee51db3
parent012edc2ecfb3c77707adf1c26a192fd724a66594 (diff)
downloadbw-atari8-tools-b74ec7755a706b2b512fb83123cea56d274bee42.tar.gz
a8xd: add -a (antic screencodes) option.
-rw-r--r--a8xd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/a8xd.c b/a8xd.c
index e543929..3871248 100644
--- a/a8xd.c
+++ b/a8xd.c
@@ -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;
}
}