#assembly #interpreter #toy #language

app ssbc

An SSBC Interpreter written in Rust. See http://csci.viu.ca/~pwalsh/teaching/261/261/261.html

1 unstable release

0.1.0 Oct 6, 2020

#334 in Emulators

MIT/Apache

16KB
298 lines

SSBC-rs

An interpreter for the SSBC.

For more information on the SSBC, see Peter Walsh's Computer Architecture course, or a past student's online interpreter written in JavaScript.

Differences

The SSBC has a different subtract instruction, depending on whether you're in CSCI 261 or CSCI 355, See the Signed Mode section of this document for instructions on how to set the mode.

Telling ssbc.pl to run without first resetting enters an infinite loop, with no side affects. Telling ssbc-rs to run without first resetting begins interpreting, which will likely NOP, unless there's been something written to ports B or D

Situations where multiple reads and/or writes are happening to the same location within an instruction may behave differently than ssbc.pl (untested).

Register overflow (stack pointer, program counter) wrap, whereas ssbc.pl likely crashes with an array index out of bounds error (untested).

Compiling

On otter, run ./build.sh Elsewhere, I recommend using cargo: cargo build

Signed Mode

By default, ssbc-rs uses two's complement subtraction, as the CSCI 355 SSBC does.

If you'd like to match the 261 SSBC's behaviour, pass --cfg 'feature="signedmagnitude_sub"' to build.sh when building on otter or pass --features=signedmagnitude_sub when you're elsewhere.

Usage

Use the ssbc-rs binary as you would ssbc.pl. If you'd like to run the SSBC's tests on ssbc-rs, you can modify .batch_test to run the ssbc-rs binary instead of ssbc.pl.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5MB
~34K SLoC