Skip to content

Commit 076b3c8

Browse files
Update README
1 parent 3a4edce commit 076b3c8

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
# Mindustry Assembler
2-
The assembler doesn't do much other that make the jump commands dynamically calculated. It is meant for use with the [Mindustry Compiler]().
2+
The assembler doesn't do much other that make the jump commands dynamically calculated. It is meant for use with the [Mindustry Compiler](TBD).
33

44
## Usage
5+
Almost like normal Mindustry code, but with a few differences:
6+
1. All code points must have whitespace in front of them after the newline
7+
```mindustry
8+
# Comments are fine
9+
jump 21 always x false # They can be at the end of a line
10+
op add x x 1
11+
```
12+
2. There are labels. They start with an &. They are used to calculate the location of a line. They do not need to be followed by an instruction, but they can be.
13+
```mindustry
14+
set i 0
15+
# &loop will be computed correctly even when there are comments
16+
&loop print "Hello, World!" # Here's a comment that doesn't matter
17+
# Oh look, another comment
18+
printflush message1
19+
op add i i 1
20+
jump &loop lessThan i 10
21+
```
22+
`&loop` will be computed and replaced in the jump command with the line number of the `&loop` label (1).
23+
24+
### Running the assembler
525
```sh
626
assembler [-d] [-h] [-c] <file> [-o <output_file>]
727
```
8-
- `-d`: Create a debug file
28+
- `-d`: Create a debug file (shows the line numbers of each label). The file is named `<file>.sym`
929
- `-h`: Print this help message
1030
- `-c`: Copy the output to the clipboard
1131
- `file`: The file to assemble

0 commit comments

Comments
 (0)