all repos — xyw @ 9f7a8f5cc12f0c2e32bd0542b1b5245cab70c7f3

A minimal virtual machine and assembler for terminals.

Removed header for now.
h3rald h3rald@h3rald.com
Thu, 04 Dec 2025 11:29:45 +0100
commit

9f7a8f5cc12f0c2e32bd0542b1b5245cab70c7f3

parent

bcad9167dd8ace3b091eb24eff747eff1f900f5e

2 files changed, 4 insertions(+), 16 deletions(-)

jump to
M xywasm.cxywasm.c

@@ -70,11 +70,11 @@

// Tracks whether we are inside a directive or not static unsigned int directive = 0; -// Bytecode to be written, including header -xyw_byte data[0xffff] = {(xyw_byte)0x0F, (xyw_byte)'x', (xyw_byte)'y', (xyw_byte)'w', (xyw_byte)0x00, (xyw_byte)0xF0}; +// Bytecode to be written +xyw_byte data[0xffff] = {}; -// Current write pointer starts after header -xyw_word ptr = 6; +// Current write pointer +xyw_word ptr = 0; // Flat single-string "dictionary" for symbols (macros and labels) // Removing 768 bytes to leave room for devices and stacks
M xywrun.cxywrun.c

@@ -320,18 +320,6 @@ {

fprintf(stderr, "Error - Could not open file [%s]\n", input); return -1; } - // Check header - xyw_byte header[6]; - xyw_dbg("Reading header from file [%s]\n", input); - fread(header, 1, 6, fp); - if (header[0] != 0x0F || header[1] != 'x' || header[2] != 'y' || header[3] != 'w' || header[4] != 0x00 || header[5] != 0xF0) - { - fprintf(stderr, "Error - Invalid file header [%s]\n", input); - fclose(fp); - return -1; - } - xyw_dbg("File header OK\n"); - // Load the rest of the file into memory size_t bytes_read = fread(&xyw_memory[USER_MEMORY_START], 1, MEMORY_SIZE - USER_MEMORY_START, fp); if (bytes_read == 0) {