summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--src/aplos.h28
-rw-r--r--src/boot.c12
-rw-r--r--src/error.c8
-rw-r--r--src/font.c2
5 files changed, 30 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index f859764..7f7c970 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@ LDFLAGS = \
OFILES = \
src/boot.o \
+ src/error.o \
src/font.o \
src/main.o \
src/nasty.o \
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);
diff --git a/src/boot.c b/src/boot.c
index 4bbe771..f3afb5e 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -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();
+}
diff --git a/src/font.c b/src/font.c
index 33c81aa..16b13bc 100644
--- a/src/font.c
+++ b/src/font.c
@@ -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;