(uxnasm) Move setup in main
This commit is contained in:
parent
26c8d5f6e7
commit
b1ec78a806
12
src/uxnasm.c
12
src/uxnasm.c
|
@ -462,14 +462,6 @@ resolve(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
assemble(char *filename)
|
||||
{
|
||||
p.ptr = 0x100;
|
||||
scpy("on-reset", p.scope, 0x40);
|
||||
return doinclude(filename) && resolve();
|
||||
}
|
||||
|
||||
static void
|
||||
review(char *filename)
|
||||
{
|
||||
|
@ -510,9 +502,11 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *dst;
|
||||
p.ptr = 0x100;
|
||||
scpy("on-reset", p.scope, 0x40);
|
||||
if(argc == 1) return error_top("usage", "uxnasm [-v] input.tal output.rom");
|
||||
if(scmp(argv[1], "-v", 2)) return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 26 Mar 2024.\n");
|
||||
if(!assemble(argv[1])) return !error_top("Assembly", "Failed to assemble rom.");
|
||||
if(!doinclude(argv[1]) || !resolve()) return !error_top("Assembly", "Failed to assemble rom.");
|
||||
if(!(dst = fopen(argv[2], "wb"))) return !error_top("Invalid Output", argv[2]);
|
||||
if(p.length <= TRIM) return !error_top("Assembly", "Output rom is empty.");
|
||||
review(argv[2]);
|
||||
|
|
Loading…
Reference in New Issue