Skip to content

Comment on Designing Zachtronics' TIS-100

Comments

This game is brilliant, in case you haven't tried it. Also, it will teach you the true fury of stream programming with only twelve instructions and a single addressable register.

The instruction set design really deserves praise: people who haven't done assembly before report picking it up without too much trouble, and it manages to fit several opportunities for subtle tricks in the space of the 13 instructions.

The moment you realize that you can use JRO with a direction to control flow from another node, it feels like a genuine revelation while being immediately obvious and logical in hindsight.

Well I hadn't realized that. This. Changes. Everything.

JRO UP? As in pulling in a value from the up port. I didn't see how that gives me a whole lot since wouldn't I need to know in the other node what the offset would be? I considered that this would be valid, but I couldn't see a way to make it really useful.

It allows you to use another processor to do control flow based on an input, freeing up cpu time. For example, suppose you wanted to emit to DOWN:

   0 if LEFT is <= 0
   UP if LEFT is > 0
So you have two options
   S: MOV LEFT ACC
   JGE E
   MOV 0 DOWN
   MOV UP NIL
   JMP S
   E: MOV UP DOWN
Or you could do this:
   S: JRO LEFT
   MOV UP NIL
   MOV 0 DOWN
   JMP S
   MOV UP DOWN
And left would send 1 if its value is <= 0, or 4 if it's >0. In this case it only saves one cycle for the node under consideration, but it could be a good deal more if the conditional is more involved.

This is much more familiar than the assembly in 0x10c. I haven't tried JRO with ports yet! I just assumed it would be an illegal operation :) Real instruction sets are clouding my mind.

I was having trouble just last night: "Just one more instruction in this cell! Just one more, please!"

I did notice that you can shorten labels to fit another line of code in, though :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.