In my game code I import a custom pattern table and then assign the same colour to all the colour table addresses in video ram.
I then use vdp_colorizePattern() to assign specific colours to specific patterns.
The method I'm using to assign the single colour is a for loop in C. I was wondering if this could be a function in NABU-LIB. It would be similar to the clear screen function which writes a 0x00 to all nameTable addresses except you could pass in a hex value to assign the fg and bg colours.
If this function was in NABU-LIB it would simplify the cross compiling work I'm doing for the z80retro. It wouldn't limit the nabu in any way. It might even make that part of the code a wee bit faster.
If you want, I can post the code for the function. Or raise a PR...
Thanks for listening...
Feature request: function to assign same colour to all colour table
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Feature request: function to assign same colour to all colour table
i've seen your loop in your game code and thought about that before . post it and I'll throw it in.
- productiondave
- Posts: 117
- Joined: Tue Mar 28, 2023 10:01 pm
Re: Feature request: function to assign same colour to all colour table
Would something like this do the trick?
NABU-LIB.h
NABU-LIB.c
it pains me to spell colour incorrectly.
NABU-LIB.h
Code: Select all
// **************************************************************************
// Set the entireColorTable to be the same value.
//
// **************************************************************************
void vdp_setPatternColor(uint8_t color);
Code: Select all
// Set all values in the color table to color.
void vdp_setPatternColor(uint8_t color) {
vdp_setWriteAddress(_vdpColorTableAddr);
for (uint16_t i = 0; i < 0x1800; i++) {
IO_VDPDATA = color;
}
}
Rock On!
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/
~ productiondave
https://github.com/linuxplayground/nabu-games
https://www.reddit.com/r/beneater/