LIVM/main.c

38 lines
700 B
C
Raw Normal View History

2022-02-15 21:55:22 +03:00
/*
(C) M. Æ.
*/
2022-02-14 15:18:13 +03:00
#include <stdio.h>
#include <stdlib.h>
2022-04-09 00:20:48 +03:00
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
2022-02-14 15:18:13 +03:00
#include <inttypes.h>
#include <math.h>
2022-04-09 00:20:48 +03:00
// #define LIVMDEBUG
// #define LLLIVMDEBUG
2022-02-15 21:55:22 +03:00
#include "livm.c"
2022-02-14 15:18:13 +03:00
uint64_t str2u64(char* data) {
uint64_t* result = (uint64_t*)data;
return *result;
}
2022-02-15 21:55:22 +03:00
int main() {
2022-04-09 00:20:48 +03:00
struct VMinst vm = createVM(512); // alloc 256 bytes
2022-02-15 21:55:22 +03:00
uint64_t vmram[] = { // "proper" way to write out "Hello, LIVM!"
2022-04-09 00:20:48 +03:00
#include "out.fx"
2022-02-15 21:55:22 +03:00
};
loadRAM(&vm, vmram, sizeof vmram / sizeof(uint64_t));
2022-04-09 00:20:48 +03:00
//print_ullram(&vm);
2022-02-15 21:55:22 +03:00
//uint64_t dt[] = {5485433203209299272, 7810728294139909705, 0};
//puts(((char*)dt));
runVM(&vm);
2022-04-09 00:20:48 +03:00
//print_ullram(&vm);
2022-02-15 21:55:22 +03:00
deleteVM(&vm);
return 0;
}