VERSION,FREEMEM,RIGHT$実装
This commit is contained in:
@@ -327,6 +327,10 @@ class BuiltinFunction
|
||||
{
|
||||
return str[0..len];
|
||||
}
|
||||
static wstring RIGHT(wstring str, int len)
|
||||
{
|
||||
return str[$ - len..$];
|
||||
}
|
||||
static wstring SUBST(wstring str, int i, Value alen, DefaultValue!(Value,false) areplace)
|
||||
{
|
||||
int len = 1;
|
||||
|
||||
@@ -168,8 +168,14 @@ class Compiler
|
||||
sysVariable["CSRY"] = new CSRY();
|
||||
global["CSRZ"] = VMVariable(-1);
|
||||
sysVariable["CSRZ"] = new CSRZ();
|
||||
addSystemVariable("VERSION", new Version());
|
||||
addSystemVariable("FREEMEM", new FreeMem());
|
||||
}
|
||||
void addSystemVariable(wstring name, SystemVariable var)
|
||||
{
|
||||
global[name] = VMVariable(-1);
|
||||
sysVariable[name] = var;
|
||||
}
|
||||
|
||||
SystemVariable[wstring] sysVariable;
|
||||
Code[] code;
|
||||
VMVariable[wstring] global;
|
||||
|
||||
@@ -15,9 +15,9 @@ import otya.smilebasic.error;
|
||||
import otya.smilebasic.bg;
|
||||
import otya.smilebasic.parser;
|
||||
const static rot_test_deg = 45f;
|
||||
const static rot_test_x = 1f;
|
||||
const static rot_test_y = 0f;
|
||||
const static rot_test_z = 0f;
|
||||
const static rot_test_x = 0f;
|
||||
const static rot_test_y = 1f;
|
||||
const static rot_test_z = 1f;
|
||||
enum Button
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
@@ -67,4 +67,19 @@ class CSRZ : SystemVariable
|
||||
return Value(vm.petitcomputer.CSRZ);
|
||||
}
|
||||
}
|
||||
|
||||
class Version : SystemVariable
|
||||
{
|
||||
@property
|
||||
override Value value(VM vm)
|
||||
{
|
||||
return Value(0x3010000);
|
||||
}
|
||||
}
|
||||
class FreeMem : SystemVariable
|
||||
{
|
||||
@property
|
||||
override Value value(VM vm)
|
||||
{
|
||||
return Value(8327164);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user