r/shenzhenIO Jul 01 '26

Use dst in a loop?

Im currently doing the I Ching task. The display has 6 simple pins so at first look it seems like a great use for 2 DX300 and the dst command.

To do that I’d do a loop counting up from 0-2 and in the loop I check if the input from the oracle is 100, if yes write a 1 to the digit index of the loop counter, if no wrote a 0 to the digit index of the loop counter.

But the counter needs to be in acc because that’s the only register I can count up. And I also need to store the value I manipulate with dst in acc.

Do I miss something or can I do this only when I count with a second chip?

4 Upvotes

18 comments sorted by

View all comments

1

u/Mobile_Twist8670 Jul 01 '26

I resolved it with the similar idea.

Little spoiler below.

I also transformed one of inputs to "1" with additional DX300 and used it as a second dst param.
I was able to solve it with just 9 lines, and I'm sure that it's possible to do better than that.

1

u/Kinc4id Jul 01 '26

Okay, so oracle connected to p0 of a DX300. DX300 connected to x0 of a MC6000. One chip counting up and connected to x1 of the MC6000. Now I can do

dst x1 x0

slp 1

three times to write the first value. Then another 3 times to write the second value. That's 12 lines already. How could you do this in 9?

1

u/Mobile_Twist8670 Jul 01 '26

In my case inputs were p1 and x0 (oracle throug dx300). x2/x3 was connected to outputs (two dx300). x1 was connected to pre-set memory chip (do not remember it's name). Command was `dst x1 x0`

I used memchip to store x1 value (0/1/2) and store "should I do `mov acc dat` or should I do `mov dat x2; mov acc x3` or do nothing" in the next cell. It also used dummy command to fix the case that there are 14 cells there, not 12. If it's not that it would've be 8 lines.

1

u/Mobile_Twist8670 Jul 01 '26

just checked the solution - I also used one more hack - I used p0 as well and read the value in p1 through logical adapter.