diff --git a/SMILEBASIC/builtinfunctions.d b/SMILEBASIC/builtinfunctions.d index a206ca7..557aff3 100644 --- a/SMILEBASIC/builtinfunctions.d +++ b/SMILEBASIC/builtinfunctions.d @@ -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; diff --git a/SMILEBASIC/compiler.d b/SMILEBASIC/compiler.d index fd6b133..8d6ee68 100644 --- a/SMILEBASIC/compiler.d +++ b/SMILEBASIC/compiler.d @@ -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; diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index 363dac9..54e2ed5 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -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, diff --git a/SMILEBASIC/systemvariable.d b/SMILEBASIC/systemvariable.d index 3916032..dd96578 100644 --- a/SMILEBASIC/systemvariable.d +++ b/SMILEBASIC/systemvariable.d @@ -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); + } +}