Skip to content

Commit 4dfc0b9

Browse files
committed
Start on instruction definition
1 parent b1f13ae commit 4dfc0b9

File tree

1 file changed

+79
-2
lines changed

1 file changed

+79
-2
lines changed

README.md

+79-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,87 @@ Fateful can be installed through [cargo](https://github.com/rust-lang/cargo) via
99

1010
The assembler can be used with the `fateful asm` or `fateful assemble` command to assembler f8ful assembly into f8ful machine code.
1111
The input and output are both optional, and default to `stdin` and `stdout` respectively.
12+
Input is positional, being the first argument, and the output can be specified with the `-o` or `--output` flag.
1213

13-
### Instructions
14+
### Instruction Set
1415

15-
There are sixteen instructions in f8ful assembly.
16+
0. [ADD](#add)
17+
0. [SUB](#sub)
18+
0. [ADC](#adc)
19+
0. [SBB](#sbb)
20+
0. [NAND](#nand)
21+
0. [OR](#or)
22+
0. [CMP](#cmp)
23+
0. [MV](#mv)
24+
0. [LD](#ld)
25+
0. [ST](#st)
26+
0. [LDA](#lda)
27+
0. [LPM](#lpm)
28+
0. [PUSH](#push)
29+
0. [POP](#pop)
30+
0. [JNZ](#jnz)
31+
0. [HALT](#halt)
32+
33+
#### ADD
34+
35+
Machine Code: `0x00`
36+
37+
Operation: Adds the first and second operand, storing the result in the first operand.
38+
39+
```asm
40+
add <register>, <register/imm8>
41+
```
42+
43+
#### SUB
44+
45+
Machine Code: `0x01`
46+
47+
Operation: Subtracts the second operand from the first, storing the result in the first operand.
48+
49+
```asm
50+
sub <register>, <register/imm8>
51+
```
52+
53+
#### ADC
54+
55+
Machine Code: `0x02`
56+
57+
Operation: Adds the first and second operands, plus an additional 1 if the carry bit is set, storing the result in the first operand.
58+
59+
```asm
60+
adc <register>, <register/imm8>
61+
```
62+
63+
#### SBB
64+
65+
Machine Code: `0x03`
66+
67+
Operation: Subtracts the second operand from the first, subtracting an additional 1 if the carry bit is set, storing the result in the first operand.
68+
69+
```asm
70+
sbb <register>, <register/imm8>
71+
```
72+
73+
#### NAND
74+
75+
Machine Code: `0x04`
76+
77+
Operation: Performs a bitwise NAND on the first and second operands, storing the result in the first operand.
78+
79+
```asm
80+
nand <register>, <register/imm8>
81+
```
82+
83+
#### OR
84+
85+
Machine Code: `0x05`
86+
87+
Operation: Performs a bitwise OR on the first and second operands,
88+
storing the result in the first operand.
89+
90+
```asm
91+
or <register>, <register/imm8>
92+
```
1693

1794
## Emulator
1895

0 commit comments

Comments
 (0)