TIS-100 For Mac

/ Comments off

And TIS-100 resembles programming in a stripped down Erlang-like mode. HRM is a great starter into the Genre, it's sure. But Spacechem is on a totally different level of complexity and beauty and depth. TIS-100 is an open-ended programming game in which you rewrite corrupted code segments to repair the TIS-100 and unlock its secrets. It's the assembly language programming game you never asked for! Print and explore the TIS-100 manual, which details the inner-workings of the TIS-100 while evoking the aesthetics of a vintage computer manual! TIS-100 is an open-ended programming game in which you rewrite corrupted code segments to repair the TIS-100 and unlock its secrets. It's the assembly language programming game you never asked for! Print and explore the TIS-100 manual, which details the inner-workings of the TIS-100 while evoking the aesthetics of a vintage computer manual!

  1. Tis-100 For Macbook
  2. Tis-100 For Macbook Pro
  3. Tis-100 For Mac Os
  4. Tis-100 Mac Download
  5. Tis-100 For Macbook Air

Recently I became infatuated with TIS-100, a game which aptlydescribes itself as “the assembly language programming game you never asked for!”

The point of the game is to program the (imaginary) TIS-100 CPU to solve problems. For example,you might need to take input from two ports and swap them, then write the outputs to two otherports.

Tis-100 For Macbook

The game flies in the face of all modern game design: The first thing you need to do is sit andread a 14 page PDF that outlines the TIS-100 instruction set. And when I say “read”, I mean “learn”,because a quick skim is not going to cut it! There are no tutorial levels or handholding.You must read the manual.

After solving the first few problems and feeling good about myself, I approached some of myprogrammer friends and tried to get them to buy the game so I could compare my solutionsto theirs. I swear I tried bringing this up with 3 people and had the exact same conversation:

Them: “So, it’s a game about programming…”

Me: “Yes, it’s so much fun!”

Them: “But I program all day.”

Me: “Me too!”

Them: “The last thing I want to do when I come home is program again”

awkward silence

Macbook

Them: “You’re nuts.”

The rabbit hole goes deeper

Despite not having any close friends to play with, I plowed through the puzzles in the game. One inparticular was quite devious; The TIS-100 is, as I mentioned, an imaginary CPU. And it is clearlydesigned to be puzzling rather than practical. It has only two registers, and one is a backup thatcannot be addressed directly. This afformentioned puzzle involved taking the input of two numbersand dividing one by the other. You then output the resulting quotient to one port and theremainder to another.

It was quite fun to work through, but to my dismay my solution was quite inefficient. If Iclicked the regular “Play” button to execute it it would take several minutes to finish.Even if I ran it in “Fast” mode it would take about 5 seconds to complete successfully.

This was obviously unacceptable.

A typical person might call it a day and say, “well, the realvictory is solving the puzzle!”. Another, more eccentric person might spend the timefiguring out how to optimize their solution so it executes in less time. And then there’s me.

Introducing my TIS-100 emulator

I decided the most logical thing to do was to implement the TIS-100 CPU myself in pure C.This seemed like a good idea to me despite having not used C in about 15 years.

Amazingly, most of the concepts came back fairly quickly. Maybe C is like riding a bike?Maybe using so much Javascript (and its C syntax) kept me on the ball? I’m not sure.

I first wrote a parser to input the TIS-100 assembly language as defined in game. It writesit to memory in byte code, which is then interpreted. The resulting performance is reallyimpressive!

The Unity version of TIS-100 that runs on my Mac executes my division program in about5 seconds, which is an eternity as far as programs go! My C emulator runs the code in asleek 0.005s, or roughly 1000x faster!

The full source code is on GitHub, so feel free todownload it and check it out. I’ll even accept pull requests as I’m sure there’s a lot ofroom for improvement.

Why did I spend my time on this pointless project?

I try to not use the word “crazy” often because I don’t want to trivialize mental illness,but let’s be honest: I have to be a least a little off base to attempt a project like this.Programming is a legitimate hobby of mine. I make a living at it but I also do it in myspare time. TIS-100 was a perfect storm of programming and fun, and I didn’twant it to end.

Obivously I’m not the only onewho enjoyed the game, so there is a market for this kind of thing. Maybe this isthe long tail of games?

All I know is I had a lot of fun doing it, and I hope someone has fun with myemulator. Let me know if you do!

TIS-100 For Mac

See Also

  • Graphics Display - How the 'visualization module' functions.

Speed

The TIS-100 runs at 50 Hz in RUN mode, 5,000 Hz in FAST mode, and 25 Hz when the STEP key (F6) is held down. (Holding the STEP button down only runs a single step.) Most assembly instructions run in a single cycle; MOV takes two cycles under some circumstances.

Overall Node Behavior

The behavior of using ANY as a destination suggests that nodes are evaluted starting at the upper left, moving left to right, and advancing down one row and returning to the left edge upon reaching the end of a row. This behavior is not guaranteed and may change.

Comments

The character # and any characters after it on a line are ignored. Comments may follow a label or opcode and arguments.

Characters following ## are treated as the program's title and are displayed in the menu. The ## does not need to be the start of comment. Spaces one the left and right side of the title are discarded. If multiple entries with ## are present, TIS-100 searches starting in the upper left node, searching from top to bottom inside of the node's assembly. If nothing is found, TIS-100 moves from left to right and repeats the search for the assembly in each node. Upon reaching the right edge, TIS-100 moves to the left of te next row down and repeats the procedure.

