/*
* TODO:
- * - time limit
* - error messages
* - debugging/play mode
* - we probably have to disable NOP
#include <math.h>
static int trace = 3;
+static int cpu_quota = -1;
+static int print_quota = -1;
// Minsk-2 has 37-bit words in sign-magnitude representation (bit 36 = sign)
typedef unsigned long long int word;
*/
if (r & 4)
{
+ if (print_quota > 0 && !--print_quota)
+ stop("OUT OF PAPER");
for (int i=0; i<128; i++)
{
int ch = linebuf[i];
memset(linebuf, 0, sizeof(linebuf));
if (r & 1)
putchar('\n');
- else
+ else if (r & 4)
putchar('\r');
fflush(stdout);
}
}
ip = (ip+1) & 07777;
+ if (cpu_quota > 0 && !--cpu_quota)
+ stop("TIMED OUT");
+
/* Arithmetic operations */
word a, b, c;