Simulator for the pioneering TX-2 computer

Overview

TX-2 Simulator

We are trying to create a simulator for Lincoln Lab's historic TX-2 computer. Notably, this is the computer on which Ivan Sutherland's Sketchpad program ran.

From the Wikipedia entry for the TX-2:

The MIT Lincoln Laboratory TX-2 computer was the successor to the Lincoln TX-0 and was known for its role in advancing both artificial intelligence and human–computer interaction. Wesley A. Clark was the chief architect of the TX-2.

The OVERVIEW file explains the high-level design of the simulator.

To Build The Code

To be able to build the code, install the Rust build tools.

Trying It Out

Right now the simulator doesn't have enough I/O support to be usable interactively, and only implements enough instructions to get part-way through the boot process. So there is not much to see, yet.

To try it out, simply run

cargo run --bin cli

This will build the code (if necessary) and then run it.

Getting More Detail on the Internals

This section of the document explains how to get information about what the simulator is doing as it runs.

If you do want to see more detail, you can get it by setting the RUST_LOG environment variable when you run the code:

RUST_LOG=debug cargo run --bin cli

For even more detail:

RUST_LOG=trace cargo run --bin cli

Full details on how to configure the logging output are in the documentation for the tracing-subscriber crate, though the analogous docmenation for env_logger is probably more accessible.

Contributing

If you are considering contributing, first of all, thanks!

We have quite a lot of documentation about the operation and programming of the TX-2. This is what our implementation is based on.

Please see our Contributor's Guide for information on what we need and how you can help. The Guide also explains what non-coding contributions are needed and how to identify a good "first issue" to pick up.

