commit 41546343e536c2483d253d4ddf24092beb7563e1
parent 1c7a14282ed870b093d7bdb37b815821bfa6106e
Author: bsandro <brian.drosan@gmail.com>
Date: Tue, 25 Jan 2022 02:54:30 +0200
small cleanup
Diffstat:
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/main.c b/main.c
@@ -1,4 +1,4 @@
-#pragma gcc_extensions on
+#pragma gcc_extensions on
#include <stdio.h>
#include <assert.h>
@@ -16,7 +16,7 @@
#define _HTONL
#endif
-#define FILENAME "stage2.um"
+#define FILENAME "SANDMARK.UMZ"
#define PLATTER_SIZE 4
struct array_t {
@@ -78,19 +78,14 @@ int main(int argc, char *argv[])
assert(f != NULL);
stat(fname, &fileinfo);
assert(fileinfo.st_size % PLATTER_SIZE == 0);
- //printf("%s (%lu bytes):\n", fname, fileinfo.st_size);
array_new(&state->arena, fileinfo.st_size / PLATTER_SIZE); // Initial array #0
read_platters = fread(state->arena.arrays[0].data, PLATTER_SIZE, fileinfo.st_size / PLATTER_SIZE, f);
assert(fileinfo.st_size == read_platters * PLATTER_SIZE);
- //printf("read ok, %lu platters (%lu bytes)\n", read_platters, state->arena.arrays[0].size);
fclose(f);
- fflush(stdout);
-
while (1) {
struct instruction_t instruction = {0};
uint32_t platter = _NTOHL(state->arena.arrays[0].data[state->finger]);
- //printf("[%s]", int2bin(platter));
instruction.opcode = platter >> 28;
if (instruction.opcode == ORTH) {
instruction.reg_a = (platter >> 25) & 7;
@@ -100,14 +95,10 @@ int main(int argc, char *argv[])
instruction.reg_b = (platter & 56) >> 3; // mask 000 111 000 = 56
instruction.reg_c = platter & 7; // mask 000 000 111 = 7
}
- //printf("[%2d][%8x]\n", state->finger, platter);
- //print_instruction(&instruction);
state->finger++;
exec_instruction(state, &instruction);
- //sleep(1);
}
- //getchar(); // in case SIOUX starts closing the window after exec again
return 0;
}
@@ -199,16 +190,12 @@ void array_free(struct arena_t *arena, uint32_t index) {
assert(index < arena->size);
free(arena->arrays[index].data);
arena->arrays[index].size = 0;
- //printf("freed array %lu\n", index);
}
void array_dup(struct arena_t *arena, uint32_t index) {
assert(index < arena->size);
array_free(arena, 0);
- //printf("attempting malloc...\n");
arena->arrays[0].data = (uint32_t *)malloc(arena->arrays[index].size * PLATTER_SIZE);
- //printf("attempting memcpy...\n");
memcpy(arena->arrays[0].data, arena->arrays[index].data, arena->arrays[index].size * PLATTER_SIZE);
arena->arrays[0].size = arena->arrays[index].size;
- //printf("memcpy ok\n");
}
diff --git a/umx b/umx
Binary files differ.