aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-30 16:11:03 -0800
committerChristian Cunningham <cc@localhost>2021-12-30 16:11:03 -0800
commit104c6fdd6b217b06183df7007882afa9183688bb (patch)
tree20f457fdae65c183f8b7caaa07c59a133c47d794 /src
parentc2ce4f14384a38e02848f5b32fd7774128ce54dd (diff)
Standardized todec algo
Diffstat (limited to 'src')
-rw-r--r--src/drivers/uart.c2
-rw-r--r--src/graphics/drawer.c12
-rw-r--r--src/sys/kernel.S2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/uart.c b/src/drivers/uart.c
index a45f86d..cc1933e 100644
--- a/src/drivers/uart.c
+++ b/src/drivers/uart.c
@@ -10,7 +10,7 @@ void uart_10(unsigned long val)
{
unsigned long t = val;
unsigned long c;
- char buffer[11] = "0000000000\0";
+ static char buffer[11] = "0000000000\0";
char* dptr = buffer + 9;
for(int i = 0; i <= 10; i++) {
c = t%10;
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
index 35a16a6..04d3e89 100644
--- a/src/graphics/drawer.c
+++ b/src/graphics/drawer.c
@@ -69,16 +69,16 @@ void write_hex32(struct Drawer* d, unsigned long val)
void write_c10(struct Drawer* d, unsigned long val, unsigned int c)
{
- static char out[] = "0000000000";
- char* s = (char*)out+10;
+ static char out[] = "0000000000\0";
+ char* s = (char*)out+9;
unsigned long tmp = val;
- if(tmp == 0)
- s--;
- while (tmp != 0) {
- s--;
+ for(int i = 0; i < 10; i++) {
unsigned char rem = tmp%10;
tmp /= 10;
*s = rem + 0x30;
+ if (tmp==0)
+ break;
+ s--;
}
write_cstring(d, s, c);
}
diff --git a/src/sys/kernel.S b/src/sys/kernel.S
index f74bc6a..cf1dbb2 100644
--- a/src/sys/kernel.S
+++ b/src/sys/kernel.S
@@ -6,7 +6,7 @@ kernel_main:
bl sysinit
bl postinit
kernel_main.loop:
- wfi
+ wfe
b kernel_main.loop
pop {lr}