SID dump file format

Assembler, C/C++ related topics
simon
Site Admin
Posts: 744
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany
Contact:

Re: SID dump file format

Postby simon » Mon Feb 09, 2015 10:03 am

No problem, Steve. I didn't expect a bugless version. :)
Funny thing is, that my dumps doesn't care about the setting order of the registers as well and some tunes sound good where others sound wrong. Listen to "Still alive" for example.

mike
Posts: 9
Joined: Mon Feb 09, 2015 10:54 am

Re: SID dump file format

Postby mike » Mon Feb 09, 2015 11:43 am

hi guys,

i'm working on a vst plugin which uses resid. for comparison and understanding the SID, i wanted to write some sort of SID dump player, so i found this nice thread.

what i've found so far:

*) for the 16 bit values like freq and pulse it makes no difference, if i write only the changed byte or both bytes.

*) in the siddump source are some checks for the waveform, which are not correct

Code: Select all

if (chn[c].wave >= 0x10)

if a channel is synced and/or ring-modulated by a channel, then the modulating channel not requires to have a waveform selected. only the modulator's freq is relevant.
http://www.waitingforfriday.com/index.php/Commodore_SID_6581_Datasheet#Control_Register_.28Register_04.29

*) in the siddump source the filter cutoff assignment is not correct

Code: Select all

filt.cutoff = (mem[0xd415] << 5) | (mem[0xd416] << 8);

should be

Code: Select all

filt.cutoff = (mem[0xd415] & 0x7) | (mem[0xd416] << 3);

0xd415 contains the lower 3 bits
0xd416 the higher 8 bits

however, what i've done, is to remove all the note-on/off checking and only use the "raw" register changes.
i export a binary file which contains a "delta-flags" byte (one set bit for each changed register), followed by the register values only.
this reduces the file size a lot, but still is much too large. some sort of pattern recognition would be nice here.
i wrote an asm player for this format and it works quite nice for all tested sid files so far, except for last ninja 2, which just fades out after a few seconds...? :lol:

i will cleanup and upload the sources later.

mike

simon
Site Admin
Posts: 744
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany
Contact:

Re: SID dump file format

Postby simon » Mon Feb 09, 2015 11:48 am

Hello Mike,

wow, that are very valuable information. Thanks a lot!!! :) I have modified the siddump sources to reflect my earlier notes. I will have to check the dumps tonight and will give feedback afterwards.

Your sources are very welcome. Did you fork the siddump sources for your project or did you write your own dumper?

Simon

mike
Posts: 9
Joined: Mon Feb 09, 2015 10:54 am

Re: SID dump file format

Postby mike » Mon Feb 09, 2015 12:01 pm

hi Simon,

you are very welcome :)

i forked the sources.

mike

mike
Posts: 9
Joined: Mon Feb 09, 2015 10:54 am

Re: SID dump file format

Postby mike » Mon Feb 09, 2015 1:35 pm

https://www.dropbox.com/s/263c6y66fgotewm/SIDDumpAndPlayer.zip?dl=0

contains the modified siddump, kick-assembler sources + compiled .prg files and some test .sid files.

i've removed most of the siddump args, it produces a .bin file by default.
in siddump.c you can uncomment the #define VERSION2_ENABLED which will produce an additional .bin.v2 file,
which has the same format as .bin but contains all register-writes (see cpu.c #define WRITE(address)) and is a lot larger...

i've built .prg player files for all the .sid files, i hope they work (in VICE they do work).

the player does not check for number of frames, it just plays the RAM after the music :D

mike

mike
Posts: 9
Joined: Mon Feb 09, 2015 10:54 am

Re: SID dump file format

Postby mike » Mon Feb 09, 2015 2:43 pm

found the problem why last ninja 2 does fade out:

the gate bit gets written twice within the same frame. i.e. noteOn and noteOff triggered.
so reading/playing only the register state at the end of a frame will not work...

will add a flag which tells the player, that another set of register values follows. that should do the trick...

mike

simon
Site Admin
Posts: 744
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany
Contact:

Re: SID dump file format

Postby simon » Mon Feb 09, 2015 7:34 pm

I didn't have luck with my modified siddump. As the sorting of the output is different to the usual siddump output, it is a bit hard to compare the results.

Mike, it seems that your zip file contains your siddump fork only. Could you give a more detailed describtion of the binary format or the player routine?

mike
Posts: 9
Joined: Mon Feb 09, 2015 10:54 am

Re: SID dump file format

Postby mike » Mon Feb 09, 2015 8:04 pm

the format is like this:

for each frame {
for 3 channels {
CHANNEL DELTAFLAGS, REGVALUE, REGVALUE, ...
}
FILTER DELTAFLAGS, REGVALUE, REGVALUE, ...
}

CHANNEL DELTAFLAGS:
bit 6: wave/ctrl
bit 5: SR
bit 4: AD
bit 3: PULSE HI
bit 2: PULSE LO
bit 1: FREQ HI
bit 0: FREQ LO

FILTER DELTAFLAGS:
bit 3: MODE/VOLUME
bit 2: RESO/CTRL
bit 1: CUTOFF HI
bit 0: CUTOFF LO

the player reads one byte (delta flags), then checks each bit (starting at bit 0) and if the bit is set, it reads one byte (reg value) and stores it in the SID register.
see doFrame(), doChannel() and doFilter() in the .asm file.

simon
Site Admin
Posts: 744
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany
Contact:

Re: SID dump file format

Postby simon » Mon Feb 09, 2015 8:09 pm

Thank you, Mike! I will look into that. :-) I just found the player as well. It was in a different directory. :-)

simon
Site Admin
Posts: 744
Joined: Thu Sep 13, 2012 9:35 am
Location: Luedenscheid, Germany
Contact:

Re: SID dump file format

Postby simon » Fri Feb 13, 2015 5:26 pm

Hi,

it took a few days, but finally I found some time to write a new player today. It uses the Mikes format of the dumps which work quite well. Thank you! I like to merge it with Steve's version thus I don't need to use xxd to convert it into a c header file. And I like to have a file header (including the number of frames) as we have with Steve's version.
You find it attached to this posting.

Simon
Attachments
sidplay2.tgz
(380.52 KiB) Downloaded 2457 times


cron