Title is 'B':

Title is '#### C ####':

Title is 'D':

Title is 'D':

Labels

Tis-100 For Macbook Pro

A label, if present, must be the first thing on the line. It is terminated with a : which must be immediately adjacent to the label. Valid characters for labels are the letters A through Z, the digits 0 through 9, and the punctuation in the set of ~`$%^&*()_-+={}[] ;'<>,.?/ . There are no limitations on which characters may be in which positions of the label. A line may only have a single label. A label must have at least one character before the colon. Labels may be up to 18 characters long, but the longest addressable label is 14 characters.

Storage

ACC - Accumulator. Register. Can be used as a source or destination. Initialized to 0. Reads and writes are instantaneous.

BAK - Backup. Register. Only SAV and SWP interact with BAK. The identifier “BAK” is never a valid identifier in a program.

NIL - Nothing. Register. Can be used as a source, in which case “0” is returned. Can be used as a destination, which which case the value is discarded.

UP, DOWN, LEFT, RIGHT - Connections to adjacent nodes. Ports. Can be used as a source or a destination. When used as a destination, the value cannot be read by the adjacent node in the same cycle that it was written to. Blocks until a destination value is used as a source by the adjacent node or a source is used as a destination by an adjacent node.

ANY - Port. Can be used as a source, in which case the value will be read from the first port with a waiting value, as searched in the order LEFT, RIGHT, UP, DOWN. Can be used as a destination, in which case the value is available to all ports; it will be cleared from all ports as soon as any adjacent node reads it. Assuming all adjacent points try to read simulataneously, the winner will be selected in the order UP, LEFT, RIGHT, and DOWN. The search order is not formally part of the TIS-100 description, so it may change in future releases.

LAST - Port. Refers to the same port used by the last reference to ANY, either in read or write. If ANY has not been used, attempts to use LAST as a source will return 0, while attempts to use LAST as a destination will block forever.

source can be ACC, NIL, UP, DOWN, LEFT, RIGHT, ANY, LAST, or an integer from −999 through 999, inclusive. If the value is an integer, it is used directory. Otherwise the register or port is read for the value to use.

destination can be ACC, NIL, UP, DOWN, LEFT, RIGHT, ANY, or LAST.

Opcodes

Each opcode has 0, 1, or 2 arguments. The opcode and arguments must be separated by at least one space or comma, but may be separated by any number of spaces or commas. The following are all equivalent:

NOP - No Operation - 1 cycle

Syntax:NOP

Does nothing.

MOV - Move - 1-2 cycles

Syntax:MOVsourcedestination

Reads a value from source and write it to destination. If source is a port, blocks until a value is present. If destination is a port, blocks until the value is received.

1 cycle when writing ACC or NIL.

2 cycles when writing to UP, DOWN, LEFT, or RIGHT, assuming the neighboring node is willing to retrieve the value on the second cycle. The data is not yet in the port until the end of the first cycle. This prevents a single value from travelling multiple nodes in a single cycle.

SWP - Swap - 1 cycle

Syntax:SWP

Swaps the values of ACC and BAK

SAV - Save - 1 cycle

Syntax:SAV

Copies the value of ACC to BAK

ADD - Add - 1 cycle

Syntax:ADDsource

The source value is added to the value in ACC, and the result placed in ACC. Results greater than 999 are limited to 999. Results less than −999 are limited to −999.

SUB - Subtract - 1 cycle

Syntax:SUBsource

The source value is subtracted to the value in ACC, and the result placed in ACC. Results greater than 999 are limited to 999. Results less than −999 are limited to −999.

NEG - Negate - 1 cycle

Syntax:NEG

The value in ACC is negative (swapped between positive and negative) and written back into ACC. 0 is left unchanged.

JMP - Jump - 1 cycle

Syntax:JMPlabel

Transfer execution to the first instruction after label.

JEZ - Jump if equal to zero - 1 cycle

Syntax:JEZlabel

If the ACC is 0, transfer execution to the first instruction after label.

JNZ - Jump if not equal to zero - 1 cycle

Syntax:JNZlabel

TIS-100 For Mac

If the ACC is not 0, transfer execution to the first instruction after label.

JGZ - Jump if greater than zero - 1 cycle

Syntax:JGZlabel

If the ACC is greater than 0, transfer execution to the first instruction after label.

Tis-100 For Mac Os

JLZ - Jump if less than zero - 1 cycle

Syntax:JLZlabel

If the ACC is greater than 0, transfer execution to the first instruction after label.

JRO - Jump relative offset - 1 cycle

Syntax:JROsource

Transfer execution to the offset specified by source. Offset is measured in instructions. Negative offsets can be used to move jump backward, positive offsets to jump forward, or 0 to execute the JRO instruction again.

HCF - Reboot

Syntax:HCF

Tis-100 Mac Download

Causes the game to restart. Halt and Catch Fire. As execution of this instruction terminates the active run, it cannot be used in a puzzle solution.

Tis-100 For Macbook Air

CopyrightCopyright 2015 Alan De Smet.This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.Fork this on GitHub!