1
0
Fork 0
forked from AbleOS/ableos
ableos/sysdata/programs/tests/src/main.hb

42 lines
876 B
Plaintext
Raw Normal View History

2024-07-06 09:24:23 -05:00
log := fn(message: ^u8, level: u8): void {
message_2 := message;
len := 0;
loop if *message_2 == 0 {
*message_2 = level;
break
} else {
len += 1;
message_2 += 1;
}
len += 1;
@eca(i32, 3, 1, message, len);
return;
}
error:= fn(message: ^u8):void return log(message, 0);
warn:= fn(message: ^u8):void return log(message, 1);
info:= fn(message: ^u8):void return log(message, 2);
debug:= fn(message: ^u8):void return log(message, 3);
trace:= fn(message: ^u8):void return log(message, 4);
request_mem_page := fn(page_count: u8): ^u8 {
msg := "\{01}\{01}00000\0";
msg_mem_page_count := msg + 1;
*msg_mem_page_count = page_count;
return @eca(^u8, 3, 2, msg, 8);
}
alloc := fn(): void {
error("Did not allocate.\0");
return;
}
main := fn(): int {
2024-07-06 09:24:23 -05:00
buffer := request_mem_page(3);
alloc();
return 0;
}