-
Notifications
You must be signed in to change notification settings - Fork 0
/
os.txt
52 lines (49 loc) · 1.02 KB
/
os.txt
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
def main() {
var program_names = vector_new(4);
var program_locations = vector_new(4);
/* @INSERT_PROGRAMS */
/*vector_push(program_names, "foo");
vector_push(program_locations, :foo);
vector_push(program_names, "bar");
vector_push(program_locations, :bar);
vector_push(program_names, "baz");
vector_push(program_locations, :baz);*/
while (1) {
io_clear();
echo "bdel and dfr os";
io_endl();
io_endl();
echo "programs";
io_endl();
var i = 0;
while (i < vector_size(program_names)) {
io_puthex(i);
io_putchar(' ');
io_printstring(vector_get(program_names, i));
io_endl();
i = i + 1;
}
io_endl();
echo "run program ";
var x = io_readhex();
io_endl();
if (x < 0 || x >= vector_size(program_names)) {
echo "invalid";
io_wait();
} else {
io_clear();
var address = vector_get(program_locations, x);
asm {
#load 1 r0;
#stack 1;
#store r14 1;
#literal :os_return r14;
#jump r0;
#os_return:;
#load 1 r14;
#stack -1;
};
io_wait();
}
}
}