Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
06182 Core Major Always Apr 19, 2016, 16:14 Apr 24, 2016, 19:57
Tester demotester View Status Public Platform MESS (Unofficial Binary)
Assigned To etabeta Resolution Fixed OS Windows XP
Status [?] Resolved Driver
Version 0.172 Fixed in Version 0.173 Build Normal
Fixed in Git Commit Github Pull Request #
Summary MESS-specific 06182: All sets in cgenie.cpp: Crashing upon starting!
Description If start the driver with below attached "problematic" file, it will crash the MAME on starting?! (see below)

 
Steps To Reproduce mess.exe cgenie -ram 32k -cass crashfile.cas
Additional Information On Genieous 1.0.3 emu it works fine! (Note: it needs 32k of ram to work)
To load and start: SYSTEM (enter), S (enter), / (enter). (or autostart file)
Github Commit
Flags
Regression Version
Affected Sets / Systems All sets in cgenie.cpp
Attached Files
zip file icon new_test.zip (495 bytes) Apr 20, 2016, 10:59 Uploaded by demotester
Relationships
There are no relationship linked to this issue.
Notes
9
User avatar
No.12539
demotester
Tester
Apr 20, 2016, 09:59
edited on: Apr 20, 2016, 10:14
Hmm, it seems the cgenie driver do not like .cas files created on Genieous 1.0.3 emu!

One simple basic program on Genieous 1.0.3 emu: (find in attachment)

10 CLS
20 FOR I=1 TO 16
25 COLOUR I
30 PRINT I, "*************************"
40 NEXT I
50 COLOUR 1

and after saving it with CSAVE"T" on Genieous 1.0.3 emu as for ex. "test.cas", it will CLOAD on Genieous 1.0.3 emu but not on cgenie driver in MESS!? (it will crash the MESS emu on starting)

But if convert it from .cas to .wav file, it will load on cgenie driver in MESS! (it seems as the mess cgenie driver is susceptible to something regarding .cas files)
User avatar
No.12540
demotester
Tester
Apr 20, 2016, 10:41
edited on: Apr 20, 2016, 11:27
But if put problematic .cas files in soft-list, no problem - so the problem is with loading .cas files out of soft-list ! (see EDIT, this one had 255 x "AA" header removed)
(attached .cas files deleted - not needed anymore)

EDIT:
Note: If there is 255 x "AA" bytes header in a .cas file that is normally created in Genieous 1.0.3 emu, it will not work from soft-list!
User avatar
No.12541
demotester
Tester
Apr 20, 2016, 10:59
edited on: Apr 20, 2016, 17:45
Ok, I found the problem!

I have attached 2 basic .cas files created on Genieous 1.0.3 emu; one problematic and one not problematic.
The difference between 2 files is that problematic one has header with 255 x "AA" bytes, that is normally created on Genieous 1.0.3 emu, and the
not problematic has that header removed in HexEdit!

The question is why the MESS cgenie driver do not like this .cas 255 x "AA" bytes header?

(Note: The Genieous 1.0.3 emu do not has a problem when loading .cas files with or without 255 x "AA" bytes header!)

The SYSTEM file structure is very simple:

255 x "AA" bytes ... as empty header (aka leader) (Note: cg-buch1 on p60 says 256 byte "AA" leader)
66 ... signs header starting (i.e. it signs leader end)
55 ... signs the next 6 bytes is file name (also means SYSTEM file)
xx xx xx xx xx xx ... 6 bytes for file name
3C ... signs start of data block
xx ... byte signs data block size (max FF long)
yy xx ... 2 bytes signs data block loading address
data block bytes
xx ... signs checksum byte (includes data block + 2 bytes of data block loading address)
(now it repeats ... 3C ... same as above for next data block if exist, if not then 78)
78 ... signs no more data block (i.e. file end)
yy xx ... 2 bytes of program starting address

(Note: a CLOAD file has a little different structure from a SYSTEM file... after leader + 66 is reserved 1 byte for file name A - X , then basic data with no checksums and the file ends with 3 zero bytes!)
User avatar
No.12542
demotester
Tester
Apr 20, 2016, 14:28
edited on: Apr 20, 2016, 17:40
Other .cas problem findings...

Ok, there is obviously the problem when loading some .cas files in mess cgenie driver, like for example "jetset" mentioned in soft-list !
The file "jetset" contains two parts and for the part2 it is said "baddump" in soft-list !?

