# HG changeset patch # User Simon Heath # Date 1664859945 14400 # Tue Oct 04 01:05:45 2022 -0400 # Node ID 7958d7741a0e6c92b051816d042e2c5ba040340b # Parent 3e06b7fe0e3ae228494f478b1c9fe486284cb953 decoding more formats diff --git a/src/main.fnl b/src/main.fnl --- a/src/main.fnl +++ b/src/main.fnl @@ -207,19 +207,23 @@ (fn decode-abx [i] "Decode an instruction in the :iABx format" - 0) + (let [a (extract i 7 8) + bx (extract i 15 17)] + {: a : bx}) (fn decode-absbx [i] - "Decode an instruction in the :iAsBx format" - 0) + "Decode an instruction in the :iAsBx format. This is ABx but Bx is signed, which... doesn't matter for us I think... so we're ok?" + (decode-abx i)) (fn decode-ax [i] "Decode an instruction in the :iAx format" - 0) + (let [a (extract i 7 25)] + {: a}) (fn decode-asj [i] "Decode an instruction in the :isJ format" - 0) + (let [j (extract i 7 25)] + {: j})) (fn decode [i] "Decodes a 32-bit integer into a table containing a Lua opcode"