summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler.c b/compiler.c
index e1b6844..2ee9514 100644
--- a/compiler.c
+++ b/compiler.c
@@ -619,12 +619,18 @@ char *_gen_address(char *prefix, char *base, char *offset, int mult, int add) {
}
}
- if(add > 0) {
- vect_push_string(&out, " + ");
+ if(add != 0) {
+ if (add > 0) {
+ vect_push_string(&out, " + ");
+ } else {
+ vect_push_string(&out, " - ");
+ add = -add;
+ }
char *astr = int_to_str(add);
vect_push_string(&out, astr);
free(astr);
}
+
vect_push_string(&out, "]");