megar wrote:I've already picked up that. (registry 8, 12 and 13 not used). I was planning to use this trick in my soon-to-be-released sprite record contest attempt.
But, 3 to 4 nop by vbl, it is not so important anyway, so I think that most code that have be published here is appliable.
I'm not shure that 12 and 13 are not used because the SOS tune is using the envolope quite heavily, it's at least once used for initialization.
Make shure your playerroutine is actually working correctly and compare the tune with the original. E.g. some of the released sprite demos don't use the envelope and just sound wrong.
My aim is to create an interchangeable and standard fileformat. The idea of reordered registers by usage is good, but perhaps a little overkill.
It would be nice if Nyh could check out some other songs for register usage.
I guess that the following grouping would be useful:
Use 1 bit for each of the frequency registers (3bits) then register 7,8,9,10 (4 bits) and last register 6 (noise frequency). Noise is 5 bit, so the 3 top bits can be used for next values: envelope frequency (regs 11,12) 1 bit and envelope type 1bit. Then we have 1 bit left. If it's set to 1, we come to the "extra features" like SID, digits or end-of-song.
e.g:
Code: Select all
01100011 ; freq channel B and C, volume C and noise
bbbbbbbb ; channel B freq
0000bbbb
ccccccccc ; channel C freq
0000cccc
0000cccc ; volume C
100nnnnn ; noise and continue: 100 = envelope freq, no reg 13, end
eeeeeeee ; envelop frequency
eeeeeeee
..... (next VBL)
Now that I think of it, the frequency registers are 12 bit, so we can use already there the noisefreq "extension".
So another idea is not to use at all a bit-field, but store that info with the data. Each VBL we read a byte, if none of the top 3 bits is set, there is no frequency register to be modified.
If a bit is set (7,6 or 5), we store the data into register 1,3 or 5 and then copy the next byte into 0,2 or 4 respectively.
If there's another bit set (6 or 5) do the same again.
This means if frequency A and C has to be modified, the first byte will have top bits like 101. If it's B and C it will be 011 etc...
And finally if bit 4 is set, there's more data, else we have finished.
Code: Select all
0111bbbb ; regs b&c and more...
bbbbbbbb ; channel B freq
0000cccc ; channel C freq
cccccccc
00100100 ; volumes ABC, reg6, reg7, envfreq, reg13, 'more'
0000cccc ; volume C
eeeeeeee ; envelope freq
eeeeeeee
.... (next VBL)
So: play nothing is just $00
Modify something but not frequency is %00010000
Discussion open: shall we continue on this way? I mean, is there someone coming up with a fast routine to decode this?
Or other crazy suggestions?
Georges