I’m trying to make sense of the interrupt vectors, first I’m trying to use the key_hnd to fire a key pressed event upon receiving the interrupt, since I want my engine to support the event driven paradigm:
1) As far as I understand, as long as the corresponding register is set as follows: HW_REGS[SCR] &= ~S_HWDIS;
the interruptions for the key pad are active, so does it means that at any moment that the user presses any key a the key_hnd should be called? that should be ideal, but I’m no receiving such call.
2) What is the vpu_hnd vector for? the comment in the code says: “Video Retrace Interrupt Handler”, but I’m not sure what it means since this document: http://www.planetvb.com/content/downloads/documents/vbprog.pdf doesn’t tell much about it. Does it get called each time the display is refreshed? could I use this interrupt to execute render related stuff to separate game’s logic from rendering? If so, does anyone know how to activate/deactivate the interrupt?
Jorgeche
I’ve been able to trigger the call for vpu_hnd by setting the following:
VIP_REGS[INTENB]= RFBEND | LFBEND;
Still not sure if it makes sense to do rendering (mainly setting up WORLDS and affine tables), but at least it works.
jorgeche wrote:
I’m trying to make sense of the interrupt vectors, first I’m trying to use the key_hnd to fire a key pressed event upon receiving the interrupt, since I want my engine to support the event driven paradigm:1) As far as I understand, as long as the corresponding register is set as follows: HW_REGS[SCR] &= ~S_HWDIS;
the interruptions for the key pad are active, so does it means that at any moment that the user presses any key a the key_hnd should be called? that should be ideal, but I’m no receiving such call.
You also need to set S_HW. Follow the procedure described in the Development Manual:
HW_REGS[SCR] &= ~S_HWDIS; HW_REGS[SCR] |= S_HW;
However, hardware reading should be on after reset. Maybe you forgot to enable interrupts at all? See the sei and cli commands.
cYa,
Tauwasser
Tauwasser wrote:
However, hardware reading should be on after reset. Maybe you forgot to enable interrupts at all? See the sei and cli commands.
cYa,
Tauwasser
Didn’t work, I’m using:
HW_REGS[SCR] &= ~(S_HWDIS | S_INTDIS);
HW_REGS[SCR] |= S_HW;
doesn’t S_INTDIS disables the interrupt?
BTW, I was reading the official development manual, and in page 4-4-10 it says:
“An interrupt will not be generated if a 1 is stored in bits 3-1”
The problem is that:
bit 1 = SGN, always 1 for standard controller according to the manual
bit 2 = A button
bit 3 = B button
so it will never trigger the interruption according to this, and even if it worked, I couldn’t use it to catch presses of A and B buttons, and the interrupt only triggers when bits 15-4 changes to 1, so a “keyUp” event wouldn’t work at all.
It looks like I will have to keep the old method, which on it’s own has it’s advantages since I don’t have to worry for other game’s logic being processed at the time of the button’s press.
Jorgeche