Skip to content

Instantly share code, notes, and snippets.

View wendigojaeger's full-sized avatar

Wendigo Jaeger wendigojaeger

  • 夢工場 - The Dream Factory
View GitHub Profile
@wendigojaeger
wendigojaeger / core.zig
Created February 2, 2020 17:42
Generic bios call
pub inline fn BIOSRegisterRamReset(flags: RamResetFlags) void {
biosCall(1, @bitCast(u8, flags));
}
pub inline fn biosCall(comptime call: u8, params: u8) void {
const assembly = comptime blk: {
const fmt = @import("std").fmt;
var buffer:[64] u8 = undefined;
break :blk fmt.bufPrint(buffer[0..], "movs r0, r1\nswi {}", .{call}) catch unreachable;
};
pub fn fromFile(allocator: *Allocator, filePath: []const u8) !Bitmap {
var result = init(allocator);
var absolutePath = try path.resolve(allocator, &[_][]const u8{filePath});
defer allocator.free(absolutePath);
var file = try fs.openFileAbsolute(absolutePath, File.OpenFlags{});
defer file.close();
var fileInStream = file.inStream();
@wendigojaeger
wendigojaeger / build.zig
Created December 14, 2019 16:57
Zig Win32 MessageBox example
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("Win32MessageBoxTest", "src/main.zig");
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());