commit b1fb65453377605f224141a3e96679be6891fc0f
parent 135b4f4aa84f8a7a5f27683899c48e951f32dede
Author: Brian Swetland <swetland@frotz.net>
Date: Sun, 29 Jun 2025 12:45:47 -0700
sr32asm: allow multiple pieces of test data per line
Comma separated, like so:
//< 1, 2, 3, 4
Diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/softrisc32/src/sr32emu.c b/softrisc32/src/sr32emu.c
@@ -109,12 +109,24 @@ void load_test_data(const char *fn) {
char *x;
uint32_t n;
if ((x = strstr(line, "//>"))) {
- n = strtoul(x + 3, 0, 0);
- outdata[outcount++] = n;
+ x += 3;
+ for (;;) {
+ n = strtoul(x, &x, 0);
+ outdata[outcount++] = n;
+ x = strchr(x, ',');
+ if (x == NULL) break;
+ x++;
+ }
}
if ((x = strstr(line, "//<"))) {
- n = strtoul(x + 3, 0, 0);
- indata[incount++] = n;
+ x += 3;
+ for (;;) {
+ n = strtoul(x, &x, 0);
+ indata[incount++] = n;
+ x = strchr(x, ',');
+ if (x == NULL) break;
+ x++;
+ }
}
}
fclose(fp);