News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_dthrone

Plus DMA Repeat instruction in Winape

Started by dthrone, 19:28, 18 August 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dthrone

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 :(

GUNHED

Please never treat emulators as perfect. Often they only have parts of the real hardware implemented. Alway refer to read hardware :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

dthrone

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


redbox

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.  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.

dthrone

Quote from: redbox on 14:27, 23 August 22
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.  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  ???

andycadley

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.

GUNHED

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.
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

andycadley

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.

dthrone

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


Executioner

Apparently I coded it to the spec, very surprised this hasn't been found before, should be easy enough to test/fix.

Powered by SMFPacks Menu Editor Mod