This commit is contained in:
2019-12-07 17:31:23 +00:00
parent ea8f7914f9
commit 4f614c7727
5 changed files with 201 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ pub fn loadFromStream(alloc: *std.mem.Allocator, stream: *std.fs.File.InStream.S
var trimmed = std.mem.trimRight(u8, num, "\r\n");
program[i] = try std.fmt.parseInt(i32, trimmed, 10);
std.debug.warn("{},", program[i]);
// std.debug.warn("{},", program[i]);
i += 1;
}
@@ -118,6 +118,11 @@ pub const Machine = struct {
while (try self.step()) {}
}
pub fn deinit(self: *Machine) void {
self.input.deinit();
self.output.deinit();
}
/// Read an immediate or position value from memory. Parameter determines
/// which field following the current instruction to read from
inline fn __read(self: *Machine, parameter: usize, mode: Mode) i32 {