aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-22 21:36:13 -0800
committerChristian Cunningham <cc@localhost>2021-12-22 21:36:13 -0800
commit88df035f3e79a6dc7280e457bd343285e8313799 (patch)
treead81f37c2f1350c2d3b1b47495b1bb4b4889c2dd
parentce90c0aa44b1f07ddd59159ae60e6f63357d85b8 (diff)
Added fonts
-rw-r--r--src/graphics/drawer.c46
-rw-r--r--src/graphics/drawer.h17
-rw-r--r--src/graphics/font.psfbin0 -> 2080 bytes
-rw-r--r--src/graphics/font.sfnbin0 -> 8283 bytes
-rw-r--r--src/graphics/glyphs.h1304
-rw-r--r--src/graphics/lfb.c218
-rw-r--r--src/graphics/lfb.h13
-rw-r--r--src/sys/core.c17
8 files changed, 1544 insertions, 71 deletions
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
new file mode 100644
index 0000000..a2c5d8e
--- /dev/null
+++ b/src/graphics/drawer.c
@@ -0,0 +1,46 @@
+#include "../graphics/lfb.h"
+#include "../graphics/drawer.h"
+
+static struct Drawer g_Drawer = {x: 0, y: 0};
+
+void write_cstring(struct Drawer* d, char* s, unsigned int c) {
+ d->x %= GG_MAX_X;
+ d->y %= GG_MAX_Y;
+ unsigned int idx = 0;
+ while(s[idx] != 0) {
+ if (s[idx] == 0x0A) {
+ d->y += 1;
+ d->x = 0;
+ idx++;
+ } else {
+ draw_cletter(d->x++, d->y, s[idx++], c);
+ if (d->x > GG_MAX_X) {
+ d->y += 1;
+ d->x = 0;
+ }
+ }
+ // CHECK Y EVENTUALLY
+ }
+}
+
+void write_string(struct Drawer* d, char* s) {
+ write_cstring(d, s, 0xFFFFFF);
+}
+
+void set_drawer(struct Drawer* d, unsigned int x, unsigned int y) {
+ d->x = x % GG_MAX_X;
+ d->y = y % GG_MAX_Y;
+}
+
+void write_chex32(struct Drawer* d, unsigned long val, unsigned int c) {
+ draw_chex32(d->x, d->y, val, c);
+ d->x += 8;
+ if (d->x > GG_MAX_X) {
+ d->y += 1;
+ d->x %= GG_MAX_X;
+ }
+}
+
+void write_hex32(struct Drawer* d, unsigned long val) {
+ write_chex32(d, val, 0xFFFFFF);
+}
diff --git a/src/graphics/drawer.h b/src/graphics/drawer.h
new file mode 100644
index 0000000..63b5194
--- /dev/null
+++ b/src/graphics/drawer.h
@@ -0,0 +1,17 @@
+#ifndef GRAPHICS_DRAWER_H
+#define GRAPHICS_DRAWER_H
+
+struct Drawer {
+ unsigned int x;
+ unsigned int y;
+};
+
+static struct Drawer g_Drawer;
+
+void write_cstring(struct Drawer* d, char* s, unsigned int c);
+void write_string(struct Drawer* d, char* s);
+void write_chex32(struct Drawer* d, unsigned long val, unsigned int c);
+void write_hex32(struct Drawer* d, unsigned long val);
+void set_drawer(struct Drawer* d, unsigned int x, unsigned int y);
+
+#endif
diff --git a/src/graphics/font.psf b/src/graphics/font.psf
new file mode 100644
index 0000000..3e67693
--- /dev/null
+++ b/src/graphics/font.psf
Binary files differ
diff --git a/src/graphics/font.sfn b/src/graphics/font.sfn
new file mode 100644
index 0000000..50a7633
--- /dev/null
+++ b/src/graphics/font.sfn
Binary files differ
diff --git a/src/graphics/glyphs.h b/src/graphics/glyphs.h
new file mode 100644
index 0000000..6fc8452
--- /dev/null
+++ b/src/graphics/glyphs.h
@@ -0,0 +1,1304 @@
+#ifndef GRAPHICS_GLYPHS_H
+#define GRAPHICS_GLYPHS_H
+
+const char glyphs[] = {
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+ 0b10000001,
+
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b10000001,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b10000001,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00101000,
+ 0b00101000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010010,
+ 0b01111110,
+ 0b00100100,
+ 0b01111110,
+ 0b01001000,
+ 0b01001000,
+ 0b00000000,
+
+ 0b00010000,
+ 0b01111100,
+ 0b10010000,
+ 0b01111100,
+ 0b00010010,
+ 0b01111100,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01100010,
+ 0b01100100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100110,
+ 0b01000110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111000,
+ 0b01000100,
+ 0b00111000,
+ 0b01010100,
+ 0b01001000,
+ 0b00110100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00100000,
+ 0b00100000,
+ 0b00100000,
+ 0b00100000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00001000,
+ 0b00001000,
+ 0b00001000,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00101000,
+ 0b00010000,
+ 0b00101000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00010000,
+ 0b00111000,
+ 0b00010000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00010000,
+ 0b00100000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00111100,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000010,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b01000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000110,
+ 0b01001010,
+ 0b01010010,
+ 0b01100010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00110000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b00000010,
+ 0b00111100,
+ 0b01000000,
+ 0b01000000,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b00000010,
+ 0b00011110,
+ 0b00000010,
+ 0b00000010,
+ 0b00111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b00111110,
+ 0b00000010,
+ 0b00000010,
+ 0b00000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b00111100,
+ 0b00000010,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b00000010,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b00111110,
+ 0b00000010,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00001000,
+ 0b00000000,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00001000,
+ 0b00000100,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00111100,
+ 0b00000000,
+ 0b00111100,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+
+ 0b00000000,
+ 0b00000000,
+ 0b00100000,
+ 0b00010000,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111000,
+ 0b01000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00000000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111000,
+ 0b01000100,
+ 0b01000100,
+ 0b01011000,
+ 0b01000100,
+ 0b00111000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00011000,
+ 0b00100100,
+ 0b01000010,
+ 0b01111110,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01000000,
+ 0b01001110,
+ 0b01000100,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01111110,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01110000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01001000,
+ 0b01010000,
+ 0b01100000,
+ 0b01010000,
+ 0b01001000,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01100110,
+ 0b01100110,
+ 0b01011010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01100010,
+ 0b01100010,
+ 0b01010010,
+ 0b01001010,
+ 0b01000110,
+ 0b01000110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b01000000,
+ 0b01000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01010010,
+ 0b01001010,
+ 0b00111100,
+ 0b00000010,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b01011000,
+ 0b01000110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01111000,
+ 0b00011110,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00100100,
+ 0b00100100,
+ 0b00011000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000100,
+ 0b01000100,
+ 0b01000100,
+ 0b01010100,
+ 0b01101100,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b01000100,
+ 0b00101000,
+ 0b00010000,
+ 0b00101000,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000100,
+ 0b00101000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00011100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00011100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000000,
+ 0b00100000,
+ 0b00010000,
+ 0b00001000,
+ 0b00000100,
+ 0b00000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111000,
+ 0b00001000,
+ 0b00001000,
+ 0b00001000,
+ 0b00001000,
+ 0b00111000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00011000,
+ 0b00100100,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00001000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00011000,
+ 0b00100100,
+ 0b01000010,
+ 0b01111110,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01000000,
+ 0b01001110,
+ 0b01000100,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01111110,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01110000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01001000,
+ 0b01010000,
+ 0b01100000,
+ 0b01010000,
+ 0b01001000,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01100110,
+ 0b01100110,
+ 0b01011010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01100010,
+ 0b01100010,
+ 0b01010010,
+ 0b01001010,
+ 0b01000110,
+ 0b01000110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b01000000,
+ 0b01000000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01010010,
+ 0b01001010,
+ 0b00111100,
+ 0b00000010,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b01011000,
+ 0b01000110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01111000,
+ 0b00011110,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b00100100,
+ 0b00100100,
+ 0b00011000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000100,
+ 0b01000100,
+ 0b01000100,
+ 0b01010100,
+ 0b01101100,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b01000100,
+ 0b00101000,
+ 0b00010000,
+ 0b00101000,
+ 0b01000100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000100,
+ 0b00101000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00001100,
+ 0b00010000,
+ 0b00110000,
+ 0b00110000,
+ 0b00010000,
+ 0b00001100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00110000,
+ 0b00001000,
+ 0b00001100,
+ 0b00001100,
+ 0b00001000,
+ 0b00110000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+ 0b00110010,
+ 0b01001100,
+ 0b00000000,
+ 0b00000000,
+ 0b00000000,
+
+ 0b11111111,
+ 0b10000001,
+ 0b10111001,
+ 0b10100101,
+ 0b10100101,
+ 0b10111001,
+ 0b10000001,
+ 0b11111111,
+};
+
+const char glyphs_byte[] = {
+ 0b00000000,
+ 0b00111100,
+ 0b01000110,
+ 0b01001010,
+ 0b01010010,
+ 0b01100010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00010000,
+ 0b00110000,
+ 0b00010000,
+ 0b00010000,
+ 0b00010000,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b00000010,
+ 0b00111100,
+ 0b01000000,
+ 0b01000000,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b00000010,
+ 0b00011110,
+ 0b00000010,
+ 0b00000010,
+ 0b00111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01000010,
+ 0b01000010,
+ 0b00111110,
+ 0b00000010,
+ 0b00000010,
+ 0b00000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b00111100,
+ 0b00000010,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b00000010,
+ 0b00000100,
+ 0b00001000,
+ 0b00010000,
+ 0b00100000,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b00111100,
+ 0b01000010,
+ 0b01000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111100,
+ 0b01000010,
+ 0b00111110,
+ 0b00000010,
+ 0b00000010,
+ 0b00111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00011000,
+ 0b00100100,
+ 0b01000010,
+ 0b01111110,
+ 0b01000010,
+ 0b01000010,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b00111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111100,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01000010,
+ 0b01111100,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01111110,
+ 0b00000000,
+
+ 0b00000000,
+ 0b01111110,
+ 0b01000000,
+ 0b01111000,
+ 0b01000000,
+ 0b01000000,
+ 0b01000000,
+ 0b00000000,
+};
+
+#endif
diff --git a/src/graphics/lfb.c b/src/graphics/lfb.c
index 682f719..de241d8 100644
--- a/src/graphics/lfb.c
+++ b/src/graphics/lfb.c
@@ -1,6 +1,8 @@
#include "../drivers/uart.h"
+#include "../graphics/lfb.h"
#include "../graphics/mbox.h"
#include "../graphics/homer.h"
+#include "../graphics/glyphs.h"
unsigned int width, height, pitch, isrgb; /* dimensions and channel order */
unsigned char *lfb; /* raw frame buffer address */
@@ -10,62 +12,62 @@ unsigned char *lfb; /* raw frame buffer address */
*/
void lfb_init()
{
- mbox[0] = 35*4;
- mbox[1] = MBOX_REQUEST;
-
- mbox[2] = 0x48003; //set phy wh
- mbox[3] = 8;
- mbox[4] = 8;
- mbox[5] = 1024; //FrameBufferInfo.width
- mbox[6] = 768; //FrameBufferInfo.height
-
- mbox[7] = 0x48004; //set virt wh
- mbox[8] = 8;
- mbox[9] = 8;
- mbox[10] = 1024; //FrameBufferInfo.virtual_width
- mbox[11] = 768; //FrameBufferInfo.virtual_height
-
- mbox[12] = 0x48009; //set virt offset
- mbox[13] = 8;
- mbox[14] = 8;
- mbox[15] = 0; //FrameBufferInfo.x_offset
- mbox[16] = 0; //FrameBufferInfo.y.offset
-
- mbox[17] = 0x48005; //set depth
- mbox[18] = 4;
- mbox[19] = 4;
- mbox[20] = 32; //FrameBufferInfo.depth
-
- mbox[21] = 0x48006; //set pixel order
- mbox[22] = 4;
- mbox[23] = 4;
- mbox[24] = 1; //RGB, not BGR preferably
-
- mbox[25] = 0x40001; //get framebuffer, gets alignment on request
- mbox[26] = 8;
- mbox[27] = 8;
- mbox[28] = 4096; //FrameBufferInfo.pointer
- mbox[29] = 0; //FrameBufferInfo.size
-
- mbox[30] = 0x40008; //get pitch
- mbox[31] = 4;
- mbox[32] = 4;
- mbox[33] = 0; //FrameBufferInfo.pitch
-
- mbox[34] = MBOX_TAG_LAST;
-
- //this might not return exactly what we asked for, could be
- //the closest supported resolution instead
- if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
- mbox[28]&=0x3FFFFFFF; //convert GPU address to ARM address
- width=mbox[5]; //get actual physical width
- height=mbox[6]; //get actual physical height
- pitch=mbox[33]; //get number of bytes per line
- isrgb=mbox[24]; //get the actual channel order
- lfb=(void*)((unsigned long)mbox[28]);
- } else {
- uart_string("Unable to set screen resolution to 1024x768x32\n");
- }
+ mbox[0] = 35*4;
+ mbox[1] = MBOX_REQUEST;
+
+ mbox[2] = 0x48003; //set phy wh
+ mbox[3] = 8;
+ mbox[4] = 8;
+ mbox[5] = 1024; //FrameBufferInfo.width
+ mbox[6] = 768; //FrameBufferInfo.height
+
+ mbox[7] = 0x48004; //set virt wh
+ mbox[8] = 8;
+ mbox[9] = 8;
+ mbox[10] = 1024; //FrameBufferInfo.virtual_width
+ mbox[11] = 768; //FrameBufferInfo.virtual_height
+
+ mbox[12] = 0x48009; //set virt offset
+ mbox[13] = 8;
+ mbox[14] = 8;
+ mbox[15] = 0; //FrameBufferInfo.x_offset
+ mbox[16] = 0; //FrameBufferInfo.y.offset
+
+ mbox[17] = 0x48005; //set depth
+ mbox[18] = 4;
+ mbox[19] = 4;
+ mbox[20] = 32; //FrameBufferInfo.depth
+
+ mbox[21] = 0x48006; //set pixel order
+ mbox[22] = 4;
+ mbox[23] = 4;
+ mbox[24] = 1; //RGB, not BGR preferably
+
+ mbox[25] = 0x40001; //get framebuffer, gets alignment on request
+ mbox[26] = 8;
+ mbox[27] = 8;
+ mbox[28] = 4096; //FrameBufferInfo.pointer
+ mbox[29] = 0; //FrameBufferInfo.size
+
+ mbox[30] = 0x40008; //get pitch
+ mbox[31] = 4;
+ mbox[32] = 4;
+ mbox[33] = 0; //FrameBufferInfo.pitch
+
+ mbox[34] = MBOX_TAG_LAST;
+
+ //this might not return exactly what we asked for, could be
+ //the closest supported resolution instead
+ if(mbox_call(MBOX_CH_PROP) && mbox[20]==32 && mbox[28]!=0) {
+ mbox[28]&=0x3FFFFFFF; //convert GPU address to ARM address
+ width=mbox[5]; //get actual physical width
+ height=mbox[6]; //get actual physical height
+ pitch=mbox[33]; //get number of bytes per line
+ isrgb=mbox[24]; //get the actual channel order
+ lfb=(void*)((unsigned long)mbox[28]);
+ } else {
+ uart_string("Unable to set screen resolution to 1024x768x32\n");
+ }
}
/**
@@ -73,19 +75,93 @@ void lfb_init()
*/
void lfb_showpicture()
{
- unsigned int x,y;
- unsigned char *ptr=lfb;
- char *data=homer_data, pixel[4];
-
- ptr += (height-homer_height)/2*pitch + (width-homer_width)*2;
- for(y=0;y<homer_height;y++) {
- for(x=0;x<homer_width;x++) {
- HEADER_PIXEL(data, pixel);
- // the image is in RGB. So if we have an RGB framebuffer, we can copy the pixels
- // directly, but for BGR we must swap R (pixel[0]) and B (pixel[2]) channels.
- *((unsigned int*)ptr)=isrgb ? *((unsigned int *)&pixel) : (unsigned int)(pixel[0]<<16 | pixel[1]<<8 | pixel[2]);
- ptr+=4;
- }
- ptr+=pitch-homer_width*4;
- }
+ unsigned int x,y;
+ unsigned char *ptr=lfb;
+ char *data=homer_data, pixel[4];
+
+ ptr += (height-homer_height)/2*pitch + (width-homer_width)*2;
+ for(y=0;y<homer_height;y++) {
+ for(x=0;x<homer_width;x++) {
+ HEADER_PIXEL(data, pixel);
+ // the image is in RGB. So if we have an RGB framebuffer, we can copy the pixels
+ // directly, but for BGR we must swap R (pixel[0]) and B (pixel[2]) channels.
+ *((unsigned int*)ptr)=isrgb ? *((unsigned int *)&pixel) : (unsigned int)(pixel[0]<<16 | pixel[1]<<8 | pixel[2]);
+ ptr+=4;
+ }
+ ptr+=pitch-homer_width*4;
+ }
+}
+
+void draw_cbyte(unsigned char lx, unsigned char ly, unsigned char letter, unsigned int c) {
+ unsigned int x, y;
+ unsigned char* ptr = lfb;
+ ptr += (pitch*ly+lx*4)*8;
+ unsigned char ltr = letter & 0x7F;
+ for(y=0; y<8; y++) {
+ for(x=0; x<8; x++) {
+ if((1 << (7-x)) & glyphs_byte[y+8*(ltr)]) {
+ *((unsigned int*)ptr) = isrgb ? c : (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16);;
+ } else {
+ *((unsigned int*)ptr) = 0x000000;
+ }
+ ptr += 4;
+ }
+ ptr += pitch - 8*4;
+ }
+}
+
+void draw_cletter(unsigned char lx, unsigned char ly, unsigned char letter, unsigned int c) {
+ unsigned int x, y;
+ unsigned char* ptr = lfb;
+ ptr += (pitch*ly+lx*4)*8;
+ unsigned char ltr = letter & 0x7F;
+ for(y=0; y<8; y++) {
+ for(x=0; x<8; x++) {
+ if((1 << (7-x)) & glyphs[y+8*(ltr)]) {
+ *((unsigned int*)ptr) = isrgb ? c : (unsigned int)((c&0xFF)<<16 | (c&0xFF00) | (c&0xFF0000)>>16);;
+ } else {
+ *((unsigned int*)ptr) = 0x000000;
+ }
+ ptr += 4;
+ }
+ ptr += pitch - 8*4;
+ }
+}
+
+void draw_cstring(unsigned int lx, unsigned int ly, char* s, unsigned int c) {
+ unsigned int x = lx % GG_MAX_X, y = ly % GG_MAX_Y;
+ unsigned int idx = 0;
+ while(s[idx] != 0) {
+ draw_cletter(x++, y, s[idx++], c);
+ if (x > GG_MAX_X) {
+ y += 1;
+ x = 0;
+ }
+ // CHECK Y EVENTUALLY
+ }
+}
+
+void draw_chex32(unsigned int lx, unsigned int ly, unsigned long val, unsigned int c) {
+ unsigned int x = lx % GG_MAX_X, y = ly % GG_MAX_Y;
+ for(unsigned int i = 0; i < 8; i++) {
+ draw_cbyte(x++, y, 0xF & (val >> (7-i)*4), c);
+ if (x > GG_MAX_X) {
+ y += 1;
+ x = 0;
+ }
+ // CHECK Y EVENTUALLY
+ }
+}
+
+void draw_byte(unsigned char lx, unsigned char ly, unsigned char letter) {
+ draw_cbyte(lx, ly, letter, 0xFFFFFF);
+}
+void draw_letter(unsigned char lx, unsigned char ly, unsigned char letter) {
+ draw_cletter(lx, ly, letter, 0xFFFFFF);
+}
+void draw_string(unsigned int lx, unsigned int ly, char* s){
+ draw_cstring(lx, ly, s, 0xFFFFFF);
+}
+void draw_hex32(unsigned int lx, unsigned int ly, unsigned long val) {
+ draw_chex32(lx, ly, val, 0xFFFFFF);
}
diff --git a/src/graphics/lfb.h b/src/graphics/lfb.h
index 4ce6163..ac2e284 100644
--- a/src/graphics/lfb.h
+++ b/src/graphics/lfb.h
@@ -1,7 +1,20 @@
#ifndef GRAPHICS_LFB_H
#define GRAPHICS_LFB_H
+#define GG_MAX_X 128
+#define GG_MAX_Y 96
+
void lfb_init();
void lfb_showpicture();
+void draw_cbyte(unsigned char lx, unsigned char ly, unsigned char letter, unsigned int c);
+void draw_cletter(unsigned char lx, unsigned char ly, unsigned char letter, unsigned int c);
+void draw_cstring(unsigned int lx, unsigned int ly, char* s, unsigned int c);
+void draw_chex32(unsigned int lx, unsigned int ly, unsigned long val, unsigned int c);
+
+void draw_byte(unsigned char lx, unsigned char ly, unsigned char letter);
+void draw_letter(unsigned char lx, unsigned char ly, unsigned char letter);
+void draw_string(unsigned int lx, unsigned int ly, char* s);
+void draw_hex32(unsigned int lx, unsigned int ly, unsigned long val);
+
#endif
diff --git a/src/sys/core.c b/src/sys/core.c
index bbef994..e7b8605 100644
--- a/src/sys/core.c
+++ b/src/sys/core.c
@@ -1,6 +1,7 @@
#include "../cpu/irq.h"
#include "../drivers/uart.h"
#include "../graphics/lfb.h"
+#include "../graphics/drawer.h"
#include "../lib/mem.h"
#include "../lib/strings.h"
#include "../util/time.h"
@@ -141,19 +142,30 @@ void output_irq_status(void) {
uart_char(0x30 + (g_val & 0x3));
uart_string((char*)" | GPU FIQ: Core ");
uart_char(0x30 + ((g_val>>2) & 0x3));
+ write_string(&g_Drawer, "GPU IRQ: Core ");
+ write_hex32(&g_Drawer, g_val & 0b11);
+ write_string(&g_Drawer, " | GPU FIQ: Core ");
+ write_hex32(&g_Drawer, (g_val >> 2) & 0b11);
uart_string("\033[6;1H");
// Check UART IRQ
uart_string((char*)"UART:");
+ set_drawer(&g_Drawer, 0, 2);
+ write_string(&g_Drawer, "UART: ");
if (i2_val & (1<<25)) {
uart_string(irq_on);
+ write_cstring(&g_Drawer, "Enabled", 0x00FF00);
} else {
uart_string(irq_off);
+ write_cstring(&g_Drawer, "Disabled", 0xFF0000);
}
// Check TIMER IRQ
uart_string((char*)" TIMER:");
+ write_string(&g_Drawer, "\n");
+ write_string(&g_Drawer, "TIMER: ");
if (ib_val & (1<<0)) {
uart_string(irq_on);
+ write_cstring(&g_Drawer, "Enabled", 0x00FF00);
// Output the frequency
uart_string(" @ ");
unsigned long frq = read_cntfrq()/1000;
@@ -161,6 +173,7 @@ void output_irq_status(void) {
uart_string((char*)" kHz");
} else {
uart_string(irq_off);
+ write_cstring(&g_Drawer, "Disabled", 0xFF0000);
}
uart_string("\033[7;1H");
@@ -171,6 +184,10 @@ void output_irq_status(void) {
uart_hex(i2_val);
uart_char(0x20);
uart_hex(f_val);
+ draw_hex32(0+9*0, 1, ib_val);
+ draw_hex32(0+9*1, 1, i1_val);
+ draw_hex32(0+9*2, 1, i2_val);
+ draw_hex32(0+9*3, 1, f_val);
}
void postinit() {