Page 2 of 2

Beware of using the VERA inside IRQ

Posted: Wed Feb 03, 2021 1:18 pm
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!


Beware of using the VERA inside IRQ

Posted: Wed Feb 03, 2021 6:19 pm
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.


Beware of using the VERA inside IRQ

Posted: Wed Feb 03, 2021 6:36 pm
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.