https://github.com/zkxs/stationeers-ic10-preprocessor
A very simple stationeers MIPS preprocessor
https://github.com/zkxs/stationeers-ic10-preprocessor
Last synced: about 2 months ago
JSON representation
A very simple stationeers MIPS preprocessor
- Host: GitHub
- URL: https://github.com/zkxs/stationeers-ic10-preprocessor
- Owner: zkxs
- License: mit
- Created: 2022-08-11T14:08:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-29T22:27:25.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T20:28:02.761Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Stationeers IC10 Preprocessor
A very simple preprocessor that replaces jumps to labels with hardcoded offsets. This does not perform actual MIPS parsing, so if you try and use keywords like `yield` as a label this will horribly break your code.
I recommend pairing this with [icX](https://traineratwot.aytour.ru/wiki/icx) to strip out aliases, comments, and whitespace.
This preprocessor also uses an obscure trick to save a `yield` instruction if you have a pattern like
```
# rest of your program
yield
j some_label
```where `some_label:` is on any line *except* line 0.
## Usage
Simply pass your files in as arguments, like so:
```
stationeers-ic10-preprocessor.exe my-program.ic10
```In Windows, you can drag-and-drop a file onto an exe to run it in this way.
**It will overwrite your input files with the minified output, so be sure to keep a copy of the original somewhere!**
## Example
Input (7 lines):
```mips
alias accumulator r0
alias display d0
start:
add accumulator accumulator 1
s display Setting accumulator
yield
j start
```Output (5 lines):
```mips
alias accumulator r0
alias display d0
add accumulator accumulator 1
s display Setting accumulator
j -2
```## Prebuilt Binary
A prebuilt Windows binary is provided [here](https://github.com/zkxs/stationeers-ic10-preprocessor/releases/latest/download/stationeers-ic10-preprocessor.exe).
## Building
Build with `cargo build --release`