diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2025-07-26 16:23:58 +0200 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2025-07-26 16:23:58 +0200 |
commit | b5a24778844f41e38168d97761d72cf0d5b400b3 (patch) | |
tree | 1d880857bb4f6ff3406d7572e25bf738134a165c /src | |
parent | fdef211fd968c6a3ff0ca6ca38620e8c13387c4c (diff) |
Some minor cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/aplos.h | 28 | ||||
-rw-r--r-- | src/boot.c | 12 | ||||
-rw-r--r-- | src/error.c | 8 | ||||
-rw-r--r-- | src/font.c | 2 |
4 files changed, 29 insertions, 21 deletions
diff --git a/src/aplos.h b/src/aplos.h index 4e663f4..a64e7cc 100644 --- a/src/aplos.h +++ b/src/aplos.h @@ -28,30 +28,32 @@ struct boot_info /* boot.c */ uint64_t cpu_count(void); - + +/* error.c */ +void assert(bool); + +/* font.c */ +void font_init(void); +void font_draw(char8_t *, uint32_t, uint32_t, uint32_t, uint32_t); + /* main.c */ void main(struct boot_info *); -#define ASSERT(chk) do{if(!(chk)) halt();}while(0) + +/* nasty.S */ +void halt(void); /* 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); +/* 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 *); /* 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); @@ -55,13 +55,13 @@ bootmain(void) { struct boot_info info; - ASSERT(LIMINE_BASE_REVISION_SUPPORTED); - ASSERT(framebuffer_request.response); - ASSERT(memmap_request.response); - ASSERT(paging_request.response); - ASSERT(mp_request.response); + assert(LIMINE_BASE_REVISION_SUPPORTED); + assert(framebuffer_request.response); + assert(memmap_request.response); + assert(paging_request.response); + assert(mp_request.response); - ASSERT(framebuffer_request.response->framebuffer_count >= 1); + assert(framebuffer_request.response->framebuffer_count >= 1); struct limine_framebuffer *framebuffer = framebuffer_request.response->framebuffers[0]; diff --git a/src/error.c b/src/error.c new file mode 100644 index 0000000..2513645 --- /dev/null +++ b/src/error.c @@ -0,0 +1,8 @@ +#include "aplos.h" + +void +assert(bool check) +{ + if(!check) + halt(); +} @@ -2,8 +2,6 @@ static const uint8_t font_data[] = { #embed "../external/spleen/spleen-8x16.psfu" -// #embed "../external/spleen/spleen-12x24.psfu" -// #embed "../external/spleen/spleen-16x32.psfu" }; static uint32_t header_size; |