chmem: Correct index for binary magic
authorTormod Volden <debian.tormod@gmail.com>
Thu, 18 Oct 2018 21:23:47 +0000 (23:23 +0200)
committerAlan Cox <alan@linux.intel.com>
Fri, 19 Oct 2018 18:48:44 +0000 (19:48 +0100)
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Applications/util/chmem.c

index 915a96b..4dc8443 100644 (file)
@@ -34,11 +34,11 @@ int main(int argc, char *argv[])
     fprintf(stderr, "%s: not a Fuzix binary format.\n", argv[1]);
     exit(1);
   }
-  if (buf[3] == 0x7E || buf[3] == 0x20)
+  if (buf[0] == 0x7E || buf[0] == 0x20)
     be = 1;    /* 6809 */
-  else if (buf[3] == 0x4C || buf[3] == 0x38)
+  else if (buf[0] == 0x4C || buf[0] == 0x38)
     be = 0;    /* 6502 */
-  else if (buf[3] == 0xC3 || buf[3] == 0x18)
+  else if (buf[0] == 0xC3 || buf[0] == 0x18)
     be = 0;    /* Z80 */
   else {
     fprintf(stderr, "%s: unknown Fuzix binary type.\n", argv[1]);