-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptidea.txt
More file actions
108 lines (83 loc) · 2.65 KB
/
scriptidea.txt
File metadata and controls
108 lines (83 loc) · 2.65 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//declare functions like this
function TestFunc
{
}
event OnCreate
{
}
event OnUpdate
{
}
event OnDraw
{
DrawSprite();
}
in bytecode, the 32nd bit (i.e. 00000000000000000000000000000000) indicates whether or not the value refers to a heap value or is a static number.
or alternatively, each value is a 5-byte number instead 00FFFFFFFF, where the first byte indicates type and size of value
SSSSSSSSSSSSTTTT, where S is size, U is unused and T is type
----OPCODES----
SET 0x00 0x01; sets value at address to static value
DEF 0x00 0x01; sets value at address 1 to value at address 2 (0x00 = 0x01)
INC 0x00; increases value at address by 1
DEC 0x00; decreases value at address by 1
ADD 0x00 0x01; adds value at address 2 to value at address 1 (0x00 = 0x00 + 0x01)
SUB 0x00 0x01; subtracts value at address 2 from value at address 1 (0x00 = 0x00 - 0x01)
MUL 0x00 0x01; multiplies value at address 1 by value at adress 2 (0x00 = 0x00 * 0x01)
DIV 0x00 0x01; divides value at address 1 by value at adress 2 (0x00 = 0x00 / 0x01)
MOD 0x00 0x01; gets modulo of value at address 1 by value at adress 2 (0x00 = 0x00 % 0x01)
BIF; Begin if. this seeks to the next CIF statement.
CIF; Check if. counts the number of true booleans in stack; pops them. if not every value is true, jumps to EIF.
EIF; end if.
NOT; flips truth of latest stack value, dunno if I'll use this
ISGRT 0x00 0x01; if (0x00 > 0x01) sets value 1 to stack.
ISLST 0x00 0x01; if (0x00 < 0x01) sets value 1 to stack
ISEQL 0x00 0x01; if (0x00 == 0x01) sets value 1 to stack.
SFUNC start function; initializies function stack
EFUNC end function; deletes function stack
EXFNC execute function? dunno how it'll be identified
HEAPS value; sets heap size to specific value. only used by compiler.
----FUNCTIONS----
registers for return values? maybe
----EXAMPLE?----
value1 = 1;
value2 = 1;
value3 = 2;
if (value1 == value2 && value3 > value2)
{
value1 = value3;
}
if (value1 == value2)
{
value1 = value3;
}
- in opcodes -
HEAPS 3
DEF value1 byte 1
DEF value2 byte 1
DEF value3 byte 2
BIF
ISEQL value1 value2
ISGRT value3 value2
CIF
EQL value1 value3
EIF
BIF
ISEQL value1 value2
CIF
EQL value1 value3
EIF
compiled script lol
0x15, 0x11, 0x03, 0x01, 0x18, 0x00, 0x01, 0x11, 0x01, 0x01, 0x01, 0x18, 0x00, 0x11, 0x01, 0x11,
0x01, 0x01, 0x18, 0x00, 0x11, 0x01, 0x11, 0x02, 0x09, 0x10, 0x18, 0x02, 0x18, 0x01, 0x0E, 0x18,
0x00, 0x18, 0x01, 0x0A, 0x00, 0x18, 0x02, 0x18, 0x00, 0x0B, 0x09, 0x10, 0x18, 0x02, 0x18, 0x01,
0x0A, 0x00, 0x18, 0x02, 0x18, 0x00, 0x0B
----------
if ((a == b AND a > c) OR c == b)
IF #begins if statement? maybe pointless
ISEQL c b #if c & b are equal, jump to
ISGRT
ISTRUE
#code goes here
ELSE
#else code here
EIF