So I checked both parts with the Tape-Edit program (not in soft-list), that has function to check checksums of blocks and it does not report any bad block! (interesting)
Also, on Genieus 1.0.3 emu the both .cas files loads fine, but on mess cgenie driver the "jetset" part2 reports "Loading error" on counter 99 !?

For testing I converted the "jetset" part2 file from .cas to .wav and guess what, no problem when loading in mess cgenie driver ! (it loads fine w/o error)
But guess what, Genieus 1.0.3 emu reported "Loading error" with the part2 .wav file on the same counter 99 place as it was reported on mess cgenie with the part2 .cas file? (weird?)

So, the mess genie driver has problem with the "jetset" part2 as .cas file and Genieus 1.0.3 emu with the "jetset" part2 as .wav file! (both stops on 99 block counter that starts to count down from 135)
User avatar
No.12543
Tafoid
Administrator
Apr 21, 2016, 02:53
Sadly, this is expected. Last commits to that file was over 7.5 years ago, so outside of .wav file images, you'll be lucky anything works.
.cas support is commented in source (src\lib\formats\cgen_cas.cpp) as:
Current state: Not working. Only the sync signal and 0x66 byte get recognized.
Last commits to source are:
https://github.com/mamedev/mess-svn/commit/2de576eb5a7ab79c0131447adb8d5921bf3aeb64
https://github.com/mamedev/mess-svn/commit/32f501bc7ccd847ba537de7521da4e8b0b95291d
https://github.com/mamedev/mess-svn/commit/21a81715a47d30a79efec94c03e6d72a1d342696
https://github.com/mamedev/mess-svn/commit/4cc1a82402ede89e762e167949cb9e8f105f19c9

Also, sadly, the emulator you mention doesn't seem to have any sources publicly available which makes fixing this a bit more difficult
User avatar
No.12544
demotester
Tester
Apr 21, 2016, 09:33
edited on: Apr 21, 2016, 10:08
Yeah, would be fine if there is a source of mentioned emu available, but I guess below could also help to improve the cgenie .cas emu in mess:

cgtapeconvert - (source code included and according to readme.txt is in the public domain)
http://www.retrowiki.es/fororw/viewtopic.php?f=733&t=29127&sid=7db54aff5dbec069cb34e6b451937dab

Btw. I noticed that cgenie in mess does not support saving in .cas file! (only in .wav)

Now there is no reason for the postponement, is needed only goodwill. :-)
User avatar
No.12552
etabeta
Developer
Apr 24, 2016, 09:41
just a small comment to say that not saving .cas is done on purpose.
MAME only saves to .wav and not to any kind of binary tape format.

it shall be able to load the file with the leader sequence of 0xaa, though.
User avatar
No.12553
etabeta
Developer
Apr 24, 2016, 14:15
The problem related to loading .cas files starting with the leading 255 bytes 0xaa has been fixed in current GIT.
Please post other problems you might find in the driver to a separate report.

Side comment about .cas files. The problem you have experienced is yet another case of an emulation format which evolves in time and not all emulators cope with the evolution.
I think the .cas format for Color Genie tapes was originally introduced by Jurgen in his emulator. Then he stopped developing it, and the format just remained untouched until a later emulator (probably Genieous itself) started supporting the format and decided it could be wise to include the leading bytes despite the original format did not include them (they are always necessary to the system and thus they get added by emulators at loading rather than included in the file itself, likely to save some space).
Things went "bad" when nobody shared this new approach to the format with other emulators (likely because nobody else was working on cgenie emulation) and thus the files became incompatible across emulators.

It's good to be aligned, at last, anyway.
User avatar
No.12555
demotester
Tester
Apr 24, 2016, 19:57
edited on: Apr 24, 2016, 20:05
Thx for fixing .cas files problem.

Otherwise, instead of crashing when loading a wrong file format, the emu should be able to report that a loaded file is not compatible, at least!
(as it happens often, in general)

Regarding the .cas format, I guess TRS80 or Video Genie, as predecessors, should use same or similar file structure for tape .cas files. (it need to be verified)

Btw. Juergen used the.cgt extension for cas files in his cgenie dos emu, but it seems the .cgt is same as .cas! (only difference is in the file extension name)