(docs) readme - Update simulator usage info

This commit is contained in:
n loewen 2023-09-23 20:29:44 -07:00
parent ae587a0712
commit 92a619fded
1 changed files with 38 additions and 11 deletions

View File

@ -8,22 +8,49 @@ Cardiograph is an imaginary computer. It has three main components:
## Simulator
### Run assembler
```./assembler.js source_code.asm [output.txt]```
By default, the output is written to `out.txt`. It is saved as a string of space-separated decimal numbers.
### Run simulator
```./cardiograph.js < machine_code.txt```
### Dependencies
- Node.js
### Quick examples
Assemble and run:
```./assembler.js -i <source.asm> | cardiograph.js```
Assemble to a file:
```./assembler.js -i <source.asm> -o <machinecode.out>```
Run from a file:
```./cardiograph.js -i <machinecode.out>```
### Assembler: assembler.js
```
Usage: ./assembler.js [-a] -i <input-file> [-o <output-file>]
-a, --annotate Output code with debugging annotations
-i, --in <file> Assembly-language input
-o, --out <file> Machine-code output
```
- If an output file is not provided, the output is printed to stdout
- If the `annotate` flag is not set, the machine code is returned as a string of space-separated decimal numbers
### Simulator: cardiograph.js
```
Usage: ./cardiograph.js [-i <file>]
-i, --in <file> Machine-code input
```
- If an input file is not provided, the input is read from stdin
## CPU
### Registers and Flags