update to latest zig, remove silkdot
This commit is contained in:
parent
9257ce6074
commit
1f41e5da8e
6 changed files with 29 additions and 115 deletions
13
src/main.zig
13
src/main.zig
|
@ -1,5 +1,4 @@
|
|||
const std = @import("std");
|
||||
const silkdot = @import("silkdot");
|
||||
|
||||
const Uxn = @import("uxn.zig");
|
||||
|
||||
|
@ -22,22 +21,10 @@ pub fn main() !void {
|
|||
var uxn = Uxn{ .pc = 0x100 };
|
||||
@memcpy(uxn.mem.m[0x100 .. rom.len + 0x100], rom);
|
||||
|
||||
// var term = try silkdot.Terminal.init(allocator);
|
||||
// defer term.deinit();
|
||||
|
||||
var running = true;
|
||||
while (running) {
|
||||
// const events = try term.getEvents();
|
||||
// defer allocator.free(events);
|
||||
// for (events) |ev| switch (ev) {
|
||||
// .keyboard => {
|
||||
// if (ev.keyboard.code == 'q') running = false;
|
||||
// },
|
||||
// else => {},
|
||||
// };
|
||||
std.debug.print("{any} {X}\n", .{ uxn.pc, uxn.mem.m[uxn.pc] });
|
||||
if (uxn.eval()) running = false;
|
||||
// try term.draw();
|
||||
}
|
||||
} else return error.NoRom;
|
||||
}
|
||||
|
|
|
@ -54,13 +54,13 @@ const Stack = struct {
|
|||
}
|
||||
|
||||
pub fn pop(self: *Stack, comptime T: type) T {
|
||||
self.sp -%= @intCast(@divExact(@typeInfo(T).Int.bits, 8));
|
||||
self.sp -%= @intCast(@divExact(@typeInfo(T).int.bits, 8));
|
||||
return self.peek(T);
|
||||
}
|
||||
|
||||
pub fn push(self: *Stack, comptime T: type, v: T) void {
|
||||
self.poke(T, v);
|
||||
self.sp +%= @intCast(@divExact(@typeInfo(T).Int.bits, 8));
|
||||
self.sp +%= @intCast(@divExact(@typeInfo(T).int.bits, 8));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -458,6 +458,8 @@ fn jsr(self: *Uxn, stack: *Stack, comptime T: type, comptime keep: bool) void {
|
|||
}
|
||||
}
|
||||
|
||||
// this one uses a bool instead of a *Stack, because it needs access to both stacks
|
||||
// TODO now that I think about it, just use a bool everywhere
|
||||
fn sth(self: *Uxn, comptime swap: bool, comptime T: type, comptime keep: bool) void {
|
||||
var src = if (swap) self.rs else self.ws;
|
||||
var dst = if (swap) self.ws else self.rs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue