From f199eae0154f354c37750c8cd3037f94dbfe70db Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Sat, 26 Jul 2025 16:03:00 +0200 Subject: Initial commit --- src/aplos.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/aplos.h (limited to 'src/aplos.h') diff --git a/src/aplos.h b/src/aplos.h new file mode 100644 index 0000000..4e663f4 --- /dev/null +++ b/src/aplos.h @@ -0,0 +1,57 @@ +#include +#include +#include +#include + +#define nelem(arr) (sizeof(arr)/sizeof(*(arr))) + +struct framebuffer +{ + void *addr; + uint64_t width; + uint64_t height; + uint64_t pitch; +}; + +struct memmap +{ + uintptr_t start; + uint64_t size; +}; + +struct boot_info +{ + struct framebuffer framebuffer; + uint64_t memmap_count; + struct memmap *memmaps; +}; + +/* boot.c */ +uint64_t cpu_count(void); + +/* main.c */ +void main(struct boot_info *); +#define ASSERT(chk) do{if(!(chk)) halt();}while(0) + +/* screen.c */ +void screen_init(struct framebuffer *); +void screen_draw_pixel(uint32_t, uint32_t, uint32_t); +void print(char8_t *, ...); + +/* font.c */ +void font_init(void); +void font_draw(char8_t *, uint32_t, uint32_t, uint32_t, uint32_t); + +/* util.c */ +uint16_t read_uint16_le(const uint8_t *); +uint16_t read_uint16_be(const uint8_t *); +uint32_t read_uint32_le(const uint8_t *); +int memcmp(const void *, const void *, size_t); + +/* utf8.c */ +int utf8_char_length(const char8_t *); +int utf8_cmp_n(const char8_t *, const char8_t *, uint64_t); +uint32_t utf8_value(const char8_t *); + +/* nasty.S */ +extern void halt(void); -- cgit v1.2.3