]> git.zerfleddert.de Git - 32620_extract/commitdiff
cleanup chipselect
authorMichael Gernoth <michael@gernoth.net>
Sat, 5 Sep 2020 19:32:03 +0000 (21:32 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sat, 5 Sep 2020 19:32:03 +0000 (21:32 +0200)
extract.c

index 79fd4233036f07d1c2db4f4121671974474f6b06..7d7c9d1987113a0531c4a131168d6254f2bb65f2 100644 (file)
--- a/extract.c
+++ b/extract.c
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
 {
        uint8_t header[64];
        uint32_t adrs[(64/3)+1] = { 0 };
-       uint8_t last_cs = 0;
+       uint8_t cs2 = 0;
        int fd;
        int r;
        int i;
@@ -74,19 +74,18 @@ int main(int argc, char **argv)
                uint32_t adr;
 
                lo = header[i];
-               if ((header[i+2] & 0xf8) & 0x40) {
+               hi = header[i+1] & 0x1f;
+
+               //!EOF ?!
+               if ((header[i+2] & 0xf8) != 0xf8)
+                       cs2 = header[i+2] & 0xf8;
+
+               if (cs2 & 0x40) {
                        cs = ((header[i+1] & 0xe0) >> 5) - 2;
                } else {
                        cs = (((header[i+1] & 0xe0) >> 5) | (1 << 3)) - 4;
                }
 
-               //EOF?!
-               if ((header[i+2] & 0xf8) == 0xf8)
-                       cs = last_cs;
-               else
-                       last_cs = cs;
-
-               hi = header[i+1] & 0x1f;
                amp = header[i+2] & 0x3;
 
                adr = ((hi << 8) | lo) + (cs * 8192);
Impressum, Datenschutz