Jump to content
IGNORED

Strange POKEY behaviour when writing AUDF1 via X register


Recommended Posts

Hi,

first of all, I have tested this only on Altirra, not on real hardware.

I just wanted to code a descending tone as you know it from so many jump and run games.

However, when using an AUDC1 value of $A8, I don't get a clean tone when writing the frequency via the X register if I use an INX directive before.

Here's my code:

                RTCLOK = $14
                AUDF1 = $d200
                AUDC1 = $d201
                AUDCTL = $d208
				TEMP = $84

				org $2000

                lda #0
                sta AUDCTL
                lda #$a8
                sta AUDC1
                lda RTCLOK
                adc #10
                sta TEMP
                ldx #10
soundloop2      inx
                stx AUDF1
                lda RTCLOK
                cmp TEMP
                bne soundloop2
                lda #$a0
                sta AUDC1
L               jmp L

 

So now if you change "stx AUDF1" into "sta AUDF1", you'll hear the expected clean tone. But even stranger is that if you stick to writing via the X register, but remove the "inx" before, it will also give you a clean (in that case constant) tone.

 

Is this known/expected behaviour? Or is it a bug in Altirra?

 

Thank you for any pointers how to deal with this...

Link to comment
Share on other sites

Your program, for 10 frames, is constantly doing INX then storing to the AUDF register.

This is occurring so fast that you'd not hear a slow clean sweep but something resembling white noise.

You'd also get jitter thanks to screen DMA and VBlank interrupt which contributes more to the "noise".

 

To get the sweep you want, you'd probably want to wait 1 frame after each INX and store to AUDF.  You might find it a bit slow though, on NTSC a bit over 4 seconds for a full low to high frequency sweep.  To do it quicker you could use waits on VCOUNT.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...