Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
07134 Media Support Major Always Oct 29, 2018, 23:09 Mar 8, 2019, 06:35
Tester Klez View Status Public Platform SDLMAME
Assigned To AmatCoder Resolution Fixed OS MacOS X
Status [?] Resolved Driver
Version 0.198 Fixed in Version 0.208 Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary MESS-specific 07134: CPC6128: Amstrad CPC6128 Floppy drive
Description Amstrad CPC 6128 floppy drive loads DSK images, but basic gives error trying to access it. The error is:
"Drive A: Read fail
Retry, Ignore or Cancel?"
(screenshot attached)

This bug is a regression, because CPC 6128 floppy drive worked perfect until MAME version 0.197, this bug happens from version 0.198 onwards.
Steps To Reproduce 1) Install a clean copy of SDLMame and the corresponding bios "cpc6128.zip"

2) Download a few Floppy DSK images to test, like Rick Dangerous or Jet Set Willy

3) Launch mame from command line with:
./mame64 cpc6128 -flop1 "roms/Rick Dangerous.dsk"

4) When the machine starts you will be in Amstrad BASIC. Type CAT
if mame is 0.198 or newer it will show an error reading floppy
if mame is 0.197 or older it will print the floppy image contents.
Additional Information
Github Commit
Flags
Regression Version 0.198
Affected Sets / Systems CPC6128
Attached Files
png file icon cpc6128-error-flop1.png (3,634 bytes) Oct 29, 2018, 23:09 Uploaded by Klez
Amstrad Basic error accessing floppy image
Klez
png file icon CatAndLoad.png (19,565 bytes) Oct 30, 2018, 17:26 Uploaded by StHiryu
Running Game Over (UK) (1987) [Original].dsk
StHiryu
jpg file icon mortadelo y filemon CAT.JPG (109,945 bytes) Oct 30, 2018, 21:43 Uploaded by Klez
Klez
jpg file icon terminator2 CAT.JPG (109,382 bytes) Oct 30, 2018, 21:44 Uploaded by Klez
Terminator 2 Judgment Day (UK) (1991) [Original].dsk
Klez
cpp file icon dsk_dsk.cpp (11,482 bytes) Oct 31, 2018, 18:02 Uploaded by AmatCoder
cpp file icon upd765.cpp (75,074 bytes) Oct 31, 2018, 23:52 Uploaded by AmatCoder
cpp file icon dsk_dsk_fixed.cpp (11,413 bytes) Nov 1, 2018, 09:48 Uploaded by AmatCoder
Relationships
There are no relationship linked to this issue.
Notes
31
User avatar
No.15660
AmatCoder
Tester
Oct 30, 2018, 03:54
edited on: Oct 30, 2018, 05:50
Can you test 0.202 (or higher) version?
I think that issue is the same reported here: https://mametesters.org/view.php?id=7081
It was fixed here: https://github.com/mamedev/mame/commit/e07b1b467f316b8460dcc3b24ca24c686cde3e20#diff-fa577dabf351d508c0b0addacc6ad448
User avatar
No.15662
Klez
Tester
Oct 30, 2018, 12:48
Unfortunately, the issue happens in all versions from 0.198 onwards, including latest official Mame v0.202 from september and current GIT as 30 october 2018 that i compiled myself. The last version that DSK was working in Amstrad CPC-6128 driver is 0.197.

Possibly related to MT07081: https://mametesters.org/view.php?id=07081 because those two particular games worked well in Mame 0.197. I don´t know why it was marked as resolved. Even public domain scene demos DSK do not load so i don´t think it´s related to particular copy protections o bad dumps.

For testing purposes i reverted your pull "dsk_dsk.cpp: sectors must be read even if it contains Deleted Mark" on my local cloned GIT and doing a full clean compile the error is the same, so it seems not related to your patch in september. The regression happened between 25 Apr (v197) and 30 May (v198).

Could be: https://github.com/mamedev/mame/commit/23045014acd8df88a44f2c019b3d11f960273a89#diff-fa577dabf351d508c0b0addacc6ad448
as noted in the comments.

