ref: 9c55802d55c88e2464d9555f4d5770f30b6a3e91
parent: 762337b0f6064391186499f82c6088607b7a75d5
author: Nicola Pisanti <nicola@npisanti.com>
date: Tue Feb 5 17:29:08 EST 2019
porting of K operator from orcaJS
--- a/sim.c
+++ b/sim.c
@@ -230,7 +230,7 @@
_('H', halt) \ _('I', increment) \ _('J', jump) \- _('K', kill) \+ _('K', konkat) \ _('L', loop) \ _('M', modulo) \ _('N', movement) \@@ -535,10 +535,23 @@
POKE(1, 0, PEEK(-1, 0));
END_OPERATOR
-BEGIN_OPERATOR(kill)
+BEGIN_OPERATOR(konkat)
LOWERCASE_REQUIRES_BANG;
- PORT(1, 0, OUT);
- POKE(1, 0, '.');
+ Isz len = (Isz)index_of(PEEK(0, -1));
+ if (len == 0) len = 1;
+ PORT(0, -1, IN | PARAM);
+ for ( Isz i = 0; i < len; ++i) {+ PORT(0, i+1, IN);
+ Glyph var = PEEK(0, i+1);
+ Usz var_idx = safe_index_of(var);
+ if( var_idx != 0 ){+ Glyph result = extra_params->vars_slots[var_idx];
+ if (result != '.'){+ PORT(1, i+1, OUT);
+ POKE(1, i+1, result);
+ }
+ }
+ }
END_OPERATOR
BEGIN_OPERATOR(loop)
--
⑨