From 24ce4addff8efe002f70316b89662f80d60fe55f Mon Sep 17 00:00:00 2001 From: Jeeves Date: Thu, 6 Mar 2025 04:04:46 -0700 Subject: [PATCH] done for now --- src/uxn.zig | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/uxn.zig b/src/uxn.zig index c7d38db..243548f 100644 --- a/src/uxn.zig +++ b/src/uxn.zig @@ -712,9 +712,15 @@ test "op" { defer uxn.deinit(std.testing.allocator); const rom = [_]u8{ + // op.inc 0x01, 0x01, 0x01, 0x01, 0x21, 0x21, 0x21, 0x21, - 0x00, + + // op.pop + 0x02, 0x02, 0x02, 0x18, + 0x02, 0x02, 0x18, 0x22, + 0x22, 0x22, 0x38, 0x22, + 0x22, 0x38, 0x00, }; @memcpy(uxn.mem.m[0x100 .. rom.len + 0x100], &rom); @@ -743,6 +749,41 @@ test "op" { try std.testing.expectEqual(0xffff, uxn.ws.pop(u16)); _ = uxn.eval(); try std.testing.expectEqual(0x0001, uxn.ws.pop(u16)); + + std.debug.print("op.pop\n", .{}); + uxn.ws.push(u16, 0x0e0f); + uxn.ws.push(u16, 0x0c0d); + uxn.ws.push(u16, 0x0a0b); + uxn.ws.push(u16, 0x0e0f); + uxn.ws.push(u16, 0x0c0d); + uxn.ws.push(u16, 0x0a0b); + uxn.ws.push(u16, 0x0e0f); + uxn.ws.push(u16, 0x0c0d); + uxn.ws.push(u16, 0x0a0b); + uxn.ws.push(u16, 0x0c0d); + uxn.ws.push(u16, 0x0a0b); + uxn.ws.push(u8, 0x0c); + uxn.ws.push(u8, 0x0b); + uxn.ws.push(u8, 0x0a); + uxn.ws.push(u8, 0x0c); + uxn.ws.push(u8, 0x0b); + uxn.ws.push(u8, 0x0a); + uxn.ws.push(u8, 0x0c); + uxn.ws.push(u8, 0x0b); + uxn.ws.push(u8, 0x0a); + uxn.ws.push(u8, 0x0b); + uxn.ws.push(u8, 0x0a); + _ = uxn.eval(); + try std.testing.expectEqual(0x0a, uxn.ws.pop(u8)); + // _ = uxn.eval(); + // _ = uxn.eval(); + // try std.testing.expectEqual(0x0a, uxn.ws.pop(u8)); + // _ = uxn.eval(); + // _ = uxn.eval(); + // try std.testing.expectEqual(0x0a, uxn.ws.pop(u8)); + // _ = uxn.eval(); + // _ = uxn.eval(); + // try std.testing.expectEqual(0x15, uxn.ws.pop(u8)); } pub fn formatInstruction(