# HG changeset patch # User John Tsiombikas # Date 1346724350 -10800 # Node ID f77381b127266d4137a20af69f0a42ed7bc5f119 # Parent 1807781b4503a9ff2ccfb1861b5f9a7736762050 palette diff -r 1807781b4503 -r f77381b12726 src/gfx.c --- a/src/gfx.c Fri Jul 20 22:47:39 2012 +0300 +++ b/src/gfx.c Tue Sep 04 05:05:50 2012 +0300 @@ -38,6 +38,8 @@ static volatile unsigned short *reg_disp_ctl = (void*)0x4000000; static volatile unsigned short *reg_vcount = (void*)0x4000006; +static unsigned short *paladdr = (void*)0x5000000; + static int xres, yres; static int sizeof_pixel; static int page_flipping; @@ -171,6 +173,10 @@ } } +void set_palette(int idx, int r, int g, int b) +{ + paladdr[idx] = RGB(r, g, b); +} void draw_line(int x1, int y1, int x2, int y2, unsigned short col, struct pixel_buffer *pbuf) { int dx, dy, dx2, dy2; diff -r 1807781b4503 -r f77381b12726 src/gfx.h --- a/src/gfx.h Fri Jul 20 22:47:39 2012 +0300 +++ b/src/gfx.h Tue Sep 04 05:05:50 2012 +0300 @@ -54,6 +54,8 @@ void blit(struct pixel_buffer *src, int src_x, int src_y, int src_w, int src_h, struct pixel_buffer *dst, int dest_x, int dest_y); +void set_palette(int idx, int r, int g, int b); + #define wait_vsync() while(*((volatile unsigned short*)0x4000006) < front_buffer->y) #define put_pixel(px, py, col, pbuf) ((unsigned short*)(pbuf)->pixels)[(py) * (pbuf)->x + (px)] = col