diff --git a/bin/os b/bin/os index 7cb4a65..e2fa090 100755 Binary files a/bin/os and b/bin/os differ diff --git a/image.hdd b/image.hdd index b8afcb8..4851914 100644 Binary files a/image.hdd and b/image.hdd differ diff --git a/limine b/limine index eecf8d6..e0e61c9 160000 --- a/limine +++ b/limine @@ -1 +1 @@ -Subproject commit eecf8d682a749701691e31b89f66f330f525c611 +Subproject commit e0e61c946933696453f591da525ab1f8a66a553d diff --git a/obj/src/int.c.o b/obj/src/int.c.o index 22cdad4..1906873 100644 Binary files a/obj/src/int.c.o and b/obj/src/int.c.o differ diff --git a/obj/src/main.c.o b/obj/src/main.c.o index c48e610..1711cd5 100644 Binary files a/obj/src/main.c.o and b/obj/src/main.c.o differ diff --git a/run.sh b/run.sh index 9b1bb9d..4feec7f 100644 --- a/run.sh +++ b/run.sh @@ -1 +1,2 @@ -/mnt/c/'Program Files'/qemu/qemu-system-x86_64.exe image.hdd +qemu-system-x86_64 image.hdd +#/mnt/c/'Program Files'/qemu/qemu-system-x86_64.exe image.hdd diff --git a/src/main.c b/src/main.c index 8696498..9f7e76e 100644 --- a/src/main.c +++ b/src/main.c @@ -205,12 +205,11 @@ void kmain() { #define LINES 40 size_t max_len = MAX_LINE_LEN; - char* line = getline_alloc(max_len); char* lines[LINES]; size_t n_lines = 0; for(n_lines = 0; n_lines < LINES; n_lines++) { - line = getline_alloc(max_len); + char* line = getline_alloc(max_len); if(!line) break; if(line[0] == 'F' && line[1] == 'I' && line[2] == '\n') diff --git a/src/prompt/lex.c b/src/prompt/lex.c index d897c0c..707d103 100644 --- a/src/prompt/lex.c +++ b/src/prompt/lex.c @@ -2,17 +2,10 @@ #include "iden.h" #include "lex.h" -#include "../print.h" +#include "../lib/stdio.h" static int lex_error(struct file* state, const char* err) { - print(state->name); - print("["); - print16(state->row+1); - print(":"); - print16(state->col+1); - print("] "); - print(err); - print("\n"); + printf("%s:%d:%d: %s\n", state->name, state->row+1, state->col+1, err); return 1; } @@ -46,7 +39,7 @@ size_t token_next = 0; static struct token* tok(enum tokentype type, struct file* state, int col, void* val) { struct token* ret = &token_pool[token_next]; if(++token_next >= MAX_TOK) { - print("OUT OF TOKENS!!!!"); + printf("OUT OF TOKENS!!!!"); hang(); } @@ -119,12 +112,11 @@ static int parse_num(struct file* state, int save, int sign) { if(ch == '0' && state->lines[state->row][state->col+1] == 'x') { state->col+=2; if(!isxdigit(state->lines[state->row][state->col])) { - print("On input: '"); - printn(&state->lines[state->row][state->col], 1); - print("'\n"); + printf("On input: '%c'\n", state->lines[state->row][state->col]); lex_error(state, "expected hexadecimal digits in hex literal"); return 1; } + while(isxdigit(state->lines[state->row][state->col])) { num <<= 4; ch = toupper(state->lines[state->row][state->col]); @@ -243,12 +235,7 @@ int lex(struct file* state) { *state->tail = tok(state->lines[state->row][state->col-1], state, save, NULL); } else { lex_error(state, "unrecognized character"); - print("Character: (0x"); - u8 ch = state->lines[state->row][state->col]; - print8(ch); - print(") '"); - printn(&ch,1); - print("'\n"); + printf("Character: (0x%x) '%c'\n", ch, ch); state->col++; return 1 + lex(state); }