shithub: orca

Download patch

ref: 32ca897ef95687a9787453b3d1fc3c80488bfa81
parent: d395999d30f90756a252c7e4c1d5e912eb6114ca
parent: 762337b0f6064391186499f82c6088607b7a75d5
author: cancel <cancel@cancel.fm>
date: Mon Jan 28 06:30:33 EST 2019

Merge pull request #11 from npisanti/master


--- a/sim.c
+++ b/sim.c
@@ -1,6 +1,6 @@
+#include "sim.h"
 #include "gbuffer.h"
 #include "mark.h"
-#include "sim.h"
 
 //////// Utilities
 
@@ -651,7 +651,7 @@
   }
   Usz key = y * width + x;
   key = hash32_shift_mult((y * width + x) ^ (Tick_number << UINT32_C(16)));
-  Usz val = key % (max + 1 - min) + min;
+  Usz val = key % (max - min) + min;
   POKE(1, 0, glyph_of(val));
 END_OPERATOR
 
@@ -706,13 +706,15 @@
   LOWERCASE_REQUIRES_BANG;
   PORT(0, -1, IN | PARAM);
   PORT(0, 1, IN | PARAM);
-  PORT(1, 0, OUT);
   Glyph left = PEEK(0, -1);
   Glyph right = PEEK(0, 1);
-  if (right == '.')
+  if (right == '.') {
+    PORT(1, 0, OUT);
     return;
+  }
   if (left == '.') {
     // Read
+    PORT(1, 0, OUT);
     Usz var_idx = safe_index_of(right);
     Glyph result = extra_params->vars_slots[var_idx];
     if (result == '.')