INS_SIZE was not a bracket table -- the run loop is the primitive for plus the counter scan, as designed -- but rot8_ins_init allocated the *translated* tape with a fixed 65536 entries, and rot8_run_hooked then wrote one entry per instruction. A 97307 character tape (examples/calc.r8asm assembled at cell 16) therefore wrote 32000 entries past the end of the heap block and died with 0xC0000005, which is why the wide calculators could not be cross checked here. rot8_ins_init now takes the length and mallocs it, rot8_run_hooked passes `step`, and read_tape_alloc's guard is back to ROT8_MAX_TAPE (16 M instructions) instead of INS_SIZE. Measured: cell 11, 62585 chars -> > 0046 cell 16, 97307 chars -> > 00046 (same as derive's 62 32 48 48 48 52 54 10) smoke unchanged: serial R8F, -n 512 1536 512 So the reference machine and both R8Forge machines now agree at a non default width as well, which is the first time the three implementations could be compared above 11 bits.
13 lines
340 B
C
13 lines
340 B
C
#ifndef ROT8_MEM_H
|
|
#define ROT8_MEM_H
|
|
#include "rot8/rot8.h"
|
|
|
|
void rot8_mem_init(rot8_data **mem); /* the configured number of cells */
|
|
void rot8_mem_init_size(rot8_data **mem, size_t cells);
|
|
void rot8_mem_free(rot8_data *mem);
|
|
|
|
void rot8_ins_init(rot8_bytecode **ins, rot8_ins_size length);
|
|
void rot8_ins_free(rot8_bytecode *ins);
|
|
|
|
#endif
|