rest of the instructions

This commit is contained in:
Jeeves 2024-04-22 14:59:06 -06:00
parent 4903ea72fb
commit 9257ce6074

View file

@ -99,7 +99,12 @@ pub fn eval(self: *Uxn) bool {
0x1E => eor(&self.ws, u8, false), // EOR
0x1F => sft(&self.ws, u8, false), // SFT
0x20 => {}, // JCI
0x20 => {
if (self.ws.pop(u8) != 0)
self.pc +%= 2 + self.mem.peek(u16, self.pc +% 1)
else
self.pc +%= 2;
}, // JCI
0x21 => inc(&self.ws, u16, false), // INC2
0x22 => pop(&self.ws, u16, false), // POP2
0x23 => nip(&self.ws, u16, false), // NIP2
@ -132,7 +137,9 @@ pub fn eval(self: *Uxn) bool {
0x3E => eor(&self.ws, u16, false), // EOR2
0x3F => sft(&self.ws, u16, false), // SFT2
0x40 => {}, // JMI
0x40 => {
self.pc +%= 2 + self.mem.peek(u16, self.pc +% 1);
}, // JMI
0x41 => inc(&self.rs, u8, false), // INCr
0x42 => pop(&self.rs, u8, false), // POPr
0x43 => nip(&self.rs, u8, false), // NIPr
@ -498,9 +505,10 @@ fn dei(self: *Uxn, stack: *Stack, comptime T: type, comptime keep: bool) void {
}
fn deo(self: *Uxn, stack: *Stack, comptime T: type, comptime keep: bool) void {
std.debug.print("DEO: {any} ", .{stack.s});
const d = if (keep) stack.peek(u8) else stack.pop(u8);
const v = if (keep) stack.peek(T) else stack.pop(T);
std.debug.print("DEO: v{X} d{X}\n", .{ v, d });
std.debug.print("v{X} d{X}\n", .{ v, d });
switch (T) {
u8 => self.dev[d] = v,
u16 => {