summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ariedlmayer@gmail.com>2024-11-13 08:15:14 -0500
committer AJR <ariedlmayer@gmail.com>2024-11-13 08:15:14 -0500
commitc95f345a5899f0eafca4431a2da708384eee87fd (patch)
treec3e4f8a1c0eff83ae2ddd346cf17509439ce62da
parentff4e382ca9cd0f24101604da80079decb35384d7 (diff)
formats/thom_cas.cpp: Improve handling of MO5 .k7 format
- Recognize a variant with the "DC" tag in hex rather than ASCII - Add padding for an extended block type found in Androides
-rw-r--r--src/lib/formats/thom_cas.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp
index 02bab6217fe..f6f9e317d4f 100644
--- a/src/lib/formats/thom_cas.cpp
+++ b/src/lib/formats/thom_cas.cpp
@@ -58,6 +58,8 @@ static uint8_t* to7_k7_bits;
and so, is used by emulators that bypass the BIOS routine.
It is generally hacked from the raw image more or less by hand
(in particular, to by-pass special loaders and copy-protection schemes).
+ Many of these hacks use emulator-exclusive 6809 instructions and will
+ not work in MAME.
As we run the original BIOS routine, we need to hack back the k7 file
into the original stream.
@@ -462,7 +464,8 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
size_t size = cass->image_size( ), pos = 0;
int i, sz, sz2, hbit = 0;
uint8_t typ, block[264], sum;
- int invalid = 0, hbitsize = 0, dcmoto = 0;
+ int invalid = 0, hbitsize = 0;
+ bool dcmoto = false, dcmoto_old = false;
LOG (( "mo5_k5_load: start conversion, size=%li\n", (long)size ));
PRINT (( "mo5_k5_load: open cassette, length: %li bytes\n", (long) size ));
@@ -553,7 +556,9 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
cass->image_read( block, pos, 6 );
if ( ! memcmp( block, "DCMOTO", 6 ) || ! memcmp( block, "DCMO5", 5 ) || ! memcmp( block, "DCMO6", 5 ) )
- dcmoto = 1;
+ dcmoto = true;
+ if ( block[0] == 0xdc && block[1] == 0x01 )
+ dcmoto_old = true;
/* loop over regular blocks */
while ( pos < size )
@@ -574,6 +579,12 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
pos += 5;
}
}
+ else if ( dcmoto_old )
+ {
+ cass->image_read( block, pos, 1 );
+ if ( block[0] == 0xdc )
+ pos++;
+ }
/* skip 0x01 filler */
for ( sz = 0; pos < size; pos++, sz++ )
@@ -693,7 +704,12 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
pos -= sz;
goto rebounce;
}
- if ( invalid < 10 && sz > 6 && ( (in == 0x3c && in2 == 0x5a) || (in == 0xc3 && in2 == 0x5a) || (in == 0xc3 && in2 == 0x3c) || (in == 0x87 && in2 == 0x4a) ) )
+ if ( invalid < 10 && sz > 6 &&
+ ( (in == 0x3c && in2 == 0x5a) ||
+ (in == 0xc3 && in2 == 0x5a) ||
+ (in == 0xc3 && in2 == 0x3c) ||
+ (in == 0x87 && in2 == 0x4a) ||
+ (in == 0x3c && in2 == 0x55) ) ) // Androïdes
{
/* special block found */
K5_FILL_0( 1200 );