Compare commits
2 Commits
be1c9f9fd7
...
9738ba1afd
| Author | SHA1 | Date | |
|---|---|---|---|
| 9738ba1afd | |||
| 432d706314 |
@@ -3,13 +3,14 @@
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./Assembleur [--help] [--version] [--output file] [--format type] file
|
./Assembleur [--help] [--reversed] [--version] [--output file] [--format type] file
|
||||||
```
|
```
|
||||||
|
|
||||||
There are 3 format types :
|
There are 3 format types :
|
||||||
- "int" : 32 bits integers are written. Exemple : `10878976`
|
- "int" : 32 bits integers are written. Exemple : `10878976`
|
||||||
- "binint" (default) : bits are written. Exemple : `00000000 10100110 00000000 00000000`
|
- "binint" : bits are written. Exemple : `00000000 10100110 00000000 00000000`
|
||||||
- "bin" : the file is written in pure binary
|
- "bin" : the file is written in pure binary
|
||||||
|
- "logisim" (default) : the file is written in binary for use in LogiSim
|
||||||
|
|
||||||
## Exemple
|
## Exemple
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ operations:
|
|||||||
or R1 R7 R3
|
or R1 R7 R3
|
||||||
sl R5 R2 #10
|
sl R5 R2 #10
|
||||||
sr R1 R2 R3
|
sr R1 R2 R3
|
||||||
|
mult R1 R1 R3
|
||||||
io:
|
io:
|
||||||
str R1 R2 R3
|
str R1 R2 R3
|
||||||
ld R1 R2 R3
|
ld R1 R2 R3
|
||||||
@@ -46,12 +48,13 @@ Produces
|
|||||||
00110000 10100110 00000000 00000000
|
00110000 10100110 00000000 00000000
|
||||||
01010000 10100110 00000000 00000000
|
01010000 10100110 00000000 00000000
|
||||||
01100000 10100110 00000000 00000000
|
01100000 10100110 00000000 00000000
|
||||||
|
01110000 10100110 00000000 00000000
|
||||||
01000001 01001100 00000000 00000000
|
01000001 01001100 00000000 00000000
|
||||||
01010001 01001100 00000000 00000000
|
01010001 01001100 00000000 00000000
|
||||||
11000000 00000000 00000000 00000101
|
11000000 00000000 00000000 00000101
|
||||||
11010001 01010000 00000000 00000011
|
11010001 01010000 00000000 00000011
|
||||||
11100001 01010000 00000000 00000010
|
11100001 01010000 00000000 00000010
|
||||||
11110001 01010000 00000000 00001100
|
11110001 01010000 00000000 00001101
|
||||||
11000001 01000000 00000000 00000001
|
11000001 01000000 00000000 00000001
|
||||||
11010100 00000000 00000000 00000111
|
11010100 00000000 00000000 00000111
|
||||||
11100000 00000000 00000000 00000000
|
11100000 00000000 00000000 00000000
|
||||||
|
|||||||
13
src/main.cpp
13
src/main.cpp
@@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
|
|
||||||
|
#define ASSEMBLEUR_VERSION "1.1"
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
argparse::ArgumentParser program("Assembleur");
|
argparse::ArgumentParser program("Assembleur", ASSEMBLEUR_VERSION);
|
||||||
|
|
||||||
std::string inputFileName;
|
std::string inputFileName;
|
||||||
program.add_argument("file").help("The assembly file to compile").store_into(inputFileName);
|
program.add_argument("file")
|
||||||
|
.help("The assembly file to compile")
|
||||||
|
.store_into(inputFileName);
|
||||||
|
|
||||||
std::string outputFileName;
|
std::string outputFileName;
|
||||||
program.add_argument("-o", "--output")
|
program.add_argument("-o", "--output")
|
||||||
@@ -33,10 +37,7 @@ int main(int argc, char** argv) {
|
|||||||
.store_into(header);
|
.store_into(header);
|
||||||
|
|
||||||
bool reverse;
|
bool reverse;
|
||||||
program.add_argument("-r", "--reversed")
|
program.add_argument("-r", "--reversed").help("inverse bit orders").flag().store_into(reverse);
|
||||||
.help("inverse bit orders")
|
|
||||||
.flag()
|
|
||||||
.store_into(reverse);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
program.parse_args(argc, argv);
|
program.parse_args(argc, argv);
|
||||||
|
|||||||
Reference in New Issue
Block a user