A new hobby programming language for OS developement?
Posted: Sun Jul 31, 2022 11:18 am
Just came up with this and wanted some feedback on it. I was just rewriting various assembly programs I've written with more C or Rust like syntax. I'm mostly just doing this for fun and for myself and accept that there are various reasons not to try and replace assembly with a programming language in OS developement. The idea is that this would simultaneously replace C and assembly. I also want it to be describing whats actually happening rather than abstracting it away as much as is reasonable. Reasonable being kind of arbitrary.
Code: Select all
// HELLO WORLD EXAMPLE
const MESSAGE:[b8] = "Hello World";
func main() -> sys_exit {
stdout = MESSAGE;
return 0;
}
// PART OF KERNEL MAIN EXAMPLE
func error(val: b8) -> hlt {
0xb8000 = "ERR: ";
0xb800a = val;
}
func check_multiboot() {
if (eax != 0x36d76289) {
error("M");
}
return;
}
func main32() -> hlt {
check_multiboot();
}
// MULTIBOOT HEADER EXAMPLE
#pragma section .multiboot_header
#define MULTIBOOT2 0xe85250d6
#define i386 0
#define FRAME_BUFFER_TAG 5
{
const MAGIC:b32 = MULTIBOOT2;
const ARCHITECTURE:b32 = i386;
}
{
const TAG_TYPE:b16 = FRAME_BUFFER_TAG;
const OPTIONAL:b16 = 0;
const WIDTH:b32 = 500;
const HEIGHT:b32 = 500;
const DEPTH:b32 = 32;
}
{
const END0:b16 = 0;
const END1:b16 = 0;
const END2:b16 = 0;
}