Beware of using the VERA inside IRQ

Chat about anything CX16 related that doesn't fit elsewhere
User avatar
AndyMt
Posts: 326
Joined: Sun Jun 21, 2020 3:02 pm
Location: Switzerland

Beware of using the VERA inside IRQ

Post by AndyMt »



18 hours ago, The 8-Bit Guy said:




And the IRQ can run right in the middle of your writes to VRAM.



Ah - this is why the sound effects in Invaderz sometimes drop out or chip in some way... I can now fix this, thanks a lot!

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

Beware of using the VERA inside IRQ

Post by StephenHorn »


My solution to this was to generally run all of my logic in the IRQ, starting with screen draws, while the non-interrupt code essentially spins on a tight loop checking on a single memory address. This way I don't have to worry about any of my routines being interrupted. An additional up-side to this is that I effectively have a thread that's not doing anything, and I'm thinking it would be ideal to place my streaming I/O logic into there, essentially spinning through banks and loading files as needed into them.

In particular, I really like the VERA's dual access channels and auto-increment settings, and how they make it really easy to write columns and rows of 16-bit tile data.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
paulscottrobson
Posts: 305
Joined: Tue Sep 22, 2020 6:43 pm

Beware of using the VERA inside IRQ

Post by paulscottrobson »


Might be quicker to semaphore it, so when your code isn't updating Vera you don't have to execute the code if it hasn't claimed the semaphore. Really depends :)

There's an argument that you shouldn't update in IRQ anyway, but have a Model-View design, so you update your model if you want in the interrupt routine, just using the IRQ as a timer.

 

Post Reply