-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsystemvariable.d
85 lines (85 loc) · 1.79 KB
/
systemvariable.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
module otya.smilebasic.systemvariable;
import otya.smilebasic.type;
import otya.smilebasic.error;
import otya.smilebasic.vm;
class SystemVariable
{
@property
abstract Value value(VM vm);
@property
void value(Value value)
{
throw new TypeMismatch();
}
}
import std.datetime;
import std.string;
import std.conv;
class Date : SystemVariable
{
@property
override Value value(VM vm)
{
auto currentTime = Clock.currTime();
wstring timeString = format("%04d/%02d/%02d", currentTime.year, currentTime.month, currentTime.day).to!wstring;
return Value(timeString);
}
}
class Time : SystemVariable
{
@property
override Value value(VM vm)
{
auto currentTime = Clock.currTime();
wstring timeString = format("%02d:%02d:%02d", currentTime.hour, currentTime.minute, currentTime.second).to!wstring;
return Value(timeString);
}
}
class Maincnt : SystemVariable
{
@property
override Value value(VM vm)
{
return Value(vm.petitcomputer.maincnt);
}
}
class CSRX : SystemVariable
{
@property
override Value value(VM vm)
{
return Value(vm.petitcomputer.CSRX);
}
}
class CSRY : SystemVariable
{
@property
override Value value(VM vm)
{
return Value(vm.petitcomputer.CSRY);
}
}
class CSRZ : SystemVariable
{
@property
override Value value(VM vm)
{
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);
}
}