Gameboy Development Forum

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.

Ads

#1 2014-10-08 08:52:52

Crona
Member
From: Wisconsin
Registered: 2014-09-23
Posts: 58
Website

Tiles glitch out when I play on a real Gameboy but not on emulator.

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

 

#2 2014-10-08 09:03:23

Crona
Member
From: Wisconsin
Registered: 2014-09-23
Posts: 58
Website

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

Like it shows the first splash screen thing waits 3 seconds, and then the tiles spaz out and the screen goes blank.
http://s30.postimg.org/ry813xzrx/20141008_075410.jpg] http://s29.postimg.org/6jeb6ws37/20141008_075414.jpg

Last edited by Crona (2014-10-08 09:11:06)

Offline

 

#3 2014-10-08 10:41:08

a cat
Member
Registered: 2014-07-27
Posts: 98

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

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();


a cat in need of knowledge!!

Offline

 

#4 2014-10-08 11:34:08

Crona
Member
From: Wisconsin
Registered: 2014-09-23
Posts: 58
Website

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

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

 

#5 2014-10-08 12:42:43

Crona
Member
From: Wisconsin
Registered: 2014-09-23
Posts: 58
Website

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

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

 

#6 2014-10-27 02:20:24

andreai
Member
Registered: 2014-07-28
Posts: 21

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

Hey Crona, try using wait_vbl_done() before and after setting background tiles or when inside an interrupt.

Offline

 

#7 2014-10-27 11:10:39

Crona
Member
From: Wisconsin
Registered: 2014-09-23
Posts: 58
Website

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

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

 

#8 2014-10-29 15:16:06

andreai
Member
Registered: 2014-07-28
Posts: 21

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

using wait_vbl_done() you just make sure the processor is done drawing the screen before you do anything new.

Offline

 

#9 2014-10-29 16:43:26

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 245

Re: Tiles glitch out when I play on a real Gameboy but not on emulator.

Be sure to use BGB for debugging. It is both an accurate emulator and a well equipped debugger.

http://bgb.bircd.org/


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson