#110183 - Dark Knight ez - Sun Nov 26, 2006 3:11 pm
Hey guys.
About time I posted another question.
This one concerns the use of VCOUNT interrupt.
As far as I understand, you can trigger an interrupt on a certain hblank (vertical scanline) with this. I checked gbatek, bugged LiraNuna about it, but I could not get it to work.
I created a small tech demo of me trying to get it to work without all the other code of my project possibly interfering. Still no luck though. Could someone point out what's wrong in my little techdemo?
(All commented out code in there was also tested enabled, to no avail.)
As you might be able to tell, the goal of this techdemo is to show black on the upper half of the screen, and another colour on the bottom half.
Thanks in advance.
edited to represent the current version (which still does not work).
_________________
AmplituDS website
Last edited by Dark Knight ez on Mon Nov 27, 2006 12:58 pm; edited 1 time in total
About time I posted another question.
This one concerns the use of VCOUNT interrupt.
As far as I understand, you can trigger an interrupt on a certain hblank (vertical scanline) with this. I checked gbatek, bugged LiraNuna about it, but I could not get it to work.
I created a small tech demo of me trying to get it to work without all the other code of my project possibly interfering. Still no luck though. Could someone point out what's wrong in my little techdemo?
(All commented out code in there was also tested enabled, to no avail.)
As you might be able to tell, the goal of this techdemo is to show black on the upper half of the screen, and another colour on the bottom half.
Thanks in advance.
Code: |
/* YTrigger Tech-Demo *
*********************/ #include <nds.h> #include <stdio.h> #include <string> #include <sstream> #include <malloc.h> #include <nds/memory.h> #include <nds/ARM9/console.h> #include <nds/registers_alt.h> static inline void setYTrigger(int YValue) { REG_DISPSTAT = (REG_DISPSTAT & 0xFF ) | (YValue << 8); //REG_DISPSTAT = (REG_DISPSTAT & 0xFF ) | (YValue << 8) | (( YValue & 0x100 ) >> 2); } void handleVBlankInterrupt() { BG_PALETTE[0] = 0; } void handleYTriggerInterrupt() { BG_PALETTE[0] = 0x1F; } int main() { powerON(POWER_ALL_2D); //vramSetBankA(VRAM_A_MAIN_BG); DISPLAY_CR = MODE_0_2D; // | DISPLAY_BG0_ACTIVE; //BG0_CR = BG_PRIORITY_0 | BG_TILE_BASE(0) | BG_256_COLOR | BG_MAP_BASE(28) | BG_32x32; irqInit(); irqSet(IRQ_VBLANK, handleVBlankInterrupt); irqEnable(IRQ_VBLANK); setYTrigger(96); irqSet(IRQ_VCOUNT, handleYTriggerInterrupt); irqEnable(IRQ_VCOUNT); while (1) { swiWaitForVBlank(); } return 0; } |
edited to represent the current version (which still does not work).
_________________
AmplituDS website
Last edited by Dark Knight ez on Mon Nov 27, 2006 12:58 pm; edited 1 time in total