Change window address -> text drawing breaks

SGDK only sub forum

Moderator: Stef

Post Reply
cero
Very interested
Posts: 339
Joined: Mon Nov 30, 2015 1:55 pm

Change window address -> text drawing breaks

Post by cero » Mon Feb 08, 2016 5:24 pm

In the following code, if I comment the setWindowAddress call, text draws fine. This is because the drawing expects the window to always be at the bottom of the top of VRAM. I think it should be changed to a draw at a static value.

Code: Select all

#include <genesis.h>
#define APLAN_DEFAULT           0xE000

int main() {

	VDP_setWindowAddress(APLAN_DEFAULT);

	VDP_setTextPlan(PLAN_B);

	VDP_drawText("This goes to plane B.", 10, 13);

	while (1);

	return 0;
}

cero
Very interested
Posts: 339
Joined: Mon Nov 30, 2015 1:55 pm

Re: Change window address -> text drawing breaks

Post by cero » Mon Feb 08, 2016 5:38 pm

I tried to work around this, keeping window the first one, by setting plane B to the same address as plane A. But apparently this isn't legal, it creates a black screen.

Is this a limitation of the Genesis, or of SGDK?

cero
Very interested
Posts: 339
Joined: Mon Nov 30, 2015 1:55 pm

Re: Change window address -> text drawing breaks

Post by cero » Mon Feb 08, 2016 5:52 pm

OK, I found a bug.

In the setBPlaneAddress function, the bplan_adr variable is not updated, even though that's done in the setReg function. Will file this one to github.

cero
Very interested
Posts: 339
Joined: Mon Nov 30, 2015 1:55 pm

Re: Change window address -> text drawing breaks

Post by cero » Mon Feb 08, 2016 6:01 pm

For my original issue: I found a working memory layout by putting plane A at 0x0000. Since I use a fullscreen window plane in this project, the garbage in plane A doesn't matter, and this way no memory is wasted, I even gain 128 more tiles.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Change window address -> text drawing breaks

Post by Stef » Mon Feb 08, 2016 7:49 pm

cero wrote:OK, I found a bug.

In the setBPlaneAddress function, the bplan_adr variable is not updated, even though that's done in the setReg function. Will file this one to github.
Thanks for pointing this one ! Never noticed, will be fixed next version :)

Post Reply