shithub: orca

Download patch

ref: 20de73bb10a09a52c2be23acddb7cabbd6e6644d
parent: 8963d7d7959f3c4e55128c44e139e98aea74f5a1
author: Devine Lu Linvega <aliceffekt@gmail.com>
date: Mon May 20 16:10:56 EDT 2019

Replace modulo with multiply operator, fixes #24

--- a/sim.c
+++ b/sim.c
@@ -577,12 +577,12 @@
 
 BEGIN_OPERATOR(modulo)
   LOWERCASE_REQUIRES_BANG;
+  PORT(0, -1, IN);
   PORT(0, 1, IN);
-  PORT(0, 2, IN);
   PORT(1, 0, OUT);
-  Usz ia = index_of(PEEK(0, 1));
-  Usz ib = index_of(PEEK(0, 2));
-  POKE(1, 0, indexed_glyphs[ib == 0 ? 0 : (ia % ib)]);
+  Usz ia = index_of(PEEK(0, -1));
+  Usz ib = index_of(PEEK(0, 1));
+  POKE(1, 0, indexed_glyphs[ia * ib]);
 END_OPERATOR
 
 BEGIN_OPERATOR(offset)