keymap changes and new framebuffer
This commit is contained in:
parent
74ea93a708
commit
ee32942ebb
|
@ -263,7 +263,7 @@
|
||||||
#define VARVARA_A BUTTON_VOL_UP
|
#define VARVARA_A BUTTON_VOL_UP
|
||||||
#define VARVARA_B BUTTON_VOL_DOWN
|
#define VARVARA_B BUTTON_VOL_DOWN
|
||||||
#define VARVARA_START BUTTON_SELECT
|
#define VARVARA_START BUTTON_SELECT
|
||||||
#define VARVARA_SELECTBUTTON_PLAYPAUSE
|
#define VARVARA_SELECT BUTTON_PLAYPAUSE
|
||||||
#define VARVARA_MENU BUTTON_BACK
|
#define VARVARA_MENU BUTTON_BACK
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
||||||
|
|
|
@ -24,9 +24,6 @@ TODO clean up
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const Uint8 hwrom[] = { /* hello world ROM */
|
const Uint8 hwrom[] = { /* hello world ROM */
|
||||||
0x20, 0x01, 0x0e, 0x94, 0x80, 0x18, 0x17, 0x21,
|
0x20, 0x01, 0x0e, 0x94, 0x80, 0x18, 0x17, 0x21,
|
||||||
0x94, 0x80, 0xf7, 0x0d, 0x22, 0x00, 0x48, 0x65,
|
0x94, 0x80, 0xf7, 0x0d, 0x22, 0x00, 0x48, 0x65,
|
||||||
|
@ -34,7 +31,7 @@ const Uint8 hwrom[] = { /* hello world ROM */
|
||||||
0x21,
|
0x21,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Uint8 screen_rom[] = { /* screen test ROM */
|
const Uint8 uxn_rom[] = { /* screen test ROM */
|
||||||
0x20, 0x01, 0x43, 0x80, 0x20, 0x37, 0x20, 0xf0,
|
0x20, 0x01, 0x43, 0x80, 0x20, 0x37, 0x20, 0xf0,
|
||||||
0x7f, 0x80, 0x08, 0x37, 0x20, 0xf0, 0xe0, 0x80,
|
0x7f, 0x80, 0x08, 0x37, 0x20, 0xf0, 0xe0, 0x80,
|
||||||
0x0a, 0x37, 0x20, 0xf0, 0xc0, 0x80, 0x0c, 0x37,
|
0x0a, 0x37, 0x20, 0xf0, 0xc0, 0x80, 0x0c, 0x37,
|
||||||
|
@ -178,7 +175,7 @@ const Uint8 vector_rom[] = { // screen vector test ROM
|
||||||
0x80, 0x80, 0x80,
|
0x80, 0x80, 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Uint8 uxn_rom[] = { /* controller test ROM */
|
const Uint8 controller_rom[] = { /* controller test ROM */
|
||||||
0x20, 0x0f, 0xf7, 0x80, 0x08, 0x37, 0x20, 0x0f,
|
0x20, 0x0f, 0xf7, 0x80, 0x08, 0x37, 0x20, 0x0f,
|
||||||
0x07, 0x80, 0x0a, 0x37, 0x20, 0x0f, 0x07, 0x80,
|
0x07, 0x80, 0x0a, 0x37, 0x20, 0x0f, 0x07, 0x80,
|
||||||
0x0c, 0x37, 0x80, 0x22, 0x36, 0x80, 0x01, 0x3f,
|
0x0c, 0x37, 0x80, 0x22, 0x36, 0x80, 0x01, 0x3f,
|
||||||
|
@ -307,6 +304,7 @@ static Ppu ppu;
|
||||||
static Device *devctrl, *devsystem, *devconsole, *devscreen;
|
static Device *devctrl, *devsystem, *devconsole, *devscreen;
|
||||||
unsigned int palette[3];
|
unsigned int palette[3];
|
||||||
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
||||||
|
static fb_data *lcd_fb = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
memzero8(void *src, uint64_t n)
|
memzero8(void *src, uint64_t n)
|
||||||
|
@ -343,7 +341,7 @@ set_palette(Uint8 *addr)
|
||||||
r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
||||||
g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
||||||
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
||||||
palette[i] = LCD_RGBPACK(r*8,g*8,b*8);
|
palette[i] = FB_RGBPACK(r*8,g*8,b*8);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
|
@ -445,22 +443,17 @@ nil_talk(Device *d, Uint8 b0, Uint8 w)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO optimise, proper greyscale
|
// TODO mono, greyscale
|
||||||
static void redraw(void)
|
static void redraw(void)
|
||||||
{
|
{
|
||||||
rb->lcd_clear_display();
|
if (!lcd_fb)
|
||||||
Uint16 x, y;
|
{
|
||||||
for(y = 0; y < ppu.height; ++y)
|
struct viewport *vp_main = rb->lcd_set_viewport(NULL);
|
||||||
for(x = 0; x < ppu.width; ++x) {
|
lcd_fb = vp_main->buffer->fb_ptr;
|
||||||
#if LCD_DEPTH > 4
|
}
|
||||||
rb->lcd_set_foreground(palette[ppu_read(&ppu, x, y)]);
|
for(int y = 0 ; y < LCD_WIDTH*LCD_HEIGHT; y++ ) {
|
||||||
rb->lcd_drawpixel(x, y);
|
lcd_fb[y] = palette[ppu_read(&ppu, y%LCD_WIDTH, y/LCD_HEIGHT)];
|
||||||
#else
|
}
|
||||||
if(palette[ppu_read(&ppu, x, y)]) {
|
|
||||||
rb->lcd_drawpixel(x, y);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
ppu.reqdraw = 0;
|
ppu.reqdraw = 0;
|
||||||
|
|
||||||
|
@ -473,6 +466,7 @@ uxn_halt(Uxn *u, Uint8 error, char *name, int id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO fix timing
|
||||||
static void run() {
|
static void run() {
|
||||||
while(!devsystem->dat[0xf]) {
|
while(!devsystem->dat[0xf]) {
|
||||||
uxn_eval(&u, devscreen->vector);
|
uxn_eval(&u, devscreen->vector);
|
||||||
|
@ -519,7 +513,6 @@ static void run() {
|
||||||
|
|
||||||
uxn_eval(&u, peek16(devctrl->dat, 0));
|
uxn_eval(&u, peek16(devctrl->dat, 0));
|
||||||
}
|
}
|
||||||
rb->sleep(HZ/60);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue