Processing metadata
h3rald h3rald@h3rald.com
Fri, 19 Dec 2025 12:49:55 +0100
1 files changed,
49 insertions(+),
0 deletions(-)
jump to
M
xywrun.c
→
xywrun.c
@@ -262,12 +262,59 @@ // Console device
{&xyw_memory[0xff10], 0, 0, console_output}, // Clock device {&xyw_memory[0xff20], clock_init, clock_input, 0}, + // File device + {&xyw_memory[0xff30], 0, 0, 0}, // Display device {&xyw_memory[0xff40], 0, display_input, display_output}, // ... }; // clang-format on +char *title, *description, *author, *date; +xyw_byte width, height; + +static void process_metadata() +{ + if ((xyw_memory[0x0003] == 0x1C | XYW_MODE_W) && xyw_memory[0x0004] == '-' && xyw_memory[0x0005] == '-' && xyw_memory[0x0006] == '-') + { + // JMPw found followed by ---, read metadata + xyw_word p = 0x0007; + + title = (char *)&xyw_memory[p]; + while (p < MEMORY_SIZE && xyw_memory[p] != 0) + p++; + if (p >= MEMORY_SIZE) + return; + p++; + + description = (char *)&xyw_memory[p]; + while (p < MEMORY_SIZE && xyw_memory[p] != 0) + p++; + if (p >= MEMORY_SIZE) + return; + p++; + + author = (char *)&xyw_memory[p]; + while (p < MEMORY_SIZE && xyw_memory[p] != 0) + p++; + if (p >= MEMORY_SIZE) + return; + p++; + + date = (char *)&xyw_memory[p]; + while (p < MEMORY_SIZE && xyw_memory[p] != 0) + p++; // skip date string + if (p >= MEMORY_SIZE) + return; + p++; + + if (p + 1 >= MEMORY_SIZE) + return; + width = xyw_memory[p++]; + height = xyw_memory[p++]; + } +} + //// Main run function int xyw_run(const char *input) {@@ -296,6 +343,8 @@ {
xyw_devices[i].init(xyw_devices[i].data); } } + // Process metadata + process_metadata(); // Set direct page to device page by default xyw_memory[SYSTEM_PAGE] = 0xff; // Initialize fenster