-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (32 loc) · 1.13 KB
/
main.cpp
File metadata and controls
34 lines (32 loc) · 1.13 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
#include <iostream>
#include "vm/vm.hpp"
#include "ss_asm/ss_asm.hpp"
#define DEBUG
#undef DEBUG
int main(int argc, char** argv)
{
ss_asm::ss_asm assembler;
std::cout << ("This will be out main entry point\n");
std::vector<uint64_t> program{
assembler.make_code(types::INSTRUCTIONS, instructions::PUSH),
assembler.make_code(types::INTEGER, 256),
assembler.make_code(types::INSTRUCTIONS, instructions::PUSH),
assembler.make_code(types::CHARACTER, '\n'),
assembler.make_code(types::INSTRUCTIONS, instructions::WRITE),
assembler.make_code(types::INSTRUCTIONS, instructions::POP),
assembler.make_code(types::INSTRUCTIONS, instructions::WRITE),
assembler.make_code(types::INSTRUCTIONS, instructions::POP),
assembler.make_code(types::INSTRUCTIONS, instructions::HALT)};
vm::stack_vm ss_vm(program);
#ifdef DEBUG
for (uint64_t& code:program)
{
std::cout << "op code:" <<
"\n\t| type: " << (uint16_t) ss_vm.get_type(code) << " | "
"\n\t| data: " << ss_vm.get_data(code) << " | "
"\n";
}
#endif // DEBUG
ss_vm.run();
return 0;
}