aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 3ecfa71..f2ffa5b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,6 +30,16 @@ console_talk(Device *d, u8 b0, u8 w) {
30 } 30 }
31} 31}
32 32
33static void
34docolors(Device *d) {
35 for(size_t i = 0; i < 4; ++i) {
36 u8 r = ((d->dat[0x8 + i / 2] >> (!(i % 2) << 2)) & 0x0f) * 0x11;
37 u8 g = ((d->dat[0xa + i / 2] >> (!(i % 2) << 2)) & 0x0f) * 0x11;
38 u8 b = ((d->dat[0xc + i / 2] >> (!(i % 2) << 2)) & 0x0f) * 0x11;
39 palette[i] = (b << 16) | (g << 8) | r;
40 }
41}
42
33void 43void
34system_talk(Device *d, u8 b0, u8 w) { 44system_talk(Device *d, u8 b0, u8 w) {
35 // uart_puts("system_talk\n"); 45 // uart_puts("system_talk\n");
@@ -46,7 +56,7 @@ system_talk(Device *d, u8 b0, u8 w) {
46 case 0xf: d->u->ram.ptr = 0x0000; break; 56 case 0xf: d->u->ram.ptr = 0x0000; break;
47 } 57 }
48 if(b0 > 0x7 && b0 < 0xe) { 58 if(b0 > 0x7 && b0 < 0xe) {
49 // docolors(d); TODO 59 docolors(d);
50 } 60 }
51 } 61 }
52 (void)b0; 62 (void)b0;
@@ -155,5 +165,20 @@ void main(void) {
155 while(1) { 165 while(1) {
156 // Echo input to standard output. 166 // Echo input to standard output.
157 uxn_eval(&u, mempeek16(devscreen->dat, 0)); 167 uxn_eval(&u, mempeek16(devscreen->dat, 0));
168
169 // DEBUG: testing fb drawing.
170 u32 lines = SCREEN_WIDTH * SCREEN_HEIGHT / 4;
171 for (size_t i = 0; i < lines; i++) {
172 framebuffer[i] = palette[0];
173 }
174 for (size_t i = lines; i < lines * 2; i++) {
175 framebuffer[i] = palette[1];
176 }
177 for (size_t i = lines * 2; i < lines * 3; i++) {
178 framebuffer[i] = palette[2];
179 }
180 for (size_t i = lines * 3; i < lines * 4; i++) {
181 framebuffer[i] = palette[3];
182 }
158 } 183 }
159} 184}