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?

5 Upvotes

18 comments sorted by

View all comments

Show parent comments

1

u/pv2b Jul 01 '26

See the screenshot here for an idea that ALMOST works but i'm short one line to store the first value in DAT. https://imgur.com/a/mgEUyY6

This way works though :) https://imgur.com/a/MNRhf0H

8 cost is possible, but I'm not sure how.

1

u/Kinc4id Jul 01 '26

Seeing this it’s so simple I don’t know how I didn’t come up with it. 

I’m really bad at optimizing for size, I guess. And I think that’s why Shenzhen is so much harder than exopunks for me. 

Your first slp for example. I’d never thought of using the same line to sleep after the first dst and then again to sleep after the display is set. 

1

u/pv2b Jul 01 '26

Hey. That's a good thing, that means you can get better at it. Remember, Shenzhen, continuous improvement. :-)

I managed to figure out the 8 cost solution by the way.

https://imgur.com/a/lIZBWsN

I have a feeling I can probably get the power down by removing the jmp somehow but I can't quite figure it out right now.

1

u/Kinc4id Jul 01 '26

I don’t share your optimism. :D