Jump to content

Background Color


Recommended Posts

How is the background color determined with the BG value? I've looked at a couple examples and it doesn't really make sense to me. In the Spritetest C project they have:

*(volatile unsigned short*)(BG)=(volatile unsigned short)2000;        // Set Background colour.

Which produced a Blue color, I changed that to 8000 and got a green color. I then added button inputs to increment or decrement that value and I merely got a darkening or lightening of the color I got at start up while it seemed to loop the same colors. I saw another example use a double digit number to get a lilac like color, what is the format? How would I convert RGB to get a matching color or is there a hardcoded table of color values? Looking at the includes it only shows the memory address for BG.



Link to comment
Share on other sites

As you have discovered BG does not hold a RGB value but a CRY value. This is a 16 bit value where the top 8 bits is the colour and the bottom 8 bits is the brightness. CRY to/from RGB is not an exact match. Normally you would preprocess the colours rather than runtime conversion each frame. I would recommend reading the Jaguar Technical Reference Manual about The CRY Colour Scheme.

  • Like 1
Link to comment
Share on other sites

Not exactly. (the doc is not well explained here)

The BG color is a 16-bit value that is writtenback to the linebuffer after each pixel read.


The linebuffer color scheme is defined by the VMODE register, so the BG can be RGB16 or CRY16.

In RGB24, the BG is not written back.



  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...