Update behavior of `I`
@@ -489,14 +489,22 @@ BEGIN_OPERATOR(increment)
PORT(0, 1, IN);
PORT(0, 2, IN);
PORT(1, 0, IN | OUT);
- Usz min = index_of(PEEK(0, 1));
- Usz max = index_of(PEEK(0, 2));
+ Usz a = index_of(PEEK(0, 1));
+ Usz b = index_of(PEEK(0, 2));
Usz val = index_of(PEEK(1, 0));
+ if (a < b) {
+ if (val < a || val >= b - 1)
+ val = a;
+ else
++val;
- if (max == 0)
- max = 10;
- if (val >= max)
- val = min;
+ } else if (a > b) {
+ if (val <= b || val > a)
+ val = a - 1;
+ else
+ --val;
+ } else {
+ return;
+ }
POKE(1, 0, glyph_of(val));
END_OPERATOR
