(uxnasm) Explicit error for empty rom

This commit is contained in:
Lobo Torres 2024-03-29 15:35:08 -03:00 committed by Devine Lu Linvega
parent 3fda89b609
commit 618dc4e843
1 changed files with 5 additions and 4 deletions

View File

@ -400,9 +400,10 @@ main(int argc, char *argv[])
{ {
ptr = PAGE; ptr = PAGE;
copy("on-reset", scope, 0); copy("on-reset", scope, 0);
if(argc == 1) return error_top("usage", "uxnasm [-v] input.tal output.rom"); if(argc == 2 && scmp(argv[1], "-v", 2)) return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 29 Mar 2024.\n");
if(scmp(argv[1], "-v", 2)) return !fprintf(stdout, "Uxnasm - Uxntal Assembler, 29 Mar 2024.\n"); if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom");
if(!assemble(argv[1]) || !length) return !error_top("Assembly", "Failed to assemble rom."); if(!assemble(argv[1])) return !error_top("Assembly", "Failed to assemble rom.");
if(!length) return !error_top("Assembly", "Output rom is empty.");
if(!resolve()) return !error_top("Assembly", "Failed to resolve symbols."); if(!resolve()) return !error_top("Assembly", "Failed to resolve symbols.");
if(!build(argv[2])) return !error_top("Assembly", "Failed to build rom."); if(!build(argv[2])) return !error_top("Assembly", "Failed to build rom.");
return 0; return 0;