You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there's a potential issue accessing VDC registers, where things could get screwed up by an interrupt handler which also accesses VDC registers.
I'd imagine would be quite common - eg using raster interrupts to create a static status bar at the bottom of an otherwise scrolling screen.
The current pce_vdc_* functions all generate access code that looks like this:
; set up a write to vram $1000
stO #0 ; Memory Address Write Register (reg 0)
stl #$00 ; lo
st2 #$01 ; hi
But if an interrupt occurs immediately after the st0 and the interrupt handler accesses another VDC register, when the main code resumes, the st1 and st2 will likely be writing to the wrong register!
This issue is outlined in one of the original tech notes:
The solution they suggest is to store the register number in a global variable before the st0, then have the interrupt handler restore it when it exits.
Am I right in thinking that this is a potential issue?
The global-var solution seems like it'd work, although user-defined interrupt handlers would have to explicitly add something to restore the register.
The text was updated successfully, but these errors were encountered:
I think there's a potential issue accessing VDC registers, where things could get screwed up by an interrupt handler which also accesses VDC registers.
I'd imagine would be quite common - eg using raster interrupts to create a static status bar at the bottom of an otherwise scrolling screen.
The current pce_vdc_* functions all generate access code that looks like this:
But if an interrupt occurs immediately after the
st0
and the interrupt handler accesses another VDC register, when the main code resumes, thest1
andst2
will likely be writing to the wrong register!This issue is outlined in one of the original tech notes:
https://archive.org/details/PCEDev/HuC62%20-%20Tech%20Notes/page/n21/mode/2up
The solution they suggest is to store the register number in a global variable before the
st0
, then have the interrupt handler restore it when it exits.Am I right in thinking that this is a potential issue?
The global-var solution seems like it'd work, although user-defined interrupt handlers would have to explicitly add something to restore the register.
The text was updated successfully, but these errors were encountered: