xyw.c
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 |
#include <stdio.h>
#include <string.h>
#include "xyw.h"
int xyw_debug = 0;
//// Main Function
int main(int argc, char *argv[])
{
(void)argc;
for (int i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0)
{
xyw_debug = 1;
}
}
// If first argument is a file ending in .xyw, assemble it
if (argc >= 2)
{
const char *input_file = argv[1];
// Output file is the same as input but with .rom extension
char output_file[256];
snprintf(output_file, sizeof(output_file), "%.*s.xywi", (int)(strlen(input_file) - 4), input_file);
if (xyw_assemble(input_file, output_file) != 0)
{
fprintf(stderr, "Assembly failed for file: %s\n", input_file);
return -1;
}
}
else
{
fprintf(stderr, "Usage: %s <input_file.xyw>\n", argv[0]);
return -1;
}
}
|