Borked int_to_str

pull/29/head
E. Almqvist 3 years ago
parent e58ec4a2ef
commit e429ac6102
  1. 4
      Makefile
  2. 5
      kernel/kernel.c
  3. 12
      lib/strf.c

@ -1,5 +1,5 @@
C_SOURCES = $(wildcard kernel/*.c drivers/*.c)
HEADERS = $(wildcard kernel/*.h drivers/*.h)
C_SOURCES = $(wildcard kernel/*.c drivers/*.c lib/*.c)
HEADERS = $(wildcard kernel/*.h drivers/*.h lib/*.h)
OBJ = $(C_SOURCES:.c=.o)
all: os-image

@ -1,9 +1,14 @@
#include "../drivers/vga.h"
#include "../lib/strf.h"
void main() {
vga_init(); // Initialize the screen first
// i.e. clear the screen et cetera.
int test = 1234;
char* teststr = int_to_str(test);
println(teststr, 0xf0);
set_cursor_pos(28, 2);
print("eOS Version 0.1 2021", 0xf0);
}

@ -1,9 +1,15 @@
#include "lib/strf.h"
#include "strf.h"
#define int_offset 48
// 0:48 - 9:57
char* int_to_str(int i) {
char* strbuf;
double num = (double)i;
char* strbuf = "XXXXXX";
while( i > 0 ) {
*(strbuf + 1) = (i % 10) + int_offset;
i /= 10;
}
return strbuf;
}

Loading…
Cancel
Save