Combined waveform noise-pulse osc value should reach maximum value of 252 when the TEST bit is enabled for voice 3.
Example program
10 s=54272
20 poke s+14,255
30 poke s+15,255
40 poke s+18,12*16
50 a=1
60 poke s+18,12*16+8
70 r=peek(s+16+11)
80 printa,r
90 a=a+1
100 if r<255 goto 70
On my real c64 and c128 both with SID 6581, osc results starts at 0 and gradually set the osc bits until it is stable at 252. Typical sequence od results are 0,0,0,...,0,16,80,208,216,248,252. Time varies but improves depending on how long the computer has been on before value becomes stable at 252 . On VICE it almost stops immediately with result of 255.
Attached is another test program with reference data from my real c64. The test is an extension of the noise writeback tests which does take sometime to complete. The screen changes colour for each waeform. The program provides results for waveform 8,9,10,11,12,13,14,and 15 each with 2 rows of data. Text in green matches reference data. Text in red highlights mismatch. Green border all data matches. Red border indicates an error was detected. Hold space bar down to see reference data.
The test for each waveform basically executes and shows results as follows.
It can be seen in the results for waveform 12 the first value read is 252 before the TEST bit is released (5th set of results). This seems to affect the noise writeback as discussed in bug# 746. In VICE for waveform 12 the results are exactly the same as the noise waveform by itself (ie. waveform 8, the 1st set of results).
ok so:
i have added the testprog in the repo at testprogs/SID/wf12nsr/. i also added reference data from my c64mk2 with 8580. interestingly when i use a 6581 the very first byte of the wave12 test is different to the reference data from yours. i think it will need some more people running these tests on various c64s - and i think the result will be that often "some" values will be different. these combined waveforms really arent an exact science, unfortunately :(
however, the test clearly shows that something is wrong in VICE in this regard - there are a LOT of differences to the reference data for wave #12. for wave #8 on 8580 there are also significant differences.
There are a couple of things to notice in the test prog:
Anyway there is something interesting about the different writeback behavior between 6581 and 8580 here, need to inverstigate further.
As for the noise+pulse test it seems that the lower bits are being pulled down by the last four noise bits which are grounded. Will look at this too.
Here is a crappy patch that solves part of the problems. It seems like in the 8580 the writeback doesn't affect the middle bits, but I'm not sure why and when this happens.
Here is a reworked writeback testsuite. It checks the writeback effect of switching from waveform X+testbit to waveform Y(where X and Y are all the combinations that include noise) after having reset the shift register.
I've included all the predictable combinations verified on a couple of chips (samplings included in the zip). Tests takes a while to run, especially on the 8580 (~10 secs to reset the noise generator).
The tests that fail on current VICE are the following:
6581
9->C
A->C
D->C
D->E
E->C
F->C
8580
C->9
C->E
C->F
I've also found some samplings of the noise+pulse combinations which confirms that the lower grounded bits pulls down the neighbor bits, with a stronger effect on the 6581. Need to write some test cases.
Edit: updated testsuite and results
Last edit: Leandro Nini 2018-11-22
Thanks. I'll check it out. BTW I just noticed a typo with point 3 of my original post which I don't seem to be able to edit. It should be 3.The waveform is set with TEST enabled again. The 3rd value in the results is the osc value read directly after this.
leandro: i take it this obsoletes all(?) the other noise writeback tests (which i havent added to the repo yet.... but i will add these new ones now :))
i have added the new tests to the test repo... i have NOT applied that patch, because it broke more tests than it fixed :)
A bit late but here is a patch for the original test to fix the mentioned problems:
The reference data must be resampled though.
mmmh somehow its not stable on my C64C (8580)... the 5th row gives random errors shrug
i made a few dumps from my C64C, each after turning it off for a couple minuts. all 3 dumps are different :(
perhaps some more elaborate "reset" function is needed?
The 8580 won't reset completely when cold. I've added a check so it will loop until all bits are high, but it will take a while so you'd better warm up the chip beforehand.
with that patch its behaving kinda weird now.... now some of the rows will be totally empty, ie all $20 (space). ... it doesnt seem to be exactly stable either (on subsequent runs the output still changes) shrug (i should only apply the 2nd patch, not both, right?)
ok well, after a bit of warmup it seems stable. i updated the repo with patched code and reference data that produces all green on my C64 and C64C (old/new SID).
interestingly, it fails in VICE- both SIDs in the 5th row ($C). rest seems ok.
This patch makes the test pass on 6581 and improves the result on 8580, only two different values. The quicktest also stops at 252 (the bitfade is not emulated though).
Additionally the SID/wb_testsuite/noise_writeback_check_C_to_A_new.prg test is now green too.
patch applied in r37944 - thanks!
btw, in the future... would you post actualy patches on the patches tracker (one ticket per patch) please? that makes it easier to track - and less likely we will forget about one of them