Comments
  • Set up unit test infrastructure

    Set up unit test infrastructure

    Right now there are lots of tests in the Rust code and none in the TypeScript code. We don't have an unit testing infrastructure set up.

    We need it, as he TypeScript code continues to grow in size and complexity.

    This FR isn't asking for the writing of unit tests, just setting up the machinery to run them:

    1. During development
    2. From GitHub actions for PRs and pushes.
    enhancement good first issue help wanted Web 
    opened by jamesyoungman 1
  • Enforce Typescript/React etc. best practices (linting, etc)

    Enforce Typescript/React etc. best practices (linting, etc)

    The github actions enforce that code changes on the Rust code adhere to best practices in code formatting, linting and so forth.

    But similar checks don't exist for the web UI code (mainly TypeScript, CSS). We should at least run a linter. And, ideally, verify that the code is correctly formatted (I'm not very opinionated about what formatting choices to take, but consistency would be a good thing).

    enhancement good first issue help wanted Web 
    opened by jamesyoungman 1
  • Quarter movements for store operations are reversed

    Quarter movements for store operations are reversed

    Describe the bug The current implementation of the exchange element (exchanger.rs) is based on the content of table 7-2 in the Users Handbook.

    But, you compare the examples for config 2 in the descriptions of LDA (page 3-6) and STA (page 3-8) the movement appears to be opposite. See example number 3 in each case.

    The existing code appears to match the load case, not the store case. Execution of stores appears to show backward behaviour compared to the examples in the STA documentation.

    To Reproduce N/A

    Expected behavior I am not 100% clear on this. For example what happens with sign extension and subword form?

    Additional context The problem manifested in the intiial implementation of the STE opcode, but so far the boot code only makes use of config value 0 (full word, all quarters active). That probably explains why I did not previously see a problem.

    opened by jamesyoungman 1
  • Implement keyboard input test

    Implement keyboard input test

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [x] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [x] Your changes include unit tests (if they are code changes).
      • [x] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Convert keyboard clicks into keyboard input events

    Convert keyboard clicks into keyboard input events

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [ ] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [x] Your changes include unit tests (if they are code changes).
      • [x] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    Not closing #68 yet as we need a test program to demonstrate that this works.

    opened by jamesyoungman 0
  • [web] Add a keyboard (which doesn't generate input yet).

    [web] Add a keyboard (which doesn't generate input yet).

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [x] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [x] Your changes include unit tests (if they are code changes).
      • [x] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Measure PETR throughput

    Measure PETR throughput

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [ x Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x ] You have done your changes in a separate branch.
      • [x ] You have a descriptive commit message with a short title (first line).
      • [x ] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x ] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [ ] Your changes include unit tests (if they are code changes).
      • [ ] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Jy/lw keyboard rs

    Jy/lw keyboard rs

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [ ] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [ ] Your contribution is made under the project's copyright license.
      • [ ] Make sure that your PR is not a duplicate.
      • [ ] You have done your changes in a separate branch.
      • [ ] You have a descriptive commit message with a short title (first line).
      • [ ] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [ ] Your changes include unit tests (if they are code changes).
      • [x] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Use separate build trees for development/release.

    Use separate build trees for development/release.

    The motivation behind this was to definitiely identify which wasm file is being used for profiling mode, because we want to be able to identify which Rust function is being executed, instead of seing just numbered WASM functions.

    This change doesn't solve that problem, but it does mean that we know a priori that the WASM file we're looking at is indeed the one build for profiling mode.

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [x] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [ ] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [ ] Your changes include unit tests (if they are code changes).
      • [ ] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Enable more clippy lints

    Enable more clippy lints

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [ ] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [ ] Your changes include unit tests (if they are code changes).
      • [ ] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Use separate build trees for development/release.

    Use separate build trees for development/release.

    The motivation behind this was to definitiely identify which wasm file is being used for profiling mode, because we want to be able to identify which Rust function is being executed, instead of seing just numbered WASM functions.

    This change doesn't solve that problem, but it does mean that we know a priori that the WASM file we're looking at is indeed the one build for profiling mode.

    Pull Request template

    Please, fill in the following checklist when you submit a PR. The items you have done should be updated with a check mark (that is, [x] instead of [ ]).

    • General
      • [x] Review the CONTRIBUTING.md file for detailed contributing guidelines before sending a PR.
      • [x] Your contribution is made under the project's copyright license.
      • [x] Make sure that your PR is not a duplicate.
      • [x] You have done your changes in a separate branch.
      • [x] You have a descriptive commit message with a short title (first line).
      • [x] You have only one commit. If not, either squash them into one commit or contribute your change as a sequence of smaller Pull Requests.
    • Basic sanity checks
      • [x] You have run runchecks.sh and it said "Everything is OK".
    • Testing and Documentation
      • [x] Your changes include unit tests (if they are code changes).
      • [ ] If your change relates to the behaviour of the simulator, please include comments explaining which part of the reference documentation describes the thing you're changing.
    • If your change is a bugfix and it fully fixes an issue:
      • [ ] Put closes #XXXX in your pull request description to auto-close the issue that your PR fixes.

    If any of the checklist items don't apply, please leave them un-checked.

    PLEASE KEEP THE ABOVE IN YOUR PULL REQUEST.

    opened by jamesyoungman 0
  • Output spacing is uneven on Pixel 4XL, producing

    Output spacing is uneven on Pixel 4XL, producing "ripple" as LW66 output scrolls

    Describe the bug The gap between consecutive lines of the Lincoln Writer 66 output on a Pixel 4 XL is slightly smaller than the gap between the last line of history and the "current" line. This produces a mild rippling effect as output lines are completed.

    To Reproduce

    1. Visit https://tx-2.github.io/demo/ on a mobile device.
    2. Follow the getting-started instructions to load and run the "hello" tape.
    3. Observe the "ripple" effect as the output is generated.

    Expected behavior Output scrolls up with no discernible difference between the final two lines and any other pair or adjacent lines.

    Screenshots Not at this time.

    Platform and version information: Pixel 4XL, Android version 12. Reproduced with version 2d5f01642251dbabbe818e5db016b723dad454c9

    Additional context This does not occur on the desktop Chromium instance I use for development. I don't know whether this affects other mobile devices.

    bug help wanted Web 
    opened by jamesyoungman 0
  • Fix overcomplex callaback scheme in the React UI

    Fix overcomplex callaback scheme in the React UI

    In tx2-web/src/AlarmPanel.tsx there are callbacks into controller/alarm.ts, and also callbacks in the opposite direction. With a callback registry.

    There is a similar picture between tx2-web/src/IoPanel.tsx and controller/io.ts.

    This seems more complex than necessary. Someone more experienced with React than I am can likely suggest a simpler approach.

    help wanted Web 
    opened by jamesyoungman 0
  • Analyse UI performance, fix low-hanging-fruit items

    Analyse UI performance, fix low-hanging-fruit items

    I think some of the design choices in the UI implementation have bad performance characteristics. For example, we update the I/O and Alarm status panels after every instruction. This could be the reason why it takes the simulator several seconds to read the 360 lines of the "hello.tape" example program even though (1) the data is in memory, and (2) the simulated tape reader should be able to do this in under a second.

    I'd like this code to be usable on portable devices (e.g. tablets) and it needs to not eat battery.

    bug good first issue help wanted Web 
    opened by jamesyoungman 1
  • Allow the user to dismiss or minimise the instructions

    Allow the user to dismiss or minimise the instructions

    The web UI includes instrucitons. These are important for helping people try the simulator out for the first time. But, once the user has read them they don't need to refer to them again, probably. It would be helpful for the user to be able to reduce the on-screen space taken up by the instructions once they've read them.

    enhancement good first issue help wanted Web 
    opened by jamesyoungman 0
  • Improve assembler error messages

    Improve assembler error messages

    Is your feature request related to a problem? Please describe.

    The assembler's error-handling strategy is modeled after https://eyalkalderon.com/blog/nom-error-recovery/ but our use of the "placeholder" denoting that we came across an invalid input is not comprehensive.

    For example, this line of input is perfectly valid:

    100|      REX₆₆   200     ** Set X₆₆ to 200.
    

    If we add an extra symbol in there like this:

    100|      REX₆₆   EXTRA 200     ** Set X₆₆ to 200.
    

    We get a somewhat confusing error:

    11:508: expected newline after a program instruction
    11:508: expected end-of-file
    2022-05-16T08:51:58.375986Z ERROR assemble{input="assembler/examples/hello.tx2as" output="hello.tape"}: tx2m4as: assembly failed: AsmFail(SyntaxError { line: 11, columns: Some((508, 3505)), msg: "expected newline after a program instruction" })
    line 11, column 509: expected newline after a program instruction
    

    Describe the solution you'd like An error message which is more understandable, making use of the existing LocatedSpan code to show the invalid/unsupported input.

    Describe alternatives you've considered I'm hoping that the overall pattern described in Eyal Kalderon's blog post will be sufficient to give a good user experience.

    Additional context See above for an example output.

    enhancement good first issue help wanted 
    opened by jamesyoungman 0
  • Find/use documentation on metabits of AE registers

    Find/use documentation on metabits of AE registers

    The AE registers (A, B, C, D) are stored in the Arithmetic Element. E is stored in the Exchange Element, but is also described as an Arithmetic Element register. They are mapped into the Vff memory range.

    I have a fuzzy recollection that they don't have metabits and so netabit operations take effect on the M register but have no effect on the actual AE registers themselves. But I can't right now find a spot in the documentation that talks about this.

    The necessary action here is to find the relevant documentation and add tests relating to it. For example use of the SKM instuction on the addresses corresponding to some of the AE registers.

    opened by jamesyoungman 2
Owner
TX-2 Simulator Project
TX-2 Simulator Project
Simulator of viral infection spread and containment in cell monolayer.

Overview VIS-A-VIS is an agent-based simulator of viral infection spread and viral infection self-containment in a monolayer of cell. The simulation m

Frederic Grabowski 2 Nov 20, 2022
A Cortex-M simulator written in Rust

cmsim - A Cortex-M Simulator I had a need to run a Rust program (well, an OS) which was compiled for an Arm Cortex-M0+ on my Windows/Linux/macOS deskt

Jonathan 'theJPster' Pallant 4 Sep 14, 2023
The Computer Language Benchmarks Game: Rust implementations

The Computer Language Benchmarks Game: Rust implementations This is the version I propose to the The Computer Language Benchmarks Game. For regex-dna,

Guillaume P. 69 Jul 11, 2022
A simple programming language, created for AP Computer Science

A simple programming language, created for AP Computer Science

Michelle S. 3 Sep 2, 2022
Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer.

Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer ?? Download | Give it a Star ⭐ | Share it on Twitte

Julio Andres 73 Jun 15, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Advanced Rust quantum computer simulator

quantum Advanced Rust quantum computer simulator. Motivation Quantum is a quantum computer simulator written with the following design goals in mind:

Ben Eills 215 Jan 1, 2023
Experimental Quantum Computer Simulator + Quantum Chess Implementation

Quantum Chess A somewhat hacky implementation of this paper (made in a week over a holiday). It's not heavily tested and probably has some bugs still

null 19 Jan 21, 2022
A simple tomasulo simulator written in Rust for the course Computer Architecture.

Tomasulo Simulator This is a Tomasulo simulator written in Rust for the course Computer Architecture. Two Demo programs are tested in the simulator, w

GZTime 5 Dec 28, 2022
An n-tuple pendulum simulator in Rust + WebAssembly (and JavaScript)

An n-tuple pendulum simulator in Rust + WebAssembly (and JavaScript) Remaking this n-tuple pendulum simulator moving the math to Rust ?? and WebAssemb

Travis Taylor 27 Feb 19, 2022
Magical Automatic Deterministic Simulator for distributed systems in Rust.

MadSim Magical Automatic Deterministic Simulator for distributed systems. Deterministic simulation MadSim is a Rust async runtime similar to tokio, bu

MadSys Research Group 249 Dec 28, 2022
Build controllers for the Webots robot simulator in Rust

Webots controllers in Rust Status: experimental This is a reference project that shows how to build controllers for the Webots robot simulator using t

Adam Jensen 14 Oct 11, 2022
Rubik's Cube simulator in Rust.

cubedesu Rubik's Cube simulator written in Rust. Play it at https://stanleydesu.github.io/cubedesu/ ! Features Visual simulation of a 3x3 cube, allowi

Stanley Su 16 Jul 15, 2022
A game of life🔬 simulator on an infinite♾️ plane

game-of-life A game of life ?? simulator on an infinite ♾️ plane NOTE: This is a toy project! I did this just for fun, not as a packaged product. Abou

adam mcdaniel 8 Jul 17, 2022
Texas hold'em poker odds simulator

odd ♠️ a rusty Texas Hold'em poker odds simulator Installation brew install rustup git clone [email protected]:ocisly/odd.git cd odd rustup -V cargo inst

Adam Thalhammer 8 Nov 13, 2022
Logimu: Circuit & logic gate simulator

Logimu: Circuit & logic gate simulator The main goal of Logimu is to simulate large circuits at a high speed. Features Live simulation Embed other cir

David Hoppenbrouwers 4 Nov 20, 2022
Render farm simulator & plotting for optimisation written in Rust.

Farm Usage Simulator Given a few basic charasteristics of a render farm and render jobs this app runs a few randomized farm usage scenarios and plots

ford 2 Jul 17, 2022
Damavand is a quantum circuit simulator. It can run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.

Damavand is a quantum circuit simulator. It can run on laptops or High Performance Computing architectures, such CPU distributed architectures or multi GPU distributed architectures.

MichelNowak 0 Mar 29, 2022
Shared cockpit for Microsoft Flight Simulator.

This project is currently on hiatus until further notice. I'd love to continue improving this project to fulfill my vision of a no hassle, fully featu

Connor T 458 Dec 28, 2022
A proof-of-concept for building Orbiter spaceflight simulator addons in Rust

Orbiter spacecraft addon development in Rust This project is a proof of concept for creating a spacecraft addon for the Orbiter spaceflight simulator

Thomas Antony 13 Oct 17, 2022