diff options
Diffstat (limited to 'nqasm.c')
-rw-r--r-- | nqasm.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -56,12 +56,12 @@ void add_instruction(const struct instruction *inst) addr += 2; } -static long eval_argument(const struct argument *arg) +static long eval_argument(const struct argument *arg, uint16_t pc) { struct label *l; switch (arg->type) { - case ARG_INTEGER: - return arg->value; + case ARG_INTEGER: return arg->value; + case ARG_PC: return pc; case ARG_LABEL: l = vector_search(&labels->v, &(struct label) { .name = arg->label }, cmp_label); @@ -82,7 +82,7 @@ static void assemble_instruction(const struct instruction *inst, uint16_t pc) const struct operand *ops = mnem->operands; const struct argument *args = inst->args.args; for (int i = 0; i < 3 && ops[i].type; i++) { - long value = eval_argument(args + i); + long value = eval_argument(args + i, pc); switch (ops[i].type) { case REG: |