From 560bc596adb5c27c43e202a365d1de21a6283ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86r=C3=BE?= <50090571+AlmiriQ@users.noreply.github.com> Date: Sat, 9 Apr 2022 04:20:48 +0700 Subject: [PATCH] Add files via upload --- date.lua | 250 +++++++++++++++ device/clock.c | 12 +- device/console.c | 3 +- device/rom.c | 44 +++ devices.c | 4 +- faxm.lua | 216 +++++++++++++ faxm/freeform.lua | 11 + faxm/main.c | 8 + faxm/main.o | Bin 0 -> 16608 bytes faxm/string.lua | 26 ++ faxmopcode.lua | 9 + livm.c | 97 +++--- main.c | 22 +- main.faxm | 15 + out.fx | 1 + xcase.c | 774 ++++++++++++++++++++++++---------------------- 16 files changed, 1053 insertions(+), 439 deletions(-) create mode 100644 date.lua create mode 100644 device/rom.c create mode 100644 faxm.lua create mode 100644 faxm/freeform.lua create mode 100644 faxm/main.c create mode 100644 faxm/main.o create mode 100644 faxm/string.lua create mode 100644 faxmopcode.lua create mode 100644 main.faxm create mode 100644 out.fx diff --git a/date.lua b/date.lua new file mode 100644 index 0000000..fee6708 --- /dev/null +++ b/date.lua @@ -0,0 +1,250 @@ +local date = { + __def_val = { + boolean = true, + string = true, + number = true + }, + __shorten_val = { + ["function"] = true, + thread = true, + userdata = true, + ["nil"] = true + }, + __spec_val = { + table = true + } +} + +--[==[ UNIT TEST FUNCTION +local function test(t) + for i, v in ipairs(t) do + local passed + if type(v[2]) == "table" then + passed = v[2][v[1]] + elseif type(v[2]) == "function" then + passed = v[2](v[1]) + else + passed = v[1] == v[2] + end + if not passed then + print("Test " .. i .. " failed!") + print(v[1], v[2]) + return false + end + end + return true +end +]==] + +local function trim(s) + local n = s:find"%S" + return n and s:match(".*%S", n) or "" +end + +function date.encode(t, st) + if date.__shorten_val[type(t)] then + return type(t) + elseif date.__def_val[type(t)] then + return trim(tostring(t):gsub("\\", "\\\\"):gsub(":", "\\:") + :gsub("%-", "\\-"):gsub("%^", "\\^"):gsub("{", "\\{"):gsub("}", "\\}")) + elseif st then + if st[1][t] then + return "{^" .. st[2][t] .. "}" + end + end + st = st or {{}, {}, 0} + if not st[1][t] then + st[3] = st[3] + 1 + st[1][t] = true + st[2][t] = st[3] + end + local result = {} + local c = 1 + local ordered = true + for k, v in pairs(t) do + ordered = ordered and c == k + local append = "" + if not ordered then + append = date.encode(k, st) .. "-" + end + if date.__spec_val[type(v)] then + if st[1][v] then append = append .. "{^" .. st[2][v] .. "}" + else + append = append .. "{" .. date.encode(v, st) .. "}" + if not st[1][t] then + st[3] = st[3] + 1 + st[1][t] = true + st[2][t] = st[3] + end + end + elseif date.__shorten_val[type(v)] then + append = append .. type(v) + elseif date.__def_val[type(v)] then + append = append .. trim(tostring(v):gsub("\\", "\\\\"):gsub(":", "\\:") + :gsub("%-", "\\-"):gsub("%^", "\\^"):gsub("{", "\\{"):gsub("}", "\\}")) + end + result[#result + 1] = append + c = c + 1 + end + return table.concat(result, ":") +end + +function date.decode(s, st) + if type(s) ~= "string" then return error("date.decode arg #1 must be string") end + s = trim(s) + if #s:gsub("\\?%-?%d+%.?$d*", "") == 0 then return tonumber(({s:gsub("\\", "")})[1]) + elseif s == "true" then return true + elseif s == "false" then return false + elseif s == "function" then return function() end + elseif s == "thread" then return coroutine.create(function() end) + elseif s == "userdata" then return "userdata" + elseif s == "nil" then return nil end + local result = {} + if st == nil then + st = { result } + else + st[#st + 1] = result + end + local sv = {} + local key, last + + local function parseValue(x) + if type(x) ~= "string" then return error("date.decode.parseValue arg #1 must be string") end + x = trim(x) + if x == "false" then return false + elseif #x:gsub("%{%^%d+%}", "") == 0 then return st[tonumber(x:gmatch"%d+"())] + elseif x == "true" then return true + elseif x == "nil" then return nil + elseif #x:gsub("\\?%-?%d+%.?%d*", "") == 0 then return tonumber(({x:gsub("\\", "")})[1]) + elseif x == "function" then return function() end + elseif x == "thread" then return coroutine.create(function() end) + elseif x == "userdata" then return "userdata" + elseif x:sub(1, 1) == "{" then return date.decode(x:sub(2, #x - 1), st) + else return x:gsub("\\%-", "-"):gsub("\\:", ":"):gsub("\\{", "{"):gsub("\\%^", "^") end + end + + local d = 0 + for c in s:gmatch"." do + if c == '{' and last ~= '\\' then + d = d + 1 + sv[#sv + 1] = c + elseif c == '}' and last ~= '\\' then + d = d - 1 + sv[#sv + 1] = c + elseif c == '-' and last ~= '\\' and d == 0 then + key = sv + sv = {} + elseif c == ':' and last ~= '\\' and d == 0 then + if key then + result[parseValue(table.concat(key, ""))] = parseValue(table.concat(sv, "")) + key = nil + sv = {} + else + result[#result + 1] = parseValue(table.concat(sv, "")) + sv = {} + end + else sv[#sv + 1] = c end + last = c + end + if #sv > 0 then + if key then + result[parseValue(table.concat(key, ""))] = parseValue(table.concat(sv, "")) + else + result[#result + 1] = parseValue(table.concat(sv, "")) + end + end + + return result +end + +--[==[ UNIT TEST +local self_ref = {} +self_ref[1] = self_ref + +local self_ref2 = {} +self_ref2[self_ref2] = self_ref2 + +for i = 1, 0x40 do + local s = test{ + -- 0-7 + {date.encode{1, 2}, "1:2"}, + {date.encode{1, 3, 2}, "1:3:2"}, + {date.encode{"str", 3, "ing"}, "str:3:ing"}, + {date.encode{"str", {"table"} ,"ing"}, "str:{table}:ing"}, + {date.encode{"str", {{"table"}} ,"ing"}, "str:{{table}}:ing"}, + {date.encode{"str", {{"table", 2}, 1} ,"ing"}, "str:{{table:2}:1}:ing"}, + {date.encode{ function()end, coroutine.create(function()end) }, "function:thread"}, + {date.encode{ true, false, nil, 1, -1, "-:" }, "true:false:4-1:5-\\-1:6-\\-\\:"}, + -- 10-17 + {date.encode"q+u:e-i", "q+u\\:e\\-i"}, + {date.encode(-5), "\\-5"}, + {date.encode(true), "true"}, + {date.encode(false), "false"}, + {date.encode(nil), "nil"}, + {date.encode{}, ""}, + {date.encode{nil}, ""}, + {date.encode{nil, nil}, ""}, + -- 20-27 + {date.encode{a = 1}, "a-1"}, + {date.encode{a = {b = {c = 1}}}, "a-{b-{c-1}}"}, + {date.encode{x = [[big + python]]}, [[x-big + python]]}, + {date.encode{["-"] = "-", [":"] = ":"}, {["\\:-\\::\\--\\-"] = true, ["\\--\\-:\\:-\\:"] = true}}, + {date.encode{self_ref}, "{{^2}}"}, + {date.encode(self_ref), "{^1}"}, + {date.encode(self_ref2), "{^1}-{^1}"}, + {date.encode(date.decode("1")), "1"}, + -- 30-37 + {date.encode(date.decode("\\-1")), "\\-1"}, + {date.encode(date.decode("str+ing")), "str+ing"}, + {date.encode(date.decode("st\\:ri\\-ng")), "st\\:ri\\-ng"}, + {date.decode("true"), true}, + {date.decode("false"), false}, + {date.decode("nil"), nil}, + {date.encode(date.decode("function")), "function"}, + {date.encode(date.decode("thread")), "thread"}, + -- 40-47 + {date.encode(date.decode("userdata")), "userdata"}, + {date.encode(date.decode("1:2")), "1:2"}, + {date.decode"1:2"[1], 1}, + {date.decode"1:2"[2], 2}, + {date.encode(date.decode"str:3:ing"), "str:3:ing"}, + {date.decode"str:3:ing"[1], "str"}, + {date.decode"str:3:ing"[2], 3}, + {date.decode"str:3:ing"[3], "ing"}, + -- 50-57 + {date.decode"str:{table}:ing"[1], "str"}, + {date.decode"str:{table}:ing"[2][1], "table"}, + {date.decode"str:{table}:ing"[3], "ing"}, + {date.decode(date.encode{"str", {{"table", 2}, 1} ,"ing"})[1], "str"}, + {date.decode(date.encode{"str", {{"table", 2}, 1} ,"ing"})[2][1][1], "table"}, + {date.decode(date.encode{"str", {{"table", 2}, 1} ,"ing"})[2][1][2], 2}, + {date.decode(date.encode{"str", {{"table", 2}, 1} ,"ing"})[2][2], 1}, + {date.decode(date.encode{"str", {{"table", 2}, 1} ,"ing"})[3], "ing"}, + -- 60-67 + {date.decode"q+u\\:e\\-i"[1], "q+u:e-i"}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[1], true}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[2], false}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[3], nil}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[4], 1}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[5], -1}, + {date.decode"true:false:4-1:5-\\-1:6-\\-\\:"[6], "-:"}, + {date.decode"a-1"["a"], 1}, + -- 70-77 + {date.decode"a-1".a, 1}, + {date.decode"a-{b-{c-1}}".a.b.c, 1}, + {date.decode[[x-big + python]].x, [[big + python]]}, + {date.decode"\\:-\\::\\--\\-"[":"], ":"}, + {date.decode"\\:-\\::\\--\\-"["-"], "-"}, + {date.decode"{{^2}}", function(x) return x[1][1] == x[1] end}, + {date.decode"{^1}", function(x) return x[1] == x end}, + {date.decode"{^1}-{^1}", function(x) return x[x] == x end} + } + if not s then print("(iteration [" .. i .. "])") break end +end +]==] + +return date \ No newline at end of file diff --git a/device/clock.c b/device/clock.c index fe5da60..0b585c7 100644 --- a/device/clock.c +++ b/device/clock.c @@ -1,24 +1,26 @@ #define CLOCK vm->devices[0] void clock_write(struct VMinst* vm, void* data, uint64_t length) { - + printf("clock_write was called. [%p, %p, %lu]", vm, data, length); + exit(-1); } void clock_out(struct VMinst* vm) { - + printf("clock_out was called. [%p]", vm); + exit(-1); } void clock_read(struct VMinst* vm, void* buffer, uint64_t length, uint64_t where) { - + time(((time_t*)buffer)); } void clock_wait(struct VMinst* vm, uint64_t data) { - + usleep(data); } void clock_poweroff(struct VMinst* vm) { #ifdef LLLIVMDEBUG - puts("clock_poweroff<"); + puts("devices[2] + +void rom_write(struct VMinst* vm, void* data, uint64_t length) { + printf("rom_write was called. [%p, %p, %lu]", vm, data, length); + exit(-1); +} + +void rom_out(struct VMinst* vm) { + printf("rom_out was called. [%p]", vm); + exit(-1); +} + +void rom_read(struct VMinst* vm, void* buffer, uint64_t length, uint64_t where) { + +} + +void rom_wait(struct VMinst* vm, uint64_t data) { +} + +void rom_poweroff(struct VMinst* vm) { + #ifdef LLLIVMDEBUG + puts(""); + #endif +} + +void setup_rom(struct VMinst* vm) { + ROM.buffer = malloc(1024 * 256); + ROM.write = &rom_write; + ROM.out = &rom_out; + ROM.read = &rom_read; + ROM.wait = &rom_wait; + ROM.poweroff = &rom_poweroff; + if (DEV_ROM_COUNT > 8) { + puts("Error: DEV_ROM_COUNT must be <= 8."); + exit(-1); + } + for (int i = 0; i < DEV_ROM_COUNT; ++i) { + ((uint64_t**)ROM.buffer)[1024 * 32 - 8 + i] = (uint64_t*) fopen(dev_rom[i], "rb+"); + } +} diff --git a/devices.c b/devices.c index 1022c5c..67f0650 100644 --- a/devices.c +++ b/devices.c @@ -2,15 +2,17 @@ (C) M. Ærþ. */ -#define DEV_C 2 +#define DEV_C 3 #include "device/clock.c" #include "device/console.c" +#include "device/rom.c" void dev_init(struct VMinst* vm) { vm->devices = (struct IODevice*)malloc(sizeof(struct IODevice) * DEV_C); setup_clock(vm); setup_console(vm); + setup_rom(vm); #ifdef LIVMDEBUG puts("dev_init"); #endif diff --git a/faxm.lua b/faxm.lua new file mode 100644 index 0000000..a9c6f34 --- /dev/null +++ b/faxm.lua @@ -0,0 +1,216 @@ +local date = require"date" +local opcode = require"faxmopcode" +local FX = { + require"faxm/string", + require"faxm/freeform" +} + + +local source +local destination = "out.fx" + +do + local parsestate = 0 + for _, a in ipairs(arg) do + if parsestate == 1 then parsestate = 0; destination = a; + elseif a:sub(1, 1) == "-" then + if a == "-o" then parsestate = 1; + end + elseif a then source = a end + end +end + +assert(source) + + +code = {} +data = {} +const = {} +ptr = { + cptr = {}, + dptr = {} +} + +function raw(x) return x end + +function string.trim(s) + local n = s:find"%S" + return n and s:match(".*%S", n) or "" +end + +function string.split(str, sep) + if sep == nil then + sep = "%s" + end + local t = {} + for x in string.gmatch(str, "([^"..sep.."]+)") do + table.insert(t, x) + end + return t +end + +function string.split_8(str) + local result = {} + for i = 0, math.floor(#str / 8) do + result[#result + 1] = str:sub(i * 8, (i + 1) * 8) + end + return result +end + + +function parseCode(source, code, data) + for k, v in pairs(FX) do if v.source then source = v.source(source) end end + local dminsize, cminsize, xtype = -1, -1, "8u" + local section, segment + local objects = {} + for line in source:gmatch("([^;]+)") do + for k, v in pairs(FX) do if v.any_line then line = v.any_line(line) end end + if line == "[mainfile]" then + elseif line:sub(1, 1) == '[' then + for k, v in pairs(date.decode(raw(line:sub(2, #line - 1):gsub("+", ":")))) do + if type(k) == "number" then + if v:sub(1, 1) == 'x' then xtype = v:sub(2, #v) + elseif v == "CODE" then section = code; + elseif v == "DATA" then section = data; + elseif k == "nominsize" then + if section == code then cminsize = -1 + else dminsize = -1 end + end + elseif k == "minsize" then + if section == code then cminsize = v else dminsize = v end + end + end + else + if #line > 5 and line:sub(1, 6) == "object" then + segment = { t = "object", p = "data" } + elseif #line > 7 and line:sub(1, 7) == "section" then + segment = { t = "section" } + end + if segment and segment.t == "object" then + if line:sub(1, 6) == "object" then + segment.name = line:sub(8, #line - 1):trim() + if ptr.dptr[segment.name] then error"equal pointer name" end + ptr.dptr[segment.name] = #data + objects[segment.name] = {} + else + local vdata, fields = table.unpack(line:split("?")) + vdata = vdata:trim():gsub(",", " "):gsub("%s+", " ") + for _, v in ipairs(vdata:split" ") do + if v:sub(1, 1) == "|" then + for k, v_ in pairs(FX) do if v_.eval then v = v_.eval(v) end end + v = v:sub(2) + if v:sub(1, 1) == "x" then v = "0" .. v end + v = load("return " .. v)() + if type(v) == "string" then + for _, i in ipairs(v:split_8()) do data[#data+1] = i end + elseif type(v) == "number" then + data[#data+1] = v + else error"wrong type" + end + end + end + fields = fields:trim():gsub(",", " "):gsub("%s+", " ") + for _, v in ipairs(fields:split(" ")) do + local k, e = table.unpack(v:split"=") + e = load("return " .. e:sub(2, #e))() + if type(e) == "number" then + objects[segment.name][k] = e + else error"object fields must be numbers" + end + end + end + elseif segment and segment.t == "section" then + if line:sub(1, 7) == "section" then + segment.name = line:sub(9, #line - 1):trim() + if ptr.cptr[segment.name] then error"equal pointer name" end + ptr.cptr[segment.name] = #code + else + for k, v in pairs(FX) do if v.line then line = v.line(line) end end + for i, v in ipairs(line) do + if i == 1 then + code[#code + 1] = opcode.getIndex(v) + code[#code + 1] = #line - 1 + else + if v:sub(1, 1) == "|" then + v = v:sub(2) + if v:sub(1, 1) == "x" then v = "0" .. v end + if v:gsub("-", ""):gsub("%d", ""):gsub("%.", "") == "" then + code[#code + 1] = tonumber(v) + elseif v:gsub("%.", "") then + code[#code + 1] = load("return (...)." .. v)(objects) + end + elseif v:sub(1, 1) == "^" then + code[#code + 1] = v:sub(1) + elseif v:sub(1, 1) == "!" then + code[#code + 1] = v:sub(1) + elseif v:sub(1, 1) == "#" then + code[#code + 1] = v:sub(1) + else error("unknown token") end + end + end + end + end + end + end + if dminsize > 0 then + while #data < dminsize do data[#data + 1] = 0 end + end + for k, v in pairs(ptr.cptr) do ptr.cptr[k] = v + #data + 8 end + for i = 1, 4 do code[#code + 1] = 0 end + for i, v in ipairs(code) do + if type(v) == "string" then + if v:sub(1, 1) == "^" then + code[i] = ptr.dptr[v:sub(2)] + elseif v:sub(1, 1) == "!" then + code[i] = ptr.cptr[v:sub(2)] - 8 + elseif v:sub(1, 1) == "#" then + v = v:sub(2) + if v:sub(1, 1) == "x" then v = "0" .. v end + if v:gsub("-", ""):gsub("%d", ""):gsub("%.", "") == "" then + const[#const + 1] = tonumber(v) + elseif v:gsub("%.", "") then + const[#const + 1] = load("return (...)." .. v)(objects) + end + code[i] = #data + #code + #const - 1 + else error("unknown expression") end + end + end +end + +local file = io.open(source) +if file then + if file:read():gsub("%s", "") == "[mainfile]" then + file:seek("set", 0) + parseCode(file:read"*a", code, data) + end + file:close() +end +local loader_segment = { + --[[ + setdp data + goto start + 1004 - checksum + ]]-- + opcode.getIndex"setdp", 1, + 6, opcode.getIndex"goto", + 1, ptr.cptr["start"], + 8, 1004 +} +local result = {} +for i, v in ipairs(loader_segment) do result[#result + 1] = v end +for _, v in ipairs(data) do result[#result + 1] = v end +for _, v in ipairs(code) do result[#result + 1] = v end +for _, v in ipairs(const) do result[#result + 1] = v end + +file = io.open(destination, "w") +if file then + for i, v in ipairs(result) do + if type(v) == "string" then + for _, v_ in ipairs(v) do file:write('str2u64("'..v..'")') end + elseif type(v) == "number" then + file:write(v) + else error"invalid type" end + if i < #result then file:write(", ") end + end + file:close() +end diff --git a/faxm/freeform.lua b/faxm/freeform.lua new file mode 100644 index 0000000..cb6d860 --- /dev/null +++ b/faxm/freeform.lua @@ -0,0 +1,11 @@ +return { + source = function(source) + return source:gsub("\n", ""):gsub("]", "];"):gsub(":", ":;") + end, + any_line = function(line) + return line:trim():gsub("%s+", " ") + end, + line = function(line) + return line:gsub(",", " "):gsub("%s+", " "):split" " + end +} \ No newline at end of file diff --git a/faxm/main.c b/faxm/main.c new file mode 100644 index 0000000..7b13698 --- /dev/null +++ b/faxm/main.c @@ -0,0 +1,8 @@ +#include + + +void main() { + unsigned long long int x[] = {0x6f77206f6c6c6568, 0x0000000000646c72}; + char* y = (char*)x; + puts(y); +} \ No newline at end of file diff --git a/faxm/main.o b/faxm/main.o new file mode 100644 index 0000000000000000000000000000000000000000..32354c1b12be22f5ef953fcaa6cb7868741ba172 GIT binary patch literal 16608 zcmeHOZ)_W98GmgjP5RGCyB4x`&||csg~fHs8dBPVVh#|CS!PVB@kjvd+O zEhz}PWlXb5Ml}s-LLemI!#05ge3&Nf!&CA0N08%S$YCg{dyk%tJ`?@7^n@fNWIB11;@TZ&FJ+8Useez2dV5*~8k zH8}wg^4j?{Iim-4@dG;jxHhxxw%=^G8+GaTVL|vY%YO6XH!ps`895&i_2ioHaZ%!V zF+n;eAlot>e$`BIyFp`aG48R&3JAY1k{{>!pAyP`M9#NVUD_mnpmbMl&t-=?Z{MCv zwdb<=@z9zQf}aI4Ez( zE@yp*nA^$iZLTYs-5>ODMl^k`E5kKK2s&y@=M}J&cdPN&Hl=j<9g*4 zed_w$;lY9F#*;J+*QZy9Ea*N@hSl{W9Fef(&D z<(>Foyz>50eY*VwiSHcP_5oj$*j;O#yYhdH5rslJOrdF2ofA@2Lsa8M32151imD)^twm(bu8rz0j_l4WO(6aLW z=F@8LhTWh3>}Kn4PWDgG@d(-Bzdtr--+SpuQ@%S{5D&LL9PC}aY@8AzmVLfX$7#|Z zBUC-%*6#%S!)=d-`oh|DLtl97w;L1T=)=qOaMx7R{&4JMxGNrx#=~2C!dg$bjqH2E z&DQ^y7s>qzibLJ^$*+K40lxx%1^f#574R$ISHQ1;Uje@YAG!+E)>F#*NxZx8noOou zHq;hqt``1xvJUfR;jvD0qwshK+aNsFYx4UT6ZG%gs1__<7GGjbum z2L)FOwh8k3Stp5`QZZYKHJGr+dnd2YWcsKLN|!_+f26@yAn$WxM~hW0LcD)e?f#I^ zGNpfOt^Q@ipZ+Dbc+{C*7cKtFqJK~LTHX@>e+^hy?mcfO7V3%u>udM-_I_U5nn(|2 zlX&NOWP6M(Gl(FhlE&Hw|u>-H?BhJ zBMR%Y-S%`h#+(wn9a3#dt1G`*MeEA(6k3SI_g{m0ySgB;Tl~BWs<1lksdHH5KljK# zA#$ugx1%WaIcfydLOy&xrd~P%^y`?nJ|{`e=f(4wZJF+)BcK-7`MV^qm;X}z`o0xs ztx9mh9;z4TY0KuOMR`6)@_<@=9r?E}RVU9sSn|c=>J5?y_-Pxn3~C=gp$-IT7tx~o zg5+zdJ}=7m4)>F(l^UAWa(|>O`QmZHzfIQLchODqRvK5{@w0;MgNyH@#1e6aB#w7{ z7D!$%&u@@?O|VVjIf`DKVL2B;oaF04eUIc^hjFQc^_wL*Jwrz;jkm5CH5`-?`@=GB z@tf<@BxieXf1eTiof6;r&6MIjM{>^7Yk!I4n&W(EzD)94!8mcaXqL?K$Vg;ZE$k#Q z%rRq__mc3|lvKeO%@u}{IU{8jiX|gio>0SuvGH8mOs68z`WC#IC2J&$#pI-s&YQ(a zHBwBDrHxd1Y;2NT9GpRxrpuJKyih)dvF}LyK%dcfFk#RR7PnnW8Hsxi#t-!Ox;56O z84}UvA)`;12zug(GWHJ~>WL2+hxYBevv1HCjQ0%maa3!o&2Xt~W&AI<)bLiFm}~z{ zI+Zk&h_SF;$8BV=k-ZUzOx?S3j8v&$WRm$5@7U=-L{_P6-YA#S)V+nwxIn}Yl}ZxE z+7o0LwBZNE;hjKrxA(ZW7P&H0k<#RtnH(ZCi#BG^%I0Z9(YT7_3uZbpnlDF&%30df zl}(8#-qYW1CP$T}%Opz~6-iCzDV~jH(bn9TE|#)|yo)hNS4`)U>>#c2oT(yKFC)~9 zj24JB(-ZW`!-$LuR-q&5j0~Jiih_W%UF{KMd!S8cNRDNP>GTDYBU5sG!6H;i6`?Ua zMnltiGyL~$o@di7M$bx{FmD24o-Jz27H!5)(&5~bg!vV4v(uQ`c>X}#>G8)r45-0S z(CeQd`MWgNMgEwt0dao34`AMnum`EZbAR|_UI%+;Qfrhsw@&@A186HPO1>&^w-3%hE8K@d%~;7 zJ^nE<0HVJL10MJTk3YU2fe&~tIL?oFKlb=zo(;r%A?&^Ve@gsoa}iA}1-l363GN}ili&y0^VHxj!at_j8ep@h|EQa7rPO6=@EGTNhzaij*uU$w2M>ISd|K#$ zKjy=8vcDO29GeL|@MV(m*n>abE3iL$M)Jq_gdeWs6XeS#@W=bd)$JrC+G<1X6aGMZ z{<`3=VqzM#Q41jRx M!7kgX>EHPO6Lhs0r2qf` literal 0 HcmV?d00001 diff --git a/faxm/string.lua b/faxm/string.lua new file mode 100644 index 0000000..32f90e6 --- /dev/null +++ b/faxm/string.lua @@ -0,0 +1,26 @@ +return { + source = function(source) + while source:match[[|"[^"]+"]] do + local s = source:match[[|"[^"]+"]] + local ss = s + s = s:sub(3, #s - 1) + local r = {} + for i = 0, math.floor(#s / 8) do + local t = s:sub(i * 8 + 1, (i + 1) * 8) + while #t < 8 do t = t .. "\0" end + t = {string.byte(t, 1, -1)} + local rt = {} + for i = 1, 8 do rt[9 - i] = t[i] end + for i = 1, 8 do rt[i] = string.format("%02x", rt[i]) end + if table.concat(rt, "") ~= "0000000000000000" then + r[#r + 1] = "|x" .. table.concat(rt, "") + end + end + local function regexEscape(str) + return str:gsub("[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%1") + end + source = source:gsub(regexEscape(ss), table.concat(r, ", ")) + end + return source + end +} \ No newline at end of file diff --git a/faxmopcode.lua b/faxmopcode.lua new file mode 100644 index 0000000..5a634b0 --- /dev/null +++ b/faxmopcode.lua @@ -0,0 +1,9 @@ +local f = io.open("opcodelist") +local opcodes, reopcodes = {}, {} +for line in f:lines() do if #line > 0 then opcodes[#opcodes + 1] = line end end +f:close() +for k, v in pairs(opcodes) do reopcodes[v] = k end +return { + getName = function(index) return opcodes[index + 1] end, + getIndex = function(name) return reopcodes[name] - 1 end +} \ No newline at end of file diff --git a/livm.c b/livm.c index e667a15..fcb195b 100644 --- a/livm.c +++ b/livm.c @@ -16,16 +16,9 @@ struct IODevice { // input/output device struct VMinst { void* ram; - int8_t* ram8; - uint8_t* uram8; - int16_t* ram16; - uint16_t* uram16; - int32_t* ram32; - uint32_t* uram32; - int64_t* ram64; - uint64_t* uram64; - float* ramf; - double* ramd; + void* raw_ram; + + uint64_t ram_size; uint64_t ip; uint64_t sp; @@ -34,6 +27,12 @@ struct VMinst { struct IODevice* devices; }; +char* dev_rom[] = {"sda"}; + +#ifndef DEV_ROM_COUNT +# define DEV_ROM_COUNT 0 +#endif + #ifdef LIVMDEBUG # define LIVMCREATION printf("LIVM instance [%p] created.\n", &vm); # define LIVMSTARTWORK printf("LIVM instance [%p] started.\n", vm) @@ -52,37 +51,35 @@ struct VMinst { struct VMinst createVM(uint64_t ram_size) { struct VMinst vm; - vm.ram = malloc(ram_size); + vm.ip = 0; + vm.sp = 0; + vm.dp = 0; + vm.raw_ram = malloc(ram_size); + vm.ram = vm.raw_ram; + vm.ram_size = ram_size; if (vm.ram == NULL) exit(-1); - vm.ram8 = (int8_t*) vm.ram; - vm.uram8 = (uint8_t*) vm.ram; - vm.ram16 = (int16_t*) vm.ram; - vm.uram16 = (uint16_t*)vm.ram; - vm.ram32 = (int32_t*) vm.ram; - vm.uram32 = (uint32_t*)vm.ram; - vm.ram64 = (int64_t*) vm.ram; - vm.uram64 = (uint64_t*)vm.ram; - vm.ramf = (float*) vm.ram; - vm.ramd = (double*) vm.ram; LIVMCREATION dev_init(&vm); return vm; } struct VMinst* loadRAM(struct VMinst* vm, uint64_t* RAM, uint64_t length) { - for (uint64_t i = 0; i < length; ++i) vm->uram64[i] = RAM[i]; + for (uint64_t i = 0; i < length; ++i) ((uint64_t*)vm->raw_ram)[i] = RAM[i]; return vm; } struct VMinst* deleteVM(struct VMinst* vm) { LIVMDELETING; - free(vm->ram); + free(vm->raw_ram); dev_delete(vm); return vm; } + + void print_ullram(struct VMinst* vm) { - for (int i = 0; i < 100; i++) printf("%lu ", vm->uram64[i]); + for (uint64_t i = 0; i < vm->ram_size / 8; i++) + printf("%p\t|\t%lu\n", ((uint64_t*)vm->ram)+i, ((uint64_t*)vm->raw_ram)[i]); printf("\n"); } @@ -91,6 +88,8 @@ struct VMinst* runVM(struct VMinst* vm) { register uint64_t ip = vm->ip, sp = vm->sp, dp = vm->dp; + void* raw_ram = vm->raw_ram; + void* ram = vm->ram; register uint64_t op = 0; register uint8_t cmp = 0; @@ -99,28 +98,27 @@ struct VMinst* runVM(struct VMinst* vm) { register uint8_t cargc = 0; uint64_t args[8]; - register int8_t* ram8 = vm->ram8; - register uint8_t* uram8 = vm->uram8; - register int16_t* ram16 = vm->ram16; - register uint16_t* uram16 = vm->uram16; - register int32_t* ram32 = vm->ram32; - register uint32_t* uram32 = vm->uram32; - register int64_t* ram64 = vm->ram64; - register uint64_t* uram64 = vm->uram64; - register float* ramf = vm->ramf; - register double* ramd = vm->ramd; + #define code_ram ((uint64_t*)raw_ram) + #define uram64 ((uint64_t*)ram) + #define ram64 ((int64_t*)ram) + #define ramd ((double*)ram) + #define uram32 ((uint32_t*)ram) + #define ram32 ((int32_t*)ram) + #define ramf ((float*)ram) + #define uram16 ((uint16_t*)ram) + #define ram16 ((int16_t*)ram) + #define uram8 ((uint8_t*)ram) + #define ram8 ((int8_t*)ram) struct IODevice* devices = vm->devices; while (1) { #ifdef LLLIVMDEBUG printf("%ld\t|\t", ip); + printf("%ld <- %ld -> %ld\t", code_ram[ip - 1], code_ram[ip], code_ram[ip + 1]); #endif - op = uram64[ip++]; - #ifdef LLLIVMDEBUG - printf("%ld <- %ld -> %ld\t", uram64[ip - 2], op, uram64[ip + 1]); - #endif - argc = uram64[ip++]; + op = code_ram[ip++]; + argc = code_ram[ip++]; #ifdef LLLIVMDEBUG printf("c=%d\t[", argc); #endif @@ -129,12 +127,14 @@ struct VMinst* runVM(struct VMinst* vm) { if (argc > 8) LIVMARGOVERFLOW; while(cargc < argc) - args[cargc++] = uram64[ip++]; + args[cargc++] = code_ram[ip++]; #ifdef LLLIVMDEBUG for (register uint8_t x = 0; x < (argc - 1); x++) printf("%ld, ", args[x]); - printf("%ld]\n", args[argc - 1]); + if (argc == 0) printf("]\t"); + else printf("%ld]\t", args[argc - 1]); + printf("|\t%lld\n", dp); #endif switch (op) { #include "xcase.c" @@ -142,13 +142,28 @@ struct VMinst* runVM(struct VMinst* vm) { #ifdef LLLIVMDEBUG if (getchar() == 'x') { print_ullram(vm); + getchar(); }; #endif } end: LIVMENDWORK; + + #undef code_ram + #undef uram64 + #undef ram64 + #undef ramd + #undef uram32 + #undef ram32 + #undef ramf + #undef uram16p + #undef ram16 + #undef uram8 + #undef ram8 + vm->ip = ip; vm->sp = sp; vm->dp = dp; + vm->ram = ram; return vm; } diff --git a/main.c b/main.c index cd6cf51..3d54257 100644 --- a/main.c +++ b/main.c @@ -4,11 +4,14 @@ #include #include +#include +#include +#include #include #include -//#define LIVMDEBUG -//#define LLLIVMDEBUG +// #define LIVMDEBUG +// #define LLLIVMDEBUG #include "livm.c" @@ -19,23 +22,16 @@ uint64_t str2u64(char* data) { int main() { - struct VMinst vm = createVM(256); // alloc 256 bytes + struct VMinst vm = createVM(512); // alloc 256 bytes uint64_t vmram[] = { // "proper" way to write out "Hello, LIVM!" - // start: - 1, 1, 8, 0, // goto code - // data: - str2u64("You ente"), str2u64("red: "), 0, 0, - // code: - 384, 2, 1, 4, - 383, 4, 1, 48, 4, 0, - 381, 3, 1, 32, 20, - 382, 1, 1, - 12, 0 + #include "out.fx" }; loadRAM(&vm, vmram, sizeof vmram / sizeof(uint64_t)); + //print_ullram(&vm); //uint64_t dt[] = {5485433203209299272, 7810728294139909705, 0}; //puts(((char*)dt)); runVM(&vm); + //print_ullram(&vm); deleteVM(&vm); return 0; } diff --git a/main.faxm b/main.faxm new file mode 100644 index 0000000..620a1e9 --- /dev/null +++ b/main.faxm @@ -0,0 +1,15 @@ +[mainfile] +[x64u+DATA+minsize-8] +object helloworld: + |"hello world", |0 ? + length=|12; +object hellohell: + |"hell-oh!", |0 ? + length=|9; +[x64+CODE+nominsize] +section start: + write |1 ^helloworld, #helloworld.length; + out |1; + write |1 ^hellohell, #hellohell.length; + out |1; + poff; \ No newline at end of file diff --git a/out.fx b/out.fx new file mode 100644 index 0000000..74eff32 --- /dev/null +++ b/out.fx @@ -0,0 +1 @@ +8, 1, 6, 1, 1, 16, 8, 1004, 8031924123371070824, 6581362, 0, 2407296241712784744, 0, 0, 0, 0, 399, 3, 1, 0, 30, 400, 1, 1, 399, 3, 1, 3, 31, 400, 1, 1, 10, 0, 0, 0, 0, 0, 12, 9 \ No newline at end of file diff --git a/xcase.c b/xcase.c index 4edfe36..e02cc60 100644 --- a/xcase.c +++ b/xcase.c @@ -10,408 +10,426 @@ case 3: ip = cmp * args[0] + (1 - cmp) * args[1]; break; case 4: ip = (1 - cmp) * args[0]; break; case 5: uram64[args[0]] = ip; break; case 6: sp = uram64[args[0]]; break; -case 7: sp = args[0]; break; -case 8: uram64[args[0]] = sp; break; -case 9: dp = uram64[args[0]]; break; -case 10: dp = args[0]; break; -case 11: uram64[args[0]] = dp; break; -case 12: goto end; break; +case 7: uram64[args[0]] = sp; break; +case 8: dp = uram64[args[0]]; ram = (void*)((uint64_t*)raw_ram + dp); break; +case 9: uram64[args[0]] = dp; break; +case 10: goto end; break; +case 11: uram64[sp + (++uram64[sp])] = (uint64_t)uram64[args[0]]; +case 12: uram64[sp + (++uram64[sp])] = (uint64_t)ram64[args[0]]; +case 13: uram64[sp + (++uram64[sp])] = (uint64_t)ramd[args[0]]; +case 14: uram64[sp + (++uram64[sp])] = (uint64_t)uram32[args[0]]; +case 15: uram64[sp + (++uram64[sp])] = (uint64_t)ram32[args[0]]; +case 16: uram64[sp + (++uram64[sp])] = (uint64_t)ramf[args[0]]; +case 17: uram64[sp + (++uram64[sp])] = (uint64_t)uram16[args[0]]; +case 18: uram64[sp + (++uram64[sp])] = (uint64_t)ram16[args[0]]; +case 19: uram64[sp + (++uram64[sp])] = (uint64_t)uram8[args[0]]; +case 20: uram64[sp + (++uram64[sp])] = (uint64_t)ram8[args[0]]; +case 21: uram64[args[0]] = (uint64_t)uram64[sp + (uram64[sp]--)]; +case 22: ram64[args[0]] = (int64_t)uram64[sp + (uram64[sp]--)]; +case 23: ramd[args[0]] = (double)uram64[sp + (uram64[sp]--)]; +case 24: uram32[args[0]] = (uint32_t)uram64[sp + (uram64[sp]--)]; +case 25: ram32[args[0]] = (int32_t)uram64[sp + (uram64[sp]--)]; +case 26: ramf[args[0]] = (float)uram64[sp + (uram64[sp]--)]; +case 27: uram16[args[0]] = (uint16_t)uram64[sp + (uram64[sp]--)]; +case 28: ram16[args[0]] = (int16_t)uram64[sp + (uram64[sp]--)]; +case 29: uram8[args[0]] = (uint8_t)uram64[sp + (uram64[sp]--)]; +case 30: ram8[args[0]] = (int8_t)uram64[sp + (uram64[sp]--)]; // math // u64 -case 13: uram64[args[0]] += uram64[args[1]]; break; -case 14: uram64[args[0]] -= uram64[args[1]]; break; -case 15: uram64[args[0]] *= uram64[args[1]]; break; -case 16: uram64[args[0]] /= uram64[args[1]]; break; -case 17: uram64[args[0]] %= uram64[args[1]]; break; -case 18: uram64[args[0]] |= uram64[args[1]]; break; -case 19: uram64[args[0]] &= uram64[args[1]]; break; -case 20: uram64[args[0]] = uram64[args[1]] + uram64[args[2]]; break; -case 21: uram64[args[0]] = uram64[args[1]] - uram64[args[2]]; break; -case 22: uram64[args[0]] = uram64[args[1]] * uram64[args[2]]; break; -case 23: uram64[args[0]] = uram64[args[1]] / uram64[args[2]]; break; -case 24: uram64[args[0]] = uram64[args[1]] % uram64[args[2]]; break; -case 25: uram64[args[0]] = uram64[args[1]] | uram64[args[2]]; break; -case 26: uram64[args[0]] = uram64[args[1]] & uram64[args[2]]; break; -case 27: uram64[args[0]] = !uram64[args[1]]; break; +case 31: uram64[args[0]] += uram64[args[1]]; break; +case 32: uram64[args[0]] -= uram64[args[1]]; break; +case 33: uram64[args[0]] *= uram64[args[1]]; break; +case 34: uram64[args[0]] /= uram64[args[1]]; break; +case 35: uram64[args[0]] %= uram64[args[1]]; break; +case 36: uram64[args[0]] |= uram64[args[1]]; break; +case 37: uram64[args[0]] &= uram64[args[1]]; break; +case 38: uram64[args[0]] = uram64[args[1]] + uram64[args[2]]; break; +case 39: uram64[args[0]] = uram64[args[1]] - uram64[args[2]]; break; +case 40: uram64[args[0]] = uram64[args[1]] * uram64[args[2]]; break; +case 41: uram64[args[0]] = uram64[args[1]] / uram64[args[2]]; break; +case 42: uram64[args[0]] = uram64[args[1]] % uram64[args[2]]; break; +case 43: uram64[args[0]] = uram64[args[1]] | uram64[args[2]]; break; +case 44: uram64[args[0]] = uram64[args[1]] & uram64[args[2]]; break; +case 45: uram64[args[0]] = !uram64[args[1]]; break; // 64 -case 28: ram64[args[0]] += ram64[args[1]]; break; -case 29: ram64[args[0]] -= ram64[args[1]]; break; -case 30: ram64[args[0]] *= ram64[args[1]]; break; -case 31: ram64[args[0]] /= ram64[args[1]]; break; -case 32: ram64[args[0]] %= ram64[args[1]]; break; -case 33: ram64[args[0]] |= ram64[args[1]]; break; -case 34: ram64[args[0]] &= ram64[args[1]]; break; -case 35: ram64[args[0]] = ram64[args[1]] + ram64[args[2]]; break; -case 36: ram64[args[0]] = ram64[args[1]] - ram64[args[2]]; break; -case 37: ram64[args[0]] = ram64[args[1]] * ram64[args[2]]; break; -case 38: ram64[args[0]] = ram64[args[1]] / ram64[args[2]]; break; -case 39: ram64[args[0]] = ram64[args[1]] % ram64[args[2]]; break; -case 40: ram64[args[0]] = ram64[args[1]] | ram64[args[2]]; break; -case 41: ram64[args[0]] = ram64[args[1]] & ram64[args[2]]; break; -case 42: ram64[args[0]] = !ram64[args[1]]; break; +case 46: ram64[args[0]] += ram64[args[1]]; break; +case 47: ram64[args[0]] -= ram64[args[1]]; break; +case 48: ram64[args[0]] *= ram64[args[1]]; break; +case 49: ram64[args[0]] /= ram64[args[1]]; break; +case 50: ram64[args[0]] %= ram64[args[1]]; break; +case 51: ram64[args[0]] |= ram64[args[1]]; break; +case 52: ram64[args[0]] &= ram64[args[1]]; break; +case 53: ram64[args[0]] = ram64[args[1]] + ram64[args[2]]; break; +case 54: ram64[args[0]] = ram64[args[1]] - ram64[args[2]]; break; +case 55: ram64[args[0]] = ram64[args[1]] * ram64[args[2]]; break; +case 56: ram64[args[0]] = ram64[args[1]] / ram64[args[2]]; break; +case 57: ram64[args[0]] = ram64[args[1]] % ram64[args[2]]; break; +case 58: ram64[args[0]] = ram64[args[1]] | ram64[args[2]]; break; +case 59: ram64[args[0]] = ram64[args[1]] & ram64[args[2]]; break; +case 60: ram64[args[0]] = !ram64[args[1]]; break; // d -case 43: ramd[args[0]] += ramd[args[1]]; break; -case 44: ramd[args[0]] -= ramd[args[1]]; break; -case 45: ramd[args[0]] *= ramd[args[1]]; break; -case 46: ramd[args[0]] /= ramd[args[1]]; break; -case 47: ramd[args[0]] = ramd[args[1]] + ramd[args[2]]; break; -case 48: ramd[args[0]] = ramd[args[1]] - ramd[args[2]]; break; -case 49: ramd[args[0]] = ramd[args[1]] * ramd[args[2]]; break; -case 50: ramd[args[0]] = ramd[args[1]] / ramd[args[2]]; break; -case 51: ramd[args[0]] = !ramd[args[1]]; break; +case 61: ramd[args[0]] += ramd[args[1]]; break; +case 62: ramd[args[0]] -= ramd[args[1]]; break; +case 63: ramd[args[0]] *= ramd[args[1]]; break; +case 64: ramd[args[0]] /= ramd[args[1]]; break; +case 65: ramd[args[0]] = ramd[args[1]] + ramd[args[2]]; break; +case 66: ramd[args[0]] = ramd[args[1]] - ramd[args[2]]; break; +case 67: ramd[args[0]] = ramd[args[1]] * ramd[args[2]]; break; +case 68: ramd[args[0]] = ramd[args[1]] / ramd[args[2]]; break; +case 69: ramd[args[0]] = !ramd[args[1]]; break; // u32 -case 52: uram32[args[0]] += uram32[args[1]]; break; -case 53: uram32[args[0]] -= uram32[args[1]]; break; -case 54: uram32[args[0]] *= uram32[args[1]]; break; -case 55: uram32[args[0]] /= uram32[args[1]]; break; -case 56: uram32[args[0]] %= uram32[args[1]]; break; -case 57: uram32[args[0]] |= uram32[args[1]]; break; -case 58: uram32[args[0]] &= uram32[args[1]]; break; -case 59: uram32[args[0]] = uram32[args[1]] + uram32[args[2]]; break; -case 60: uram32[args[0]] = uram32[args[1]] - uram32[args[2]]; break; -case 61: uram32[args[0]] = uram32[args[1]] * uram32[args[2]]; break; -case 62: uram32[args[0]] = uram32[args[1]] / uram32[args[2]]; break; -case 63: uram32[args[0]] = uram32[args[1]] % uram32[args[2]]; break; -case 64: uram32[args[0]] = uram32[args[1]] | uram32[args[2]]; break; -case 65: uram32[args[0]] = uram32[args[1]] & uram32[args[2]]; break; -case 66: uram32[args[0]] = !uram32[args[1]]; break; +case 70: uram32[args[0]] += uram32[args[1]]; break; +case 71: uram32[args[0]] -= uram32[args[1]]; break; +case 72: uram32[args[0]] *= uram32[args[1]]; break; +case 73: uram32[args[0]] /= uram32[args[1]]; break; +case 74: uram32[args[0]] %= uram32[args[1]]; break; +case 75: uram32[args[0]] |= uram32[args[1]]; break; +case 76: uram32[args[0]] &= uram32[args[1]]; break; +case 77: uram32[args[0]] = uram32[args[1]] + uram32[args[2]]; break; +case 78: uram32[args[0]] = uram32[args[1]] - uram32[args[2]]; break; +case 79: uram32[args[0]] = uram32[args[1]] * uram32[args[2]]; break; +case 80: uram32[args[0]] = uram32[args[1]] / uram32[args[2]]; break; +case 81: uram32[args[0]] = uram32[args[1]] % uram32[args[2]]; break; +case 82: uram32[args[0]] = uram32[args[1]] | uram32[args[2]]; break; +case 83: uram32[args[0]] = uram32[args[1]] & uram32[args[2]]; break; +case 84: uram32[args[0]] = !uram32[args[1]]; break; // 32 -case 67: ram32[args[0]] += ram32[args[1]]; break; -case 68: ram32[args[0]] -= ram32[args[1]]; break; -case 69: ram32[args[0]] *= ram32[args[1]]; break; -case 70: ram32[args[0]] /= ram32[args[1]]; break; -case 71: ram32[args[0]] %= ram32[args[1]]; break; -case 72: ram32[args[0]] |= ram32[args[1]]; break; -case 73: ram32[args[0]] &= ram32[args[1]]; break; -case 74: ram32[args[0]] = ram32[args[1]] + ram32[args[2]]; break; -case 75: ram32[args[0]] = ram32[args[1]] - ram32[args[2]]; break; -case 76: ram32[args[0]] = ram32[args[1]] * ram32[args[2]]; break; -case 77: ram32[args[0]] = ram32[args[1]] / ram32[args[2]]; break; -case 78: ram32[args[0]] = ram32[args[1]] % ram32[args[2]]; break; -case 79: ram32[args[0]] = ram32[args[1]] | ram32[args[2]]; break; -case 80: ram32[args[0]] = ram32[args[1]] & ram32[args[2]]; break; -case 81: ram32[args[0]] = !ram32[args[1]]; break; +case 85: ram32[args[0]] += ram32[args[1]]; break; +case 86: ram32[args[0]] -= ram32[args[1]]; break; +case 87: ram32[args[0]] *= ram32[args[1]]; break; +case 88: ram32[args[0]] /= ram32[args[1]]; break; +case 89: ram32[args[0]] %= ram32[args[1]]; break; +case 90: ram32[args[0]] |= ram32[args[1]]; break; +case 91: ram32[args[0]] &= ram32[args[1]]; break; +case 92: ram32[args[0]] = ram32[args[1]] + ram32[args[2]]; break; +case 93: ram32[args[0]] = ram32[args[1]] - ram32[args[2]]; break; +case 94: ram32[args[0]] = ram32[args[1]] * ram32[args[2]]; break; +case 95: ram32[args[0]] = ram32[args[1]] / ram32[args[2]]; break; +case 96: ram32[args[0]] = ram32[args[1]] % ram32[args[2]]; break; +case 97: ram32[args[0]] = ram32[args[1]] | ram32[args[2]]; break; +case 98: ram32[args[0]] = ram32[args[1]] & ram32[args[2]]; break; +case 99: ram32[args[0]] = !ram32[args[1]]; break; // f -case 82: ramf[args[0]] += ramf[args[1]]; break; -case 83: ramf[args[0]] -= ramf[args[1]]; break; -case 84: ramf[args[0]] *= ramf[args[1]]; break; -case 85: ramf[args[0]] /= ramf[args[1]]; break; -case 86: ramf[args[0]] = ramf[args[1]] + ramf[args[2]]; break; -case 87: ramf[args[0]] = ramf[args[1]] - ramf[args[2]]; break; -case 88: ramf[args[0]] = ramf[args[1]] * ramf[args[2]]; break; -case 89: ramf[args[0]] = ramf[args[1]] / ramf[args[2]]; break; -case 90: ramf[args[0]] = !ramf[args[1]]; break; +case 100: ramf[args[0]] += ramf[args[1]]; break; +case 101: ramf[args[0]] -= ramf[args[1]]; break; +case 102: ramf[args[0]] *= ramf[args[1]]; break; +case 103: ramf[args[0]] /= ramf[args[1]]; break; +case 104: ramf[args[0]] = ramf[args[1]] + ramf[args[2]]; break; +case 105: ramf[args[0]] = ramf[args[1]] - ramf[args[2]]; break; +case 106: ramf[args[0]] = ramf[args[1]] * ramf[args[2]]; break; +case 107: ramf[args[0]] = ramf[args[1]] / ramf[args[2]]; break; +case 108: ramf[args[0]] = !ramf[args[1]]; break; // u16 -case 91: uram16[args[0]] += uram16[args[1]]; break; -case 92: uram16[args[0]] -= uram16[args[1]]; break; -case 93: uram16[args[0]] *= uram16[args[1]]; break; -case 94: uram16[args[0]] /= uram16[args[1]]; break; -case 95: uram16[args[0]] %= uram16[args[1]]; break; -case 96: uram16[args[0]] |= uram16[args[1]]; break; -case 97: uram16[args[0]] &= uram16[args[1]]; break; -case 98: uram16[args[0]] = uram16[args[1]] + uram16[args[2]]; break; -case 99: uram16[args[0]] = uram16[args[1]] - uram16[args[2]]; break; -case 100: uram16[args[0]] = uram16[args[1]] * uram16[args[2]]; break; -case 101: uram16[args[0]] = uram16[args[1]] / uram16[args[2]]; break; -case 102: uram16[args[0]] = uram16[args[1]] % uram16[args[2]]; break; -case 103: uram16[args[0]] = uram16[args[1]] | uram16[args[2]]; break; -case 104: uram16[args[0]] = uram16[args[1]] & uram16[args[2]]; break; -case 105: uram16[args[0]] = !uram16[args[1]]; break; +case 109: uram16[args[0]] += uram16[args[1]]; break; +case 110: uram16[args[0]] -= uram16[args[1]]; break; +case 111: uram16[args[0]] *= uram16[args[1]]; break; +case 112: uram16[args[0]] /= uram16[args[1]]; break; +case 113: uram16[args[0]] %= uram16[args[1]]; break; +case 114: uram16[args[0]] |= uram16[args[1]]; break; +case 115: uram16[args[0]] &= uram16[args[1]]; break; +case 116: uram16[args[0]] = uram16[args[1]] + uram16[args[2]]; break; +case 117: uram16[args[0]] = uram16[args[1]] - uram16[args[2]]; break; +case 118: uram16[args[0]] = uram16[args[1]] * uram16[args[2]]; break; +case 119: uram16[args[0]] = uram16[args[1]] / uram16[args[2]]; break; +case 120: uram16[args[0]] = uram16[args[1]] % uram16[args[2]]; break; +case 121: uram16[args[0]] = uram16[args[1]] | uram16[args[2]]; break; +case 122: uram16[args[0]] = uram16[args[1]] & uram16[args[2]]; break; +case 123: uram16[args[0]] = !uram16[args[1]]; break; // 16 -case 106: ram16[args[0]] += ram16[args[1]]; break; -case 107: ram16[args[0]] -= ram16[args[1]]; break; -case 108: ram16[args[0]] *= ram16[args[1]]; break; -case 109: ram16[args[0]] /= ram16[args[1]]; break; -case 110: ram16[args[0]] %= ram16[args[1]]; break; -case 111: ram16[args[0]] |= ram16[args[1]]; break; -case 112: ram16[args[0]] &= ram16[args[1]]; break; -case 113: ram16[args[0]] = ram16[args[1]] + ram16[args[2]]; break; -case 114: ram16[args[0]] = ram16[args[1]] - ram16[args[2]]; break; -case 115: ram16[args[0]] = ram16[args[1]] * ram16[args[2]]; break; -case 116: ram16[args[0]] = ram16[args[1]] / ram16[args[2]]; break; -case 117: ram16[args[0]] = ram16[args[1]] % ram16[args[2]]; break; -case 118: ram16[args[0]] = ram16[args[1]] | ram16[args[2]]; break; -case 119: ram16[args[0]] = ram16[args[1]] & ram16[args[2]]; break; -case 120: ram16[args[0]] = !ram16[args[1]]; break; +case 124: ram16[args[0]] += ram16[args[1]]; break; +case 125: ram16[args[0]] -= ram16[args[1]]; break; +case 126: ram16[args[0]] *= ram16[args[1]]; break; +case 127: ram16[args[0]] /= ram16[args[1]]; break; +case 128: ram16[args[0]] %= ram16[args[1]]; break; +case 129: ram16[args[0]] |= ram16[args[1]]; break; +case 130: ram16[args[0]] &= ram16[args[1]]; break; +case 131: ram16[args[0]] = ram16[args[1]] + ram16[args[2]]; break; +case 132: ram16[args[0]] = ram16[args[1]] - ram16[args[2]]; break; +case 133: ram16[args[0]] = ram16[args[1]] * ram16[args[2]]; break; +case 134: ram16[args[0]] = ram16[args[1]] / ram16[args[2]]; break; +case 135: ram16[args[0]] = ram16[args[1]] % ram16[args[2]]; break; +case 136: ram16[args[0]] = ram16[args[1]] | ram16[args[2]]; break; +case 137: ram16[args[0]] = ram16[args[1]] & ram16[args[2]]; break; +case 138: ram16[args[0]] = !ram16[args[1]]; break; // u8 -case 121: uram8[args[0]] += uram8[args[1]]; break; -case 122: uram8[args[0]] -= uram8[args[1]]; break; -case 123: uram8[args[0]] *= uram8[args[1]]; break; -case 124: uram8[args[0]] /= uram8[args[1]]; break; -case 125: uram8[args[0]] %= uram8[args[1]]; break; -case 126: uram8[args[0]] |= uram8[args[1]]; break; -case 127: uram8[args[0]] &= uram8[args[1]]; break; -case 128: uram8[args[0]] = uram8[args[1]] + uram8[args[2]]; break; -case 129: uram8[args[0]] = uram8[args[1]] - uram8[args[2]]; break; -case 130: uram8[args[0]] = uram8[args[1]] * uram8[args[2]]; break; -case 131: uram8[args[0]] = uram8[args[1]] / uram8[args[2]]; break; -case 132: uram8[args[0]] = uram8[args[1]] % uram8[args[2]]; break; -case 133: uram8[args[0]] = uram8[args[1]] | uram8[args[2]]; break; -case 134: uram8[args[0]] = uram8[args[1]] & uram8[args[2]]; break; -case 135: uram8[args[0]] = !uram8[args[1]]; break; +case 139: uram8[args[0]] += uram8[args[1]]; break; +case 140: uram8[args[0]] -= uram8[args[1]]; break; +case 141: uram8[args[0]] *= uram8[args[1]]; break; +case 142: uram8[args[0]] /= uram8[args[1]]; break; +case 143: uram8[args[0]] %= uram8[args[1]]; break; +case 144: uram8[args[0]] |= uram8[args[1]]; break; +case 145: uram8[args[0]] &= uram8[args[1]]; break; +case 146: uram8[args[0]] = uram8[args[1]] + uram8[args[2]]; break; +case 147: uram8[args[0]] = uram8[args[1]] - uram8[args[2]]; break; +case 148: uram8[args[0]] = uram8[args[1]] * uram8[args[2]]; break; +case 149: uram8[args[0]] = uram8[args[1]] / uram8[args[2]]; break; +case 150: uram8[args[0]] = uram8[args[1]] % uram8[args[2]]; break; +case 151: uram8[args[0]] = uram8[args[1]] | uram8[args[2]]; break; +case 152: uram8[args[0]] = uram8[args[1]] & uram8[args[2]]; break; +case 153: uram8[args[0]] = !uram8[args[1]]; break; // 8 -case 136: ram8[args[0]] += ram8[args[1]]; break; -case 137: ram8[args[0]] -= ram8[args[1]]; break; -case 138: ram8[args[0]] *= ram8[args[1]]; break; -case 139: ram8[args[0]] /= ram8[args[1]]; break; -case 140: ram8[args[0]] %= ram8[args[1]]; break; -case 141: ram8[args[0]] |= ram8[args[1]]; break; -case 142: ram8[args[0]] &= ram8[args[1]]; break; -case 143: ram8[args[0]] = ram8[args[1]] + ram8[args[2]]; break; -case 144: ram8[args[0]] = ram8[args[1]] - ram8[args[2]]; break; -case 145: ram8[args[0]] = ram8[args[1]] * ram8[args[2]]; break; -case 146: ram8[args[0]] = ram8[args[1]] / ram8[args[2]]; break; -case 147: ram8[args[0]] = ram8[args[1]] % ram8[args[2]]; break; -case 148: ram8[args[0]] = ram8[args[1]] | ram8[args[2]]; break; -case 149: ram8[args[0]] = ram8[args[1]] & ram8[args[2]]; break; -case 150: ram8[args[0]] = !ram8[args[1]]; break; +case 154: ram8[args[0]] += ram8[args[1]]; break; +case 155: ram8[args[0]] -= ram8[args[1]]; break; +case 156: ram8[args[0]] *= ram8[args[1]]; break; +case 157: ram8[args[0]] /= ram8[args[1]]; break; +case 158: ram8[args[0]] %= ram8[args[1]]; break; +case 159: ram8[args[0]] |= ram8[args[1]]; break; +case 160: ram8[args[0]] &= ram8[args[1]]; break; +case 161: ram8[args[0]] = ram8[args[1]] + ram8[args[2]]; break; +case 162: ram8[args[0]] = ram8[args[1]] - ram8[args[2]]; break; +case 163: ram8[args[0]] = ram8[args[1]] * ram8[args[2]]; break; +case 164: ram8[args[0]] = ram8[args[1]] / ram8[args[2]]; break; +case 165: ram8[args[0]] = ram8[args[1]] % ram8[args[2]]; break; +case 166: ram8[args[0]] = ram8[args[1]] | ram8[args[2]]; break; +case 167: ram8[args[0]] = ram8[args[1]] & ram8[args[2]]; break; +case 168: ram8[args[0]] = !ram8[args[1]]; break; // == -case 151: cmp = uram64[args[0]] == uram64[args[1]]; break; -case 152: cmp = ram64[args[0]] == ram64[args[1]]; break; -case 153: cmp = ramd[args[0]] == ramd[args[1]]; break; -case 154: cmp = uram32[args[0]] == uram32[args[1]]; break; -case 155: cmp = ram32[args[0]] == ram32[args[1]]; break; -case 156: cmp = ramf[args[0]] == ramf[args[1]]; break; -case 157: cmp = uram16[args[0]] == uram16[args[1]]; break; -case 158: cmp = ram16[args[0]] == ram16[args[1]]; break; -case 159: cmp = uram8[args[0]] == uram8[args[1]]; break; -case 160: cmp = ram8[args[0]] == ram8[args[1]]; break; +case 169: cmp = uram64[args[0]] == uram64[args[1]]; break; +case 170: cmp = ram64[args[0]] == ram64[args[1]]; break; +case 171: cmp = ramd[args[0]] == ramd[args[1]]; break; +case 172: cmp = uram32[args[0]] == uram32[args[1]]; break; +case 173: cmp = ram32[args[0]] == ram32[args[1]]; break; +case 174: cmp = ramf[args[0]] == ramf[args[1]]; break; +case 175: cmp = uram16[args[0]] == uram16[args[1]]; break; +case 176: cmp = ram16[args[0]] == ram16[args[1]]; break; +case 177: cmp = uram8[args[0]] == uram8[args[1]]; break; +case 178: cmp = ram8[args[0]] == ram8[args[1]]; break; // != -case 161: cmp = uram64[args[0]] != uram64[args[1]]; break; -case 162: cmp = ram64[args[0]] != ram64[args[1]]; break; -case 163: cmp = ramd[args[0]] != ramd[args[1]]; break; -case 164: cmp = uram32[args[0]] != uram32[args[1]]; break; -case 165: cmp = ram32[args[0]] != ram32[args[1]]; break; -case 166: cmp = ramf[args[0]] != ramf[args[1]]; break; -case 167: cmp = uram16[args[0]] != uram16[args[1]]; break; -case 168: cmp = ram16[args[0]] != ram16[args[1]]; break; -case 169: cmp = uram8[args[0]] != uram8[args[1]]; break; -case 170: cmp = ram8[args[0]] != ram8[args[1]]; break; +case 179: cmp = uram64[args[0]] != uram64[args[1]]; break; +case 180: cmp = ram64[args[0]] != ram64[args[1]]; break; +case 181: cmp = ramd[args[0]] != ramd[args[1]]; break; +case 182: cmp = uram32[args[0]] != uram32[args[1]]; break; +case 183: cmp = ram32[args[0]] != ram32[args[1]]; break; +case 184: cmp = ramf[args[0]] != ramf[args[1]]; break; +case 185: cmp = uram16[args[0]] != uram16[args[1]]; break; +case 186: cmp = ram16[args[0]] != ram16[args[1]]; break; +case 187: cmp = uram8[args[0]] != uram8[args[1]]; break; +case 188: cmp = ram8[args[0]] != ram8[args[1]]; break; // > -case 171: cmp = uram64[args[0]] > uram64[args[1]]; break; -case 172: cmp = ram64[args[0]] > ram64[args[1]]; break; -case 173: cmp = ramd[args[0]] > ramd[args[1]]; break; -case 174: cmp = uram32[args[0]] > uram32[args[1]]; break; -case 175: cmp = ram32[args[0]] > ram32[args[1]]; break; -case 176: cmp = ramf[args[0]] > ramf[args[1]]; break; -case 177: cmp = uram16[args[0]] > uram16[args[1]]; break; -case 178: cmp = ram16[args[0]] > ram16[args[1]]; break; -case 179: cmp = uram8[args[0]] > uram8[args[1]]; break; -case 180: cmp = ram8[args[0]] > ram8[args[1]]; break; +case 189: cmp = uram64[args[0]] > uram64[args[1]]; break; +case 190: cmp = ram64[args[0]] > ram64[args[1]]; break; +case 191: cmp = ramd[args[0]] > ramd[args[1]]; break; +case 192: cmp = uram32[args[0]] > uram32[args[1]]; break; +case 193: cmp = ram32[args[0]] > ram32[args[1]]; break; +case 194: cmp = ramf[args[0]] > ramf[args[1]]; break; +case 195: cmp = uram16[args[0]] > uram16[args[1]]; break; +case 196: cmp = ram16[args[0]] > ram16[args[1]]; break; +case 197: cmp = uram8[args[0]] > uram8[args[1]]; break; +case 198: cmp = ram8[args[0]] > ram8[args[1]]; break; // < -case 181: cmp = uram64[args[0]] < uram64[args[1]]; break; -case 182: cmp = ram64[args[0]] < ram64[args[1]]; break; -case 183: cmp = ramd[args[0]] < ramd[args[1]]; break; -case 184: cmp = uram32[args[0]] < uram32[args[1]]; break; -case 185: cmp = ram32[args[0]] < ram32[args[1]]; break; -case 186: cmp = ramf[args[0]] < ramf[args[1]]; break; -case 187: cmp = uram16[args[0]] < uram16[args[1]]; break; -case 188: cmp = ram16[args[0]] < ram16[args[1]]; break; -case 189: cmp = uram8[args[0]] < uram8[args[1]]; break; -case 190: cmp = ram8[args[0]] < ram8[args[1]]; break; +case 199: cmp = uram64[args[0]] < uram64[args[1]]; break; +case 200: cmp = ram64[args[0]] < ram64[args[1]]; break; +case 201: cmp = ramd[args[0]] < ramd[args[1]]; break; +case 202: cmp = uram32[args[0]] < uram32[args[1]]; break; +case 203: cmp = ram32[args[0]] < ram32[args[1]]; break; +case 204: cmp = ramf[args[0]] < ramf[args[1]]; break; +case 205: cmp = uram16[args[0]] < uram16[args[1]]; break; +case 206: cmp = ram16[args[0]] < ram16[args[1]]; break; +case 207: cmp = uram8[args[0]] < uram8[args[1]]; break; +case 208: cmp = ram8[args[0]] < ram8[args[1]]; break; // >= -case 191: cmp = uram64[args[0]] >= uram64[args[1]]; break; -case 192: cmp = ram64[args[0]] >= ram64[args[1]]; break; -case 193: cmp = ramd[args[0]] >= ramd[args[1]]; break; -case 194: cmp = uram32[args[0]] >= uram32[args[1]]; break; -case 195: cmp = ram32[args[0]] >= ram32[args[1]]; break; -case 196: cmp = ramf[args[0]] >= ramf[args[1]]; break; -case 197: cmp = uram16[args[0]] >= uram16[args[1]]; break; -case 198: cmp = ram16[args[0]] >= ram16[args[1]]; break; -case 199: cmp = uram8[args[0]] >= uram8[args[1]]; break; -case 200: cmp = ram8[args[0]] >= ram8[args[1]]; break; +case 209: cmp = uram64[args[0]] >= uram64[args[1]]; break; +case 210: cmp = ram64[args[0]] >= ram64[args[1]]; break; +case 211: cmp = ramd[args[0]] >= ramd[args[1]]; break; +case 212: cmp = uram32[args[0]] >= uram32[args[1]]; break; +case 213: cmp = ram32[args[0]] >= ram32[args[1]]; break; +case 214: cmp = ramf[args[0]] >= ramf[args[1]]; break; +case 215: cmp = uram16[args[0]] >= uram16[args[1]]; break; +case 216: cmp = ram16[args[0]] >= ram16[args[1]]; break; +case 217: cmp = uram8[args[0]] >= uram8[args[1]]; break; +case 218: cmp = ram8[args[0]] >= ram8[args[1]]; break; // <= -case 201: cmp = uram64[args[0]] <= uram64[args[1]]; break; -case 202: cmp = ram64[args[0]] <= ram64[args[1]]; break; -case 203: cmp = ramd[args[0]] <= ramd[args[1]]; break; -case 204: cmp = uram32[args[0]] <= uram32[args[1]]; break; -case 205: cmp = ram32[args[0]] <= ram32[args[1]]; break; -case 206: cmp = ramf[args[0]] <= ramf[args[1]]; break; -case 207: cmp = uram16[args[0]] <= uram16[args[1]]; break; -case 208: cmp = ram16[args[0]] <= ram16[args[1]]; break; -case 209: cmp = uram8[args[0]] <= uram8[args[1]]; break; -case 210: cmp = ram8[args[0]] <= ram8[args[1]]; break; +case 219: cmp = uram64[args[0]] <= uram64[args[1]]; break; +case 220: cmp = ram64[args[0]] <= ram64[args[1]]; break; +case 221: cmp = ramd[args[0]] <= ramd[args[1]]; break; +case 222: cmp = uram32[args[0]] <= uram32[args[1]]; break; +case 223: cmp = ram32[args[0]] <= ram32[args[1]]; break; +case 224: cmp = ramf[args[0]] <= ramf[args[1]]; break; +case 225: cmp = uram16[args[0]] <= uram16[args[1]]; break; +case 226: cmp = ram16[args[0]] <= ram16[args[1]]; break; +case 227: cmp = uram8[args[0]] <= uram8[args[1]]; break; +case 228: cmp = ram8[args[0]] <= ram8[args[1]]; break; // ++ -case 211: uram64[args[0]]++; break; -case 212: ram64[args[0]]++; break; -case 213: ramd[args[0]]++; break; -case 214: uram32[args[0]]++; break; -case 215: ram32[args[0]]++; break; -case 216: ramf[args[0]]++; break; -case 217: uram16[args[0]]++; break; -case 218: ram16[args[0]]++; break; -case 219: uram8[args[0]]++; break; -case 220: ram8[args[0]]++; break; +case 229: uram64[args[0]]++; break; +case 230: ram64[args[0]]++; break; +case 231: ramd[args[0]]++; break; +case 232: uram32[args[0]]++; break; +case 233: ram32[args[0]]++; break; +case 234: ramf[args[0]]++; break; +case 235: uram16[args[0]]++; break; +case 236: ram16[args[0]]++; break; +case 237: uram8[args[0]]++; break; +case 238: ram8[args[0]]++; break; // -- -case 221: uram64[args[0]]--; break; -case 222: ram64[args[0]]--; break; -case 223: ramd[args[0]]--; break; -case 224: uram32[args[0]]--; break; -case 225: ram32[args[0]]--; break; -case 226: ramf[args[0]]--; break; -case 227: uram16[args[0]]--; break; -case 228: ram16[args[0]]--; break; -case 229: uram8[args[0]]--; break; -case 230: ram8[args[0]]--; break; +case 239: uram64[args[0]]--; break; +case 240: ram64[args[0]]--; break; +case 241: ramd[args[0]]--; break; +case 242: uram32[args[0]]--; break; +case 243: ram32[args[0]]--; break; +case 244: ramf[args[0]]--; break; +case 245: uram16[args[0]]--; break; +case 246: ram16[args[0]]--; break; +case 247: uram8[args[0]]--; break; +case 248: ram8[args[0]]--; break; // a = b -case 231: uram64[args[0]] = (uint64_t)args[1]; break; -case 232: ram64[args[0]] = (int64_t)args[1]; break; -case 233: ramd[args[0]] = (int64_t)args[1]; break; -case 234: uram32[args[0]] = (uint32_t)args[1]; break; -case 235: ram32[args[0]] = (int32_t)args[1]; break; -case 236: ramf[args[0]] = (int32_t)args[1]; break; -case 237: uram16[args[0]] = (uint16_t)args[1]; break; -case 238: ram16[args[0]] = (int16_t)args[1]; break; -case 239: uram8[args[0]] = (uint8_t)args[1]; break; -case 240: ram8[args[0]] = (int8_t)args[1]; break; +case 249: uram64[args[0]] = (uint64_t)args[1]; break; +case 250: ram64[args[0]] = (int64_t)args[1]; break; +case 251: ramd[args[0]] = (int64_t)args[1]; break; +case 252: uram32[args[0]] = (uint32_t)args[1]; break; +case 253: ram32[args[0]] = (int32_t)args[1]; break; +case 254: ramf[args[0]] = (int32_t)args[1]; break; +case 255: uram16[args[0]] = (uint16_t)args[1]; break; +case 256: ram16[args[0]] = (int16_t)args[1]; break; +case 257: uram8[args[0]] = (uint8_t)args[1]; break; +case 258: ram8[args[0]] = (int8_t)args[1]; break; // a = *b -case 241: uram64[args[0]] = uram64[args[1]]; break; -case 242: ram64[args[0]] = ram64[args[1]]; break; -case 243: ramd[args[0]] = ramd[args[1]]; break; -case 244: uram32[args[0]] = uram32[args[1]]; break; -case 245: ram32[args[0]] = ram32[args[1]]; break; -case 246: ramf[args[0]] = ramf[args[1]]; break; -case 247: uram16[args[0]] = uram16[args[1]]; break; -case 248: ram16[args[0]] = ram16[args[1]]; break; -case 249: uram8[args[0]] = uram8[args[1]]; break; -case 250: ram8[args[0]] = ram8[args[1]]; break; +case 259: uram64[args[0]] = uram64[args[1]]; break; +case 260: ram64[args[0]] = ram64[args[1]]; break; +case 261: ramd[args[0]] = ramd[args[1]]; break; +case 262: uram32[args[0]] = uram32[args[1]]; break; +case 263: ram32[args[0]] = ram32[args[1]]; break; +case 264: ramf[args[0]] = ramf[args[1]]; break; +case 265: uram16[args[0]] = uram16[args[1]]; break; +case 266: ram16[args[0]] = ram16[args[1]]; break; +case 267: uram8[args[0]] = uram8[args[1]]; break; +case 268: ram8[args[0]] = ram8[args[1]]; break; // a = **b -case 251: uram64[args[0]] = uram64[uram64[args[1]]]; break; -case 252: ram64[args[0]] = ram64[uram64[args[1]]]; break; -case 253: ramd[args[0]] = ramd[uram64[args[1]]]; break; -case 254: uram32[args[0]] = uram32[uram64[args[1]]]; break; -case 255: ram32[args[0]] = ram32[uram64[args[1]]]; break; -case 256: ramf[args[0]] = ramf[uram64[args[1]]]; break; -case 257: uram16[args[0]] = uram16[uram64[args[1]]]; break; -case 258: ram16[args[0]] = ram16[uram64[args[1]]]; break; -case 259: uram8[args[0]] = uram8[uram64[args[1]]]; break; -case 260: ram8[args[0]] = ram8[uram64[args[1]]]; break; +case 269: uram64[args[0]] = uram64[uram64[args[1]]]; break; +case 270: ram64[args[0]] = ram64[uram64[args[1]]]; break; +case 271: ramd[args[0]] = ramd[uram64[args[1]]]; break; +case 272: uram32[args[0]] = uram32[uram64[args[1]]]; break; +case 273: ram32[args[0]] = ram32[uram64[args[1]]]; break; +case 274: ramf[args[0]] = ramf[uram64[args[1]]]; break; +case 275: uram16[args[0]] = uram16[uram64[args[1]]]; break; +case 276: ram16[args[0]] = ram16[uram64[args[1]]]; break; +case 277: uram8[args[0]] = uram8[uram64[args[1]]]; break; +case 278: ram8[args[0]] = ram8[uram64[args[1]]]; break; // *a = b -case 261: uram64[uram64[args[0]]] = (uint64_t) args[1]; break; -case 262: ram64[uram64[args[0]]] = (int64_t) args[1]; break; -case 263: ramd[uram64[args[0]]] = (double) args[1]; break; -case 264: uram32[uram64[args[0]]] = (uint32_t) args[1]; break; -case 265: ram32[uram64[args[0]]] = (int32_t) args[1]; break; -case 266: ramf[uram64[args[0]]] = (float) args[1]; break; -case 267: uram16[uram64[args[0]]] = (uint16_t) args[1]; break; -case 268: ram16[uram64[args[0]]] = (int16_t) args[1]; break; -case 269: uram8[uram64[args[0]]] = (uint8_t) args[1]; break; -case 270: ram8[uram64[args[0]]] = (int8_t) args[1]; break; +case 279: uram64[uram64[args[0]]] = (uint64_t) args[1]; break; +case 280: ram64[uram64[args[0]]] = (int64_t) args[1]; break; +case 281: ramd[uram64[args[0]]] = (double) args[1]; break; +case 282: uram32[uram64[args[0]]] = (uint32_t) args[1]; break; +case 283: ram32[uram64[args[0]]] = (int32_t) args[1]; break; +case 284: ramf[uram64[args[0]]] = (float) args[1]; break; +case 285: uram16[uram64[args[0]]] = (uint16_t) args[1]; break; +case 286: ram16[uram64[args[0]]] = (int16_t) args[1]; break; +case 287: uram8[uram64[args[0]]] = (uint8_t) args[1]; break; +case 288: ram8[uram64[args[0]]] = (int8_t) args[1]; break; // *a = *b -case 271: uram64[uram64[args[0]]] = uram64[args[1]]; break; -case 272: ram64[uram64[args[0]]] = ram64[args[1]]; break; -case 273: ramd[uram64[args[0]]] = ramd[args[1]]; break; -case 274: uram32[uram64[args[0]]] = uram32[args[1]]; break; -case 275: ram32[uram64[args[0]]] = ram32[args[1]]; break; -case 276: ramf[uram64[args[0]]] = ramf[args[1]]; break; -case 277: uram16[uram64[args[0]]] = uram16[args[1]]; break; -case 278: ram16[uram64[args[0]]] = ram16[args[1]]; break; -case 279: uram8[uram64[args[0]]] = uram8[args[1]]; break; -case 280: ram8[uram64[args[0]]] = ram8[args[1]]; break; +case 289: uram64[uram64[args[0]]] = uram64[args[1]]; break; +case 290: ram64[uram64[args[0]]] = ram64[args[1]]; break; +case 291: ramd[uram64[args[0]]] = ramd[args[1]]; break; +case 292: uram32[uram64[args[0]]] = uram32[args[1]]; break; +case 293: ram32[uram64[args[0]]] = ram32[args[1]]; break; +case 294: ramf[uram64[args[0]]] = ramf[args[1]]; break; +case 295: uram16[uram64[args[0]]] = uram16[args[1]]; break; +case 296: ram16[uram64[args[0]]] = ram16[args[1]]; break; +case 297: uram8[uram64[args[0]]] = uram8[args[1]]; break; +case 298: ram8[uram64[args[0]]] = ram8[args[1]]; break; // *a = **b -case 281: uram64[uram64[args[0]]] = uram64[uram64[args[1]]]; break; -case 282: ram64[uram64[args[0]]] = ram64[uram64[args[1]]]; break; -case 283: ramd[uram64[args[0]]] = ramd[uram64[args[1]]]; break; -case 284: uram32[uram64[args[0]]] = uram32[uram64[args[1]]]; break; -case 285: ram32[uram64[args[0]]] = ram32[uram64[args[1]]]; break; -case 286: ramf[uram64[args[0]]] = ramf[uram64[args[1]]]; break; -case 287: uram16[uram64[args[0]]] = uram16[uram64[args[1]]]; break; -case 288: ram16[uram64[args[0]]] = ram16[uram64[args[1]]]; break; -case 289: uram8[uram64[args[0]]] = uram8[uram64[args[1]]]; break; -case 290: ram8[uram64[args[0]]] = ram8[uram64[args[1]]]; break; +case 299: uram64[uram64[args[0]]] = uram64[uram64[args[1]]]; break; +case 300: ram64[uram64[args[0]]] = ram64[uram64[args[1]]]; break; +case 301: ramd[uram64[args[0]]] = ramd[uram64[args[1]]]; break; +case 302: uram32[uram64[args[0]]] = uram32[uram64[args[1]]]; break; +case 303: ram32[uram64[args[0]]] = ram32[uram64[args[1]]]; break; +case 304: ramf[uram64[args[0]]] = ramf[uram64[args[1]]]; break; +case 305: uram16[uram64[args[0]]] = uram16[uram64[args[1]]]; break; +case 306: ram16[uram64[args[0]]] = ram16[uram64[args[1]]]; break; +case 307: uram8[uram64[args[0]]] = uram8[uram64[args[1]]]; break; +case 308: ram8[uram64[args[0]]] = ram8[uram64[args[1]]]; break; // cast -case 291: uram64[args[0]] = (uint64_t)ram64[args[1]]; break; -case 292: uram64[args[0]] = (uint64_t)ramd[args[1]]; break; -case 293: uram64[args[0]] = (uint64_t)uram32[args[1]]; break; -case 294: uram64[args[0]] = (uint64_t)ram32[args[1]]; break; -case 295: uram64[args[0]] = (uint64_t)ramf[args[1]]; break; -case 296: uram64[args[0]] = (uint64_t)uram16[args[1]]; break; -case 297: uram64[args[0]] = (uint64_t)ram16[args[1]]; break; -case 298: uram64[args[0]] = (uint64_t)uram8[args[1]]; break; -case 299: uram64[args[0]] = (uint64_t)ram8[args[1]]; break; -case 300: ram64[args[0]] = (int64_t)uram64[args[1]]; break; -case 301: ram64[args[0]] = (int64_t)ramd[args[1]]; break; -case 302: ram64[args[0]] = (int64_t)uram32[args[1]]; break; -case 303: ram64[args[0]] = (int64_t)ram32[args[1]]; break; -case 304: ram64[args[0]] = (int64_t)ramf[args[1]]; break; -case 305: ram64[args[0]] = (int64_t)uram16[args[1]]; break; -case 306: ram64[args[0]] = (int64_t)ram16[args[1]]; break; -case 307: ram64[args[0]] = (int64_t)uram8[args[1]]; break; -case 308: ram64[args[0]] = (int64_t)ram8[args[1]]; break; -case 309: ramd[args[0]] = (double)uram64[args[1]]; break; -case 310: ramd[args[0]] = (double)ram64[args[1]]; break; -case 311: ramd[args[0]] = (double)uram32[args[1]]; break; -case 312: ramd[args[0]] = (double)ram32[args[1]]; break; -case 313: ramd[args[0]] = (double)ramf[args[1]]; break; -case 314: ramd[args[0]] = (double)uram16[args[1]]; break; -case 315: ramd[args[0]] = (double)ram16[args[1]]; break; -case 316: ramd[args[0]] = (double)uram8[args[1]]; break; -case 317: ramd[args[0]] = (double)ram8[args[1]]; break; -case 318: uram32[args[0]] = (uint32_t)uram64[args[1]]; break; -case 319: uram32[args[0]] = (uint32_t)ram64[args[1]]; break; -case 320: uram32[args[0]] = (uint32_t)ramd[args[1]]; break; -case 321: uram32[args[0]] = (uint32_t)ram32[args[1]]; break; -case 322: uram32[args[0]] = (uint32_t)ramf[args[1]]; break; -case 323: uram32[args[0]] = (uint32_t)uram16[args[1]]; break; -case 324: uram32[args[0]] = (uint32_t)ram16[args[1]]; break; -case 325: uram32[args[0]] = (uint32_t)uram8[args[1]]; break; -case 326: uram32[args[0]] = (uint32_t)ram8[args[1]]; break; -case 327: ram32[args[0]] = (int32_t)uram64[args[1]]; break; -case 328: ram32[args[0]] = (int32_t)ram64[args[1]]; break; -case 329: ram32[args[0]] = (int32_t)ramd[args[1]]; break; -case 330: ram32[args[0]] = (int32_t)uram32[args[1]]; break; -case 331: ram32[args[0]] = (int32_t)ramf[args[1]]; break; -case 332: ram32[args[0]] = (int32_t)uram16[args[1]]; break; -case 333: ram32[args[0]] = (int32_t)ram16[args[1]]; break; -case 334: ram32[args[0]] = (int32_t)uram8[args[1]]; break; -case 335: ram32[args[0]] = (int32_t)ram8[args[1]]; break; -case 336: ramf[args[0]] = (float)uram64[args[1]]; break; -case 337: ramf[args[0]] = (float)ram64[args[1]]; break; -case 338: ramf[args[0]] = (float)ramd[args[1]]; break; -case 339: ramf[args[0]] = (float)uram32[args[1]]; break; -case 340: ramf[args[0]] = (float)ram32[args[1]]; break; -case 341: ramf[args[0]] = (float)uram16[args[1]]; break; -case 342: ramf[args[0]] = (float)ram16[args[1]]; break; -case 343: ramf[args[0]] = (float)uram8[args[1]]; break; -case 344: ramf[args[0]] = (float)ram8[args[1]]; break; -case 345: uram16[args[0]] = (uint16_t)uram64[args[1]]; break; -case 346: uram16[args[0]] = (uint16_t)ram64[args[1]]; break; -case 347: uram16[args[0]] = (uint16_t)ramd[args[1]]; break; -case 348: uram16[args[0]] = (uint16_t)uram32[args[1]]; break; -case 349: uram16[args[0]] = (uint16_t)ram32[args[1]]; break; -case 350: uram16[args[0]] = (uint16_t)ramf[args[1]]; break; -case 351: uram16[args[0]] = (uint16_t)ram16[args[1]]; break; -case 352: uram16[args[0]] = (uint16_t)uram8[args[1]]; break; -case 353: uram16[args[0]] = (uint16_t)ram8[args[1]]; break; -case 354: ram16[args[0]] = (int16_t)uram64[args[1]]; break; -case 355: ram16[args[0]] = (int16_t)ram64[args[1]]; break; -case 356: ram16[args[0]] = (int16_t)ramd[args[1]]; break; -case 357: ram16[args[0]] = (int16_t)uram32[args[1]]; break; -case 358: ram16[args[0]] = (int16_t)ram32[args[1]]; break; -case 359: ram16[args[0]] = (int16_t)ramf[args[1]]; break; -case 360: ram16[args[0]] = (int16_t)uram16[args[1]]; break; -case 361: ram16[args[0]] = (int16_t)uram8[args[1]]; break; -case 362: ram16[args[0]] = (int16_t)ram8[args[1]]; break; -case 363: uram8[args[0]] = (uint8_t)uram64[args[1]]; break; -case 364: uram8[args[0]] = (uint8_t)ram64[args[1]]; break; -case 365: uram8[args[0]] = (uint8_t)ramd[args[1]]; break; -case 366: uram8[args[0]] = (uint8_t)uram32[args[1]]; break; -case 367: uram8[args[0]] = (uint8_t)ram32[args[1]]; break; -case 368: uram8[args[0]] = (uint8_t)ramf[args[1]]; break; -case 369: uram8[args[0]] = (uint8_t)uram16[args[1]]; break; -case 370: uram8[args[0]] = (uint8_t)ram16[args[1]]; break; -case 371: uram8[args[0]] = (int8_t)ram8[args[1]]; break; -case 372: ram8[args[0]] = (int8_t)uram64[args[1]]; break; -case 373: ram8[args[0]] = (int8_t)ram64[args[1]]; break; -case 374: ram8[args[0]] = (int8_t)ramd[args[1]]; break; -case 375: ram8[args[0]] = (int8_t)uram32[args[1]]; break; -case 376: ram8[args[0]] = (int8_t)ram32[args[1]]; break; -case 377: ram8[args[0]] = (int8_t)ramf[args[1]]; break; -case 378: ram8[args[0]] = (int8_t)uram16[args[1]]; break; -case 379: ram8[args[0]] = (int8_t)ram16[args[1]]; break; -case 380: ram8[args[0]] = (int8_t)uram8[args[1]]; break; +case 309: uram64[args[0]] = (uint64_t)ram64[args[1]]; break; +case 310: uram64[args[0]] = (uint64_t)ramd[args[1]]; break; +case 311: uram64[args[0]] = (uint64_t)uram32[args[1]]; break; +case 312: uram64[args[0]] = (uint64_t)ram32[args[1]]; break; +case 313: uram64[args[0]] = (uint64_t)ramf[args[1]]; break; +case 314: uram64[args[0]] = (uint64_t)uram16[args[1]]; break; +case 315: uram64[args[0]] = (uint64_t)ram16[args[1]]; break; +case 316: uram64[args[0]] = (uint64_t)uram8[args[1]]; break; +case 317: uram64[args[0]] = (uint64_t)ram8[args[1]]; break; +case 318: ram64[args[0]] = (int64_t)uram64[args[1]]; break; +case 319: ram64[args[0]] = (int64_t)ramd[args[1]]; break; +case 320: ram64[args[0]] = (int64_t)uram32[args[1]]; break; +case 321: ram64[args[0]] = (int64_t)ram32[args[1]]; break; +case 322: ram64[args[0]] = (int64_t)ramf[args[1]]; break; +case 323: ram64[args[0]] = (int64_t)uram16[args[1]]; break; +case 324: ram64[args[0]] = (int64_t)ram16[args[1]]; break; +case 325: ram64[args[0]] = (int64_t)uram8[args[1]]; break; +case 326: ram64[args[0]] = (int64_t)ram8[args[1]]; break; +case 327: ramd[args[0]] = (double)uram64[args[1]]; break; +case 328: ramd[args[0]] = (double)ram64[args[1]]; break; +case 329: ramd[args[0]] = (double)uram32[args[1]]; break; +case 330: ramd[args[0]] = (double)ram32[args[1]]; break; +case 331: ramd[args[0]] = (double)ramf[args[1]]; break; +case 332: ramd[args[0]] = (double)uram16[args[1]]; break; +case 333: ramd[args[0]] = (double)ram16[args[1]]; break; +case 334: ramd[args[0]] = (double)uram8[args[1]]; break; +case 335: ramd[args[0]] = (double)ram8[args[1]]; break; +case 336: uram32[args[0]] = (uint32_t)uram64[args[1]]; break; +case 337: uram32[args[0]] = (uint32_t)ram64[args[1]]; break; +case 338: uram32[args[0]] = (uint32_t)ramd[args[1]]; break; +case 339: uram32[args[0]] = (uint32_t)ram32[args[1]]; break; +case 340: uram32[args[0]] = (uint32_t)ramf[args[1]]; break; +case 341: uram32[args[0]] = (uint32_t)uram16[args[1]]; break; +case 342: uram32[args[0]] = (uint32_t)ram16[args[1]]; break; +case 343: uram32[args[0]] = (uint32_t)uram8[args[1]]; break; +case 344: uram32[args[0]] = (uint32_t)ram8[args[1]]; break; +case 345: ram32[args[0]] = (int32_t)uram64[args[1]]; break; +case 346: ram32[args[0]] = (int32_t)ram64[args[1]]; break; +case 347: ram32[args[0]] = (int32_t)ramd[args[1]]; break; +case 348: ram32[args[0]] = (int32_t)uram32[args[1]]; break; +case 349: ram32[args[0]] = (int32_t)ramf[args[1]]; break; +case 350: ram32[args[0]] = (int32_t)uram16[args[1]]; break; +case 351: ram32[args[0]] = (int32_t)ram16[args[1]]; break; +case 352: ram32[args[0]] = (int32_t)uram8[args[1]]; break; +case 353: ram32[args[0]] = (int32_t)ram8[args[1]]; break; +case 354: ramf[args[0]] = (float)uram64[args[1]]; break; +case 355: ramf[args[0]] = (float)ram64[args[1]]; break; +case 356: ramf[args[0]] = (float)ramd[args[1]]; break; +case 357: ramf[args[0]] = (float)uram32[args[1]]; break; +case 358: ramf[args[0]] = (float)ram32[args[1]]; break; +case 359: ramf[args[0]] = (float)uram16[args[1]]; break; +case 360: ramf[args[0]] = (float)ram16[args[1]]; break; +case 361: ramf[args[0]] = (float)uram8[args[1]]; break; +case 362: ramf[args[0]] = (float)ram8[args[1]]; break; +case 363: uram16[args[0]] = (uint16_t)uram64[args[1]]; break; +case 364: uram16[args[0]] = (uint16_t)ram64[args[1]]; break; +case 365: uram16[args[0]] = (uint16_t)ramd[args[1]]; break; +case 366: uram16[args[0]] = (uint16_t)uram32[args[1]]; break; +case 367: uram16[args[0]] = (uint16_t)ram32[args[1]]; break; +case 368: uram16[args[0]] = (uint16_t)ramf[args[1]]; break; +case 369: uram16[args[0]] = (uint16_t)ram16[args[1]]; break; +case 370: uram16[args[0]] = (uint16_t)uram8[args[1]]; break; +case 371: uram16[args[0]] = (uint16_t)ram8[args[1]]; break; +case 372: ram16[args[0]] = (int16_t)uram64[args[1]]; break; +case 373: ram16[args[0]] = (int16_t)ram64[args[1]]; break; +case 374: ram16[args[0]] = (int16_t)ramd[args[1]]; break; +case 375: ram16[args[0]] = (int16_t)uram32[args[1]]; break; +case 376: ram16[args[0]] = (int16_t)ram32[args[1]]; break; +case 377: ram16[args[0]] = (int16_t)ramf[args[1]]; break; +case 378: ram16[args[0]] = (int16_t)uram16[args[1]]; break; +case 379: ram16[args[0]] = (int16_t)uram8[args[1]]; break; +case 380: ram16[args[0]] = (int16_t)ram8[args[1]]; break; +case 381: uram8[args[0]] = (uint8_t)uram64[args[1]]; break; +case 382: uram8[args[0]] = (uint8_t)ram64[args[1]]; break; +case 383: uram8[args[0]] = (uint8_t)ramd[args[1]]; break; +case 384: uram8[args[0]] = (uint8_t)uram32[args[1]]; break; +case 385: uram8[args[0]] = (uint8_t)ram32[args[1]]; break; +case 386: uram8[args[0]] = (uint8_t)ramf[args[1]]; break; +case 387: uram8[args[0]] = (uint8_t)uram16[args[1]]; break; +case 388: uram8[args[0]] = (uint8_t)ram16[args[1]]; break; +case 389: uram8[args[0]] = (int8_t)ram8[args[1]]; break; +case 390: ram8[args[0]] = (int8_t)uram64[args[1]]; break; +case 391: ram8[args[0]] = (int8_t)ram64[args[1]]; break; +case 392: ram8[args[0]] = (int8_t)ramd[args[1]]; break; +case 393: ram8[args[0]] = (int8_t)uram32[args[1]]; break; +case 394: ram8[args[0]] = (int8_t)ram32[args[1]]; break; +case 395: ram8[args[0]] = (int8_t)ramf[args[1]]; break; +case 396: ram8[args[0]] = (int8_t)uram16[args[1]]; break; +case 397: ram8[args[0]] = (int8_t)ram16[args[1]]; break; +case 398: ram8[args[0]] = (int8_t)uram8[args[1]]; break; // io dev -case 381: devices[args[0]].write(vm, uram8 + args[1], args[2]); break; -case 382: devices[args[0]].out(vm); break; -case 383: devices[args[0]].read(vm, uram8 + args[1], args[2], args[3]); break; -case 384: devices[args[0]].wait(vm, args[1]); break; +case 399: devices[args[0]].write(vm, uram8 + args[1] * 8, uram64[args[2]]); break; +case 400: devices[args[0]].out(vm); break; +case 401: devices[args[0]].read(vm, uram8 + args[1] * 8, args[2], args[3]); break; +case 402: devices[args[0]].wait(vm, uram64[args[1]]); break;