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 {
|
2024-07-06 11:23:44 -05:00
|
|
|
msg := "\{00}\{01}xxxxxxxx\0";
|
2024-07-06 09:24:23 -05:00
|
|
|
msg_mem_page_count := msg + 1;
|
|
|
|
*msg_mem_page_count = page_count;
|
2024-07-06 11:23:44 -05:00
|
|
|
return @eca(^u8, 3, 2, msg, 12);
|
2024-07-06 09:24:23 -05:00
|
|
|
}
|
|
|
|
|
2024-07-06 11:23:44 -05:00
|
|
|
release_mem_page := fn(ptr: ^u8, page_count: u8): void {
|
|
|
|
msg := "\{01}\{00}xxxxxxxx\0";
|
|
|
|
|
|
|
|
msg_mem_page_count := msg + 1;
|
|
|
|
*msg_mem_page_count = page_count;
|
|
|
|
|
|
|
|
msg_mem_ptr := @as(^^u8, @bitcast(msg+2));
|
|
|
|
*msg_mem_ptr = ptr;
|
|
|
|
|
|
|
|
a := @eca(void, 3, 2, msg, 12);
|
2024-07-06 09:24:23 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-05-31 10:07:22 -05:00
|
|
|
main := fn(): int {
|
2024-07-06 09:24:23 -05:00
|
|
|
buffer := request_mem_page(3);
|
2024-07-06 11:23:44 -05:00
|
|
|
release_mem_page(buffer, 3);
|
2024-07-06 09:24:23 -05:00
|
|
|
|
2024-05-31 10:07:22 -05:00
|
|
|
return 0;
|
|
|
|
}
|