Files
Assembleur/README.md
2024-12-06 17:03:07 +01:00

95 lines
1.9 KiB
Markdown

# Assembleur
## Usage
```bash
./Assembleur [--help] [--reversed] [--version] [--output file] [--format type] file
```
There are 3 format types :
- "int" : 32 bits integers are written. Exemple : `10878976`
- "binint" : bits are written. Exemple : `00000000 10100110 00000000 00000000`
- "bin" : the file is written in pure binary
- "logisim" (default) : the file is written in binary for use in LogiSim
## Exemple
```assembly
operations:
ADD R1 R2 #1
SUB R1 R2 R3
AND R1 R2 #33
XOR R1 R2 R3
OR R1 R2 R3
SL R1 R2 R3
SR R1 R2 R3
MUL R1 R2 R3
io:
STR R1 R2 R3
LD R1 R2 R3
sauts:
JMP controle
JEQU R1 R2 io
JNEQ R1 R2 sauts
JSUP R1 R2 operations
JINF R1 R2 controle
controle:
CALL io
RET
```
Produces
```
00000100 10100000 00000000 00000001
00010000 10100110 00000000 00000000
00100100 10100000 00000000 00100001
01000000 10100110 00000000 00000000
00110000 10100110 00000000 00000000
01010000 10100110 00000000 00000000
01100000 10100110 00000000 00000000
01110000 10100110 00000000 00000000
01000000 10100110 00000000 00000000
01010000 10100110 00000000 00000000
11000000 00000000 00000000 00010000
11010000 10100000 00000000 00001001
11100000 10100000 00000000 00001011
11110000 10100000 00000000 00000001
11000000 10100000 00000000 00010000
11010000 00000000 00000000 00001001
11100000 00000000 00000000 00000000
```
## Releases
Pre-compiled binaries are available in the [Release](https://git.ale-pri.com/Persson-dev/Assembleur/releases) section.
## Build
If you wish to compile yourself, you must have [xmake](https://xmake.io) installed.
Instructions on how to install (and you should) [here](https://xmake.io/#/guide/installation)
```bash
xmake
```
## Run
```bash
xmake run Assembleur [args]
```
Example :
```bash
xmake run Assembleur test.asm -o memory
```
Parses the file `test.asm` and writes the output into the file `memory`
## Install
You can also add the binary to your path using
```bash
xmake install
```