2 blender for the Gameboy Advance
3 Copyright (C) 2021 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
25 static void handle_keys(void);
27 extern struct { unsigned char r, g, b; } bgimg_cmap[];
28 extern unsigned char bgimg_pixels[];
34 unsigned char r, g, b;
40 /* mode 4: 240x160 8bpp */
41 REG_DISPCNT = DISPCNT_BG2 | 4;
43 cptr = (uint16_t*)CRAM_BG_ADDR;
44 for(i=0; i<128; i++) {
45 r = bgimg_cmap[i].r >> 3;
46 g = bgimg_cmap[i].g >> 3;
47 b = bgimg_cmap[i].b >> 3;
48 *cptr++ = r | (g << 5) | (b << 10);
50 memcpy((void*)VRAM_LFB_FB0_ADDR, bgimg_pixels, 240 * 160);
51 memcpy((void*)VRAM_LFB_FB1_ADDR, bgimg_pixels, 240 * 160);
53 /*key_repeat(500, 75, KEY_LEFT | KEY_RIGHT | KEY_DOWN | KEY_UP);*/
63 static void handle_keys(void)
67 if(KEYPRESS(KEY_UP)) {
69 if(KEYPRESS(KEY_DOWN)) {
71 if(KEYPRESS(KEY_LEFT)) {
73 if(KEYPRESS(KEY_RIGHT)) {