freetz Posted January 12 Share Posted January 12 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... Quote Link to comment Share on other sites More sharing options...
Rybags Posted January 12 Share Posted January 12 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. Quote Link to comment Share on other sites More sharing options...
sanny Posted January 12 Share Posted January 12 You don't delay in your loop. You should give pokey some time to play the new frequency.... Quote Link to comment Share on other sites More sharing options...
freetz Posted January 12 Author Share Posted January 12 D'oh. Thanks. That should have been obvious ;)... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.