basic terminal
[cortex-from-scratch] / lib.c
diff --git a/lib.c b/lib.c
index 62c56e8..ba55c01 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -7,15 +7,15 @@
 /* Temporary libc functions, which can later be 
  * replaced by a *real* library */
 
-char hexbuf[8] = {'0', '0','0', '0','0', '0','0', '0'};
+char hexbuf[8];
 
-void addrtohex(const uint32_t addr) {
+/* Still kind of a debug function */
+void addrtohex(uint32_t addr) {
        char tmpbuf[6] = {'A', 'B', 'C', 'D', 'E', 'F'};
        memset(&hexbuf, 0, sizeof(uint32_t) * 8);
-       uint32_t tmp = addr;
 
        for (int i = 0; i < 8 ; i++) {
-               tmp = addr;
+               uint32_t tmp = addr;
                tmp = tmp >> (i * 4);
                tmp = tmp & 0xF;
                if ((tmp >= 0) && tmp < 10) {
@@ -26,21 +26,12 @@ void addrtohex(const uint32_t addr) {
                }
        }
 
-       uart_puts("ADDRESS: 0x");
-       for (int i = 7; i >= 0; i--) {
-               uart_putc(hexbuf[i]);
-       }
-       uart_putc('\n');
+        for (int i = 7; i >= 0; i--) {
+               cputchar(hexbuf[i]);
+       } 
 }
 
 
-void *malloc(size_t size) {
-
-
 
-}
-
-void free(void * ptr) {
 
 
-}