const fmt = @import("std").fmt; const Writer = @import("std").io.Writer; fn inb(port: u16) u8 { return asm volatile ("inb %[port], %[result]" : [result] "={al}" (-> u8), : [port] "{dx}" (port), ); } fn outb(port: u16, data: u8) void { asm volatile ("outb %[data], %[port]" : : [port] "{dx}" (port), [data] "{al}" (data), ); } pub fn write(data: []const u8) void { for (data) |x| { outb(0xe9, x); } } pub const writer = Writer(void, error{}, callback){ .context = {} }; fn callback(_: void, string: []const u8) error{}!usize { write(string); return string.len; } pub fn printf(comptime format: []const u8, args: anytype) void { fmt.format(writer, format, args) catch unreachable; }