r16/asm/main.c

26 lines
562 B
C
Raw Normal View History

2024-04-22 13:05:10 +00:00
#include "../lib/carg-parse/carg-parse.h"
#include "./asm_const.h"
2024-12-10 10:50:54 +00:00
#include "./assembler.h"
2024-04-22 13:05:10 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
2024-12-10 10:50:54 +00:00
const char demo[] =
2024-12-10 11:03:41 +00:00
"mov R0, 0x1\n\
mov ACU, 0x0\n\
2024-12-17 10:09:20 +00:00
add ACU, R0\n\
2024-12-10 11:03:41 +00:00
out ACU, 0x0\n\
2024-12-17 10:09:20 +00:00
jmp 0x8, 0x0\n";
2024-12-10 10:50:54 +00:00
2024-04-22 13:05:10 +00:00
int main(int argc, char **argv)
{
carg_parse_data* args = carg_parse(argc, argv);
2024-12-10 10:50:54 +00:00
AsmInstructionArray* abin = InterpretAssembly(/*args->values[0]*/ demo);
AsmLabelArray* labels = GenerateLabels(abin);
uint16_t* bin = CompileAsembly(abin, labels);
2024-04-22 13:05:10 +00:00
carg_parse_free(args);
return 0;
}