I'm a bit confused by how Winape treats the Plus DMA Repeat instruction.
The Arnold V doc states "The argument field (N) of the REPEAT instruction is actually the number of times the loop is taken. The block of code between REPEAT and LOOP instructions is therefore executed N+1 times." I don't quite understand what this means.
In a Repeat (&2NNN) / Loop (&4001) loop Winape seems to output the PSG data in between NNN+1 times. In the Arnold emulator and on a real GX the data seems to be outputted NNN times.
So my sound is bugged in Winape but not on real hardware or in Arnold :(
Please never treat emulators as perfect. Often they only have parts of the real hardware implemented. Alway refer to read hardware :)
Quote from: GUNHED on 13:12, 23 August 22Please never treat emulators as perfect. Often they only have parts of the real hardware implemented. Alway refer to read hardware :)
Yep, luckily I think there are plenty of C4CPCs out there ;D
Quote from: dthrone on 19:28, 18 August 22The Arnold V doc states "The argument field (N) of the REPEAT instruction is actually the number of times the loop is taken. The block of code between REPEAT and LOOP instructions is therefore executed N+1 times." I don't quite understand what this means.
I came across this problem when I used the DMA to make digidrums (https://www.cpcwiki.eu/forum/programming/arkos-tracker-player-with-digidrums/msg66272/#msg66272). Inside the attached file on that post is the source to convert a sample to a DMA playlist.
As far as I remember, the repeat instruction starts from 0. So, if you enter the repeat instruction with a 0 it will play 1 iteration. I might be wrong, but I remember testing the above source on both WinAPE and a real 6128 plus and the output was the same.
Quote from: redbox on 14:27, 23 August 22Quote from: dthrone on 19:28, 18 August 22The Arnold V doc states "The argument field (N) of the REPEAT instruction is actually the number of times the loop is taken. The block of code between REPEAT and LOOP instructions is therefore executed N+1 times." I don't quite understand what this means.
I came across this problem when I used the DMA to make digidrums (https://www.cpcwiki.eu/forum/programming/arkos-tracker-player-with-digidrums/msg66272/#msg66272). Inside the attached file on that post is the source to convert a sample to a DMA playlist.
As far as I remember, the repeat instruction starts from 0. So, if you enter the repeat instruction with a 0 it will play 1 iteration. I might be wrong, but I remember testing the above source on both WinAPE and a real 6128 plus and the output was the same.
Thanks for the reply. The Arnold V doc states the below regarding Repeat 0. But that sort of contradicts the "The block of code between REPEAT and LOOP instructions is therefore executed N+1 times. " statement.Note that :- REPEAT Loops cannot be nested . Only one is allowed to be active per instruction stream at any time
- REPEAT 0 and PAUSE 0 instructions have no effect, i.e. they are equivalent to NOP.
I definitely hear aurally and observe with the timing that a Repeat N repeats N+1 times on Winape and N times only on real GX ???
The way to test is probably to put some interrupt instructions in a loop and have it change the border colour, then count how many stripes are generated. Likely easier than trying to do it by audio alone.
It will be hard to see one scanline more or less. But good thing to give it a try.
Running GX and Winape at the same time and to hear if timing changes could be probably more easy though.
Shove a few PAUSE or NOPs in the to make wider bands. Don't have access to a PC at the moment, but sure I could throw together some test code next week if nobody else does.
My loops are below. Comments -
(1) Hard to miscount a 160 frame sound effect. You hear it 5 times on Winape, 4 times on real GX.
(2) You hear it 9 times in Winape and it cocks up the syncing because the next list is triggered once this one is closed out. You hear it 8 times on real GX and the next list triggers correctly.
So I'm convinced but some independent verification would be great.
(1)
defw &2004 ; loop x 4
; sound effect here that lasts 160(!) frames
defw &4001 ; next loop
(2)
defw &2008 ; loop x 8
; sound data here that runs for 20 frames
defw &4001 ; next loop
Apparently I coded it to the spec, very surprised this hasn't been found before, should be easy enough to test/fix.