diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 9c4a770dd2ca448d94c011b76cc3801404e9194f..2baf543f1333e10031e9d830d20a0a81050ef238 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -48,6 +48,7 @@ typedef unsigned int size_t; #define API_DISP_RECT 0x16 #define API_DISP_CIRC 0x17 #define API_DISP_PIXEL 0x18 +#define API_DISP_UPDATE_FB 0x19 #define API_FILE_OPEN 0x30 #define API_FILE_CLOSE 0x31 @@ -289,6 +290,14 @@ API(API_DISP_CLOSE, int epic_disp_close()); */ API(API_DISP_UPDATE, int epic_disp_update()); +/** + * HACKHACKACHK + */ +API(API_DISP_UPDATE_FB, + int epic_disp_update_fb( + void *framebuffer) + ); + /** * Prints a string into the display framebuffer * diff --git a/epicardium/modules/display.c b/epicardium/modules/display.c index 1786d80534ed630e405763c9a7efd77fddc9806c..5228453f1097ca7848e16b77fb45caaff6a6cd12 100644 --- a/epicardium/modules/display.c +++ b/epicardium/modules/display.c @@ -125,6 +125,18 @@ int epic_disp_update() } } +int epic_disp_update_fb( + void *framebuffer +) { + int cl = check_lock(); + if (cl < 0) { + return cl; + } else { + LCD_Set((uint8_t *)framebuffer, 160*80*2); + return 0; + } +} + int epic_disp_open() { TaskHandle_t task = xTaskGetCurrentTaskHandle(); diff --git a/epicardium/support.c b/epicardium/support.c index a4af99db481fc0530545832221af9a99fb90bc64..200aca470861ba3ab0d4e23c0f903b41339d4d82 100644 --- a/epicardium/support.c +++ b/epicardium/support.c @@ -27,9 +27,9 @@ void pre_idle_sleep(TickType_t xExpectedIdleTime) * TODO: Ensure this is actually correct and does not have any * race conditions. */ - __asm volatile("dsb" ::: "memory"); - __asm volatile("wfe"); - __asm volatile("isb"); + //__asm volatile("dsb" ::: "memory"); + //__asm volatile("wfe"); + //__asm volatile("isb"); } } diff --git a/l0dables/cube/data/confidence.h b/l0dables/cube/data/confidence.h new file mode 100644 index 0000000000000000000000000000000000000000..c939715e18b4fbf95a273c394f1e0c49b50f925d --- /dev/null +++ b/l0dables/cube/data/confidence.h @@ -0,0 +1,175 @@ +/* GIMP RGB C-Source image dump (confidence.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ + unsigned char pixel_data[32 * 32 * 3 + 1]; +} confidence = { + 32, 32, 3, + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\373\373\377\355\355\377\352\352" + "\377\352\352\377\352\352\377\346\346\377\344\344\377\353\353\377\374\374" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\363\363\377\347\347\377\303\303" + "\377\232\232\377\226\226\377\224\224\377\225\225\377\214\214\377\205\205" + "\377\224\224\377\276\276\377\321\321\377\361\361\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\352\352\377\263\263" + "\377\225\225\377\241\241\377\313\313\377\267\267\377\304\304\377\310\310" + "\377\267\267\377\334\334\377\305\305\377\220\220\377yy\377\230\230\377\324" + "\324\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\344\344\377\276\276\377\276\276\377\236" + "\236\377\247\247\377\314\314\377\340\340\377\246\246\377\266\266\377\251" + "\251\377\227\227\377\264\264\377\275\275\377\337\337\377\361\361\377\324" + "\324\377pp\377JJ\377\232\232\377\310\310\377\335\335\377\376\376\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\352\352\377\230\230\377\225\225\377\206\206\377||\377" + "\254\254\377\357\357\377\377\377\377\343\343\377\223\223\377\322\322\377" + "\266\266\377\250\250\377\276\276\377\206\206\377\177\177\377nn\377gg\377" + "__\37722\377//\377BB\377==\377XX\377\217\217\377\325\325\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\336\336\377zz\377\267\267" + "\377\302\302\377\231\231\377\250\250\377\362\362\377\377\377\377\377\377" + "\377\371\371\377\377\377\377\377\377\377\377\377\377\377\377\377\225\225" + "\37799\374ii\330bb\257WW\317\211\211\376\302\302\377\304\304\377\264\264" + "\377\233\233\377ZZ\377\36\36\377))\377{{\377\361\361\377\377\377\377\377" + "\377\377\366\366\377hh\377\314\314\377\377\377\377\341\341\377\216\216\377" + "\316\316\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377{{\377JJ\377\254\254\365\325\325\252\250\250\212" + "\223\223\257\265\265\277\304\304\351\357\357\377\377\377\377\377\377\377" + "\355\355\377\312\312\377ss\377\5\5\377BB\377\377\377\377\376\376\377\271" + "\271\377\221\221\377\377\377\377\370\370\377\265\265\377\244\244\377\363" + "\363\377\361\361\377\333\333\377\257\257\377\244\244\377\244\244\377\316" + "\316\377zz\377\\\\\377\334\334\377\377\377\375\377\377\353\354\354\272\272" + "\272\223\223\223\316\316\316\374\374\374\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\367\367\377\261\261\377\22\22\377\376\376\377\375\375" + "\377\211\211\377\352\352\377\377\377\377\356\356\377\235\235\377\266\266" + "\377\366\366\377\327\327\377\305\305\377\273\273\377\310\310\377\314\314" + "\377\272\272\37799\377\260\260\377\377\377\377\377\377\377\377\377\377\377" + "\377\370\370\370\361\361\361\373\375\375\377\377\377\377\377\377\377\377" + "\377\377\376\376\377\377\377\377\360\360\377\331\331\377..\377\377\377\377" + "\375\375\377\232\232\377\375\375\377\377\377\377\362\362\377\250\250\377" + "\256\256\377\373\373\377\375\375\377\374\374\377\364\364\377\377\377\377" + "\377\377\377\373\373\377\362\362\377\270\270\377\217\217\377\254\254\377" + "\330\330\377\376\376\377\377\377\377\373\373\377\340\340\377\257\257\377" + "^^\377kk\377\360\360\377\304\304\377;;\377nn\377gg\377\377\377\377\377\377" + "\377\342\342\377\322\322\377\377\377\377\377\377\377\265\265\377\211\211" + "\377\377\377\377\377\377\377\377\377\377\311\311\377\221\221\377\331\331" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\344\344\377aa\377\35" + "\35\377\225\225\377\307\307\377\337\337\377\233\233\377\14\14\377\207\207" + "\377\343\343\377\250\250\377\311\311\377))\377\357\357\377\377\377\377\377" + "\377\377\376\376\377\345\345\377\376\376\377\377\377\377\321\321\377\202" + "\202\377\331\331\377\365\365\377\224\224\377PP\377\247\247\377uu\377vv\377" + "ll\377aa\377HH\377CC\377~~\377\263\263\377\367\367\377\377\377\377\356\356" + "\377MM\377\21\21\377\315\315\377\377\377\377\317\317\377//\377\322\322\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\377" + "\377\377\377\377\377\377\250\250\377ll\377\337\337\377\377\377\377\350\350" + "\377gg\377\217\217\377dd\377\206\206\377\272\272\377\203\203\377\327\327" + "\377QQ\377\226\226\377\377\377\377\357\357\377jj\377\0\0\377\215\215\377" + "\331\331\377tt\377--\377\324\324\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\226\226\377UU\377\267\267\377\341\341\377\356\356\377\244\244" + "\377\301\301\377\327\327\377ll\377\315\315\377\307\307\377\336\336\377\377" + "\377\377\314\314\377NN\377\0\0\377''\377GG\377!!\377rr\377\366\366\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\272" + "\272\377DD\377^^\377\234\234\377\321\321\377\330\330\377\312\312\377\356" + "\356\377\341\341\377\334\334\377\304\304\377pp\377\"\"\377%%\377II\377dd" + "\377\233\233\377\357\357\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374" + "\377\246\246\377MM\377::\377RR\377``\377``\377XX\377II\37711\377EE\377\240" + "\240\377\366\366\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\353" + "\353\377\303\303\377\252\252\377\240\240\377\250\250\377\300\300\377\343" + "\343\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377", +}; + diff --git a/l0dables/cube/data/dragonsector.h b/l0dables/cube/data/dragonsector.h new file mode 100644 index 0000000000000000000000000000000000000000..040bfa05892e1a237d5a6a6f360d0f6679d9281d --- /dev/null +++ b/l0dables/cube/data/dragonsector.h @@ -0,0 +1,178 @@ +/* GIMP RGB C-Source image dump (dragonsector.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ + unsigned char pixel_data[32 * 32 * 3 + 1]; +} dragonsector = { + 32, 32, 3, + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\366\373\362\356\367\347" + "\377\377\377\377\377\377\377\377\377\377\377\377\357\367\350\366\372\362" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\370\373\365\323\352\300" + "\317\350\272\336\360\320\376\376\376\356\366\341\351\363\327\376\376\376" + "\340\360\323\317\350\272\323\352\300\367\373\364\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\363\371\360\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\345\363\336" + "\320\351\300\327\354\306\374\375\373\377\377\377\377\377\377\275\337\240" + "\257\330\214\375\376\375\377\377\377\374\375\373\330\354\310\320\351\300" + "\343\362\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\306\347\302" + "\261\340\261\343\363\345\376\376\376\377\377\377\377\377\377\377\377\377" + "\343\363\340\312\350\302\350\365\343\377\377\377\377\377\377\377\377\377" + "\370\374\370\220\320\207|\310q\360\370\356\377\377\377\377\377\377\377\377" + "\377\351\365\344\311\350\300\340\362\336\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\350\366\352\375\377\375\377\377" + "\377\316\352\322\226\323\237\215\315\231\214\312\232\303\342\313\356\366" + "\361\370\374\370\314\353\315\342\363\341\377\377\377\377\377\377\377\377" + "\377\377\377\377\371\374\371\204\312\217p\301}\365\372\365\377\377\377\377" + "\377\377\377\377\377\377\377\377\344\364\343\300\346\302\367\373\367\377" + "\377\377\377\377\377\376\376\376\330\354\336\240\323\253\252\332\262\377" + "\377\377\377\377\377\331\353\337\305\340\316\275\335\310\225\312\244\215" + "\305\236\215\303\240\247\320\266\233\313\254\304\336\317\310\341\323\310" + "\340\323\276\333\312\237\313\261\332\353\340\200\274\225l\262\205\350\362" + "\354\273\332\310\321\345\332\351\363\355\365\371\367\371\373\372\277\342" + "\306\324\351\332\342\357\350\272\331\307\206\276\233z\271\217\256\326\272" + "\317\346\326\377\377\377\377\377\377\337\354\345\303\334\316\355\365\360" + "\377\377\377\376\376\376\353\363\356\267\323\303h\246\204A\216dX\236x\211" + "\273\240\240\311\262~\264\226\331\350\337U\231tH\222j\336\353\344|\262\224" + "n\252\212\211\272\240s\253\215k\245\206f\242\202\210\270\236\231\304\255" + "\245\314\266\271\330\307\317\345\330\340\354\346\327\350\337\377\377\377" + "\377\377\377\327\344\335\316\336\325\377\377\377\347\356\353\263\314\276" + "\251\306\266\253\310\270\231\274\251\250\306\266\350\360\354\374\375\374" + "\310\331\320\260\314\275\235\275\254\37jA\24c8|\247\217\307\333\320\315\336" + "\325\367\372\370\334\350\342\236\300\255`\226y\236\277\255\272\320\304\366" + "\370\367\377\377\377\377\377\377\342\354\347\335\350\342\377\377\377\377" + "\377\377\302\323\311\274\316\304\260\306\272\236\272\253\274\320\305\365" + "\370\366\356\362\360\247\300\262\335\347\342\377\377\377\370\372\371\301" + "\323\311\304\324\313R\203h\25X3\25X36pP\273\315\303\314\333\323\353\361\356" + "\377\377\377\364\367\365\261\310\273\306\327\316\261\310\274\263\310\275" + "\276\317\306\356\362\360\353\361\356\323\337\330\377\377\377\345\353\347" + "\211\245\225\236\266\250\303\322\311\344\353\347\377\377\377\377\377\377" + "\267\310\276\277\320\306\377\377\377\377\377\377\336\345\341\244\272\256" + "\252\277\263T\177g\26O0\26O0Z\204l\234\264\247\273\313\302\322\334\326\377" + "\377\377\377\377\377\320\334\325\262\305\273\372\373\372\366\370\367\313" + "\331\321\300\320\307\264\306\274\245\273\257\356\362\357\365\366\365\334" + "\344\340\356\362\360\352\357\354\327\337\333\323\333\327\277\313\304\260" + "\301\267\351\355\353\350\354\352\370\371\371\273\310\301\273\311\301\370" + "\372\371\264\303\273\36L2-X?\314\327\321\344\352\347\310\323\315\310\323" + "\314\377\377\377\374\374\374\367\370\367\263\303\272\263\302\272\377\377" + "\377\342\347\344\341\347\344\326\337\331\320\332\324\366\371\367\377\377" + "\377\377\377\377\377\377\377\377\377\377\371\372\371\256\274\264\235\255" + "\244\312\323\316\321\331\325\316\327\322\320\330\324\241\261\250\335\343" + "\340\377\377\377\323\333\326)M94VC\341\346\343\377\377\377\332\341\335\250" + "\267\256\307\320\313\307\321\313\304\316\311\313\324\317\237\260\246\257" + "\274\265\335\343\337\373\374\374\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\302\313\306\262" + "\275\270\273\303\300\377\377\377\377\377\377\376\376\376\346\352\350\377" + "\377\377\377\377\377\346\351\3478SC9SD\347\352\350\377\377\377\377\377\377" + "\317\326\322\330\336\333\375\375\375\377\377\377\304\313\310\314\323\317" + "\302\313\306\375\375\375\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\374" + "\373\374\374\255\265\263\353\355\355\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\336\341\3375I==PE\344\346\345\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\356\357\357\255\266\263\372\373" + "\373\367\370\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\301\306\305\255\263\262\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\374\374\374hsmZe_\370\371\371\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\255\263\262\277\304\303\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\257\262\262\272\274\274\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377z\177{uzv\375\375\375\377\377" + "\377\377\377\377\377\377\377\377\377\377\275\276\277\257\262\262\376\376" + "\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\363\363\364\255\256\257\264\265" + "\266\377\377\377\377\377\377\377\377\377\372\372\372fig\251\253\252\377\377" + "\377\377\377\377\377\377\377\377\377\377\267\267\271\252\253\254\357\357" + "\360\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\366\366" + "\366\251\252\253\247\247\251\340\340\341\376\376\376\372\372\372}~\177\323" + "\324\324\377\377\377\376\376\376\341\342\342\247\247\251\252\252\253\363" + "\363\363\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\303\303\304\242\243\244\236\236\240\274" + "\275\276\223\224\225\253\254\255\257\260\261\236\237\240\242\242\244\301" + "\302\303\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376" + "\376\376\350\350\350\327\327\330\243\243\244\311\311\312\316\317\317\347" + "\347\347\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\356\356\356\270\270\271\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\371" + "\371\371\341\341\341\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\362\362\362\373\373\373\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377", +}; + diff --git a/l0dables/cube/data/font.h b/l0dables/cube/data/font.h new file mode 100644 index 0000000000000000000000000000000000000000..ec6361a13111e88420cfcec40bf9c493f9032a9f --- /dev/null +++ b/l0dables/cube/data/font.h @@ -0,0 +1,385 @@ +struct { + struct { + char codepoint; + unsigned char lines[16]; + } glyphs[94]; +} FB_Font = { + .glyphs = { + { + .codepoint = 0x21, + .lines = { 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x22, + .lines = { 0x00, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x23, + .lines = { 0x00, 0x00, 0x24, 0x24, 0x24, 0x7e, 0x24, 0x24, 0x7e, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x24, + .lines = { 0x00, 0x10, 0x10, 0x7c, 0x92, 0x90, 0x90, 0x7c, 0x12, 0x12, 0x92, 0x7c, 0x10, 0x10, 0x00, 0x00 } + }, + { + .codepoint = 0x25, + .lines = { 0x00, 0x00, 0x64, 0x94, 0x68, 0x08, 0x10, 0x10, 0x20, 0x2c, 0x52, 0x4c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x26, + .lines = { 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x30, 0x4a, 0x44, 0x44, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x27, + .lines = { 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x28, + .lines = { 0x00, 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x29, + .lines = { 0x00, 0x00, 0x20, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2a, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x7e, 0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2b, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2c, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2d, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2e, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x2f, + .lines = { 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3a, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3b, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3c, + .lines = { 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3d, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3e, + .lines = { 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x3f, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x40, + .lines = { 0x00, 0x00, 0x7c, 0x82, 0x9e, 0xa2, 0xa2, 0xa2, 0xa6, 0x9a, 0x80, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5b, + .lines = { 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5c, + .lines = { 0x00, 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5d, + .lines = { 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5e, + .lines = { 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5f, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00 } + }, + { + .codepoint = 0x60, + .lines = { 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x7b, + .lines = { 0x00, 0x00, 0x0c, 0x10, 0x10, 0x10, 0x20, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x7c, + .lines = { 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x7d, + .lines = { 0x00, 0x00, 0x30, 0x08, 0x08, 0x08, 0x04, 0x08, 0x08, 0x08, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x7e, + .lines = { 0x00, 0x62, 0x92, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x61, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x62, + .lines = { 0x00, 0x00, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x63, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x64, + .lines = { 0x00, 0x00, 0x02, 0x02, 0x02, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x65, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x66, + .lines = { 0x00, 0x00, 0x0e, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x67, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00 } + }, + { + .codepoint = 0x68, + .lines = { 0x00, 0x00, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x69, + .lines = { 0x00, 0x00, 0x10, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x6a, + .lines = { 0x00, 0x00, 0x04, 0x04, 0x00, 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00 } + }, + { + .codepoint = 0x6b, + .lines = { 0x00, 0x00, 0x40, 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x6c, + .lines = { 0x00, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x6d, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x6e, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x6f, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x70, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x00 } + }, + { + .codepoint = 0x71, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x00 } + }, + { + .codepoint = 0x72, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x60, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x73, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x7c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x74, + .lines = { 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x75, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x76, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x77, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x78, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x79, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00 } + }, + { + .codepoint = 0x7a, + .lines = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x41, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x42, + .lines = { 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x43, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x44, + .lines = { 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x45, + .lines = { 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x46, + .lines = { 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x47, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x4e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x48, + .lines = { 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x49, + .lines = { 0x00, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4a, + .lines = { 0x00, 0x00, 0x0e, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4b, + .lines = { 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4c, + .lines = { 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4d, + .lines = { 0x00, 0x00, 0x82, 0xc6, 0xaa, 0x92, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4e, + .lines = { 0x00, 0x00, 0x42, 0x42, 0x42, 0x62, 0x52, 0x4a, 0x46, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x4f, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x50, + .lines = { 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x51, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x4a, 0x3c, 0x02, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x52, + .lines = { 0x00, 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x53, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x54, + .lines = { 0x00, 0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x55, + .lines = { 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x56, + .lines = { 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x57, + .lines = { 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, 0xaa, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x58, + .lines = { 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x59, + .lines = { 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x5a, + .lines = { 0x00, 0x00, 0x7e, 0x02, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x30, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x31, + .lines = { 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x3e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x32, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x33, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x1c, 0x02, 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x34, + .lines = { 0x00, 0x00, 0x02, 0x06, 0x0a, 0x12, 0x22, 0x42, 0x7e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x35, + .lines = { 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x7c, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x36, + .lines = { 0x00, 0x00, 0x1c, 0x20, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x37, + .lines = { 0x00, 0x00, 0x7e, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x38, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 } + }, + { + .codepoint = 0x39, + .lines = { 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00 } + }, + } +}; diff --git a/l0dables/cube/data/pepper.h b/l0dables/cube/data/pepper.h new file mode 100644 index 0000000000000000000000000000000000000000..cc614441ea5f167994076cadc296262418c3a13b --- /dev/null +++ b/l0dables/cube/data/pepper.h @@ -0,0 +1,147 @@ +/* GIMP RGB C-Source image dump (pepper.c) */ + +static const struct { + unsigned int width; + unsigned int height; + unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ + unsigned char pixel_data[32 * 32 * 3 + 1]; +} pepper = { + 32, 32, 3, + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\341\347\334\321\345\310" + "\367\367\367\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\330\323\313\243\306\223\313\324\307\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\374\374\374\263\256\241\204\255n\271\327\256\347\346\346\375" + "\375\375\375\375\375\373\373\373\374\374\374\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\375\375\375\350\344\342\261\272\233\230\275|v\251Y\247\317\225\241" + "\243\211\234\177h\241\226m\236\220]\257\272{\324\326\273\370\370\370\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\375\375\375\354\352\352\332" + "\322\317\251\210y\214\244k}\260e\205\273qh\234K\223\302{\244\300\220eZ+o" + "b/s~:\202\253W\214\276q\255\321\233\355\356\354\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372" + "\372\372\256\272\235~\257m~\253igzGuqCZ])\210\262h`\231J}\257a\253\322\242" + "\177\231[u|;n\204:w\251V\213\271o\225\264d\244\304{\346\350\345\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\305\321\274|\263h\207\271l\201\271o\202\270\210\\ZAN!\22LP(r\253U}\262]" + "\256\326\245\244\305\207l\213?q\223Av\220OmB\34\210_)\214\244Q\232\300~\346" + "\347\345\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\366" + "\366\365\236\304\215}\262Y\206\262\\\221\273r\210\255{|\230Y[`6ay=\202\266" + "\\\211\272`\256\323\227\253\317\214\206\252_\202\254`g_,qT%r\210<|\256W\215" + "\300g\243\313\210\356\357\355\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\314\321\304\212\272nu\257Xt\251T\212\257\\\226\270pckBw\211H~\243U\200" + "\253[\221\277r\240\306~\222\270y\200\252[\212\241bEE\35hz6v\221<\201\263" + "S\216\300h\223\307\200\273\322\256\376\376\376\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376" + "\376\376\301\324\270\206\265ho\252Yr\255Wq\240Pp\224J{\245Vx\256]s\251Wx" + "\260^|\242`NQ,m~>r\224A\205\252R\200\250R\205\257T}\260Q\200\266W\222\302" + "s\246\321\243\245\316\230\366\367\366\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\276\323\257s\243Wm\242Sr\245Vi\236Th\242Vh\250Wk\260Zv\270aw\267d\211\300" + "~z\242c\\\177;a\233Ht\262U\203\274b\211\277x\223\302\210\223\303\212\222" + "\277x\245\316\233\242\316\235\351\352\351\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\266\310\243n\231Qo\234Uo\232[k\233]k\243an\255dk\256Yo\263_\202\272" + "~\272\333\312\246\312\267X|@c\230Kj\250N\201\271m\241\312\250\302\336\321" + "\272\332\307\227\301\211\240\311\206\236\310\211\342\345\340\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\262\301\235t\233Wu\235cp\226]n\230]n\237`p\251c" + "k\251Wt\262h\226\307\237\253\322\270\260\325\301Y\177FX\210:_\232Bs\256Z" + "\212\274\203\242\312\241\230\302\216\217\272n\225\300n\227\302v\340\343\334" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\257\275\234q\227Ww\235ft\231ao\225\\" + "n\233^k\235Vg\244Su\261f|\265p\204\270y\211\275\211\\\206ER\1771Z\220:e\243" + "Jk\247T}\261c\212\267l\213\266h\212\267a\220\276o\344\346\341\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\263\272\237lzCq}Iq\213Sm\212Qj\216Pd\217Ic\230K" + "p\250Yv\253\\u\251Zv\246][\205<T\2002Z\2136b\230Ak\237L{\253X\206\260b\206" + "\260_\204\262[\231\301|\360\361\360\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303" + "\302\260uzJs\\2so@jo;ezAa\201Af\214Du\240Sw\245Vr\241Rq\233Qa\211<a\2118" + "`\2126f\222=n\233Ey\244N|\250S~\255W\201\260X\234\273\205\373\373\373\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\341\336\331\233\237zsh9~o>p^3pt>qz?k\201" + "?q\226Nw\243Wz\241Wp\214I_{4`\212:a\217<h\220>q\230Fw\240Lv\242L{\252R}\255" + "U\235\271\212\375\375\375\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\374" + "\272\265\242y\201L}r=q_/rzAr~Ahq6l\210Cv\234R|\236Tt\201Bgj-g~3j\2139l\216" + "=o\225Dp\231Dr\237Hv\246O~\260Z\236\274\213\375\375\375\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\314\277\266~|Rui4{l9no9t\203Cpw=mv;x\220I}\225" + "Nvp9o^)kp.jx/j\2035m\221@q\233Du\241J}\253T\201\262[\236\300\213\373\373" + "\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\334\323\320\216\205" + "frf7\200n=r].wy@w\201Dlo5q\204A{\227Rx\201Fjb+hw3i\2059n\211=j\213<r\230" + "Bw\242J}\255W~\261[\232\277\201\371\371\371\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\364\362\361\250\234\210tj=\177n;uY.rd7v{Alj3nu7y\220Luv" + "?jc,du2j\206:q\223Er\230Iu\236Jw\245L~\256W\200\262[\234\277\201\370\370" + "\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\375\375\375\272\251" + "\237vb@}k=mQ+j[2t~Don6nq4v\205Brf5hV*gr4h\210>n\224Gr\236Nt\243Mw\250M\177" + "\260V\177\262X\246\276\216\374\374\374\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\307\265\256zaD|g9o[/mk9s\202Fnr9mx:t\203Er_1qV+" + "lc.kx6m\212>o\231Hp\240Hs\241F\201\255Q\216\262]\303\307\270\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\325\310\305" + "\214pZzc8r_1kn;q\205Hp}Am{=u\202DqX.jB$hA\40hQ%mp1o\217Ap\234Cs\242E\212" + "\264\\\262\303\223\365\365\364\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\362\357\357\250\213\201\202_<x`5m^0u\206Gu\207" + "Gq}>w{AtP-j2\37i8\37qR*mh.o\216>q\235Bz\251O\246\306\215\360\360\357\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\376\376\376\317\276\272\222oV\201d;jI'rh7tv;xt9xk;q>)g#\33l-!n<" + "%n[.r\220H\220\267m\264\321\237\353\355\351\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\365\362\362\274\243\230\234yYwI3sH0xR4\206b?\223lQ\216cY\241|x\253\207" + "\204\244\205\177\251\216\206\274\256\243\341\341\335\374\374\374\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\361\355\354\323\277" + "\272\273\241\234\271\237\230\276\245\234\311\264\254\316\301\276\355\354" + "\354\372\372\372\373\373\373\372\372\372\374\374\374\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\376\376\376\376\376\376\376\376\376\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377", +}; + diff --git a/l0dables/cube/linearalgebra.c b/l0dables/cube/linearalgebra.c new file mode 100644 index 0000000000000000000000000000000000000000..cdc54538df3837eb13f6a269ed43d9eded4fc04e --- /dev/null +++ b/l0dables/cube/linearalgebra.c @@ -0,0 +1,121 @@ +#include <math.h> +#include <string.h> + +#include "linearalgebra.h" + +void LA_MakeIdentity(struct M4 *out) { + struct M4 m = { + .m = { + { 1.0, 0.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0, 0.0 }, + { 0.0, 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0 } + } + }; + memcpy(out, &m, sizeof(m)); +} + +void LA_MakeRotationX(struct M4 *out, float t) { + struct M4 m = { + .m = { + { 1.0, 0.0, 0.0, 0.0 }, + { 0.0, cosf(t), -sinf(t), 0.0 }, + { 0.0, sinf(t), cosf(t), 0.0 }, + { 0.0, 0.0, 0.0, 1.0 } + } + }; + memcpy(out, &m, sizeof(m)); +} + +void LA_MakeRotationY(struct M4 *out, float t) { + struct M4 m = { + .m = { + { cosf(t), 0.0, sinf(t), 0.0 }, + { 0.0, 1.0, 0.0, 0.0 }, + { -sinf(t), 0.0, cosf(t), 0.0 }, + { 0.0, 0.0, 0.0, 1.0 } + } + }; + memcpy(out, &m, sizeof(m)); +} + +void LA_MakeRotationZ(struct M4 *out, float t) { + struct M4 m = { + .m = { + { cosf(t), -sinf(t), 0.0, 0.0 }, + { sinf(t), cosf(t), 0.0, 0.0 }, + { 0.0, 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0 } + } + }; + memcpy(out, &m, sizeof(m)); +} + +void LA_MakePerspective(struct M4 *out, float fov, float aspect_ratio, float near, float far) { + float y_max = near * tanf(fov * 0.5); + float y_min = -y_max; + float x_min = y_min * aspect_ratio; + float x_max = -x_min; + + struct M4 m = { + .m = { + { 2.*near/(x_max-x_min), 0.0, (x_max+x_min)/(x_max-x_min), 0.0 }, + { 0.0, 2.*near/(y_max-y_min), (y_max+y_min)/(y_max-y_min), 0.0 }, + { 0.0, 0.0, -((far+near)/(far-near)), -2.*far*near/(far-near) }, + { 0.0, 0.0, -1.0, 0.0 }, + } + }; + memcpy(out, &m, sizeof(m)); +} + +void LA_MultM4V4(struct V4 *out, struct M4 *m, struct V4 *v) +{ + float outd[4]; + int i; + for (i = 0; i < 4; i++) { + outd[i] = + m->m[i].X * v->X + + m->m[i].Y * v->Y + + m->m[i].Z * v->Z + + m->m[i].W * v->W; + } + out->X = outd[0]/outd[3]; + out->Y = outd[1]/outd[3]; + out->Z = outd[2]/outd[3]; + out->W = 1.0; +} + +void LA_MultM4M4(struct M4 *out, struct M4 *a, struct M4 *b) +{ + // huge hack... + float *hout[] = { + (float*)&out->m[0], + (float*)&out->m[1], + (float*)&out->m[2], + (float*)&out->m[3] + }; + float *ha[] = { + (float*)&a->m[0], + (float*)&a->m[1], + (float*)&a->m[2], + (float*)&a->m[3] + }; + float *hb[] = { + (float*)&b->m[0], + (float*)&b->m[1], + (float*)&b->m[2], + (float*)&b->m[3] + }; + + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + hout[j][i] = + ha[j][0] * hb[0][i] + + ha[j][1] * hb[1][i] + + ha[j][2] * hb[2][i] + + ha[j][3] * hb[3][i]; + } + } +} + + diff --git a/l0dables/cube/linearalgebra.h b/l0dables/cube/linearalgebra.h new file mode 100644 index 0000000000000000000000000000000000000000..5ca5840843466b2238bf1e4441334b1d2620ac23 --- /dev/null +++ b/l0dables/cube/linearalgebra.h @@ -0,0 +1,23 @@ +#ifndef __LINEARALGEBRA_H__ +#define __LINERAALGEBRA_H__ + +struct V4 { + float X; + float Y; + float Z; + float W; +}; + +struct M4 { + struct V4 m[4]; +}; + +void LA_MakeIdentity(struct M4 *out); +void LA_MakeRotationX(struct M4 *out, float t); +void LA_MakeRotationY(struct M4 *out, float t); +void LA_MakeRotationZ(struct M4 *out, float t); +void LA_MakePerspective(struct M4 *out, float fov, float aspect_ratio, float near, float far); +void LA_MultM4V4(struct V4 *out, struct M4 *m, struct V4 *v); +void LA_MultM4M4(struct M4 *out, struct M4 *a, struct M4 *b); + +#endif diff --git a/l0dables/cube/main.c b/l0dables/cube/main.c new file mode 100644 index 0000000000000000000000000000000000000000..630acbcbe8f7ab871344575ebfbf2648f0fc8228 --- /dev/null +++ b/l0dables/cube/main.c @@ -0,0 +1,50 @@ +#include "epicardium.h" + +#include <stdio.h> + +#include "render.h" + +uint16_t framebuffer[FB_WIDTH*FB_HEIGHT]; + +/* + * main() is called when l0dable is loaded and executed. + */ +int main(void) { + printf("Hello core1!\n"); + epic_disp_open(); + + float theta = 0.0f; + int i = 0; + for (;;) { + FB_Draw(framebuffer, theta); + epic_disp_update_fb(framebuffer); + theta += 0.1f; + } + + epic_disp_close(); +} + +void NMI_Handler() { + printf("NMI\n"); + for (;;) {} +} + +void HardFault_Handler() { + printf("HardFault\n"); + for (;;) {} +} + +void MemManage_Handler() { + printf("MemMange\n"); + for (;;) {} +} + +void BusFault_Handler() { + printf("BusFault\n"); + for (;;) {} +} + +void UsageFault_Handler() { + printf("UsageFault\n"); + for (;;) {} +} diff --git a/l0dables/cube/main_sim.c b/l0dables/cube/main_sim.c new file mode 100644 index 0000000000000000000000000000000000000000..fb6556ab55482c03751a860ced5ba6bb07d39168 --- /dev/null +++ b/l0dables/cube/main_sim.c @@ -0,0 +1,84 @@ +#include <stdint.h> +#include <stdio.h> +#include <sys/time.h> + +#include "SDL.h" + +#include "render.h" + +uint16_t framebuffer[FB_WIDTH*FB_HEIGHT]; + +void +fill_surface(SDL_Surface *out) { + int bpp = out->format->BytesPerPixel; + for (int x = 0; x < FB_WIDTH; x++) { + for (int y = 0; y < FB_HEIGHT; y++) { + uint8_t *p = (uint8_t*)out->pixels + y * out->pitch + x * bpp; + uint16_t pixel_swap = framebuffer[(FB_HEIGHT-(y+1)) * FB_WIDTH + x]; + uint16_t pixel = (pixel_swap >> 8) | (pixel_swap << 8); + switch (bpp) { + case 3: + { + if(SDL_BYTEORDER == SDL_BIG_ENDIAN) { + p[0] = ((pixel >> 11) & 0b11111) << 3; + p[1] = ((pixel >> 5) & 0b111111) << 2; + p[2] = (pixel & 0b11111) << 3; + } else { + p[2] = ((pixel >> 11) & 0b11111) << 3; + p[1] = ((pixel >> 5) & 0b111111) << 2; + p[0] = (pixel & 0b11111) << 3; + } + break; + } + default: + { + fprintf(stderr, "Unexpected BPP: %i\n", bpp); + exit(-3); + } + } + } + } +} + +uint64_t +get_ms(void) { + struct timeval tv; + gettimeofday(&tv, 0); + return tv.tv_sec * 1000 + tv.tv_usec / 1000; +} + +int main(void) { + if (-1 == SDL_Init(SDL_INIT_VIDEO)) { + fprintf(stderr, "Failed to initialize SDL: %s\n", SDL_GetError()); + return -1; + } + + SDL_Surface *screen = SDL_SetVideoMode(FB_WIDTH, FB_HEIGHT, 24, SDL_SWSURFACE); + if (NULL == screen) { + fprintf(stderr, "Failed to set SDL video mode: %s\n", SDL_GetError()); + } + + uint64_t start = get_ms(); + uint64_t frames = 0; + for (;;) { + uint64_t ms = get_ms() - start; + float theta = (float)(ms) / 1000.0f; + FB_Draw(framebuffer, theta); + if (SDL_MUSTLOCK(screen)) { + if (SDL_LockSurface(screen) < 0) { + fprintf(stderr, "Failed to lock SDL surface: %s\n", SDL_GetError()); + return -2; + } + } + fill_surface(screen); + if (SDL_MUSTLOCK(screen)) { + SDL_UnlockSurface(screen); + } + SDL_UpdateRect(screen, 0, 0, FB_WIDTH, FB_HEIGHT); + + frames++; + if ((frames % 100) == 0) { + printf("FPS: %d\n", (1000*frames)/ms); + } + } +} diff --git a/l0dables/cube/meson.build b/l0dables/cube/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..8e2f774eecdd90c8ed39a79e4b0527005c406350 --- /dev/null +++ b/l0dables/cube/meson.build @@ -0,0 +1,37 @@ +name = 'cube' + +elf = executable( + name + '.elf', + 'main.c', + 'render.c', + 'linearalgebra.c', + build_by_default: true, + dependencies: [l0dable_startup, api_caller], + link_whole: [l0dable_startup_lib], + link_args: [ + '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map', + ], + pie: true, +) + +sdl = declare_dependency( + link_args: [ + '-lSDL', + ], + compile_args: [ + '-I/usr/include/SDL/', '-O2', + ], +) + +sim = executable( + name + '_sim', + 'main_sim.c', + 'render.c', + 'linearalgebra.c', + build_by_default: true, + link_args: [ + '-lm', + ], + dependencies: [sdl], + native: true, +) diff --git a/l0dables/cube/render.c b/l0dables/cube/render.c new file mode 100644 index 0000000000000000000000000000000000000000..bc5eeb02e206d628f5c0f3e62d41c4701d08fe5b --- /dev/null +++ b/l0dables/cube/render.c @@ -0,0 +1,580 @@ +#include <stdint.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <sys/time.h> +#include <stdlib.h> +#include <stdarg.h> + +#include "render.h" +#include "linearalgebra.h" + +float g_ZBuffer[FB_WIDTH*FB_HEIGHT]; + +struct FB_Color { + uint8_t R; + uint8_t G; + uint8_t B; +}; + +void FB_ClearZBuffer(void) { + int x, y; + for (x = 0; x < FB_WIDTH; x++) { + for (y = 0; y < FB_HEIGHT; y++) { + g_ZBuffer[x + y * FB_WIDTH] = -INFINITY; + } + } +} + +void FB_SetPixelZBuf(uint16_t *buf, int x, int y, float z, struct FB_Color color) { + uint16_t pixel_swap = ((color.R >> 3) << 11) | ((color.G >> 2) << 5) | (color.B >> 3); + uint16_t pixel = (pixel_swap >> 8) | (pixel_swap << 8); + if (x >= 0 && x < FB_WIDTH && y >= 0 && y < FB_HEIGHT) { + if (z >= g_ZBuffer[x + y * FB_WIDTH]) { + buf[y * FB_WIDTH + x] = pixel; + g_ZBuffer[x + y * FB_WIDTH] = z; + } + } +} + +void FB_SetPixel(uint16_t *buf, int x, int y, struct FB_Color color) { + uint16_t pixel_swap = ((color.R >> 3) << 11) | ((color.G >> 2) << 5) | (color.B >> 3); + uint16_t pixel = (pixel_swap >> 8) | (pixel_swap << 8); + if (x >= 0 && x < FB_WIDTH && y >= 0 && y < FB_HEIGHT) + buf[y * FB_WIDTH + x] = pixel; +} + +void FB_Fill(uint16_t *buf, struct FB_Color color) { + int x, y; + + for (x = 0; x < FB_WIDTH; x++) { + for (y = 0; y < FB_HEIGHT; y++) { + FB_SetPixel(buf, x, y, color); + } + } +} + +void FB_Line(uint16_t *buf, int x0, int y0, int x1, int y1, struct FB_Color color) { + int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1; + int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; + int err = (dx>dy ? dx : -dy)/2, e2; + + for(;;){ + FB_SetPixel(buf, x0, y0, color); + if (x0==x1 && y0==y1) break; + e2 = err; + if (e2 >-dx) { err -= dy; x0 += sx; } + if (e2 < dy) { err += dx; y0 += sy; } + } +} + +struct Texture { + uint32_t width; + uint32_t height; + const uint8_t *data; +}; + +void UV_Sample(struct FB_Color *color, struct Texture *t, float U, float V) { + int x = (int)(U * t->width) % t->width; + int y = (int)(V * t->height) % t->height; + int offset = (x + y * t->width)*3; + color->R = t->data[offset]; + color->G = t->data[offset+1]; + color->B = t->data[offset+2]; +} + +#include "data/pepper.h" +struct Texture g_PepperTexture = { + .width = 32, + .height = 32, + .data = pepper.pixel_data +}; +#include "data/dragonsector.h" +struct Texture g_DragonSectorTexture = { + .width = 32, + .height = 32, + .data = dragonsector.pixel_data +}; +#include "data/confidence.h" +struct Texture g_ConfidenceTexture = { + .width = 32, + .height = 32, + .data = confidence.pixel_data +}; + +struct Triangle { + struct V4 *p[3]; + struct FB_Color color; +}; + +struct UV_Coord { + float U; + float V; +}; + +struct TriangleTexture { + struct Texture *t; + struct UV_Coord c[3]; +}; + +#include "data/font.h" + +void FB_FontDrawGlyph(uint16_t *buf, int x, int y, int8_t codepoint, struct FB_Color color) { + uint8_t *lines = NULL; + for (int i = 0; i < sizeof(FB_Font.glyphs)/sizeof(FB_Font.glyphs[0]); i++) { + if (FB_Font.glyphs[i].codepoint == codepoint) { + lines = FB_Font.glyphs[i].lines; + break; + } + } + if (lines == NULL) + return; + for (int i = 0; i < 16; i++) { + uint8_t line = lines[i]; + for (int j = 0; j < 8; j++) { + if ((line & (1 << (7-j))) > 0) + FB_SetPixel(buf, x+j, y+i, color); + } + } +} + +void FB_FontDrawString(uint16_t *buf, int x, int y, const char *string, struct FB_Color color) { + for (int i = 0; i < strlen(string); i++) { + FB_FontDrawGlyph(buf, x, y, string[i], color); + x += 8; + } +} + +void FB_FontFormatString(uint16_t *buf, int x, int y, struct FB_Color color, const char *fmt, ...) { + char buffer[32]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buffer, 32, fmt, ap); + va_end(ap); + FB_FontDrawString(buf, x, y, buffer, color); +} + +struct TriangleTexture g_ConfiTex1 = { + .c = { + { 0.0, 0.0 }, { 0.0, 1.0}, {1.0, 1.0} + }, + .t = &g_ConfidenceTexture +}; +struct TriangleTexture g_ConfiTex2 = { + .c = { + { 0.0, 0.0 }, { 1.0, 0.0}, {1.0, 1.0} + }, + .t = &g_ConfidenceTexture +}; + +struct TriangleTexture g_DSTex1 = { + .c = { + { 0.0, 0.0 }, { 0.0, 1.0}, {1.0, 1.0} + }, + .t = &g_DragonSectorTexture +}; +struct TriangleTexture g_DSTex2 = { + .c = { + { 0.0, 0.0 }, { 1.0, 0.0}, {1.0, 1.0} + }, + .t = &g_DragonSectorTexture +}; + +struct TriangleTexture g_PepperTex1 = { + .c = { + { 0.0, 0.0 }, { 0.0, 1.0}, {1.0, 1.0} + }, + .t = &g_PepperTexture +}; +struct TriangleTexture g_PepperTex2 = { + .c = { + { 0.0, 0.0 }, { 1.0, 0.0}, {1.0, 1.0} + }, + .t = &g_PepperTexture +}; + +struct V4 g_Cube[] = { + { -1.0, -1.0, -1.0, 1.0 }, + { -1.0, 1.0, -1.0, 1.0 }, + { 1.0, 1.0, -1.0, 1.0 }, + { 1.0, -1.0, -1.0, 1.0 }, + + { -1.0, -1.0, 1.0, 1.0 }, + { -1.0, 1.0, 1.0, 1.0 }, + { 1.0, 1.0, 1.0, 1.0 }, + { 1.0, -1.0, 1.0, 1.0 } +}; + +struct Triangle g_CubeTriangles[] = { + // front + { .p = { &g_Cube[0], &g_Cube[1], &g_Cube[2] }}, + { .p = { &g_Cube[0], &g_Cube[3], &g_Cube[2] }}, + + // back + { .p = { &g_Cube[4], &g_Cube[5], &g_Cube[6] }}, + { .p = { &g_Cube[4], &g_Cube[7], &g_Cube[6] }}, + + // left + { .p = { &g_Cube[0], &g_Cube[1], &g_Cube[5] }}, + { .p = { &g_Cube[0], &g_Cube[4], &g_Cube[5] }}, + + // right + { .p = { &g_Cube[3], &g_Cube[2], &g_Cube[6] }}, + { .p = { &g_Cube[3], &g_Cube[7], &g_Cube[6] }}, + + // top + { .p = { &g_Cube[0], &g_Cube[3], &g_Cube[7] }}, + { .p = { &g_Cube[0], &g_Cube[4], &g_Cube[7] }}, + + // bottom + { .p = { &g_Cube[1], &g_Cube[2], &g_Cube[6] }}, + { .p = { &g_Cube[1], &g_Cube[5], &g_Cube[6] }}, +}; + +struct TriangleTexture *g_PepperTextureTriangles[] = { + &g_DSTex1, &g_DSTex2, + &g_DSTex1, &g_DSTex2, + &g_PepperTex1, &g_PepperTex2, + &g_PepperTex1, &g_PepperTex2, + &g_ConfiTex1, &g_ConfiTex2, + &g_ConfiTex1, &g_ConfiTex2, +}; + +struct FB_Coord { + int X; + int Y; + float Z; +}; + +struct FB_Edge { + // Coordinates that make up the edge + struct FB_Coord *min_y; + struct FB_Coord *max_y; + // UV coords + struct UV_Coord *tmin_y; + struct UV_Coord *tmax_y; + + // Triangle for material info + struct Triangle *triangle; + struct TriangleTexture *ttriangle; + + // Scanline stepping parameters + // X Bresenham step + float xStep; + // Z-Buffer step + float zStep; + // U, V Bresenham steps + float uStep; + float vStep; + + // Stepping state + float X, Z, U, V; +}; + +void FB_MakeEdge(struct FB_Edge *out, + struct FB_Coord *min_y, struct FB_Coord *max_y, + struct UV_Coord *tmin_y, struct UV_Coord *tmax_y, + struct Triangle *t, struct TriangleTexture *tt) { + out->triangle = t; + out->ttriangle = tt; + out->min_y = min_y; + out->max_y = max_y; + out->tmin_y = tmin_y; + out->tmax_y = tmax_y; + + float y_dist = max_y->Y - min_y->Y; + float x_dist = max_y->X - min_y->X; + out->xStep = x_dist / y_dist; + + float z_dist = max_y->Z - min_y->Z; + out->zStep = z_dist / y_dist; + + float u_dist = tmax_y->U - tmin_y->U; + float v_dist = tmax_y->V - tmin_y->V; + out->uStep = u_dist / y_dist; + out->vStep = v_dist / y_dist; + + out->X = out->min_y->X; + out->Z = out->min_y->Z; + out->U = out->tmin_y->U; + out->V = out->tmin_y->V; +} + +void FB_ScanEdges(uint16_t *buf, struct FB_Edge *left, struct FB_Edge *right, int shorter_index) { + struct FB_Edge *shorter; + if (shorter_index == 0) + shorter = left; + else + shorter = right; + + int y_start = shorter->min_y->Y; + int y_end = shorter->max_y->Y; + + // Short circuit on horizontal 'left' lines + if (left->min_y->Y == left->max_y->Y) + return; + + // Scan line by line... + for (int j = y_start; j < y_end; j++) { + int x0 = left->X; + int x1 = right->X; + + float x_dist = right->X - left->X; + float z_dist = right->Z - left->Z; + float u_dist = right->U - left->U; + float v_dist = right->V - left->V; + float zx_step = z_dist/x_dist; + float ux_step = u_dist/x_dist; + float vx_step = v_dist/x_dist; + // + // Scan pixel by pixel... + float z = left->Z; + float u = left->U; + float v = left->V; + for (int i = x0; i < x1; i++) { + if (left->ttriangle) { + struct FB_Color color; + UV_Sample(&color, left->ttriangle->t, u, v); + FB_SetPixelZBuf(buf, i, j, z, color); + } else { + FB_SetPixelZBuf(buf, i, j, z, left->triangle->color); + } + z += zx_step; + u += ux_step; + v += vx_step; + } + + left->X += left->xStep; + right->X += right->xStep; + left->Z += left->zStep; + right->Z += right->zStep; + left->U += left->uStep; + right->U += right->uStep; + left->V += left->vStep; + right->V += right->vStep; + } +} + +struct TransformEntry { + int index; + struct M4 m; + struct TransformEntry *next; +} g_TransformRoot = { + .index = 0, + .m = { + .m = { + { 1.0, 0.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0, 0.0 }, + { 0.0, 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0 } + } + }, + .next = NULL +}; +struct M4 g_TransformCache; +uint8_t g_TransformIsCached = 0; + +struct TransformEntry *TR_Top(void) { + struct TransformEntry *t = &g_TransformRoot; + while (t->next != NULL) { + t = t->next; + } + return t; +} + +void TR_MultV4(struct V4 *out, struct V4 *in) { + if (!g_TransformIsCached) { + LA_MakeIdentity(&g_TransformCache); + struct TransformEntry *t = &g_TransformRoot; + do { + struct M4 squashed; + memcpy(&squashed, &g_TransformCache, sizeof(struct M4)); + + LA_MultM4M4(&g_TransformCache, &squashed, &t->m); + t = t->next; + } while (t != NULL); + g_TransformIsCached = 1; + } + LA_MultM4V4(out, &g_TransformCache, in); +} + +void TR_PushMultM4(struct M4 *in) { + g_TransformIsCached = 0; + struct TransformEntry *t = TR_Top(); + t->next = (struct TransformEntry *)malloc(sizeof(struct TransformEntry)); + t->next->index = t->index + 1; + t->next->next = NULL; + memcpy(&t->next->m, in, sizeof(struct M4)); +} + +void TR_Pop(void) { + g_TransformIsCached = 0; + struct TransformEntry *t = TR_Top(); + if (t->index <= 0) + return; + struct TransformEntry *p = &g_TransformRoot; + while (p->index != t->index-1) { + p = p->next; + } + p->next = NULL; + free(t); +} + +void TR_MultByM4(struct M4 *m) { + g_TransformIsCached = 0; + struct TransformEntry *t = TR_Top(); + struct M4 c; + memcpy(&c, &t->m, sizeof(c)); + LA_MultM4M4(&t->m, &c, m); +} + +void RE_ToScreenspace(struct FB_Coord *c, struct V4 *v) { + float VX = v->X; + float VY = v->Y; + c->X = VX * (FB_WIDTH/2) + FB_WIDTH/2; + c->Y = VY * (FB_HEIGHT/2) + FB_HEIGHT/2; + c->Z = v->Z; +} + +float FB_TriangleArea2(struct FB_Coord *a, struct FB_Coord *b, struct FB_Coord *c) +{ + float x1 = b->X - a->X; + float y1 = b->Y - a->Y; + float x2 = c->X - a->X; + float y2 = c->Y - a->Y; + return (x1 * y2 - x2 * y1); +} + +void RE_FillTriangle(uint16_t *buf, struct Triangle *t, struct TriangleTexture *tt) { + struct FB_Coord min_y, mid_y, max_y; + + struct V4 p0, p1, p2; + struct UV_Coord tmin_y, tmid_y, tmax_y; + + TR_MultV4(&p0, t->p[0]); + TR_MultV4(&p1, t->p[1]); + TR_MultV4(&p2, t->p[2]); + + if (tt != NULL) { + memcpy(&tmin_y, &tt->c[0], sizeof(tt->c[0])); + memcpy(&tmid_y, &tt->c[1], sizeof(tt->c[1])); + memcpy(&tmax_y, &tt->c[2], sizeof(tt->c[2])); + } else { + tmin_y.U = 0.0; tmin_y.V = 0.0; + tmid_y.U = 0.0; tmid_y.V = 0.0; + tmax_y.U = 0.0; tmax_y.V = 0.0; + } + + RE_ToScreenspace(&min_y, &p0); + RE_ToScreenspace(&mid_y, &p1); + RE_ToScreenspace(&max_y, &p2); + // Actually sort them by Y... + // (yes that is an inlined bubblesort) + if (max_y.Y < mid_y.Y) { + struct FB_Coord tmp; + memcpy(&tmp, &max_y, sizeof(max_y)); + memcpy(&max_y, &mid_y, sizeof(mid_y)); + memcpy(&mid_y, &tmp, sizeof(tmp)); + struct UV_Coord ttmp; + memcpy(&ttmp, &tmax_y, sizeof(tmax_y)); + memcpy(&tmax_y, &tmid_y, sizeof(tmax_y)); + memcpy(&tmid_y, &ttmp, sizeof(tmax_y)); + } + if (mid_y.Y < min_y.Y) { + struct FB_Coord tmp; + memcpy(&tmp, &mid_y, sizeof(mid_y)); + memcpy(&mid_y, &min_y, sizeof(min_y)); + memcpy(&min_y, &tmp, sizeof(tmp)); + struct UV_Coord ttmp; + memcpy(&ttmp, &tmid_y, sizeof(tmax_y)); + memcpy(&tmid_y, &tmin_y, sizeof(tmax_y)); + memcpy(&tmin_y, &ttmp, sizeof(tmax_y)); + } + if (max_y.Y < mid_y.Y) { + struct FB_Coord tmp; + memcpy(&tmp, &max_y, sizeof(max_y)); + memcpy(&max_y, &mid_y, sizeof(mid_y)); + memcpy(&mid_y, &tmp, sizeof(tmp)); + struct UV_Coord ttmp; + memcpy(&ttmp, &tmax_y, sizeof(tmax_y)); + memcpy(&tmax_y, &tmid_y, sizeof(tmax_y)); + memcpy(&tmid_y, &ttmp, sizeof(tmax_y)); + } + + struct FB_Edge top_to_bottom, top_to_middle, middle_to_bottom; + FB_MakeEdge(&top_to_bottom, &min_y, &max_y, &tmin_y, &tmax_y, t, tt); + FB_MakeEdge(&top_to_middle, &min_y, &mid_y, &tmin_y, &tmid_y, t, tt); + FB_MakeEdge(&middle_to_bottom, &mid_y, &max_y, &tmid_y, &tmax_y, t, tt); + int area2 = FB_TriangleArea2(&min_y, &max_y, &mid_y); + if (area2 < 0) { + FB_ScanEdges(buf, &top_to_bottom, &top_to_middle, 1); + FB_ScanEdges(buf, &top_to_bottom, &middle_to_bottom, 1); + } else { + FB_ScanEdges(buf, &top_to_middle, &top_to_bottom, 0); + FB_ScanEdges(buf, &middle_to_bottom, &top_to_bottom, 0); + } +} + +float g_StartTime = 0.0; +void RE_RenderScene(uint16_t *buf, float theta) { + struct M4 perspective, camera; + LA_MakePerspective(&perspective, 0.40, 160.0/80.0, 1.0, 1000.0); + LA_MakeIdentity(&camera); + + camera.m[2].W = 10.0; + + TR_PushMultM4(&perspective); + TR_PushMultM4(&camera); + + struct M4 rx, ry, rz; + + LA_MakeRotationX(&rx, sinf(theta)/3); + LA_MakeRotationY(&ry, sinf(theta+1)/2); + LA_MakeRotationZ(&rz, sinf(theta-1)/2.5); + + // Cube + struct M4 cube_pos; + LA_MakeIdentity(&cube_pos); + cube_pos.m[0].W = 2; + cube_pos.m[1].W = sinf(theta/2)/2; + cube_pos.m[0].X = 1.3; + cube_pos.m[1].Y = 1.3; + cube_pos.m[2].Z = 1.3; + TR_PushMultM4(&cube_pos); + TR_MultByM4(&ry); + TR_MultByM4(&rx); + TR_MultByM4(&rz); + for (int i = 0; i < sizeof(g_CubeTriangles)/sizeof(struct Triangle); i++) { + struct Triangle *t = &g_CubeTriangles[i]; + RE_FillTriangle(buf, t, g_PepperTextureTriangles[i]); + } + TR_Pop(); + + // Cube + LA_MakeIdentity(&cube_pos); + cube_pos.m[0].W = -2; + cube_pos.m[1].W = sinf(theta/2)/2; + cube_pos.m[0].X = 1.3; + cube_pos.m[1].Y = 1.3; + cube_pos.m[2].Z = 1.3; + TR_PushMultM4(&cube_pos); + TR_MultByM4(&ry); + TR_MultByM4(&rx); + TR_MultByM4(&rz); + for (int i = 0; i < sizeof(g_CubeTriangles)/sizeof(struct Triangle); i++) { + struct Triangle *t = &g_CubeTriangles[i]; + RE_FillTriangle(buf, t, g_PepperTextureTriangles[i]); + } + TR_Pop(); + + TR_Pop(); + TR_Pop(); + //FB_FontDrawString(buf, 20, 20, "q3k delin"); +} + +void FB_Draw(uint16_t *buf, float theta) { + struct FB_Color pink = { 255, 129, 165 }; + FB_ClearZBuffer(); + FB_Fill(buf, pink); + RE_RenderScene(buf, theta); +} diff --git a/l0dables/cube/render.h b/l0dables/cube/render.h new file mode 100644 index 0000000000000000000000000000000000000000..5af40cc1ac87883ee7637f62e708efb61db66404 --- /dev/null +++ b/l0dables/cube/render.h @@ -0,0 +1,10 @@ +#ifndef __FRAMEBUFFER_H__ +#define __FRAMEBUFFER_H__ + +#define FB_WIDTH 160 +#define FB_HEIGHT 80 + +void FB_Draw(uint16_t *buf, float theta); + +#endif + diff --git a/l0dables/meson.build b/l0dables/meson.build index f4be10b507d2e028d204202e14fa68bdf195a6ac..3eeddbd6a2c142669ced138569763feea728cafb 100644 --- a/l0dables/meson.build +++ b/l0dables/meson.build @@ -1,3 +1,5 @@ subdir('lib/') subdir('blinky/') + +subdir('cube/') diff --git a/lib/card10/card10.c b/lib/card10/card10.c index 003a563e2a565824142ffb5f962da0473dd1e34a..9f3e139560d58bfd5b356fd78c4e3f7adb80f2d1 100644 --- a/lib/card10/card10.c +++ b/lib/card10/card10.c @@ -28,7 +28,7 @@ * Current suspicion is that the SDK is buggy. * * At 12 MHz things seem stable*/ -#define SPI_SPEED (12 * 1000 * 1000) // Bit Rate. Display has 15 MHz limit +#define SPI_SPEED (8 * 1000 * 1000) // Bit Rate. Display has 15 MHz limit const gpio_cfg_t bhi_interrupt_pin = { PORT_0, PIN_13, GPIO_FUNC_IN, GPIO_PAD_PULL_UP