mirror of
https://github.com/emptyynes/LIVM.git
synced 2025-01-04 23:52:25 +03:00
Add files via upload
This commit is contained in:
parent
d02a5d3dfd
commit
560bc596ad
16 changed files with 1053 additions and 439 deletions
250
date.lua
Normal file
250
date.lua
Normal file
|
@ -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
|
|
@ -1,24 +1,26 @@
|
||||||
#define CLOCK vm->devices[0]
|
#define CLOCK vm->devices[0]
|
||||||
|
|
||||||
void clock_write(struct VMinst* vm, void* data, uint64_t length) {
|
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) {
|
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) {
|
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) {
|
void clock_wait(struct VMinst* vm, uint64_t data) {
|
||||||
|
usleep(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clock_poweroff(struct VMinst* vm) {
|
void clock_poweroff(struct VMinst* vm) {
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
puts("clock_poweroff<");
|
puts("<clock_poweroff");
|
||||||
#endif
|
#endif
|
||||||
free(CLOCK.buffer);
|
free(CLOCK.buffer);
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
|
|
|
@ -11,6 +11,7 @@ void console_write(struct VMinst* vm, void* data, uint64_t length) {
|
||||||
|
|
||||||
void console_out(struct VMinst* vm) {
|
void console_out(struct VMinst* vm) {
|
||||||
puts((char*)(CONSOLE.buffer + 2));
|
puts((char*)(CONSOLE.buffer + 2));
|
||||||
|
((uint16_t*)CONSOLE.buffer)[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void console_read(struct VMinst* vm, void* buffer, uint64_t length, uint64_t where) {
|
void console_read(struct VMinst* vm, void* buffer, uint64_t length, uint64_t where) {
|
||||||
|
@ -32,7 +33,7 @@ void console_wait(struct VMinst* vm, uint64_t data) {
|
||||||
|
|
||||||
void console_poweroff(struct VMinst* vm) {
|
void console_poweroff(struct VMinst* vm) {
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
puts("console_poweroff<");
|
puts("<console_poweroff");
|
||||||
#endif
|
#endif
|
||||||
free(CONSOLE.buffer);
|
free(CONSOLE.buffer);
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
|
|
44
device/rom.c
Normal file
44
device/rom.c
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#define ROM vm->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("<rom_poweroff");
|
||||||
|
#endif
|
||||||
|
free(ROM.buffer);
|
||||||
|
#ifdef LLLIVMDEBUG
|
||||||
|
puts("rom_poweroff>");
|
||||||
|
#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+");
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,15 +2,17 @@
|
||||||
(C) M. Ærþ.
|
(C) M. Ærþ.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEV_C 2
|
#define DEV_C 3
|
||||||
|
|
||||||
#include "device/clock.c"
|
#include "device/clock.c"
|
||||||
#include "device/console.c"
|
#include "device/console.c"
|
||||||
|
#include "device/rom.c"
|
||||||
|
|
||||||
void dev_init(struct VMinst* vm) {
|
void dev_init(struct VMinst* vm) {
|
||||||
vm->devices = (struct IODevice*)malloc(sizeof(struct IODevice) * DEV_C);
|
vm->devices = (struct IODevice*)malloc(sizeof(struct IODevice) * DEV_C);
|
||||||
setup_clock(vm);
|
setup_clock(vm);
|
||||||
setup_console(vm);
|
setup_console(vm);
|
||||||
|
setup_rom(vm);
|
||||||
#ifdef LIVMDEBUG
|
#ifdef LIVMDEBUG
|
||||||
puts("dev_init");
|
puts("dev_init");
|
||||||
#endif
|
#endif
|
||||||
|
|
216
faxm.lua
Normal file
216
faxm.lua
Normal file
|
@ -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
|
11
faxm/freeform.lua
Normal file
11
faxm/freeform.lua
Normal file
|
@ -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
|
||||||
|
}
|
8
faxm/main.c
Normal file
8
faxm/main.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
unsigned long long int x[] = {0x6f77206f6c6c6568, 0x0000000000646c72};
|
||||||
|
char* y = (char*)x;
|
||||||
|
puts(y);
|
||||||
|
}
|
BIN
faxm/main.o
Normal file
BIN
faxm/main.o
Normal file
Binary file not shown.
26
faxm/string.lua
Normal file
26
faxm/string.lua
Normal file
|
@ -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
|
||||||
|
}
|
9
faxmopcode.lua
Normal file
9
faxmopcode.lua
Normal file
|
@ -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
|
||||||
|
}
|
97
livm.c
97
livm.c
|
@ -16,16 +16,9 @@ struct IODevice { // input/output device
|
||||||
|
|
||||||
struct VMinst {
|
struct VMinst {
|
||||||
void* ram;
|
void* ram;
|
||||||
int8_t* ram8;
|
void* raw_ram;
|
||||||
uint8_t* uram8;
|
|
||||||
int16_t* ram16;
|
uint64_t ram_size;
|
||||||
uint16_t* uram16;
|
|
||||||
int32_t* ram32;
|
|
||||||
uint32_t* uram32;
|
|
||||||
int64_t* ram64;
|
|
||||||
uint64_t* uram64;
|
|
||||||
float* ramf;
|
|
||||||
double* ramd;
|
|
||||||
|
|
||||||
uint64_t ip;
|
uint64_t ip;
|
||||||
uint64_t sp;
|
uint64_t sp;
|
||||||
|
@ -34,6 +27,12 @@ struct VMinst {
|
||||||
struct IODevice* devices;
|
struct IODevice* devices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char* dev_rom[] = {"sda"};
|
||||||
|
|
||||||
|
#ifndef DEV_ROM_COUNT
|
||||||
|
# define DEV_ROM_COUNT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LIVMDEBUG
|
#ifdef LIVMDEBUG
|
||||||
# define LIVMCREATION printf("LIVM instance [%p] created.\n", &vm);
|
# define LIVMCREATION printf("LIVM instance [%p] created.\n", &vm);
|
||||||
# define LIVMSTARTWORK printf("LIVM instance [%p] started.\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 createVM(uint64_t ram_size) {
|
||||||
struct VMinst vm;
|
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);
|
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
|
LIVMCREATION
|
||||||
dev_init(&vm);
|
dev_init(&vm);
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VMinst* loadRAM(struct VMinst* vm, uint64_t* RAM, uint64_t length) {
|
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;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VMinst* deleteVM(struct VMinst* vm) {
|
struct VMinst* deleteVM(struct VMinst* vm) {
|
||||||
LIVMDELETING;
|
LIVMDELETING;
|
||||||
free(vm->ram);
|
free(vm->raw_ram);
|
||||||
dev_delete(vm);
|
dev_delete(vm);
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void print_ullram(struct VMinst* 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");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +88,8 @@ struct VMinst* runVM(struct VMinst* vm) {
|
||||||
register uint64_t ip = vm->ip,
|
register uint64_t ip = vm->ip,
|
||||||
sp = vm->sp,
|
sp = vm->sp,
|
||||||
dp = vm->dp;
|
dp = vm->dp;
|
||||||
|
void* raw_ram = vm->raw_ram;
|
||||||
|
void* ram = vm->ram;
|
||||||
|
|
||||||
register uint64_t op = 0;
|
register uint64_t op = 0;
|
||||||
register uint8_t cmp = 0;
|
register uint8_t cmp = 0;
|
||||||
|
@ -99,28 +98,27 @@ struct VMinst* runVM(struct VMinst* vm) {
|
||||||
register uint8_t cargc = 0;
|
register uint8_t cargc = 0;
|
||||||
uint64_t args[8];
|
uint64_t args[8];
|
||||||
|
|
||||||
register int8_t* ram8 = vm->ram8;
|
#define code_ram ((uint64_t*)raw_ram)
|
||||||
register uint8_t* uram8 = vm->uram8;
|
#define uram64 ((uint64_t*)ram)
|
||||||
register int16_t* ram16 = vm->ram16;
|
#define ram64 ((int64_t*)ram)
|
||||||
register uint16_t* uram16 = vm->uram16;
|
#define ramd ((double*)ram)
|
||||||
register int32_t* ram32 = vm->ram32;
|
#define uram32 ((uint32_t*)ram)
|
||||||
register uint32_t* uram32 = vm->uram32;
|
#define ram32 ((int32_t*)ram)
|
||||||
register int64_t* ram64 = vm->ram64;
|
#define ramf ((float*)ram)
|
||||||
register uint64_t* uram64 = vm->uram64;
|
#define uram16 ((uint16_t*)ram)
|
||||||
register float* ramf = vm->ramf;
|
#define ram16 ((int16_t*)ram)
|
||||||
register double* ramd = vm->ramd;
|
#define uram8 ((uint8_t*)ram)
|
||||||
|
#define ram8 ((int8_t*)ram)
|
||||||
|
|
||||||
struct IODevice* devices = vm->devices;
|
struct IODevice* devices = vm->devices;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
printf("%ld\t|\t", ip);
|
printf("%ld\t|\t", ip);
|
||||||
|
printf("%ld <- %ld -> %ld\t", code_ram[ip - 1], code_ram[ip], code_ram[ip + 1]);
|
||||||
#endif
|
#endif
|
||||||
op = uram64[ip++];
|
op = code_ram[ip++];
|
||||||
#ifdef LLLIVMDEBUG
|
argc = code_ram[ip++];
|
||||||
printf("%ld <- %ld -> %ld\t", uram64[ip - 2], op, uram64[ip + 1]);
|
|
||||||
#endif
|
|
||||||
argc = uram64[ip++];
|
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
printf("c=%d\t[", argc);
|
printf("c=%d\t[", argc);
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,12 +127,14 @@ struct VMinst* runVM(struct VMinst* vm) {
|
||||||
if (argc > 8) LIVMARGOVERFLOW;
|
if (argc > 8) LIVMARGOVERFLOW;
|
||||||
|
|
||||||
while(cargc < argc)
|
while(cargc < argc)
|
||||||
args[cargc++] = uram64[ip++];
|
args[cargc++] = code_ram[ip++];
|
||||||
|
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
for (register uint8_t x = 0; x < (argc - 1); x++)
|
for (register uint8_t x = 0; x < (argc - 1); x++)
|
||||||
printf("%ld, ", args[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
|
#endif
|
||||||
switch (op) {
|
switch (op) {
|
||||||
#include "xcase.c"
|
#include "xcase.c"
|
||||||
|
@ -142,13 +142,28 @@ struct VMinst* runVM(struct VMinst* vm) {
|
||||||
#ifdef LLLIVMDEBUG
|
#ifdef LLLIVMDEBUG
|
||||||
if (getchar() == 'x') {
|
if (getchar() == 'x') {
|
||||||
print_ullram(vm);
|
print_ullram(vm);
|
||||||
|
getchar();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
end: LIVMENDWORK;
|
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->ip = ip;
|
||||||
vm->sp = sp;
|
vm->sp = sp;
|
||||||
vm->dp = dp;
|
vm->dp = dp;
|
||||||
|
vm->ram = ram;
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
main.c
22
main.c
|
@ -4,11 +4,14 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
//#define LIVMDEBUG
|
// #define LIVMDEBUG
|
||||||
//#define LLLIVMDEBUG
|
// #define LLLIVMDEBUG
|
||||||
#include "livm.c"
|
#include "livm.c"
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,23 +22,16 @@ uint64_t str2u64(char* data) {
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
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!"
|
uint64_t vmram[] = { // "proper" way to write out "Hello, LIVM!"
|
||||||
// start:
|
#include "out.fx"
|
||||||
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
|
|
||||||
};
|
};
|
||||||
loadRAM(&vm, vmram, sizeof vmram / sizeof(uint64_t));
|
loadRAM(&vm, vmram, sizeof vmram / sizeof(uint64_t));
|
||||||
|
//print_ullram(&vm);
|
||||||
//uint64_t dt[] = {5485433203209299272, 7810728294139909705, 0};
|
//uint64_t dt[] = {5485433203209299272, 7810728294139909705, 0};
|
||||||
//puts(((char*)dt));
|
//puts(((char*)dt));
|
||||||
runVM(&vm);
|
runVM(&vm);
|
||||||
|
//print_ullram(&vm);
|
||||||
deleteVM(&vm);
|
deleteVM(&vm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
15
main.faxm
Normal file
15
main.faxm
Normal file
|
@ -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;
|
1
out.fx
Normal file
1
out.fx
Normal file
|
@ -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
|
774
xcase.c
774
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 4: ip = (1 - cmp) * args[0]; break;
|
||||||
case 5: uram64[args[0]] = ip; break;
|
case 5: uram64[args[0]] = ip; break;
|
||||||
case 6: sp = uram64[args[0]]; break;
|
case 6: sp = uram64[args[0]]; break;
|
||||||
case 7: sp = args[0]; break;
|
case 7: uram64[args[0]] = sp; break;
|
||||||
case 8: uram64[args[0]] = sp; break;
|
case 8: dp = uram64[args[0]]; ram = (void*)((uint64_t*)raw_ram + dp); break;
|
||||||
case 9: dp = uram64[args[0]]; break;
|
case 9: uram64[args[0]] = dp; break;
|
||||||
case 10: dp = args[0]; break;
|
case 10: goto end; break;
|
||||||
case 11: uram64[args[0]] = dp; break;
|
case 11: uram64[sp + (++uram64[sp])] = (uint64_t)uram64[args[0]];
|
||||||
case 12: goto end; break;
|
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
|
// math
|
||||||
// u64
|
// u64
|
||||||
case 13: uram64[args[0]] += uram64[args[1]]; break;
|
case 31: uram64[args[0]] += uram64[args[1]]; break;
|
||||||
case 14: uram64[args[0]] -= uram64[args[1]]; break;
|
case 32: uram64[args[0]] -= uram64[args[1]]; break;
|
||||||
case 15: uram64[args[0]] *= uram64[args[1]]; break;
|
case 33: uram64[args[0]] *= uram64[args[1]]; break;
|
||||||
case 16: uram64[args[0]] /= uram64[args[1]]; break;
|
case 34: uram64[args[0]] /= uram64[args[1]]; break;
|
||||||
case 17: uram64[args[0]] %= uram64[args[1]]; break;
|
case 35: uram64[args[0]] %= uram64[args[1]]; break;
|
||||||
case 18: uram64[args[0]] |= uram64[args[1]]; break;
|
case 36: uram64[args[0]] |= uram64[args[1]]; break;
|
||||||
case 19: uram64[args[0]] &= uram64[args[1]]; break;
|
case 37: uram64[args[0]] &= uram64[args[1]]; break;
|
||||||
case 20: uram64[args[0]] = uram64[args[1]] + uram64[args[2]]; break;
|
case 38: uram64[args[0]] = uram64[args[1]] + uram64[args[2]]; break;
|
||||||
case 21: uram64[args[0]] = uram64[args[1]] - uram64[args[2]]; break;
|
case 39: uram64[args[0]] = uram64[args[1]] - uram64[args[2]]; break;
|
||||||
case 22: uram64[args[0]] = uram64[args[1]] * uram64[args[2]]; break;
|
case 40: uram64[args[0]] = uram64[args[1]] * uram64[args[2]]; break;
|
||||||
case 23: uram64[args[0]] = uram64[args[1]] / uram64[args[2]]; break;
|
case 41: uram64[args[0]] = uram64[args[1]] / uram64[args[2]]; break;
|
||||||
case 24: uram64[args[0]] = uram64[args[1]] % uram64[args[2]]; break;
|
case 42: uram64[args[0]] = uram64[args[1]] % uram64[args[2]]; break;
|
||||||
case 25: uram64[args[0]] = uram64[args[1]] | uram64[args[2]]; break;
|
case 43: uram64[args[0]] = uram64[args[1]] | uram64[args[2]]; break;
|
||||||
case 26: uram64[args[0]] = uram64[args[1]] & uram64[args[2]]; break;
|
case 44: uram64[args[0]] = uram64[args[1]] & uram64[args[2]]; break;
|
||||||
case 27: uram64[args[0]] = !uram64[args[1]]; break;
|
case 45: uram64[args[0]] = !uram64[args[1]]; break;
|
||||||
// 64
|
// 64
|
||||||
case 28: ram64[args[0]] += ram64[args[1]]; break;
|
case 46: ram64[args[0]] += ram64[args[1]]; break;
|
||||||
case 29: ram64[args[0]] -= ram64[args[1]]; break;
|
case 47: ram64[args[0]] -= ram64[args[1]]; break;
|
||||||
case 30: ram64[args[0]] *= ram64[args[1]]; break;
|
case 48: ram64[args[0]] *= ram64[args[1]]; break;
|
||||||
case 31: ram64[args[0]] /= ram64[args[1]]; break;
|
case 49: ram64[args[0]] /= ram64[args[1]]; break;
|
||||||
case 32: ram64[args[0]] %= ram64[args[1]]; break;
|
case 50: ram64[args[0]] %= ram64[args[1]]; break;
|
||||||
case 33: ram64[args[0]] |= ram64[args[1]]; break;
|
case 51: ram64[args[0]] |= ram64[args[1]]; break;
|
||||||
case 34: ram64[args[0]] &= ram64[args[1]]; break;
|
case 52: ram64[args[0]] &= ram64[args[1]]; break;
|
||||||
case 35: ram64[args[0]] = ram64[args[1]] + ram64[args[2]]; break;
|
case 53: ram64[args[0]] = ram64[args[1]] + ram64[args[2]]; break;
|
||||||
case 36: ram64[args[0]] = ram64[args[1]] - ram64[args[2]]; break;
|
case 54: ram64[args[0]] = ram64[args[1]] - ram64[args[2]]; break;
|
||||||
case 37: ram64[args[0]] = ram64[args[1]] * ram64[args[2]]; break;
|
case 55: ram64[args[0]] = ram64[args[1]] * ram64[args[2]]; break;
|
||||||
case 38: ram64[args[0]] = ram64[args[1]] / ram64[args[2]]; break;
|
case 56: ram64[args[0]] = ram64[args[1]] / ram64[args[2]]; break;
|
||||||
case 39: ram64[args[0]] = ram64[args[1]] % ram64[args[2]]; break;
|
case 57: ram64[args[0]] = ram64[args[1]] % ram64[args[2]]; break;
|
||||||
case 40: ram64[args[0]] = ram64[args[1]] | ram64[args[2]]; break;
|
case 58: ram64[args[0]] = ram64[args[1]] | ram64[args[2]]; break;
|
||||||
case 41: ram64[args[0]] = ram64[args[1]] & ram64[args[2]]; break;
|
case 59: ram64[args[0]] = ram64[args[1]] & ram64[args[2]]; break;
|
||||||
case 42: ram64[args[0]] = !ram64[args[1]]; break;
|
case 60: ram64[args[0]] = !ram64[args[1]]; break;
|
||||||
// d
|
// d
|
||||||
case 43: ramd[args[0]] += ramd[args[1]]; break;
|
case 61: ramd[args[0]] += ramd[args[1]]; break;
|
||||||
case 44: ramd[args[0]] -= ramd[args[1]]; break;
|
case 62: ramd[args[0]] -= ramd[args[1]]; break;
|
||||||
case 45: ramd[args[0]] *= ramd[args[1]]; break;
|
case 63: ramd[args[0]] *= ramd[args[1]]; break;
|
||||||
case 46: ramd[args[0]] /= ramd[args[1]]; break;
|
case 64: ramd[args[0]] /= ramd[args[1]]; break;
|
||||||
case 47: ramd[args[0]] = ramd[args[1]] + ramd[args[2]]; break;
|
case 65: ramd[args[0]] = ramd[args[1]] + ramd[args[2]]; break;
|
||||||
case 48: ramd[args[0]] = ramd[args[1]] - ramd[args[2]]; break;
|
case 66: ramd[args[0]] = ramd[args[1]] - ramd[args[2]]; break;
|
||||||
case 49: ramd[args[0]] = ramd[args[1]] * ramd[args[2]]; break;
|
case 67: ramd[args[0]] = ramd[args[1]] * ramd[args[2]]; break;
|
||||||
case 50: ramd[args[0]] = ramd[args[1]] / ramd[args[2]]; break;
|
case 68: ramd[args[0]] = ramd[args[1]] / ramd[args[2]]; break;
|
||||||
case 51: ramd[args[0]] = !ramd[args[1]]; break;
|
case 69: ramd[args[0]] = !ramd[args[1]]; break;
|
||||||
// u32
|
// u32
|
||||||
case 52: uram32[args[0]] += uram32[args[1]]; break;
|
case 70: uram32[args[0]] += uram32[args[1]]; break;
|
||||||
case 53: uram32[args[0]] -= uram32[args[1]]; break;
|
case 71: uram32[args[0]] -= uram32[args[1]]; break;
|
||||||
case 54: uram32[args[0]] *= uram32[args[1]]; break;
|
case 72: uram32[args[0]] *= uram32[args[1]]; break;
|
||||||
case 55: uram32[args[0]] /= uram32[args[1]]; break;
|
case 73: uram32[args[0]] /= uram32[args[1]]; break;
|
||||||
case 56: uram32[args[0]] %= uram32[args[1]]; break;
|
case 74: uram32[args[0]] %= uram32[args[1]]; break;
|
||||||
case 57: uram32[args[0]] |= uram32[args[1]]; break;
|
case 75: uram32[args[0]] |= uram32[args[1]]; break;
|
||||||
case 58: uram32[args[0]] &= uram32[args[1]]; break;
|
case 76: uram32[args[0]] &= uram32[args[1]]; break;
|
||||||
case 59: uram32[args[0]] = uram32[args[1]] + uram32[args[2]]; break;
|
case 77: uram32[args[0]] = uram32[args[1]] + uram32[args[2]]; break;
|
||||||
case 60: uram32[args[0]] = uram32[args[1]] - uram32[args[2]]; break;
|
case 78: uram32[args[0]] = uram32[args[1]] - uram32[args[2]]; break;
|
||||||
case 61: uram32[args[0]] = uram32[args[1]] * uram32[args[2]]; break;
|
case 79: uram32[args[0]] = uram32[args[1]] * uram32[args[2]]; break;
|
||||||
case 62: uram32[args[0]] = uram32[args[1]] / uram32[args[2]]; break;
|
case 80: uram32[args[0]] = uram32[args[1]] / uram32[args[2]]; break;
|
||||||
case 63: uram32[args[0]] = uram32[args[1]] % uram32[args[2]]; break;
|
case 81: uram32[args[0]] = uram32[args[1]] % uram32[args[2]]; break;
|
||||||
case 64: uram32[args[0]] = uram32[args[1]] | uram32[args[2]]; break;
|
case 82: uram32[args[0]] = uram32[args[1]] | uram32[args[2]]; break;
|
||||||
case 65: uram32[args[0]] = uram32[args[1]] & uram32[args[2]]; break;
|
case 83: uram32[args[0]] = uram32[args[1]] & uram32[args[2]]; break;
|
||||||
case 66: uram32[args[0]] = !uram32[args[1]]; break;
|
case 84: uram32[args[0]] = !uram32[args[1]]; break;
|
||||||
// 32
|
// 32
|
||||||
case 67: ram32[args[0]] += ram32[args[1]]; break;
|
case 85: ram32[args[0]] += ram32[args[1]]; break;
|
||||||
case 68: ram32[args[0]] -= ram32[args[1]]; break;
|
case 86: ram32[args[0]] -= ram32[args[1]]; break;
|
||||||
case 69: ram32[args[0]] *= ram32[args[1]]; break;
|
case 87: ram32[args[0]] *= ram32[args[1]]; break;
|
||||||
case 70: ram32[args[0]] /= ram32[args[1]]; break;
|
case 88: ram32[args[0]] /= ram32[args[1]]; break;
|
||||||
case 71: ram32[args[0]] %= ram32[args[1]]; break;
|
case 89: ram32[args[0]] %= ram32[args[1]]; break;
|
||||||
case 72: ram32[args[0]] |= ram32[args[1]]; break;
|
case 90: ram32[args[0]] |= ram32[args[1]]; break;
|
||||||
case 73: ram32[args[0]] &= ram32[args[1]]; break;
|
case 91: ram32[args[0]] &= ram32[args[1]]; break;
|
||||||
case 74: ram32[args[0]] = ram32[args[1]] + ram32[args[2]]; break;
|
case 92: ram32[args[0]] = ram32[args[1]] + ram32[args[2]]; break;
|
||||||
case 75: ram32[args[0]] = ram32[args[1]] - ram32[args[2]]; break;
|
case 93: ram32[args[0]] = ram32[args[1]] - ram32[args[2]]; break;
|
||||||
case 76: ram32[args[0]] = ram32[args[1]] * ram32[args[2]]; break;
|
case 94: ram32[args[0]] = ram32[args[1]] * ram32[args[2]]; break;
|
||||||
case 77: ram32[args[0]] = ram32[args[1]] / ram32[args[2]]; break;
|
case 95: ram32[args[0]] = ram32[args[1]] / ram32[args[2]]; break;
|
||||||
case 78: ram32[args[0]] = ram32[args[1]] % ram32[args[2]]; break;
|
case 96: ram32[args[0]] = ram32[args[1]] % ram32[args[2]]; break;
|
||||||
case 79: ram32[args[0]] = ram32[args[1]] | ram32[args[2]]; break;
|
case 97: ram32[args[0]] = ram32[args[1]] | ram32[args[2]]; break;
|
||||||
case 80: ram32[args[0]] = ram32[args[1]] & ram32[args[2]]; break;
|
case 98: ram32[args[0]] = ram32[args[1]] & ram32[args[2]]; break;
|
||||||
case 81: ram32[args[0]] = !ram32[args[1]]; break;
|
case 99: ram32[args[0]] = !ram32[args[1]]; break;
|
||||||
// f
|
// f
|
||||||
case 82: ramf[args[0]] += ramf[args[1]]; break;
|
case 100: ramf[args[0]] += ramf[args[1]]; break;
|
||||||
case 83: ramf[args[0]] -= ramf[args[1]]; break;
|
case 101: ramf[args[0]] -= ramf[args[1]]; break;
|
||||||
case 84: ramf[args[0]] *= ramf[args[1]]; break;
|
case 102: ramf[args[0]] *= ramf[args[1]]; break;
|
||||||
case 85: ramf[args[0]] /= ramf[args[1]]; break;
|
case 103: ramf[args[0]] /= ramf[args[1]]; break;
|
||||||
case 86: ramf[args[0]] = ramf[args[1]] + ramf[args[2]]; break;
|
case 104: ramf[args[0]] = ramf[args[1]] + ramf[args[2]]; break;
|
||||||
case 87: ramf[args[0]] = ramf[args[1]] - ramf[args[2]]; break;
|
case 105: ramf[args[0]] = ramf[args[1]] - ramf[args[2]]; break;
|
||||||
case 88: ramf[args[0]] = ramf[args[1]] * ramf[args[2]]; break;
|
case 106: ramf[args[0]] = ramf[args[1]] * ramf[args[2]]; break;
|
||||||
case 89: ramf[args[0]] = ramf[args[1]] / ramf[args[2]]; break;
|
case 107: ramf[args[0]] = ramf[args[1]] / ramf[args[2]]; break;
|
||||||
case 90: ramf[args[0]] = !ramf[args[1]]; break;
|
case 108: ramf[args[0]] = !ramf[args[1]]; break;
|
||||||
// u16
|
// u16
|
||||||
case 91: uram16[args[0]] += uram16[args[1]]; break;
|
case 109: uram16[args[0]] += uram16[args[1]]; break;
|
||||||
case 92: uram16[args[0]] -= uram16[args[1]]; break;
|
case 110: uram16[args[0]] -= uram16[args[1]]; break;
|
||||||
case 93: uram16[args[0]] *= uram16[args[1]]; break;
|
case 111: uram16[args[0]] *= uram16[args[1]]; break;
|
||||||
case 94: uram16[args[0]] /= uram16[args[1]]; break;
|
case 112: uram16[args[0]] /= uram16[args[1]]; break;
|
||||||
case 95: uram16[args[0]] %= uram16[args[1]]; break;
|
case 113: uram16[args[0]] %= uram16[args[1]]; break;
|
||||||
case 96: uram16[args[0]] |= uram16[args[1]]; break;
|
case 114: uram16[args[0]] |= uram16[args[1]]; break;
|
||||||
case 97: uram16[args[0]] &= uram16[args[1]]; break;
|
case 115: uram16[args[0]] &= uram16[args[1]]; break;
|
||||||
case 98: uram16[args[0]] = uram16[args[1]] + uram16[args[2]]; break;
|
case 116: uram16[args[0]] = uram16[args[1]] + uram16[args[2]]; break;
|
||||||
case 99: uram16[args[0]] = uram16[args[1]] - uram16[args[2]]; break;
|
case 117: uram16[args[0]] = uram16[args[1]] - uram16[args[2]]; break;
|
||||||
case 100: uram16[args[0]] = uram16[args[1]] * uram16[args[2]]; break;
|
case 118: uram16[args[0]] = uram16[args[1]] * uram16[args[2]]; break;
|
||||||
case 101: uram16[args[0]] = uram16[args[1]] / uram16[args[2]]; break;
|
case 119: uram16[args[0]] = uram16[args[1]] / uram16[args[2]]; break;
|
||||||
case 102: uram16[args[0]] = uram16[args[1]] % uram16[args[2]]; break;
|
case 120: uram16[args[0]] = uram16[args[1]] % uram16[args[2]]; break;
|
||||||
case 103: uram16[args[0]] = uram16[args[1]] | uram16[args[2]]; break;
|
case 121: uram16[args[0]] = uram16[args[1]] | uram16[args[2]]; break;
|
||||||
case 104: uram16[args[0]] = uram16[args[1]] & uram16[args[2]]; break;
|
case 122: uram16[args[0]] = uram16[args[1]] & uram16[args[2]]; break;
|
||||||
case 105: uram16[args[0]] = !uram16[args[1]]; break;
|
case 123: uram16[args[0]] = !uram16[args[1]]; break;
|
||||||
// 16
|
// 16
|
||||||
case 106: ram16[args[0]] += ram16[args[1]]; break;
|
case 124: ram16[args[0]] += ram16[args[1]]; break;
|
||||||
case 107: ram16[args[0]] -= ram16[args[1]]; break;
|
case 125: ram16[args[0]] -= ram16[args[1]]; break;
|
||||||
case 108: ram16[args[0]] *= ram16[args[1]]; break;
|
case 126: ram16[args[0]] *= ram16[args[1]]; break;
|
||||||
case 109: ram16[args[0]] /= ram16[args[1]]; break;
|
case 127: ram16[args[0]] /= ram16[args[1]]; break;
|
||||||
case 110: ram16[args[0]] %= ram16[args[1]]; break;
|
case 128: ram16[args[0]] %= ram16[args[1]]; break;
|
||||||
case 111: ram16[args[0]] |= ram16[args[1]]; break;
|
case 129: ram16[args[0]] |= ram16[args[1]]; break;
|
||||||
case 112: ram16[args[0]] &= ram16[args[1]]; break;
|
case 130: ram16[args[0]] &= ram16[args[1]]; break;
|
||||||
case 113: ram16[args[0]] = ram16[args[1]] + ram16[args[2]]; break;
|
case 131: ram16[args[0]] = ram16[args[1]] + ram16[args[2]]; break;
|
||||||
case 114: ram16[args[0]] = ram16[args[1]] - ram16[args[2]]; break;
|
case 132: ram16[args[0]] = ram16[args[1]] - ram16[args[2]]; break;
|
||||||
case 115: ram16[args[0]] = ram16[args[1]] * ram16[args[2]]; break;
|
case 133: ram16[args[0]] = ram16[args[1]] * ram16[args[2]]; break;
|
||||||
case 116: ram16[args[0]] = ram16[args[1]] / ram16[args[2]]; break;
|
case 134: ram16[args[0]] = ram16[args[1]] / ram16[args[2]]; break;
|
||||||
case 117: ram16[args[0]] = ram16[args[1]] % ram16[args[2]]; break;
|
case 135: ram16[args[0]] = ram16[args[1]] % ram16[args[2]]; break;
|
||||||
case 118: ram16[args[0]] = ram16[args[1]] | ram16[args[2]]; break;
|
case 136: ram16[args[0]] = ram16[args[1]] | ram16[args[2]]; break;
|
||||||
case 119: ram16[args[0]] = ram16[args[1]] & ram16[args[2]]; break;
|
case 137: ram16[args[0]] = ram16[args[1]] & ram16[args[2]]; break;
|
||||||
case 120: ram16[args[0]] = !ram16[args[1]]; break;
|
case 138: ram16[args[0]] = !ram16[args[1]]; break;
|
||||||
// u8
|
// u8
|
||||||
case 121: uram8[args[0]] += uram8[args[1]]; break;
|
case 139: uram8[args[0]] += uram8[args[1]]; break;
|
||||||
case 122: uram8[args[0]] -= uram8[args[1]]; break;
|
case 140: uram8[args[0]] -= uram8[args[1]]; break;
|
||||||
case 123: uram8[args[0]] *= uram8[args[1]]; break;
|
case 141: uram8[args[0]] *= uram8[args[1]]; break;
|
||||||
case 124: uram8[args[0]] /= uram8[args[1]]; break;
|
case 142: uram8[args[0]] /= uram8[args[1]]; break;
|
||||||
case 125: uram8[args[0]] %= uram8[args[1]]; break;
|
case 143: uram8[args[0]] %= uram8[args[1]]; break;
|
||||||
case 126: uram8[args[0]] |= uram8[args[1]]; break;
|
case 144: uram8[args[0]] |= uram8[args[1]]; break;
|
||||||
case 127: uram8[args[0]] &= uram8[args[1]]; break;
|
case 145: uram8[args[0]] &= uram8[args[1]]; break;
|
||||||
case 128: uram8[args[0]] = uram8[args[1]] + uram8[args[2]]; break;
|
case 146: uram8[args[0]] = uram8[args[1]] + uram8[args[2]]; break;
|
||||||
case 129: uram8[args[0]] = uram8[args[1]] - uram8[args[2]]; break;
|
case 147: uram8[args[0]] = uram8[args[1]] - uram8[args[2]]; break;
|
||||||
case 130: uram8[args[0]] = uram8[args[1]] * uram8[args[2]]; break;
|
case 148: uram8[args[0]] = uram8[args[1]] * uram8[args[2]]; break;
|
||||||
case 131: uram8[args[0]] = uram8[args[1]] / uram8[args[2]]; break;
|
case 149: uram8[args[0]] = uram8[args[1]] / uram8[args[2]]; break;
|
||||||
case 132: uram8[args[0]] = uram8[args[1]] % uram8[args[2]]; break;
|
case 150: uram8[args[0]] = uram8[args[1]] % uram8[args[2]]; break;
|
||||||
case 133: uram8[args[0]] = uram8[args[1]] | uram8[args[2]]; break;
|
case 151: uram8[args[0]] = uram8[args[1]] | uram8[args[2]]; break;
|
||||||
case 134: uram8[args[0]] = uram8[args[1]] & uram8[args[2]]; break;
|
case 152: uram8[args[0]] = uram8[args[1]] & uram8[args[2]]; break;
|
||||||
case 135: uram8[args[0]] = !uram8[args[1]]; break;
|
case 153: uram8[args[0]] = !uram8[args[1]]; break;
|
||||||
// 8
|
// 8
|
||||||
case 136: ram8[args[0]] += ram8[args[1]]; break;
|
case 154: ram8[args[0]] += ram8[args[1]]; break;
|
||||||
case 137: ram8[args[0]] -= ram8[args[1]]; break;
|
case 155: ram8[args[0]] -= ram8[args[1]]; break;
|
||||||
case 138: ram8[args[0]] *= ram8[args[1]]; break;
|
case 156: ram8[args[0]] *= ram8[args[1]]; break;
|
||||||
case 139: ram8[args[0]] /= ram8[args[1]]; break;
|
case 157: ram8[args[0]] /= ram8[args[1]]; break;
|
||||||
case 140: ram8[args[0]] %= ram8[args[1]]; break;
|
case 158: ram8[args[0]] %= ram8[args[1]]; break;
|
||||||
case 141: ram8[args[0]] |= ram8[args[1]]; break;
|
case 159: ram8[args[0]] |= ram8[args[1]]; break;
|
||||||
case 142: ram8[args[0]] &= ram8[args[1]]; break;
|
case 160: ram8[args[0]] &= ram8[args[1]]; break;
|
||||||
case 143: ram8[args[0]] = ram8[args[1]] + ram8[args[2]]; break;
|
case 161: ram8[args[0]] = ram8[args[1]] + ram8[args[2]]; break;
|
||||||
case 144: ram8[args[0]] = ram8[args[1]] - ram8[args[2]]; break;
|
case 162: ram8[args[0]] = ram8[args[1]] - ram8[args[2]]; break;
|
||||||
case 145: ram8[args[0]] = ram8[args[1]] * ram8[args[2]]; break;
|
case 163: ram8[args[0]] = ram8[args[1]] * ram8[args[2]]; break;
|
||||||
case 146: ram8[args[0]] = ram8[args[1]] / ram8[args[2]]; break;
|
case 164: ram8[args[0]] = ram8[args[1]] / ram8[args[2]]; break;
|
||||||
case 147: ram8[args[0]] = ram8[args[1]] % ram8[args[2]]; break;
|
case 165: ram8[args[0]] = ram8[args[1]] % ram8[args[2]]; break;
|
||||||
case 148: ram8[args[0]] = ram8[args[1]] | ram8[args[2]]; break;
|
case 166: ram8[args[0]] = ram8[args[1]] | ram8[args[2]]; break;
|
||||||
case 149: ram8[args[0]] = ram8[args[1]] & ram8[args[2]]; break;
|
case 167: ram8[args[0]] = ram8[args[1]] & ram8[args[2]]; break;
|
||||||
case 150: ram8[args[0]] = !ram8[args[1]]; break;
|
case 168: ram8[args[0]] = !ram8[args[1]]; break;
|
||||||
// ==
|
// ==
|
||||||
case 151: cmp = uram64[args[0]] == uram64[args[1]]; break;
|
case 169: cmp = uram64[args[0]] == uram64[args[1]]; break;
|
||||||
case 152: cmp = ram64[args[0]] == ram64[args[1]]; break;
|
case 170: cmp = ram64[args[0]] == ram64[args[1]]; break;
|
||||||
case 153: cmp = ramd[args[0]] == ramd[args[1]]; break;
|
case 171: cmp = ramd[args[0]] == ramd[args[1]]; break;
|
||||||
case 154: cmp = uram32[args[0]] == uram32[args[1]]; break;
|
case 172: cmp = uram32[args[0]] == uram32[args[1]]; break;
|
||||||
case 155: cmp = ram32[args[0]] == ram32[args[1]]; break;
|
case 173: cmp = ram32[args[0]] == ram32[args[1]]; break;
|
||||||
case 156: cmp = ramf[args[0]] == ramf[args[1]]; break;
|
case 174: cmp = ramf[args[0]] == ramf[args[1]]; break;
|
||||||
case 157: cmp = uram16[args[0]] == uram16[args[1]]; break;
|
case 175: cmp = uram16[args[0]] == uram16[args[1]]; break;
|
||||||
case 158: cmp = ram16[args[0]] == ram16[args[1]]; break;
|
case 176: cmp = ram16[args[0]] == ram16[args[1]]; break;
|
||||||
case 159: cmp = uram8[args[0]] == uram8[args[1]]; break;
|
case 177: cmp = uram8[args[0]] == uram8[args[1]]; break;
|
||||||
case 160: cmp = ram8[args[0]] == ram8[args[1]]; break;
|
case 178: cmp = ram8[args[0]] == ram8[args[1]]; break;
|
||||||
// !=
|
// !=
|
||||||
case 161: cmp = uram64[args[0]] != uram64[args[1]]; break;
|
case 179: cmp = uram64[args[0]] != uram64[args[1]]; break;
|
||||||
case 162: cmp = ram64[args[0]] != ram64[args[1]]; break;
|
case 180: cmp = ram64[args[0]] != ram64[args[1]]; break;
|
||||||
case 163: cmp = ramd[args[0]] != ramd[args[1]]; break;
|
case 181: cmp = ramd[args[0]] != ramd[args[1]]; break;
|
||||||
case 164: cmp = uram32[args[0]] != uram32[args[1]]; break;
|
case 182: cmp = uram32[args[0]] != uram32[args[1]]; break;
|
||||||
case 165: cmp = ram32[args[0]] != ram32[args[1]]; break;
|
case 183: cmp = ram32[args[0]] != ram32[args[1]]; break;
|
||||||
case 166: cmp = ramf[args[0]] != ramf[args[1]]; break;
|
case 184: cmp = ramf[args[0]] != ramf[args[1]]; break;
|
||||||
case 167: cmp = uram16[args[0]] != uram16[args[1]]; break;
|
case 185: cmp = uram16[args[0]] != uram16[args[1]]; break;
|
||||||
case 168: cmp = ram16[args[0]] != ram16[args[1]]; break;
|
case 186: cmp = ram16[args[0]] != ram16[args[1]]; break;
|
||||||
case 169: cmp = uram8[args[0]] != uram8[args[1]]; break;
|
case 187: cmp = uram8[args[0]] != uram8[args[1]]; break;
|
||||||
case 170: cmp = ram8[args[0]] != ram8[args[1]]; break;
|
case 188: cmp = ram8[args[0]] != ram8[args[1]]; break;
|
||||||
// >
|
// >
|
||||||
case 171: cmp = uram64[args[0]] > uram64[args[1]]; break;
|
case 189: cmp = uram64[args[0]] > uram64[args[1]]; break;
|
||||||
case 172: cmp = ram64[args[0]] > ram64[args[1]]; break;
|
case 190: cmp = ram64[args[0]] > ram64[args[1]]; break;
|
||||||
case 173: cmp = ramd[args[0]] > ramd[args[1]]; break;
|
case 191: cmp = ramd[args[0]] > ramd[args[1]]; break;
|
||||||
case 174: cmp = uram32[args[0]] > uram32[args[1]]; break;
|
case 192: cmp = uram32[args[0]] > uram32[args[1]]; break;
|
||||||
case 175: cmp = ram32[args[0]] > ram32[args[1]]; break;
|
case 193: cmp = ram32[args[0]] > ram32[args[1]]; break;
|
||||||
case 176: cmp = ramf[args[0]] > ramf[args[1]]; break;
|
case 194: cmp = ramf[args[0]] > ramf[args[1]]; break;
|
||||||
case 177: cmp = uram16[args[0]] > uram16[args[1]]; break;
|
case 195: cmp = uram16[args[0]] > uram16[args[1]]; break;
|
||||||
case 178: cmp = ram16[args[0]] > ram16[args[1]]; break;
|
case 196: cmp = ram16[args[0]] > ram16[args[1]]; break;
|
||||||
case 179: cmp = uram8[args[0]] > uram8[args[1]]; break;
|
case 197: cmp = uram8[args[0]] > uram8[args[1]]; break;
|
||||||
case 180: cmp = ram8[args[0]] > ram8[args[1]]; break;
|
case 198: cmp = ram8[args[0]] > ram8[args[1]]; break;
|
||||||
// <
|
// <
|
||||||
case 181: cmp = uram64[args[0]] < uram64[args[1]]; break;
|
case 199: cmp = uram64[args[0]] < uram64[args[1]]; break;
|
||||||
case 182: cmp = ram64[args[0]] < ram64[args[1]]; break;
|
case 200: cmp = ram64[args[0]] < ram64[args[1]]; break;
|
||||||
case 183: cmp = ramd[args[0]] < ramd[args[1]]; break;
|
case 201: cmp = ramd[args[0]] < ramd[args[1]]; break;
|
||||||
case 184: cmp = uram32[args[0]] < uram32[args[1]]; break;
|
case 202: cmp = uram32[args[0]] < uram32[args[1]]; break;
|
||||||
case 185: cmp = ram32[args[0]] < ram32[args[1]]; break;
|
case 203: cmp = ram32[args[0]] < ram32[args[1]]; break;
|
||||||
case 186: cmp = ramf[args[0]] < ramf[args[1]]; break;
|
case 204: cmp = ramf[args[0]] < ramf[args[1]]; break;
|
||||||
case 187: cmp = uram16[args[0]] < uram16[args[1]]; break;
|
case 205: cmp = uram16[args[0]] < uram16[args[1]]; break;
|
||||||
case 188: cmp = ram16[args[0]] < ram16[args[1]]; break;
|
case 206: cmp = ram16[args[0]] < ram16[args[1]]; break;
|
||||||
case 189: cmp = uram8[args[0]] < uram8[args[1]]; break;
|
case 207: cmp = uram8[args[0]] < uram8[args[1]]; break;
|
||||||
case 190: cmp = ram8[args[0]] < ram8[args[1]]; break;
|
case 208: cmp = ram8[args[0]] < ram8[args[1]]; break;
|
||||||
// >=
|
// >=
|
||||||
case 191: cmp = uram64[args[0]] >= uram64[args[1]]; break;
|
case 209: cmp = uram64[args[0]] >= uram64[args[1]]; break;
|
||||||
case 192: cmp = ram64[args[0]] >= ram64[args[1]]; break;
|
case 210: cmp = ram64[args[0]] >= ram64[args[1]]; break;
|
||||||
case 193: cmp = ramd[args[0]] >= ramd[args[1]]; break;
|
case 211: cmp = ramd[args[0]] >= ramd[args[1]]; break;
|
||||||
case 194: cmp = uram32[args[0]] >= uram32[args[1]]; break;
|
case 212: cmp = uram32[args[0]] >= uram32[args[1]]; break;
|
||||||
case 195: cmp = ram32[args[0]] >= ram32[args[1]]; break;
|
case 213: cmp = ram32[args[0]] >= ram32[args[1]]; break;
|
||||||
case 196: cmp = ramf[args[0]] >= ramf[args[1]]; break;
|
case 214: cmp = ramf[args[0]] >= ramf[args[1]]; break;
|
||||||
case 197: cmp = uram16[args[0]] >= uram16[args[1]]; break;
|
case 215: cmp = uram16[args[0]] >= uram16[args[1]]; break;
|
||||||
case 198: cmp = ram16[args[0]] >= ram16[args[1]]; break;
|
case 216: cmp = ram16[args[0]] >= ram16[args[1]]; break;
|
||||||
case 199: cmp = uram8[args[0]] >= uram8[args[1]]; break;
|
case 217: cmp = uram8[args[0]] >= uram8[args[1]]; break;
|
||||||
case 200: cmp = ram8[args[0]] >= ram8[args[1]]; break;
|
case 218: cmp = ram8[args[0]] >= ram8[args[1]]; break;
|
||||||
// <=
|
// <=
|
||||||
case 201: cmp = uram64[args[0]] <= uram64[args[1]]; break;
|
case 219: cmp = uram64[args[0]] <= uram64[args[1]]; break;
|
||||||
case 202: cmp = ram64[args[0]] <= ram64[args[1]]; break;
|
case 220: cmp = ram64[args[0]] <= ram64[args[1]]; break;
|
||||||
case 203: cmp = ramd[args[0]] <= ramd[args[1]]; break;
|
case 221: cmp = ramd[args[0]] <= ramd[args[1]]; break;
|
||||||
case 204: cmp = uram32[args[0]] <= uram32[args[1]]; break;
|
case 222: cmp = uram32[args[0]] <= uram32[args[1]]; break;
|
||||||
case 205: cmp = ram32[args[0]] <= ram32[args[1]]; break;
|
case 223: cmp = ram32[args[0]] <= ram32[args[1]]; break;
|
||||||
case 206: cmp = ramf[args[0]] <= ramf[args[1]]; break;
|
case 224: cmp = ramf[args[0]] <= ramf[args[1]]; break;
|
||||||
case 207: cmp = uram16[args[0]] <= uram16[args[1]]; break;
|
case 225: cmp = uram16[args[0]] <= uram16[args[1]]; break;
|
||||||
case 208: cmp = ram16[args[0]] <= ram16[args[1]]; break;
|
case 226: cmp = ram16[args[0]] <= ram16[args[1]]; break;
|
||||||
case 209: cmp = uram8[args[0]] <= uram8[args[1]]; break;
|
case 227: cmp = uram8[args[0]] <= uram8[args[1]]; break;
|
||||||
case 210: cmp = ram8[args[0]] <= ram8[args[1]]; break;
|
case 228: cmp = ram8[args[0]] <= ram8[args[1]]; break;
|
||||||
// ++
|
// ++
|
||||||
case 211: uram64[args[0]]++; break;
|
case 229: uram64[args[0]]++; break;
|
||||||
case 212: ram64[args[0]]++; break;
|
case 230: ram64[args[0]]++; break;
|
||||||
case 213: ramd[args[0]]++; break;
|
case 231: ramd[args[0]]++; break;
|
||||||
case 214: uram32[args[0]]++; break;
|
case 232: uram32[args[0]]++; break;
|
||||||
case 215: ram32[args[0]]++; break;
|
case 233: ram32[args[0]]++; break;
|
||||||
case 216: ramf[args[0]]++; break;
|
case 234: ramf[args[0]]++; break;
|
||||||
case 217: uram16[args[0]]++; break;
|
case 235: uram16[args[0]]++; break;
|
||||||
case 218: ram16[args[0]]++; break;
|
case 236: ram16[args[0]]++; break;
|
||||||
case 219: uram8[args[0]]++; break;
|
case 237: uram8[args[0]]++; break;
|
||||||
case 220: ram8[args[0]]++; break;
|
case 238: ram8[args[0]]++; break;
|
||||||
// --
|
// --
|
||||||
case 221: uram64[args[0]]--; break;
|
case 239: uram64[args[0]]--; break;
|
||||||
case 222: ram64[args[0]]--; break;
|
case 240: ram64[args[0]]--; break;
|
||||||
case 223: ramd[args[0]]--; break;
|
case 241: ramd[args[0]]--; break;
|
||||||
case 224: uram32[args[0]]--; break;
|
case 242: uram32[args[0]]--; break;
|
||||||
case 225: ram32[args[0]]--; break;
|
case 243: ram32[args[0]]--; break;
|
||||||
case 226: ramf[args[0]]--; break;
|
case 244: ramf[args[0]]--; break;
|
||||||
case 227: uram16[args[0]]--; break;
|
case 245: uram16[args[0]]--; break;
|
||||||
case 228: ram16[args[0]]--; break;
|
case 246: ram16[args[0]]--; break;
|
||||||
case 229: uram8[args[0]]--; break;
|
case 247: uram8[args[0]]--; break;
|
||||||
case 230: ram8[args[0]]--; break;
|
case 248: ram8[args[0]]--; break;
|
||||||
// a = b
|
// a = b
|
||||||
case 231: uram64[args[0]] = (uint64_t)args[1]; break;
|
case 249: uram64[args[0]] = (uint64_t)args[1]; break;
|
||||||
case 232: ram64[args[0]] = (int64_t)args[1]; break;
|
case 250: ram64[args[0]] = (int64_t)args[1]; break;
|
||||||
case 233: ramd[args[0]] = (int64_t)args[1]; break;
|
case 251: ramd[args[0]] = (int64_t)args[1]; break;
|
||||||
case 234: uram32[args[0]] = (uint32_t)args[1]; break;
|
case 252: uram32[args[0]] = (uint32_t)args[1]; break;
|
||||||
case 235: ram32[args[0]] = (int32_t)args[1]; break;
|
case 253: ram32[args[0]] = (int32_t)args[1]; break;
|
||||||
case 236: ramf[args[0]] = (int32_t)args[1]; break;
|
case 254: ramf[args[0]] = (int32_t)args[1]; break;
|
||||||
case 237: uram16[args[0]] = (uint16_t)args[1]; break;
|
case 255: uram16[args[0]] = (uint16_t)args[1]; break;
|
||||||
case 238: ram16[args[0]] = (int16_t)args[1]; break;
|
case 256: ram16[args[0]] = (int16_t)args[1]; break;
|
||||||
case 239: uram8[args[0]] = (uint8_t)args[1]; break;
|
case 257: uram8[args[0]] = (uint8_t)args[1]; break;
|
||||||
case 240: ram8[args[0]] = (int8_t)args[1]; break;
|
case 258: ram8[args[0]] = (int8_t)args[1]; break;
|
||||||
// a = *b
|
// a = *b
|
||||||
case 241: uram64[args[0]] = uram64[args[1]]; break;
|
case 259: uram64[args[0]] = uram64[args[1]]; break;
|
||||||
case 242: ram64[args[0]] = ram64[args[1]]; break;
|
case 260: ram64[args[0]] = ram64[args[1]]; break;
|
||||||
case 243: ramd[args[0]] = ramd[args[1]]; break;
|
case 261: ramd[args[0]] = ramd[args[1]]; break;
|
||||||
case 244: uram32[args[0]] = uram32[args[1]]; break;
|
case 262: uram32[args[0]] = uram32[args[1]]; break;
|
||||||
case 245: ram32[args[0]] = ram32[args[1]]; break;
|
case 263: ram32[args[0]] = ram32[args[1]]; break;
|
||||||
case 246: ramf[args[0]] = ramf[args[1]]; break;
|
case 264: ramf[args[0]] = ramf[args[1]]; break;
|
||||||
case 247: uram16[args[0]] = uram16[args[1]]; break;
|
case 265: uram16[args[0]] = uram16[args[1]]; break;
|
||||||
case 248: ram16[args[0]] = ram16[args[1]]; break;
|
case 266: ram16[args[0]] = ram16[args[1]]; break;
|
||||||
case 249: uram8[args[0]] = uram8[args[1]]; break;
|
case 267: uram8[args[0]] = uram8[args[1]]; break;
|
||||||
case 250: ram8[args[0]] = ram8[args[1]]; break;
|
case 268: ram8[args[0]] = ram8[args[1]]; break;
|
||||||
// a = **b
|
// a = **b
|
||||||
case 251: uram64[args[0]] = uram64[uram64[args[1]]]; break;
|
case 269: uram64[args[0]] = uram64[uram64[args[1]]]; break;
|
||||||
case 252: ram64[args[0]] = ram64[uram64[args[1]]]; break;
|
case 270: ram64[args[0]] = ram64[uram64[args[1]]]; break;
|
||||||
case 253: ramd[args[0]] = ramd[uram64[args[1]]]; break;
|
case 271: ramd[args[0]] = ramd[uram64[args[1]]]; break;
|
||||||
case 254: uram32[args[0]] = uram32[uram64[args[1]]]; break;
|
case 272: uram32[args[0]] = uram32[uram64[args[1]]]; break;
|
||||||
case 255: ram32[args[0]] = ram32[uram64[args[1]]]; break;
|
case 273: ram32[args[0]] = ram32[uram64[args[1]]]; break;
|
||||||
case 256: ramf[args[0]] = ramf[uram64[args[1]]]; break;
|
case 274: ramf[args[0]] = ramf[uram64[args[1]]]; break;
|
||||||
case 257: uram16[args[0]] = uram16[uram64[args[1]]]; break;
|
case 275: uram16[args[0]] = uram16[uram64[args[1]]]; break;
|
||||||
case 258: ram16[args[0]] = ram16[uram64[args[1]]]; break;
|
case 276: ram16[args[0]] = ram16[uram64[args[1]]]; break;
|
||||||
case 259: uram8[args[0]] = uram8[uram64[args[1]]]; break;
|
case 277: uram8[args[0]] = uram8[uram64[args[1]]]; break;
|
||||||
case 260: ram8[args[0]] = ram8[uram64[args[1]]]; break;
|
case 278: ram8[args[0]] = ram8[uram64[args[1]]]; break;
|
||||||
// *a = b
|
// *a = b
|
||||||
case 261: uram64[uram64[args[0]]] = (uint64_t) args[1]; break;
|
case 279: uram64[uram64[args[0]]] = (uint64_t) args[1]; break;
|
||||||
case 262: ram64[uram64[args[0]]] = (int64_t) args[1]; break;
|
case 280: ram64[uram64[args[0]]] = (int64_t) args[1]; break;
|
||||||
case 263: ramd[uram64[args[0]]] = (double) args[1]; break;
|
case 281: ramd[uram64[args[0]]] = (double) args[1]; break;
|
||||||
case 264: uram32[uram64[args[0]]] = (uint32_t) args[1]; break;
|
case 282: uram32[uram64[args[0]]] = (uint32_t) args[1]; break;
|
||||||
case 265: ram32[uram64[args[0]]] = (int32_t) args[1]; break;
|
case 283: ram32[uram64[args[0]]] = (int32_t) args[1]; break;
|
||||||
case 266: ramf[uram64[args[0]]] = (float) args[1]; break;
|
case 284: ramf[uram64[args[0]]] = (float) args[1]; break;
|
||||||
case 267: uram16[uram64[args[0]]] = (uint16_t) args[1]; break;
|
case 285: uram16[uram64[args[0]]] = (uint16_t) args[1]; break;
|
||||||
case 268: ram16[uram64[args[0]]] = (int16_t) args[1]; break;
|
case 286: ram16[uram64[args[0]]] = (int16_t) args[1]; break;
|
||||||
case 269: uram8[uram64[args[0]]] = (uint8_t) args[1]; break;
|
case 287: uram8[uram64[args[0]]] = (uint8_t) args[1]; break;
|
||||||
case 270: ram8[uram64[args[0]]] = (int8_t) args[1]; break;
|
case 288: ram8[uram64[args[0]]] = (int8_t) args[1]; break;
|
||||||
// *a = *b
|
// *a = *b
|
||||||
case 271: uram64[uram64[args[0]]] = uram64[args[1]]; break;
|
case 289: uram64[uram64[args[0]]] = uram64[args[1]]; break;
|
||||||
case 272: ram64[uram64[args[0]]] = ram64[args[1]]; break;
|
case 290: ram64[uram64[args[0]]] = ram64[args[1]]; break;
|
||||||
case 273: ramd[uram64[args[0]]] = ramd[args[1]]; break;
|
case 291: ramd[uram64[args[0]]] = ramd[args[1]]; break;
|
||||||
case 274: uram32[uram64[args[0]]] = uram32[args[1]]; break;
|
case 292: uram32[uram64[args[0]]] = uram32[args[1]]; break;
|
||||||
case 275: ram32[uram64[args[0]]] = ram32[args[1]]; break;
|
case 293: ram32[uram64[args[0]]] = ram32[args[1]]; break;
|
||||||
case 276: ramf[uram64[args[0]]] = ramf[args[1]]; break;
|
case 294: ramf[uram64[args[0]]] = ramf[args[1]]; break;
|
||||||
case 277: uram16[uram64[args[0]]] = uram16[args[1]]; break;
|
case 295: uram16[uram64[args[0]]] = uram16[args[1]]; break;
|
||||||
case 278: ram16[uram64[args[0]]] = ram16[args[1]]; break;
|
case 296: ram16[uram64[args[0]]] = ram16[args[1]]; break;
|
||||||
case 279: uram8[uram64[args[0]]] = uram8[args[1]]; break;
|
case 297: uram8[uram64[args[0]]] = uram8[args[1]]; break;
|
||||||
case 280: ram8[uram64[args[0]]] = ram8[args[1]]; break;
|
case 298: ram8[uram64[args[0]]] = ram8[args[1]]; break;
|
||||||
// *a = **b
|
// *a = **b
|
||||||
case 281: uram64[uram64[args[0]]] = uram64[uram64[args[1]]]; break;
|
case 299: uram64[uram64[args[0]]] = uram64[uram64[args[1]]]; break;
|
||||||
case 282: ram64[uram64[args[0]]] = ram64[uram64[args[1]]]; break;
|
case 300: ram64[uram64[args[0]]] = ram64[uram64[args[1]]]; break;
|
||||||
case 283: ramd[uram64[args[0]]] = ramd[uram64[args[1]]]; break;
|
case 301: ramd[uram64[args[0]]] = ramd[uram64[args[1]]]; break;
|
||||||
case 284: uram32[uram64[args[0]]] = uram32[uram64[args[1]]]; break;
|
case 302: uram32[uram64[args[0]]] = uram32[uram64[args[1]]]; break;
|
||||||
case 285: ram32[uram64[args[0]]] = ram32[uram64[args[1]]]; break;
|
case 303: ram32[uram64[args[0]]] = ram32[uram64[args[1]]]; break;
|
||||||
case 286: ramf[uram64[args[0]]] = ramf[uram64[args[1]]]; break;
|
case 304: ramf[uram64[args[0]]] = ramf[uram64[args[1]]]; break;
|
||||||
case 287: uram16[uram64[args[0]]] = uram16[uram64[args[1]]]; break;
|
case 305: uram16[uram64[args[0]]] = uram16[uram64[args[1]]]; break;
|
||||||
case 288: ram16[uram64[args[0]]] = ram16[uram64[args[1]]]; break;
|
case 306: ram16[uram64[args[0]]] = ram16[uram64[args[1]]]; break;
|
||||||
case 289: uram8[uram64[args[0]]] = uram8[uram64[args[1]]]; break;
|
case 307: uram8[uram64[args[0]]] = uram8[uram64[args[1]]]; break;
|
||||||
case 290: ram8[uram64[args[0]]] = ram8[uram64[args[1]]]; break;
|
case 308: ram8[uram64[args[0]]] = ram8[uram64[args[1]]]; break;
|
||||||
// cast
|
// cast
|
||||||
case 291: uram64[args[0]] = (uint64_t)ram64[args[1]]; break;
|
case 309: uram64[args[0]] = (uint64_t)ram64[args[1]]; break;
|
||||||
case 292: uram64[args[0]] = (uint64_t)ramd[args[1]]; break;
|
case 310: uram64[args[0]] = (uint64_t)ramd[args[1]]; break;
|
||||||
case 293: uram64[args[0]] = (uint64_t)uram32[args[1]]; break;
|
case 311: uram64[args[0]] = (uint64_t)uram32[args[1]]; break;
|
||||||
case 294: uram64[args[0]] = (uint64_t)ram32[args[1]]; break;
|
case 312: uram64[args[0]] = (uint64_t)ram32[args[1]]; break;
|
||||||
case 295: uram64[args[0]] = (uint64_t)ramf[args[1]]; break;
|
case 313: uram64[args[0]] = (uint64_t)ramf[args[1]]; break;
|
||||||
case 296: uram64[args[0]] = (uint64_t)uram16[args[1]]; break;
|
case 314: uram64[args[0]] = (uint64_t)uram16[args[1]]; break;
|
||||||
case 297: uram64[args[0]] = (uint64_t)ram16[args[1]]; break;
|
case 315: uram64[args[0]] = (uint64_t)ram16[args[1]]; break;
|
||||||
case 298: uram64[args[0]] = (uint64_t)uram8[args[1]]; break;
|
case 316: uram64[args[0]] = (uint64_t)uram8[args[1]]; break;
|
||||||
case 299: uram64[args[0]] = (uint64_t)ram8[args[1]]; break;
|
case 317: uram64[args[0]] = (uint64_t)ram8[args[1]]; break;
|
||||||
case 300: ram64[args[0]] = (int64_t)uram64[args[1]]; break;
|
case 318: ram64[args[0]] = (int64_t)uram64[args[1]]; break;
|
||||||
case 301: ram64[args[0]] = (int64_t)ramd[args[1]]; break;
|
case 319: ram64[args[0]] = (int64_t)ramd[args[1]]; break;
|
||||||
case 302: ram64[args[0]] = (int64_t)uram32[args[1]]; break;
|
case 320: ram64[args[0]] = (int64_t)uram32[args[1]]; break;
|
||||||
case 303: ram64[args[0]] = (int64_t)ram32[args[1]]; break;
|
case 321: ram64[args[0]] = (int64_t)ram32[args[1]]; break;
|
||||||
case 304: ram64[args[0]] = (int64_t)ramf[args[1]]; break;
|
case 322: ram64[args[0]] = (int64_t)ramf[args[1]]; break;
|
||||||
case 305: ram64[args[0]] = (int64_t)uram16[args[1]]; break;
|
case 323: ram64[args[0]] = (int64_t)uram16[args[1]]; break;
|
||||||
case 306: ram64[args[0]] = (int64_t)ram16[args[1]]; break;
|
case 324: ram64[args[0]] = (int64_t)ram16[args[1]]; break;
|
||||||
case 307: ram64[args[0]] = (int64_t)uram8[args[1]]; break;
|
case 325: ram64[args[0]] = (int64_t)uram8[args[1]]; break;
|
||||||
case 308: ram64[args[0]] = (int64_t)ram8[args[1]]; break;
|
case 326: ram64[args[0]] = (int64_t)ram8[args[1]]; break;
|
||||||
case 309: ramd[args[0]] = (double)uram64[args[1]]; break;
|
case 327: ramd[args[0]] = (double)uram64[args[1]]; break;
|
||||||
case 310: ramd[args[0]] = (double)ram64[args[1]]; break;
|
case 328: ramd[args[0]] = (double)ram64[args[1]]; break;
|
||||||
case 311: ramd[args[0]] = (double)uram32[args[1]]; break;
|
case 329: ramd[args[0]] = (double)uram32[args[1]]; break;
|
||||||
case 312: ramd[args[0]] = (double)ram32[args[1]]; break;
|
case 330: ramd[args[0]] = (double)ram32[args[1]]; break;
|
||||||
case 313: ramd[args[0]] = (double)ramf[args[1]]; break;
|
case 331: ramd[args[0]] = (double)ramf[args[1]]; break;
|
||||||
case 314: ramd[args[0]] = (double)uram16[args[1]]; break;
|
case 332: ramd[args[0]] = (double)uram16[args[1]]; break;
|
||||||
case 315: ramd[args[0]] = (double)ram16[args[1]]; break;
|
case 333: ramd[args[0]] = (double)ram16[args[1]]; break;
|
||||||
case 316: ramd[args[0]] = (double)uram8[args[1]]; break;
|
case 334: ramd[args[0]] = (double)uram8[args[1]]; break;
|
||||||
case 317: ramd[args[0]] = (double)ram8[args[1]]; break;
|
case 335: ramd[args[0]] = (double)ram8[args[1]]; break;
|
||||||
case 318: uram32[args[0]] = (uint32_t)uram64[args[1]]; break;
|
case 336: uram32[args[0]] = (uint32_t)uram64[args[1]]; break;
|
||||||
case 319: uram32[args[0]] = (uint32_t)ram64[args[1]]; break;
|
case 337: uram32[args[0]] = (uint32_t)ram64[args[1]]; break;
|
||||||
case 320: uram32[args[0]] = (uint32_t)ramd[args[1]]; break;
|
case 338: uram32[args[0]] = (uint32_t)ramd[args[1]]; break;
|
||||||
case 321: uram32[args[0]] = (uint32_t)ram32[args[1]]; break;
|
case 339: uram32[args[0]] = (uint32_t)ram32[args[1]]; break;
|
||||||
case 322: uram32[args[0]] = (uint32_t)ramf[args[1]]; break;
|
case 340: uram32[args[0]] = (uint32_t)ramf[args[1]]; break;
|
||||||
case 323: uram32[args[0]] = (uint32_t)uram16[args[1]]; break;
|
case 341: uram32[args[0]] = (uint32_t)uram16[args[1]]; break;
|
||||||
case 324: uram32[args[0]] = (uint32_t)ram16[args[1]]; break;
|
case 342: uram32[args[0]] = (uint32_t)ram16[args[1]]; break;
|
||||||
case 325: uram32[args[0]] = (uint32_t)uram8[args[1]]; break;
|
case 343: uram32[args[0]] = (uint32_t)uram8[args[1]]; break;
|
||||||
case 326: uram32[args[0]] = (uint32_t)ram8[args[1]]; break;
|
case 344: uram32[args[0]] = (uint32_t)ram8[args[1]]; break;
|
||||||
case 327: ram32[args[0]] = (int32_t)uram64[args[1]]; break;
|
case 345: ram32[args[0]] = (int32_t)uram64[args[1]]; break;
|
||||||
case 328: ram32[args[0]] = (int32_t)ram64[args[1]]; break;
|
case 346: ram32[args[0]] = (int32_t)ram64[args[1]]; break;
|
||||||
case 329: ram32[args[0]] = (int32_t)ramd[args[1]]; break;
|
case 347: ram32[args[0]] = (int32_t)ramd[args[1]]; break;
|
||||||
case 330: ram32[args[0]] = (int32_t)uram32[args[1]]; break;
|
case 348: ram32[args[0]] = (int32_t)uram32[args[1]]; break;
|
||||||
case 331: ram32[args[0]] = (int32_t)ramf[args[1]]; break;
|
case 349: ram32[args[0]] = (int32_t)ramf[args[1]]; break;
|
||||||
case 332: ram32[args[0]] = (int32_t)uram16[args[1]]; break;
|
case 350: ram32[args[0]] = (int32_t)uram16[args[1]]; break;
|
||||||
case 333: ram32[args[0]] = (int32_t)ram16[args[1]]; break;
|
case 351: ram32[args[0]] = (int32_t)ram16[args[1]]; break;
|
||||||
case 334: ram32[args[0]] = (int32_t)uram8[args[1]]; break;
|
case 352: ram32[args[0]] = (int32_t)uram8[args[1]]; break;
|
||||||
case 335: ram32[args[0]] = (int32_t)ram8[args[1]]; break;
|
case 353: ram32[args[0]] = (int32_t)ram8[args[1]]; break;
|
||||||
case 336: ramf[args[0]] = (float)uram64[args[1]]; break;
|
case 354: ramf[args[0]] = (float)uram64[args[1]]; break;
|
||||||
case 337: ramf[args[0]] = (float)ram64[args[1]]; break;
|
case 355: ramf[args[0]] = (float)ram64[args[1]]; break;
|
||||||
case 338: ramf[args[0]] = (float)ramd[args[1]]; break;
|
case 356: ramf[args[0]] = (float)ramd[args[1]]; break;
|
||||||
case 339: ramf[args[0]] = (float)uram32[args[1]]; break;
|
case 357: ramf[args[0]] = (float)uram32[args[1]]; break;
|
||||||
case 340: ramf[args[0]] = (float)ram32[args[1]]; break;
|
case 358: ramf[args[0]] = (float)ram32[args[1]]; break;
|
||||||
case 341: ramf[args[0]] = (float)uram16[args[1]]; break;
|
case 359: ramf[args[0]] = (float)uram16[args[1]]; break;
|
||||||
case 342: ramf[args[0]] = (float)ram16[args[1]]; break;
|
case 360: ramf[args[0]] = (float)ram16[args[1]]; break;
|
||||||
case 343: ramf[args[0]] = (float)uram8[args[1]]; break;
|
case 361: ramf[args[0]] = (float)uram8[args[1]]; break;
|
||||||
case 344: ramf[args[0]] = (float)ram8[args[1]]; break;
|
case 362: ramf[args[0]] = (float)ram8[args[1]]; break;
|
||||||
case 345: uram16[args[0]] = (uint16_t)uram64[args[1]]; break;
|
case 363: uram16[args[0]] = (uint16_t)uram64[args[1]]; break;
|
||||||
case 346: uram16[args[0]] = (uint16_t)ram64[args[1]]; break;
|
case 364: uram16[args[0]] = (uint16_t)ram64[args[1]]; break;
|
||||||
case 347: uram16[args[0]] = (uint16_t)ramd[args[1]]; break;
|
case 365: uram16[args[0]] = (uint16_t)ramd[args[1]]; break;
|
||||||
case 348: uram16[args[0]] = (uint16_t)uram32[args[1]]; break;
|
case 366: uram16[args[0]] = (uint16_t)uram32[args[1]]; break;
|
||||||
case 349: uram16[args[0]] = (uint16_t)ram32[args[1]]; break;
|
case 367: uram16[args[0]] = (uint16_t)ram32[args[1]]; break;
|
||||||
case 350: uram16[args[0]] = (uint16_t)ramf[args[1]]; break;
|
case 368: uram16[args[0]] = (uint16_t)ramf[args[1]]; break;
|
||||||
case 351: uram16[args[0]] = (uint16_t)ram16[args[1]]; break;
|
case 369: uram16[args[0]] = (uint16_t)ram16[args[1]]; break;
|
||||||
case 352: uram16[args[0]] = (uint16_t)uram8[args[1]]; break;
|
case 370: uram16[args[0]] = (uint16_t)uram8[args[1]]; break;
|
||||||
case 353: uram16[args[0]] = (uint16_t)ram8[args[1]]; break;
|
case 371: uram16[args[0]] = (uint16_t)ram8[args[1]]; break;
|
||||||
case 354: ram16[args[0]] = (int16_t)uram64[args[1]]; break;
|
case 372: ram16[args[0]] = (int16_t)uram64[args[1]]; break;
|
||||||
case 355: ram16[args[0]] = (int16_t)ram64[args[1]]; break;
|
case 373: ram16[args[0]] = (int16_t)ram64[args[1]]; break;
|
||||||
case 356: ram16[args[0]] = (int16_t)ramd[args[1]]; break;
|
case 374: ram16[args[0]] = (int16_t)ramd[args[1]]; break;
|
||||||
case 357: ram16[args[0]] = (int16_t)uram32[args[1]]; break;
|
case 375: ram16[args[0]] = (int16_t)uram32[args[1]]; break;
|
||||||
case 358: ram16[args[0]] = (int16_t)ram32[args[1]]; break;
|
case 376: ram16[args[0]] = (int16_t)ram32[args[1]]; break;
|
||||||
case 359: ram16[args[0]] = (int16_t)ramf[args[1]]; break;
|
case 377: ram16[args[0]] = (int16_t)ramf[args[1]]; break;
|
||||||
case 360: ram16[args[0]] = (int16_t)uram16[args[1]]; break;
|
case 378: ram16[args[0]] = (int16_t)uram16[args[1]]; break;
|
||||||
case 361: ram16[args[0]] = (int16_t)uram8[args[1]]; break;
|
case 379: ram16[args[0]] = (int16_t)uram8[args[1]]; break;
|
||||||
case 362: ram16[args[0]] = (int16_t)ram8[args[1]]; break;
|
case 380: ram16[args[0]] = (int16_t)ram8[args[1]]; break;
|
||||||
case 363: uram8[args[0]] = (uint8_t)uram64[args[1]]; break;
|
case 381: uram8[args[0]] = (uint8_t)uram64[args[1]]; break;
|
||||||
case 364: uram8[args[0]] = (uint8_t)ram64[args[1]]; break;
|
case 382: uram8[args[0]] = (uint8_t)ram64[args[1]]; break;
|
||||||
case 365: uram8[args[0]] = (uint8_t)ramd[args[1]]; break;
|
case 383: uram8[args[0]] = (uint8_t)ramd[args[1]]; break;
|
||||||
case 366: uram8[args[0]] = (uint8_t)uram32[args[1]]; break;
|
case 384: uram8[args[0]] = (uint8_t)uram32[args[1]]; break;
|
||||||
case 367: uram8[args[0]] = (uint8_t)ram32[args[1]]; break;
|
case 385: uram8[args[0]] = (uint8_t)ram32[args[1]]; break;
|
||||||
case 368: uram8[args[0]] = (uint8_t)ramf[args[1]]; break;
|
case 386: uram8[args[0]] = (uint8_t)ramf[args[1]]; break;
|
||||||
case 369: uram8[args[0]] = (uint8_t)uram16[args[1]]; break;
|
case 387: uram8[args[0]] = (uint8_t)uram16[args[1]]; break;
|
||||||
case 370: uram8[args[0]] = (uint8_t)ram16[args[1]]; break;
|
case 388: uram8[args[0]] = (uint8_t)ram16[args[1]]; break;
|
||||||
case 371: uram8[args[0]] = (int8_t)ram8[args[1]]; break;
|
case 389: uram8[args[0]] = (int8_t)ram8[args[1]]; break;
|
||||||
case 372: ram8[args[0]] = (int8_t)uram64[args[1]]; break;
|
case 390: ram8[args[0]] = (int8_t)uram64[args[1]]; break;
|
||||||
case 373: ram8[args[0]] = (int8_t)ram64[args[1]]; break;
|
case 391: ram8[args[0]] = (int8_t)ram64[args[1]]; break;
|
||||||
case 374: ram8[args[0]] = (int8_t)ramd[args[1]]; break;
|
case 392: ram8[args[0]] = (int8_t)ramd[args[1]]; break;
|
||||||
case 375: ram8[args[0]] = (int8_t)uram32[args[1]]; break;
|
case 393: ram8[args[0]] = (int8_t)uram32[args[1]]; break;
|
||||||
case 376: ram8[args[0]] = (int8_t)ram32[args[1]]; break;
|
case 394: ram8[args[0]] = (int8_t)ram32[args[1]]; break;
|
||||||
case 377: ram8[args[0]] = (int8_t)ramf[args[1]]; break;
|
case 395: ram8[args[0]] = (int8_t)ramf[args[1]]; break;
|
||||||
case 378: ram8[args[0]] = (int8_t)uram16[args[1]]; break;
|
case 396: ram8[args[0]] = (int8_t)uram16[args[1]]; break;
|
||||||
case 379: ram8[args[0]] = (int8_t)ram16[args[1]]; break;
|
case 397: ram8[args[0]] = (int8_t)ram16[args[1]]; break;
|
||||||
case 380: ram8[args[0]] = (int8_t)uram8[args[1]]; break;
|
case 398: ram8[args[0]] = (int8_t)uram8[args[1]]; break;
|
||||||
// io dev
|
// io dev
|
||||||
case 381: devices[args[0]].write(vm, uram8 + args[1], args[2]); break;
|
case 399: devices[args[0]].write(vm, uram8 + args[1] * 8, uram64[args[2]]); break;
|
||||||
case 382: devices[args[0]].out(vm); break;
|
case 400: devices[args[0]].out(vm); break;
|
||||||
case 383: devices[args[0]].read(vm, uram8 + args[1], args[2], args[3]); break;
|
case 401: devices[args[0]].read(vm, uram8 + args[1] * 8, args[2], args[3]); break;
|
||||||
case 384: devices[args[0]].wait(vm, args[1]); break;
|
case 402: devices[args[0]].wait(vm, uram64[args[1]]); break;
|
||||||
|
|
Loading…
Reference in a new issue