summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2021-01-22 16:22:42 +0100
committer Olivier Galibert <galibert@pobox.com>2021-01-22 16:23:11 +0100
commit2cb2bdc1a0fd5620a63f36ba3418547c95c1afcb (patch)
treedb2605ed9bd5764d692538231cd4375fba807cc7
parent9365219ff3356dc49bf818c269ed97d499365b46 (diff)
flopimg: Fix gcr checksum
-rw-r--r--src/devices/imagedev/floppy.cpp2
-rw-r--r--src/lib/formats/flopimg.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp
index 3bdf22a5f4e..98b2a1712aa 100644
--- a/src/devices/imagedev/floppy.cpp
+++ b/src/devices/imagedev/floppy.cpp
@@ -2520,7 +2520,7 @@ void mac_floppy_device::seek_phase_w(int phases)
case 0x7: // Start eject
logerror("cmd start eject\n");
- call_unload();
+ unload();
break;
case 0x9: // MFM mode on
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index 15046e45139..d6f8e00cf17 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -2912,12 +2912,14 @@ void floppy_image_format_t::build_mac_track_gcr(int track, int head, floppy_imag
uint16_t sumb = cb + vb + (suma >> 8);
cb = sumb;
vb = vb ^ ca;
- cc = cc + vc + (sumb >> 8);
+ if(i != 174)
+ cc = cc + vc + (sumb >> 8);
vc = vc ^ cb;
uint32_t nb = i != 174 ? 32 : 24;
raw_w(buffer, nb, gcr6_encode(va, vb, vc) >> (32-nb));
}
+
raw_w(buffer, 32, gcr6_encode(ca, cb, cc));
raw_w(buffer, 32, 0xdeaaffff);
}
@@ -3026,15 +3028,13 @@ std::vector<std::vector<uint8_t>> floppy_image_format_t::extract_sectors_from_tr
cb = sumb;
vc = vc ^ cb;
- if(i == 174)
- vc = 0;
-
- cc = cc + vc + (sumb >> 8);
-
sdata[3*i] = va;
sdata[3*i+1] = vb;
- if(i != 174)
+
+ if(i != 174) {
+ cc = cc + vc + (sumb >> 8);
sdata[3*i+2] = vc;
+ }
}
for(auto &e : h) {
e = nib[pos];