I was experimenting in VBDE earlier today, trying to see if I could use my new FlashBoy to run my own code on actual Virtual Boy hardware. I only know the very basics of programming in C, so I started by modifying one of the more simple demo files.
I was able to get my code to compile, and it seems to run well in RealityBoy. When I flash to the FlashBoy and try to run it on the VirtualBoy, though, it’s all… blinky. It looks like the mirrors aren’t syncing properly with the LEDs, or something. The image is there, but it’s strobing out of control, and there are vertical gaps.
I thought the problem might be with my code, so I compiled the first VBDE demo project (a static image of the PlanetVB logo) and flashed it. Same problem: I could make out the image, but it was strobing like crazy and interrupted by vertical gaps.
Just to be sure that the problem wasn’t with my FlashBoy, I flashed it with a commercial rom. The commercial rom played perfectly.
Is this a common problem? Does anyone know how I might go about addressing it?
Test and debug your code against Mednafen. Reality Boy is old and its emulation is not very accurate.
Good advice, but I’m wondering if anyone has any insight into what’s causing the underlying issue.
Even when I compile code that was written by other people (who actually know what they’re doing), it still looks glitchy on my VB.
Is it possible VBDE isn’t configured correctly?
Could you post an example of some code you’ve recently tried that definitely causes glitches on hardware?
Here’s my code. It’s a lightly modified version of one of the samples that comes packaged with VBDE. All it does is populate the displays with a bunch of red rectangles in a diagonal pattern. I made the charmap and bgmap using VIDE.
//Include library, charmap, charset
#include libgccvb.h
#include "testchmap.h"
#include "testchset.h"
int main()
{
//Initialize variables
int x = 30;
int y = 20;
int i = 30;
//Initial setup
vbDisplayOn();
//Copy tileset and tilemap into memory
copymem((void*)CharSeg0, (void*)testchset, 256*16);
copymem((void*)BGMap(0), (void*)testchmap, 450*16);
//Setup worlds
//(This uses structs to access world data, the old method using functions is commented out)
WA[31].head = (WRLD_ON|WRLD_OVR);
WA[31].w = 384;
WA[31].h = 224;
//vbSetWorld(31, (WRLD_LON|WRLD_OVR), 0, 0, 0, 0, 0, 0, 384, 224);
while(i > 20)
{
WA.head = (WRLD_ON|WRLD_OVR);
WA.w = 384;
WA.h = 224;
WA.gx = x;
WA.gy = y;
x = x + 30;
y = y + 20;
i--;
//vbSetWorld(30, (WRLD_RON|WRLD_OVR), 0, 0, 0, 0, 0, 224, 384, 224);
}
WA[20].head = WRLD_END;
//vbSetWorld(29, WRLD_END, 0, 0, 0, 0, 0, 0, 0, 0);
//Set brightness registers
vbDisplayShow();
//Main loop (Empty because we're done but don't want to reach the end)
for (;;){vbWaitFrame(0);}
return 0;
}
The code looks OK. The symptoms you’re describing sound like the column table is not initialized. VBDE’s startup code should initialize it automatically (unless it doesn’t do that anymore), but you can manually call vbSetColTable() and see whether that fixes the problem.
That was it! It totally works now. I can’t believe I developed Virtual Boy software. (Well, sort of.)
Thanks.