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[] =
|
|
|
|
"mov R0, 1\n\
|
|
|
|
mov ACU, 0\n\
|
|
|
|
loop: add ACU, R0\n\
|
|
|
|
out ACU\n\
|
|
|
|
jmp loop\n";
|
|
|
|
|
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;
|
|
|
|
}
|