Viterbi Encoded Sound Sample

Probably the most technical forum around. It does not have to be coding related, or assembly code only. Just talk about how you can use the AY chip to do cool sounding things :)
User avatar
jbperin
Flight Lieutenant
Posts: 377
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Viterbi Encoded Sound Sample

Post by jbperin »

Dbug wrote:
Sat Aug 07, 2021 7:52 pm
If you save registers like that, your IRQ is not reentrant, they will overwrite the status.
For reentrant IRQ you need to use different locations for the various calls, generally done using the stack.
DAWN !! you're right :shock:
I wonder what it works despite this massive design mistake .. how weird ..

User avatar
jbperin
Flight Lieutenant
Posts: 377
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Viterbi Encoded Sound Sample

Post by jbperin »

I added a few samples to the repository in order to test a little bit: I already encoded these samples so that they can be used to generate the source code.

To do so:

Edit the scipt util/genbuf.py and edit the line

Code: Select all

from LetItWhip import Out
to replace LetItWhip by the name one of the pre-encoded sample from the list above

Then open a command shell at the root of the directory and run the command:

Code: Select all

python util\genbuf.py
This will generate files src\soundbuf.s and src/nbsample.h

Now you can go to src directory and type the command

Code: Select all

osdk_build.bat && osdk_execute.bat
to hear the sample

But the best is to do that on a real Oric because the Oricutron emulator do not properly emulate the Oric sound.
(there's a 6ms flat signal inserted every 46 or 92 ms which really destroys the rendering).

User avatar
jbperin
Flight Lieutenant
Posts: 377
Joined: Wed Nov 06, 2019 11:00 am
Location: Valence, France

Re: Viterbi Encoded Sound Sample

Post by jbperin »

Dbug wrote:
Sat Aug 07, 2021 7:52 pm
jbperin wrote:
Sat Aug 07, 2021 7:44 pm
This is why I put the bit $304 just after the jsr TASK_4KHZ and before the 25Hz stuffs in the irq_handler.

Code: Select all

	;Preserve registers 
	sta 	irq_A: stx 	irq_X: sty 	irq_Y
	jsr TASK_4KHZ ;  TASK_4KHZ_4BITS ; 
	bit $304
If you save registers like that, your IRQ is not reentrant, they will overwrite the status.
For reentrant IRQ you need to use different locations for the various calls, generally done using the stack.
is it better that way ?

iss wrote:
Fri Aug 06, 2021 5:44 pm
Additionally you can optimize the IRQ routine - you save the registers to ZP *and* save them again with PHA's - use only the first one.
I removed the useless saving of registers here

Post Reply