More testing this afternoon.
User avatar
No.15663
StHiryu
Tester
Oct 30, 2018, 14:29
edited on: Oct 30, 2018, 15:44
The problems with the CAT instruction have been always there. Since I use mame to play amstrad games, mame always gives that error when doing CAT on disks that must be loaded with the |CPM command. The issues with some games like "Mortadelo y Filemon II" were solved in last build.

However if you put an image and you can't load it, the amstrad will give error at least until you remove the disk and restart mame. (If you take a look to some reports I've made recently, the problem occurs in the spectrum driver too).
User avatar
No.15664
Klez
Tester
Oct 30, 2018, 16:01
I never experienced any problems typing CAT to read disks in Amstrad CPC6128 before version 0.198. I am not referring to any specific titles, since all DSK images fail to CAT, even public domain scene demos. Most Amstrad DSK titles i´ve got are loaded typing CAT and then RUN "whatever".

I clean compiled again fresh GIT mame from today, with the file src/lib/formats/dsk_dsk.cpp from 25 oct 2017: https://github.com/mamedev/mame/blob/b4e8282023cb11659d1b785d3c010549c0ebfae5/src/lib/formats/dsk_dsk.cpp
and the error with DSK Amstrad floppies does not happen and working good as how were in versions 0.197 and older.

So i think this regression is caused by this commit by shatered on 9 May: https://github.com/mamedev/mame/commit/23045014acd8df88a44f2c019b3d11f960273a89#diff-fa577dabf351d508c0b0addacc6ad448
User avatar
No.15666
StHiryu
Tester
Oct 30, 2018, 17:25
edited on: Oct 30, 2018, 17:26
As I said, it's not specific titles. In amstrad there are two ways of loading disks:
1-|CPM
2-CAT, RUN"name

When you execute CAT on a dsk that needs the first method, always gives that error message. Anyway there are problems. Tried to load Game Over (UK) (1987) [Original].dsk from CPC-POWER.com in Mame 202, the CAT works but when you try to load it, the game won't run....
User avatar
No.15667
AmatCoder
Tester
Oct 30, 2018, 17:32
edited on: Oct 30, 2018, 18:44
@Klez
Which dsk files do not work?
Because '"Rick Dangerous" [CRC:75D177E0] and "Jet Set Willy" [CRC:269F0D8A] are working fine here with 0.202 version.

Can you load some dsk file commented on MT07081?
(They are "Mortadelo Y Filemon II (S) (1989) [Original]" or "Terminator 2 Judgment Day (UK) (1991) [Original]")

Edit: Are you saying that "all DSK images fail to CAT"? Definitely this is not happening with 0.202 version.
User avatar
No.15669
AmatCoder
Tester
Oct 30, 2018, 18:23
@StHiryu
"Game Over (UK) (1987) [Original].dsk" uses a protection (Speedlock version D/2.1) not supported by MAME.
User avatar
No.15671
Klez
Tester
Oct 30, 2018, 21:43
With a renewed clean install of mame 0.202 i can´t reproduce the screenshot uploaded by StHiryu, where the CPC6128 shows contents typing CAT.
The rest of titles give me the same mentioned error, like all other DSK images i´ve got.

So i can´t explain why it is not working for me and its ok in your side, even this is a clean new installation. Maybe is specefic for the macOS build, but i doubt it. For me it´s very strange that cat its working prior the commit of 9th may in dsk_dsk.cpp.

I tested with ./mame64 cpc6128 -flop1 "Mortadelo Y Filemon II (S) (1989) [Original].dsk" and the same for terminator 2, from cpc-power website and the result is the same error. I do not have a single DSK file that does not give error on CAT.

Uploaded two screenshots demostrating this.
User avatar
No.15672
Klez
Tester
Oct 30, 2018, 22:00
Even the file "Game Over (UK) (1987) [Original].dsk" with crc32 8d8e3122 gives me the cat error, i can´t understand why on your side cat listed contents of this specific disk image.
User avatar
No.15673
StHiryu
Tester
Oct 30, 2018, 22:10
edited on: Oct 30, 2018, 22:18
Well I've downloaded an official mame 202 (I was using MameUI), and tested from a clean install on a cpc6128:

