aboutsummaryrefslogtreecommitdiff
path: root/src/usr
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-23 23:19:02 -0700
committerChristian Cunningham <cc@localhost>2022-03-23 23:19:02 -0700
commit3e64dda5d5c350cc325650133f7e64967f1efe84 (patch)
treee42452c9140327e3f9c53a32c6d42aecce731b91 /src/usr
parent48bc61ac76b82b1514ed4bf1d3dc7ba6cb2c991c (diff)
Toy task start - 1/40u
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/usr/main.c b/src/usr/main.c
new file mode 100644
index 0000000..67b9c3a
--- /dev/null
+++ b/src/usr/main.c
@@ -0,0 +1,25 @@
+#include <graphics/lfb.h>
+#include <symbols.h>
+
+char* ulong_to_string(unsigned long value, char* data)
+{
+ unsigned long t = value;
+ unsigned long c;
+ char* dptr = data + 9;
+ for (int i = 0; i <= 10; i++) {
+ c = t%10;
+ *dptr = 0x30 + (c&0xF);
+ t /= 10;
+ if (t==0)
+ break;
+ dptr -= 1;
+ }
+ return dptr;
+}
+
+void main(void)
+{
+ static char str[13];
+ char* start = ulong_to_string(*(volatile unsigned long*)SYS_TIMER_CHI, str);
+ draw_string(0, 10, start);
+}