What I'm trying to do is enable DMC IRQ, play a sample, and continually retrigger that sample to prevent it from generating an IRQ. I'm trying this because I'm making a bit-banged UART that can poll in the tightest loop possible without getting hung up if the other end isn't responding.
The result I'm getting is that I seem to get an IRQ when I retrigger the sample. I've tried things a few different ways, but I always seem to get interrupted.
Here's how I set it up, this part by itself seems OK. I can run this, do an SEI when communication begins, and it's fine.
Code: Select all
lda #$40 sta $4017 lda #$80 sta $4010 lda #$3f sta $4013 lda #$10 sta $4015 sta $4015 cli
Code: Select all
sei lda #0 sta $4015 lda #$10 sta $4015 lda $4015 nop cli
The IRQ routine itself reads $4015 to acknowledge the IRQ. The interrupt timer needed is something like 2 seconds long. Shorter time out would be OK, but NMI is out of the question because I'd have to sync to it. And frame IRQ, I don't know how it works exactly but I believe that's something that I can't reset, correct? If I have to sync up with it, it's not usable.
It's not a huge deal. It works if I don't try to retrigger it, and that's good enough for like 95% of the time I would need it. I can make a work-around that will mostly take care of the other situations, but it would be great if I could never leave the NES vulnerable to being locked up like that. I guess if I really had to know I'd be turning to Visual 2A03, but I haven't really used that enough to know exactly what I'd be looking for. This is already kind of a side-quest of a side-quest. But I was wondering if anyone else wanted to look at this, correct my misunderstanding of DMC IRQ, or shed any light on the subject otherwise.