Implemented assembler.
h3rald h3rald@h3rald.com
Fri, 28 Nov 2025 14:47:16 +0100
M
xyw.c
→
xyw.c
@@ -119,7 +119,6 @@ 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) { - // TODO: Standardize errors fprintf(stderr, "Assembly failed for file: %s\n", input_file); return -1; }
M
xywasm.c
→
xywasm.c
@@ -527,8 +527,6 @@ if (validate_symbol(ctx, token, token_length) != 0)
{ return -1; } - // TODO: Remove - printf("Symbol:\t\t%s\n", token); token_type = TOKEN_TYPE_SYMBOL; if (!directive) {@@ -538,7 +536,7 @@ {
xyw_symbol *sym = &symbols[i]; if (sym->type == SYMBOL_TYPE_MACRO) { - printf("-> Macro:\t%s\n", sym->contents); + printf("Macro:\t\t%s -> %s\n", token, sym->contents); ctx->sp = sym->contents; assemble_string(ctx); ctx->src = SRC_FILE;@@ -559,7 +557,7 @@ }
else { // Store reference to be resolved later - printf("-> Reference:\t%s\n", token); + printf("Reference:\t%s\n", token); if (ref(ctx, token) != 0) { return -1;@@ -624,7 +622,10 @@ if (validate_single_directive_argument(ctx, r) != 0)
{ return -1; } - return assemble_file(&include_ctx); + printf("-> Accessing:\t%s\n", include_ctx.file); + int result = assemble_file(&include_ctx); + printf("<- Continuing:\t%s\n", ctx->file); + return result; } static int process_directive_string(xyw_context *ctx)@@ -1018,10 +1019,10 @@ return -1;
} // Patch the data at the reference address with the label address write(refsym->address, defsym->address); - printf("Patched:\t%s -> $%04X @ $%04X\n", defsym->name, defsym->address, refsym->address); + printf("Patch:\t\t%s -> $%04X @ $%04X\n", defsym->name, defsym->address, refsym->address); } fwrite(data, 1, ptr, fp); fclose(fp); - printf("Assembled %s successfully (%d bytes - %d symbols - %d refs).\n", input, ptr, symcount, refcount); + printf("File '%s' assembled successfully [%d bytes - %d symbols - %d refs]\n", input, ptr, symcount, refcount); return 0; }