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 2017-02-22 02:13:31

Zubie
New member
Registered: 2017-02-22
Posts: 5

GBDK not setting background data correctly

So I'm attempting to make a background in C using GBDK, but the set_bkg_tiles function seems to break it. "castle" refers to a the data of 5 16x16 tiles made in GBTD, while "levelOne" refers to a map made in GBMB using the tiles in "castle." I have the c files for castle and levelOne included at the top of my main .c file. If I comment out the set_bkg_tiles, BGB shows a few extra tiles palletted but all of the tiles from castle are included. However, set_bkg_tiles seems to make the sprite "picking" go haywire, as BGB shows a bunch of random spots in VRAM as palletted. Has anyone encountered this before? Does anyone know what I'm doing wrong? The code snippet from my main function is as follows:

wait_vbl_done();
DISPLAY_OFF;

set_bkg_data(0x00,0x13, castle);
set_bkg_tiles(0x00, 0x00, 0x12, 0x12, levelOne);

SHOW_BKG;

DISPLAY_ON;

Offline

 

#2 2017-02-22 16:00:31

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: GBDK not setting background data correctly

Are you in GBC mode? Screenshots?

Offline

 

#3 2017-02-23 13:19:14

Zubie
New member
Registered: 2017-02-22
Posts: 5

Re: GBDK not setting background data correctly

If you have to explicitly set GBC mode, I am not in GBC mode. Here's a screenshot of VRAM and what I'm getting:

https://i.imgur.com/LGgjRi2.png

Offline

 

#4 2017-02-23 20:58:08

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: GBDK not setting background data correctly

Ok, but what's the expected output?

Offline

 

#5 2017-02-23 23:22:11

Zubie
New member
Registered: 2017-02-22
Posts: 5

Re: GBDK not setting background data correctly

Sorry! It should look like this:
https://i.imgur.com/ZoBR3hx.png

Also if you look in the VRAM in my first image, the paletted sprites are all over the place, when they should just be the 19 sprites I loaded. There should be a white space at the bottom (where I would put the window for the score display)

Last edited by Zubie (2017-02-24 00:24:55)

Offline

 

#6 2017-02-24 20:36:39

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: GBDK not setting background data correctly

Well, first of all, you are using 16x16 tiles, which doesn't exist for backgrounds. You can do it but it needs extra code, and I'm sure you don't have that code, so you 'll have to split them to 8x8 blocks.

Offline

 

#7 2017-02-25 14:25:43

Zubie
New member
Registered: 2017-02-22
Posts: 5

Re: GBDK not setting background data correctly

I could not find that distinction in any of the resources I found, but that fixed the tiling part. However, the loading into VRAM is still very much broken so that's a different issue.

EDIT: Fixed it thanks!

Last edited by Zubie (2017-02-25 20:34:17)

Offline

 

#8 2017-02-26 07:26:03

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: GBDK not setting background data correctly

If the map is really exported using 8x8 tiles it should be working now, the code looks fine to me. Maybe the export parameters of GBMB are wrong.

Last edited by AntonioND (2017-02-26 07:26:55)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson