#include "common.h"
-char opcodes_strings[N_INSTRUCTIONS][4] = {"nop", "inc", "dec", "lod", "ldl", "sav", "swp", "jmp", "jez", "hlt", "pts", "pfs", "dpx"};
+char opcodes_strings[N_INSTRUCTIONS][4] = {"nop", "inc", "dec", "lod", "ldl", "sav", "swp", "jmp", "jez", "hlt", "pts", "pfs", "dpx", "lor"};
* rex, 2 byte length - instruction + dest register - read from external(stdin) - blocks execution until 2 bytes are read
*
* dpx, 4 byte length - instruction + register with pixel location + register with R and G + register with B and A(R and B are first 8 bits, G and A are second 8 bits)
+ *
+ * lor, 3 byte length - instruction + dest register + register containing address where to load from
*
* all instructions are padded to 4 bytes
*/
return;
}
-void (*opcodes[N_INSTRUCTIONS]) (uint8_t, uint8_t, uint8_t) = {nop, inc, dec, lod, ldl, sav, swp, jmp, jez, hlt, pts, pfs, dpx};
+void lor(uint8_t dest_reg, uint8_t unused_1, uint8_t mem_addr_reg)
+{
+ regs[dest_reg] = mem[regs[mem_addr_reg]];
+ current_instruction += 2;
+ return;
+}
+
+void (*opcodes[N_INSTRUCTIONS]) (uint8_t, uint8_t, uint8_t) = {nop, inc, dec, lod, ldl, sav, swp, jmp, jez, hlt, pts, pfs, dpx, lor};