]> git.sur5r.net Git - cc65/blobdiff - util/gamate/gamate-fixcart.c
conio and most other stuff working now
[cc65] / util / gamate / gamate-fixcart.c
diff --git a/util/gamate/gamate-fixcart.c b/util/gamate/gamate-fixcart.c
new file mode 100644 (file)
index 0000000..a994838
--- /dev/null
@@ -0,0 +1,25 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+unsigned char buffer[512 * 1024];
+unsigned len;
+FILE *in, *out;
+int n, i;
+
+int main(int argc, char *argv[]) {
+    if (argc < 3) {
+        exit(-1);
+    }
+    in = fopen(argv[1], "rb");
+    out = fopen(argv[2], "wb");
+    len = fread(buffer, 1, 512 * 1024, in);
+    n = 0; for (i = 0x1000; i < 0x2000; i++) {
+        n += buffer[i];
+    }
+    buffer[0] = n & 0xff;
+    buffer[1] = (n >> 8) & 0xff;
+    fwrite(buffer, 1, len, out);
+    fclose(in);
+    fclose(out);
+}