odds and ends

This commit is contained in:
Hopeless Tyromancy 2026-02-18 19:15:14 -05:00
parent 78f56d916c
commit c6b416d2d4
8 changed files with 10 additions and 23 deletions

BIN
bin/os

Binary file not shown.

BIN
image.hdd

Binary file not shown.

2
limine

@ -1 +1 @@
Subproject commit eecf8d682a749701691e31b89f66f330f525c611
Subproject commit e0e61c946933696453f591da525ab1f8a66a553d

Binary file not shown.

Binary file not shown.

3
run.sh
View File

@ -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

View File

@ -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')

View File

@ -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);
}