shithub: orca

Download patch

ref: 84a4ce4f7aab51c82b94f32f6b1e678b35f7b907
parent: 3946701d85b15315ec07198b32f6fee2a98f2d29
author: cancel <cancel@cancel.fm>
date: Wed Nov 28 13:14:39 EST 2018

Add 'F'

--- a/sim.c
+++ b/sim.c
@@ -260,6 +260,7 @@
   _('W', 'w', west)                                                            \
   _('Z', 'z', southeast)                                                       \
   _('A', 'a', add)                                                             \
+  _('F', 'f', if)                                                              \
   _('G', 'g', generator)                                                       \
   _('H', 'h', halt)                                                            \
   _('I', 'i', increment)                                                       \
@@ -297,6 +298,22 @@
   REALIZE_DUAL;
   STOP_IF_DUAL_INACTIVE;
   POKE(1, 0, glyphs_add(PEEK(0, 1), PEEK(0, 2)));
+END_PHASE
+
+BEGIN_DUAL_PHASE_0(if)
+  REALIZE_DUAL;
+  BEGIN_DUAL_PORTS
+    PORT(0, 1, IN);
+    PORT(0, 2, IN);
+    PORT(1, 0, OUT);
+  END_PORTS
+END_PHASE
+BEGIN_DUAL_PHASE_1(if)
+  REALIZE_DUAL;
+  STOP_IF_DUAL_INACTIVE;
+  Glyph g0 = PEEK(0, 1);
+  Glyph g1 = PEEK(0, 2);
+  POKE(1, 0, g0 == g1 ? '1' : '0');
 END_PHASE
 
 BEGIN_DUAL_PHASE_0(generator)