diff options
| author | 0x221E <0x221E@0xinfinity.dev> | 2026-06-11 20:10:31 +0200 |
|---|---|---|
| committer | 0x221E <0x221E@0xinfinity.dev> | 2026-06-11 20:11:56 +0200 |
| commit | 6d559b7e50dbab428d324b4ddaed9db7a8ced887 (patch) | |
| tree | c2e807a19d2d0b6054e13a6d3ece16750796198d /include | |
| download | tmpbootloader-master.tar.gz | |
Diffstat (limited to 'include')
| -rw-r--r-- | include/defs.h | 14 | ||||
| -rw-r--r-- | include/printk.h | 10 | ||||
| -rw-r--r-- | include/string.h | 9 | ||||
| -rw-r--r-- | include/vga.h | 16 |
4 files changed, 49 insertions, 0 deletions
diff --git a/include/defs.h b/include/defs.h new file mode 100644 index 0000000..9932af1 --- /dev/null +++ b/include/defs.h @@ -0,0 +1,14 @@ +#ifndef DEFS_H +#define DEFS_H + +#ifdef STAGE1 + #define BLSEC_TEXT __attribute__((section(".stage1.text"))) + #define BLSEC_DATA __attribute__((section(".stage1.data"))) +#elif STAGE2 + #define BLSEC_DATA __attribute__((section(".stage2.data"))) + #define BLSEC_DATA __attribute__((section(".stage2.data"))) +#else + #error "You must define a stage to compile the libraries!" +#endif + +#endif // DEFS_H diff --git a/include/printk.h b/include/printk.h new file mode 100644 index 0000000..08a2778 --- /dev/null +++ b/include/printk.h @@ -0,0 +1,10 @@ +#ifndef PRINTK_H +#define PRINTK_H + +#include <defs.h> + +#include <stdint.h> + +void write(char *str, uint8_t color) BLSEC_TEXT; + +#endif diff --git a/include/string.h b/include/string.h new file mode 100644 index 0000000..7c1caa5 --- /dev/null +++ b/include/string.h @@ -0,0 +1,9 @@ +#ifndef STRING_H +#define STRING_H + +#include <defs.h> +#include <stddef.h> + +size_t strlen(char* s) BLSEC_TEXT; + +#endif diff --git a/include/vga.h b/include/vga.h new file mode 100644 index 0000000..66a5441 --- /dev/null +++ b/include/vga.h @@ -0,0 +1,16 @@ +#ifndef VGA_H +#define VGA_H + +#include <defs.h> +#include <stdint.h> + +#define VGA_MEMORY_ADDR (volatile uint16_t*)0xB8000; + +#define MAX_WIDTH 80 +#define MAX_HEIGHT 25 + +void vga_setup(int maxw, int maxh) BLSEC_TEXT; +uint8_t vga_color(uint8_t fg, uint8_t bg) BLSEC_TEXT; +void vga_put(uint32_t x, uint32_t y, unsigned char uc, uint8_t color) BLSEC_TEXT; + +#endif |
