vitamin-caig / zxtune

Mirror of http://bitbucket.org/zxtune/zxtune repository with robot-only issues tracker
https://zxtune.bitbucket.io
145 stars 16 forks source link

Sam Coupé format fix #4

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello, I noticed that some of the Sam Coupé songs won't play but i found a fix by searching around a bit. See below. If this is already known and you are using this method, just delete this ticket.

1) Is there "ETracker" in ASCII at file offset 0xA? If so it's an ETracker song. Load etracker.bin (usually found in archives with Sam Coupe songs) at 0x8000 and the song data at 0x84B3. Run the Z80 code at 0x8000 until it returns to initialize the player, then run the code at 0x8006 each frame until it returns.

2) For all other songs, first copy them to 0x8000. a) If the song + 0x13 matches the bytes { 0x01, 0xff, 0x01, 0x3e, 0x1c, 0xed }, patch 0x01 to 0x8001 and 0x00 to 0x8002. b) If the song + 0 matches the bytes { 0x43, 0x72, 0x3d, 0xc2, 0x23, 0x81 } patch 0x01 to 0x8001. c) For all of these type 2 songs there is no setup, you simply call the Z80 code at 0x8000 each frame until it returns.

vitamin-caig commented 10 years ago

Hello! Thank you for interest to zxtune project!

1) this format (ETracker) should be fully supported and detected by signature located at the end of src/formats/chiptune/saa/etracker.cpp (FORMAT constant)

2) zxtune does not use z80 emulation for Sam Coupe (and other tracker formats) songs playback, only for ay format. Have you examples of files with this format? How byte can be patched to word?

ghost commented 10 years ago

I got those instructions from some website, i think those 0x8001 and 0x8002 are offsets. See below links to the samples.

vitamin-caig commented 10 years ago

Can you find that instruction once more? 1) bd.cop is supported by zxtune, so is not a problem 2) bearmix.cop is already compiled for 0x8000 3) craft.cop contains very strange code at start. I cannot analyze patched version right now.

If the 2nd and 3rd files are just a compiled version of ETracker module, I can implement decompiler to play it like regular 1st file. I am trying to avoid z80 code emulation as possible.

ghost commented 10 years ago

http://aaa.amigaworld.net/modules/newbb/viewtopic.php?viewmode=thread&order=0&topic_id=24407&forum=32&post_id=&refresh=Go

Go there and scroll down a bit and you'll see the instructions.

vitamin-caig commented 10 years ago

Thank you! I'll try to extract playback algorithm from attached samples to support such a types. Seems like module format is quite weak and pre-compiled for address, so player code will be mandatory for detection. Unfortunately, I cannot give any estimation for fix because I have no enough time for zxtune activities:(

ghost commented 10 years ago

it's no problem really, at least you are aware of this now :)

vitamin-caig commented 10 years ago

Is this thread is the source of our discussion? :) http://www.un4seen.com/forum/?topic=15694 FYI: libzxtune does not support processing of multitrack modules and seeking for modules in raw data dump, but desktop version does. It supports a lot of compressors and archives as far as plain data analyze.

ghost commented 10 years ago

yeah thats the one

vitamin-caig commented 10 years ago

I have found 22 modules of 2a type and the only one module of 2b type. In the same time, I have found 1101 modules of 1 type (431 unique). Moreover, I still don't know name of the software unsupported modules were created in.

So, seems like support of that types is unprofitable...

ghost commented 10 years ago

Fair enough, this case can be closed then. I should have done this investigation by myself, thanks for checking this out.