Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Pages: 1
This peice of code glitches out just before the printf
set_bkg_data(0,256,SpaceKittyGamesLogo_tiledata);
set_bkg_tiles(0,0,20,18,SpaceKittyGamesLogo_tilemap);
SHOW_BKG;
delay(3000);
HIDE_BKG;
printf(" \n\n\n PEW PEW\n\n\n\n\n (PRESS START)\n\n\n\n\n MadeBy:\nIsaac Tschampl\n Website:\nSpaceKittyGames.com");
waitpad(J_START);
waitpadup();
Is there something I am clearly doing wrong here that I just cant figure out? It works totally fine on an emulator (you can try for yourself if you want here is the rom)
Last edited by Crona (2014-10-08 08:53:10)
Offline
Offline
i think you need to turn the display on and off
try this:
set_bkg_data(0,256,SpaceKittyGamesLogo_tiledata);
set_bkg_tiles(0,0,20,18,SpaceKittyGamesLogo_tilemap);
SHOW_BKG
DISPLAY_ON;
delay(3000);
HIDE_BKG;
DISPLAY_OFF;
printf(" \n\n\n PEW PEW\n\n\n\n\n (PRESS START)\n\n\n\n\n MadeBy:\nIsaac Tschampl\n Website:\nSpaceKittyGames.com");
waitpad(J_START);
waitpadup();
Offline
It still glitches out with that. I remember hearing or reading in some tutorial doing a printf while graphics are active is a no-no, but there has to be a way to do it. I would just make the printf into a separate background, but I don't think there is enough space left.
Offline
I tried making it into a background and it did the same thing.
Whats weird is that in an older version of the code I go from bkg to a printf no problem. The only difference is that the new code has const in front of the tiles.
______________________________________________________________________________________________________
Thats what the problem was, apparently you cant change background data if its a const and printf occupies the background layer.
Last edited by Crona (2014-10-08 14:49:16)
Offline
Hey Crona, try using wait_vbl_done() before and after setting background tiles or when inside an interrupt.
Offline
I am a little confused about how vbl works, from what I understand it lets you run code in the time right before the screen draws. But wouldn't wait_vbl_done() make it run while the screen is drawing?
Offline
using wait_vbl_done() you just make sure the processor is done drawing the screen before you do anything new.
Offline
Be sure to use BGB for debugging. It is both an accurate emulator and a well equipped debugger.
http://bgb.bircd.org/
Offline
Pages: 1