Skip to content

Commit 65774f2

Browse files
Merge pull request #9 from RandomSearch18/draft/great-mccarthy
Add support for demos in the browser using CodeSandbox
2 parents ea2d7be + d3e6f1a commit 65774f2

4 files changed

Lines changed: 64 additions & 8 deletions

File tree

.codesandbox/tasks.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// These tasks will run in order when initializing your CodeSandbox project.
3+
"setupTasks": [],
4+
5+
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
6+
"tasks": {}
7+
}

.devcontainer/devcontainer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
3+
{
4+
"name": "Rust",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye"
7+
8+
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
9+
// "mounts": [
10+
// {
11+
// "source": "devcontainer-cargo-cache-${devcontainerId}",
12+
// "target": "/usr/local/cargo",
13+
// "type": "volume"
14+
// }
15+
// ]
16+
17+
// Features to add to the dev container. More info: https://containers.dev/features.
18+
// "features": {},
19+
20+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
21+
// "forwardPorts": [],
22+
23+
// Use 'postCreateCommand' to run commands after the container is created.
24+
// "postCreateCommand": "rustc --version",
25+
26+
// Configure tool-specific properties.
27+
// "customizations": {},
28+
29+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
30+
// "remoteUser": "root"
31+
}

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,13 @@ It contains two tools:
99
- **`rusty_man_computer`** Is the main program. It reads a binary file containing assembled LMC code and runs it.
1010
- **`bin_creator`** is a utility that lets you paste in the contents of LMC's memory (from the online simulator), which it will convert to a binary file (which can be executed by `rusty_man_computer`).
1111

12-
## Screenshots
13-
14-
### Printing every ASCII character
15-
16-
This screenshot only shows the last few clock cycles, after all the characters have been printed.
12+
## Usage
1713

18-
Each clock cycle, the contents of the registers are shown on the first line, the next line is the output, and then the contents of memory is printed, formatted in the same way as the online simulator (left to right, and then down).
14+
### Running in CodeSandbox
1915

20-
![Screenshot of some of the output from the emulator running in a terminal](assets/terminal-demo-1.png)
16+
You can try Rusty-Man Computer in your browser by visiting the **CodeSandbox demo**. (TODO: Add link)
2117

22-
## Usage
18+
Once CodeSandbox has loaded, press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>\`</kbd> to open a new terminal, where you can use `cargo run` to run the [demo programs](#running-the-demo-programs) below.
2319

2420
### Pre-compiled binaries
2521

@@ -106,6 +102,16 @@ cargo run --bin rusty_man_computer -- --ram my_program.bin
106102
- `--help` (`-h`) prints the help message, which shows a list of command-line arguments.
107103
- `--version` (`-V`) prints the program name and version.
108104

105+
## Screenshots
106+
107+
### Printing every ASCII character
108+
109+
This screenshot only shows the last few clock cycles, after all the characters have been printed.
110+
111+
Each clock cycle, the contents of the registers are shown on the first line, the next line is the output, and then the contents of memory is printed, formatted in the same way as the online simulator (left to right, and then down).
112+
113+
![Screenshot of some of the output from the emulator running in a terminal](assets/terminal-demo-1.png)
114+
109115
## Features
110116

111117
Rusty-Man Computer shows the whole state of the computer at the end of every clock cycle, including the contents of the registers, all memory values, the output, and if a branch instruction has been called. This verbose output should make it easy to see what the emulator is doing, and to track your code as it runs.

0 commit comments

Comments
 (0)