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-09-26 21:35:50

Videogamer555
New member
Registered: 2014-09-26
Posts: 1

What are the different modes in GBDK?

According to the documentation

plot_point (UINT8 x, UINT8 y)
Plot a point in the current drawing mode and colour at (x,y).

And to set the mode and color you must use the command "color" and it has documentation that says this

color (UINT8 forecolor, UINT8 backcolor, UINT8 mode)
Set the current foreground colour (for pixels), background colour, and draw mode.

Unfortunately it doesn't give valid values for the modes. I have tried the values 0 and 1 for the "mode" parameter in the program I'm writing, and have seen no visible effect on how plot_point works.

Can someone here please explain the different modes to me?

Offline

 

#2 2014-09-27 05:58:51

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

Re: What are the different modes in GBDK?

From "gb/drawing.h":

#define    SOLID    0x00        /* Overwrites the existing pixels */
#define    OR    0x01        /* Performs a logical OR */
#define    XOR    0x02        /* Performs a logical XOR */
#define    AND    0x03        /* Performs a logical AND */

The value of color can be 0-3, I suppose, so this is what it does:

SOLID -> screen_color = new_color;
OR -> screen_color = new_color | old_color;
XOR -> screen_color = new_color ^ old_color;
AND -> screen_color = new_color & old_color;

The code is in "libc/gb/drawing.s", if you want to check it.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson