@@ -9,10 +9,87 @@ Fateful can be installed through [cargo](https://github.com/rust-lang/cargo) via
9
9
10
10
The assembler can be used with the ` fateful asm ` or ` fateful assemble ` command to assembler f8ful assembly into f8ful machine code.
11
11
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.
12
13
13
- ### Instructions
14
+ ### Instruction Set
14
15
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
+ ```
16
93
17
94
## Emulator
18
95
0 commit comments