pacifist Posted June 12, 2005 Share Posted June 12, 2005 Alright! I've been looking foreward to this version of dualis. I'm having some troubles though. Enabling the VBlank interrupt with this codeirqInitHandler(irqDefaultHandler); irqSet(IRQ_VBLANK, irqVBlank); seems to always crash the emu. I can do it the long way:IME = 0; IRQ_HANDLER = &irqVBlank; IE = IRQ_VBLANK; IF = ~0; DISP_SR = DISP_VBLANK_IRQ; IME = 1; but only if I have turned the power to the screen on first POWER_CR = POWER_ALL_2D; and even then dualis crashes after I start excecuting code. Turning on a timer TIMER2_CR = (TIMER_ENABLE | TIMER_DIV_256);also crashes dualis if I haven't set the power cr yet. Also I'm having problems with my bitmap backgrounds: vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_MAIN_BG, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE); vramSetBankE(VRAM_E_MAIN_SPRITE); vramSetBankI(VRAM_I_SUB_BG); SUB_BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(BMP_BASE) | BG_PRIORITY_1; for(int i = 0; i < 128*256; i++) ((u16*)BG_BMP_RAM_SUB(BMP_BASE))[i] = (u16)0;(note this code isn't a straight copy and paste there are other backgrounds being set-up, scaling registers being set etc...) this crashes when I try to initialise the background, that is, on this line:for(int i = 0; i < 128*256; i++) ((u16*)BG_BMP_RAM_SUB(BMP_BASE))[i] = (u16)0; I assume this is a VRAM thing but I don't really understand VRAM. I can work up a demo for any of this if you like. btw, mic, in my struggle to get various bitmap backgrounds going I stumbled upon your graphics notes and found them exTREMELY helpfull. thanks for posting them. Link to comment Share on other sites More sharing options...
mic Posted June 12, 2005 Share Posted June 12, 2005 The IRQ/timer issue is news to me. I'll look into it. For the VRAM problem, what mode are you using?I'm not familiar with the ndslib defines, only with the raw bitpatterns. If you posted a demo eventually that'd help, since that way I could figure out which line of code in the emulator is causing the crash which makes finding the reason behind it easier. Link to comment Share on other sites More sharing options...
pacifist Posted June 12, 2005 Author Share Posted June 12, 2005 (edited) I'm using mode 3 Here's a quick demo to show off the problem. http://on-tap.ca/Mode3.zip expected output is one screen with every second pixel red and the other with every second pixel yellow. Edited June 13, 2005 by pacifist Link to comment Share on other sites More sharing options...
mic Posted June 13, 2005 Share Posted June 13, 2005 Found the bug. Bank I was getting a 128kB size when mapped to the sub BG, when it's actually only 16kB -> crash. (This is what you get when creating large arrays by copy-pasting Link to comment Share on other sites More sharing options...
Robert Posted June 13, 2005 Share Posted June 13, 2005 That was pretty quick! Mic, how did you go with the IRQ / timer issue? Link to comment Share on other sites More sharing options...
mic Posted June 13, 2005 Share Posted June 13, 2005 Mic, how did you go with the IRQ / timer issue?I haven't solved that yet, since I don't know of any demos that exhibit that behavior. Might have to write one myself. Link to comment Share on other sites More sharing options...
pacifist Posted June 13, 2005 Author Share Posted June 13, 2005 I can probably work out a demo for that as well if you like. Link to comment Share on other sites More sharing options...
mic Posted June 13, 2005 Share Posted June 13, 2005 That'd be swell. Link to comment Share on other sites More sharing options...
pacifist Posted June 14, 2005 Author Share Posted June 14, 2005 ok I'm thinkin' the vblank stuff is my fault I went and grabbed the new version of ndslib, re-compiled, and dualis is havin' no troubles. although while I was building the demo I did notice that while on hardware this code displays one screen red and one screen blue on dualis they are both white. void irqVBlank(void) { IF = IRQ_VBLANK; } int main(void) { POWER_CR = POWER_ALL_2D; DISPLAY_CR = MODE_0_2D | DISPLAY_BG0_ACTIVE; SUB_DISPLAY_CR = MODE_0_2D | DISPLAY_BG0_ACTIVE; irqInitHandler(irqDefaultHandler); irqSet(IRQ_VBLANK, irqVBlank); PALETTE[0] = RGB15(0, 0, 31); PALETTE[512] = RGB15(31, 0, 0); while(1) swiWaitForVBlank; return 0; } Not a big deal for me, but I thought I'd mention it since I stumbled across it. sorry about the false alarm on the VBlank Link to comment Share on other sites More sharing options...
mic Posted June 14, 2005 Share Posted June 14, 2005 The reason for the screens being white is that the scanline renderer is searching for an appropriately mapped VRAM bank for each active BG. If no suitable bank was found for any of the active BGs I should draw just the backdrop (which I'm not at this point). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now