@AmatCoder Sorry I was wrong and tested the english version, the spanish one (Game Over (S) (1986) [Original].dsk) worked in previous releases and it's working in mame 202: The CAT and the RUN commands runs fine.

@Klez I've tested "Mortadelo Y Filemon II (S) (1989) [Original].dsk" and works fine both CAT and RUN commands, so I suppose it's a problem on your side. Please check in your cpc6128.ini:
#
# IMAGE DEVICES
#
printout
snapshot
cassette
floppydisk1 "Z:\Descargas\Game Over (S) (1986) [Original].dsk"
floppydisk2

If you have the path of the last image loaded like in this example, delete it, save, run mame again, insert the disk image and try the CAT.
User avatar
No.15674
Klez
Tester
Oct 30, 2018, 23:06
edited on: Oct 30, 2018, 23:13
Joder Gazpacho no hay manera.

So, new clean macOS SDLmame v.202 with empty INI, CFG and NVRAM directories,

Launch directly from command line, no internal UI
./mame64 cpc6128 -flop1 "roms/Mortadelo Y Filemon II (S) (1989) [Original].dsk"

Gives error on cat, like all other DSK as the snap i took demonstrating that the DSK file is indeed correctly loaded on floppy1.
I can´t explain why it works in versions older than 0.198 and I do not have a PC for testing this in Windows.

Out of ideas
User avatar
No.15675
AmatCoder
Tester
Oct 31, 2018, 06:12
Does it work if you send the complete path (something like -flop1 "/User/Klez/Downloads/roms/foo.dsk")?
and loading from internal UI?
User avatar
No.15677
Klez
Tester
Oct 31, 2018, 13:22
edited on: Oct 31, 2018, 16:17
I tested on a old laptop and it works... so strange

Now we know that Mame (32bit) v0.202 in windows 7 this line works:
# mame32.exe cpc6128 -flop1 roms/Mortadelo Y Filemon II (S) (1989) [Original].dsk

Then i also did the same test with same laptop in Arch Linux 32 mame 0.201 wich is the avaliable version in the ARCH32 repository and works well too.

So why is not working on my mac since that specific commit shatered on 9 May ? i don´t think it´s a coincidence
User avatar
No.15679
AmatCoder
Tester
Oct 31, 2018, 18:06
I uploaded a "dsk_dsk.cpp" file with a printf command to debug the issue.
Can you compile Mame on MacOS with it and paste here (or in pastebin.com) the output?
User avatar
No.15680
Klez
Tester
Oct 31, 2018, 21:10
edited on: Oct 31, 2018, 21:51
Thanks for your interest Amat,

OK full compile from todays GITwith your patched file.

loaded with:
/Juegos/Mame> ./mame64 cpc6128 -flop1 roms/Amstrad/mortadelo.dsk

typing CAT gives the mentioned error, i´ve pressing (R) retry multiple times to create a larger console log.
read it here: https://pastebin.com/QhUwrCMq
User avatar
No.15681
AmatCoder
Tester
Oct 31, 2018, 23:51
Log is completely normal. Dsk file loads fine and fdc register 1 gives 0 as usually.
I don't understand how it works with "src/lib/formats/dsk_dsk.cpp from 25 oct 2017" but not now...

I upload a "upd765.cpp" file to get more output (path is '/src/devices/machine/upd765.cpp').
Also run Mame with -v option.
User avatar
No.15682
Klez
Tester
Nov 1, 2018, 03:54
Full recompile again this time with patched upd765.cpp...
This is the full console log:
https://pastebin.com/QA0stuRB
User avatar
No.15683
AmatCoder
Tester
Nov 1, 2018, 09:46
edited on: Nov 1, 2018, 09:50
Ok, now I think I know what happens...

I upload a new "dsk_dsk.cpp" file (uploaded as "dsk_dsk_fixed.cpp", rename it).

Please, paste the output and tell me if now it works for you.
User avatar
No.15686
Klez
Tester
Nov 1, 2018, 13:08
edited on: Nov 1, 2018, 13:21
YES!

It works now!

