Offline
Chicago

Hey All, me again!

So, in my last post I was trying to achieve a fade effect manually, but i found that simply changing bits 5 and 6 on the value written to $4000 would do that just fine for my needs AND I can modify the length using the highest 5 bits written to register $4003. Awesome.
Now my issue seems to be an inability to trigger a sequence of more than one note.
I know that once the counter reaches 0 on the note length, the flag for the note length at register $4015 will set to 0.
My code looks like this:

    .inesprg 1
    .ineschr 0
    .inesmap 1
    .inesmir 0

    .bank 1
    .org $FFFA
    .dw 0 ;vbank
    .dw Main
    .dw 0

    .bank 0
    .org $C000
   

Main:
   
    ;period/frequ and also set length
One:
    JSR D3

    ldx $4015
    cpx #%00000000
    beq Two


Infiniteloop
    jmp Infiniteloop

Two:
    JSR D4

    jmp Infiniteloop


D3:
    ;D3, eighth note
    lda #%00000001
    sta $4015
    lda #%10011111
    sta $4000
    lda #%11111001
    sta $4002
    lda #%01001010
    sta $4003
   


    RTS


D4:
    lda #%00000001
    sta $4015
    lda #%10011111
    sta $4000
    lda #%01111100
    sta $4002
    lda #%01001001
    sta $4003



    RTS

In my head, the code should.
1. From main, jump to my subroutine D3, where I
    a. enable PU1 by writing 1 to the first bit of register $4015
    b. write the duty cycle/volume/period/length data to registers $4000, $4002, and $4003
    c. return to main
2. Load the value stored at $4015 to the x register
3. test the value against a correct zero-d out $4015, meaning that the timer on PU1 had counted to zero
4. Jump to D4, where i would do the same process as in step one.

On paper, i feel like my code checks out, but clearly i am missing something here, so if anyone could help me (again) that would be extremely cool.
Thanks!

Offline
Chicago

Update: Solution found, please ignore.