2019-02-21 20:58:38 +01:00
|
|
|
#define GINT_NEED_VRAM
|
|
|
|
#include <gint/display.h>
|
|
|
|
#include <gint/defs/types.h>
|
|
|
|
|
|
|
|
/* dpixel() - change a pixel's color */
|
|
|
|
void dpixel(int x, int y, color_t color)
|
|
|
|
{
|
|
|
|
/* Sanity checks */
|
2019-03-06 14:32:51 +01:00
|
|
|
if((uint)x >= 128 || (uint)y >= 64) return;
|
2019-02-21 20:58:38 +01:00
|
|
|
|
|
|
|
uint32_t *lword = vram + (y << 2) + (x >> 5);
|
|
|
|
uint32_t mask = 1 << (~x & 31);
|
|
|
|
|
2019-06-15 07:04:38 +02:00
|
|
|
if(color == color_white)
|
2019-02-21 20:58:38 +01:00
|
|
|
{
|
|
|
|
*lword &= ~mask;
|
2019-06-15 07:04:38 +02:00
|
|
|
}
|
|
|
|
else if(color == color_black)
|
|
|
|
{
|
2019-02-21 20:58:38 +01:00
|
|
|
*lword |= mask;
|
2019-06-15 07:04:38 +02:00
|
|
|
}
|
|
|
|
else if(color == color_invert)
|
|
|
|
{
|
2019-02-21 20:58:38 +01:00
|
|
|
*lword ^= mask;
|
|
|
|
}
|
|
|
|
}
|