now CAT returns flop1 contents and i can load DSK titles again. I tested all the DSKs images i´ve got an all of them show contents
This is the log with the same Motardelo y filemon DSK floppy image:
https://pastebin.com/DXT63QAf

Thank you very much for your efforts. If you need more tests just ask me.
User avatar
No.15687
AmatCoder
Tester
Nov 1, 2018, 14:14
edited on: Nov 1, 2018, 14:19
Great! I have created a pull request here: https://github.com/mamedev/mame/pull/4225

The reason why it failed was that "desc_pc_sector" struct fields (as "bad_crc") were not initialized so it gives an undefined value.
It worked in Windows and Linux because this behavior depend on your compiler (GCC may to initialize them automatically but Clang not).
User avatar
No.15694
Klez
Tester
Nov 1, 2018, 19:55
edited on: Nov 1, 2018, 19:56
Cloned curent GIT now that your patch was accepted, recompiled and ta-daaa, the regression is now fixed.

This MT can be closed as: SOLVED

Frankly i don't understand the difference between sects[j].deleted = (sector.fdc_status_reg2 & 0x40); and sects[j].deleted = 1; in terms of assigning a true/false value to a boolean from the specified struct, even if it wasn´t initialized to anything.

Well, enough full compilations for this week!
Thank you very much
User avatar
No.15700
mahlemiut
Developer
Nov 2, 2018, 00:30
For me, Game Over progresses more, but now instead of getting a read fail error, I get the message "***THIS DISC IS AN ILLEGAL COPY***"
Can confirm that it worked in 0.197, though.
User avatar
No.15701
AmatCoder
Tester
Nov 2, 2018, 02:22
@mahlemiut
There are a lot of versions of Game Over. All cracked versions works AFAIK.

"Game Over (S) (1987) [Original].dsk" from CPC-Power works fine (it needs RUN"GAM)

"Game Over (UK) (1987) [Original].dsk" from CPC-Power does not work because protection. I doubt that it ever did.
Keep in mind that this is a new version uploaded on 2018-06-09. Before there was others original versions (even one with weak sectors) but they have been deleted. Maybe one of those was working, I don't know.

Give me the CRC of your version and I take a look.
User avatar
No.15703
mahlemiut
Developer
Nov 2, 2018, 06:45
It was the UK version from CPC-Power, which was mentioned earlier. And as I said before, it does work in 0.197.
User avatar
No.15716
Tafoid
Administrator
Nov 3, 2018, 20:20
Set to acknowledged as discussion continues
User avatar
No.15729
AmatCoder
Tester
Nov 4, 2018, 02:26
Hmm, mahlemiut was right. Current UK version of Game Over from CPC-Power worked on mame 0.197.

It is not working right now because this: https://github.com/mamedev/mame/commit/54f91cc4055e51e981bdff8d048c7ea6871ca235
"No Data" flag is not setted after that commit.

If you uncomment line 1782 in file "src/devices/machine/upd765.cpp" the protection is passed.
User avatar
No.15752
AmatCoder
Tester
Nov 6, 2018, 14:00
I have created a pull request to fix games with speedlock version D/2.1 protection like Game Over (UK): https://github.com/mamedev/mame/pull/4263
User avatar
No.16212
AmatCoder
Tester
Mar 6, 2019, 20:02
Finally patch was (somewhat) accepted: https://github.com/mamedev/mame/commit/9a5e311c0b7116645a415fcde820a7a96bb8571b

Games with speedlock version 2.1 protection should work now.
A list of them here: http://www.cpc-power.com/index.php?page=protection&lenom=Speedlock%20D7%20-%201987%20-%20AAAA%20v2.1

This issue can be closed.
User avatar
No.16217
StHiryu
Tester
Mar 7, 2019, 12:14
@AmatCoder Do you know if 06927 is related to this?
User avatar
No.16218
AmatCoder
Tester
Mar 7, 2019, 13:09
@StHiryu
No, that is a vsync related issue. I will take a look.
User avatar
No.16221
Osso
Moderator
Mar 8, 2019, 06:35
Tried with 'bubbler', which didn't work in 0.207 and works with current GIT.