-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasm_commands.cpp
83 lines (62 loc) · 1.29 KB
/
asm_commands.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "asm_commands.h"
#include <stdio.h>
void ldi(int reg, char val) {
printf("ldi %d %d\n", reg, val);
}
void mov(int reg1, int reg2) {
printf("mov %d %d\n", reg1, reg2);
}
void add(int reg1, int reg2) {
printf("add %d %d\n", reg1, reg2);
}
void adc(int reg1, int reg2) {
printf("adc %d %d\n", reg1, reg2);
}
void mul(int reg1, int reg2) {
printf("mul %d %d\n", reg1, reg2);
}
void mulc(int reg1, int reg2) {
printf("mulc %d %d\n", reg1, reg2);
}
void sts(int memloc, int reg) {
printf("sts %u %d\n", memloc, reg);
}
void push(int reg) {
printf("push %d\n", reg);
}
void pop(int reg) {
printf("pop %d\n", reg);
}
void jmp(const char* lbl) {
printf("jmp %s\n", lbl);
}
void cp(int reg1, int reg2) {
printf("cp %d %d\n", reg1, reg2);
}
void cpi(int reg1, int val) {
printf("cpi %d %d\n", reg1, val);
}
void ld(int reg, int loc) {
printf("ld %d %d\n", reg, loc);
}
void adiw(int reg, int val) {
printf("adiw %d %d\n", reg, val);
}
void sbiw(int reg, int val) {
printf("sbiw %d %d\n", reg, val);
}
void label(const char* label) {
printf("%s\n", label);
}
void brge(const char* lbl) {
printf("brge %s\n", lbl);
}
void brlt(const char* lbl) {
printf("brlt %s\n", lbl);
}
void breq(const char* lbl) {
printf("breq %s\n", lbl);
}
void brne(const char* lbl) {
printf("brne %s\n", lbl);
}