hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/boot/boot.zig
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-10 07:17:15 +0200
committerhachem <im@hachem.wtf>2026-09-10 07:17:15 +0200
commitdbe50063b0f78ecbcb14ade65e16c5c74ad9abe1 (patch)
tree2a4c08c6772b710cb30a0a586124196b5dabe954 /boot/boot.zig
parent0434097a393e790085911bad5229a6654876dae3 (diff)
feat: basic framebuffer
Diffstat (limited to 'boot/boot.zig')
-rw-r--r--boot/boot.zig23
1 files changed, 20 insertions, 3 deletions
diff --git a/boot/boot.zig b/boot/boot.zig
index a7822af..2303409 100644
--- a/boot/boot.zig
+++ b/boot/boot.zig
@@ -1,6 +1,7 @@
const std = @import("std");
const limine = @import("limine.zig");
const serial = @import("serial.zig");
+const framebuffer = @import("framebuffer.zig");
// We need a panic handler otherwise zig won't be happy,
// std usually formats a message through std.Io.Writer which
@@ -9,9 +10,9 @@ const serial = @import("serial.zig");
pub const panic = std.debug.FullPanic(struct {
fn halt(msg: []const u8, _: ?usize) noreturn {
serial.init();
- serial.write("\n!!! uhhhh engine kaput : ");
+ serial.write("\r\n!!! uhhhh engine kaput : ");
serial.write(msg);
- serial.write("\n");
+ serial.write("\r\n");
while (true) asm volatile ("hlt");
}
}.halt);
@@ -24,6 +25,22 @@ export var requests_end: limine.RequestsEndMarker linksection(".limine_requests_
// ENTRY(_start)
export fn _start() callconv(.c) noreturn {
serial.init();
- serial.write("if you see this, it means revel didn't shit the bed");
+ serial.write("if you see this, it means revel didn't shit the bed\r\n");
+
+ if (framebuffer.get()) |screen| {
+ // XOR texture
+ var y: usize = 0;
+ while (y < screen.height) : (y += 1) {
+ var x: usize = 0;
+ while (x < screen.width) : (x += 1) {
+ const v: u32 = @intCast((x ^ y) & 0xFF);
+ framebuffer.putpixel(screen, x, y, (v << 16) | (v << 8) | v);
+ }
+ }
+ serial.write("drew to the framebuffer\r\n");
+ } else {
+ serial.write("limine was a piece of shit.\r\n");
+ }
+
while (true) asm volatile ("hlt");
}