diff --git a/src/tools/aindump/macros.c b/src/tools/aindump/macros.c index 40b50b5..1296761 100644 --- a/src/tools/aindump/macros.c +++ b/src/tools/aindump/macros.c @@ -168,6 +168,8 @@ static bool localassign_macro(struct dasm_state *dasm, int32_t no) int32_t val = dasm_arg(dasm, 0); if (!check_next_opcode(dasm, ASSIGN)) return false; + if (!check_next_opcode(dasm, POP)) + return false; fprintf(dasm->out, ".LOCALASSIGN "); print_local(dasm, no); @@ -214,6 +216,8 @@ static bool globalassign_macro(struct dasm_state *dasm, int32_t no) int32_t val = dasm_arg(dasm, 0); if (!check_next_opcode(dasm, ASSIGN)) return false; + if (!check_next_opcode(dasm, POP)) + return false; fprintf(dasm->out, ".GLOBALASSIGN "); dasm_print_identifier(dasm, dasm->ain->globals[no].name); @@ -259,6 +263,8 @@ static bool structassign_macro(struct dasm_state *dasm, struct ain_struct *s, st int32_t val = dasm_arg(dasm, 0); if (!check_next_opcode(dasm, ASSIGN)) return false; + if (!check_next_opcode(dasm, POP)) + return false; fprintf(dasm->out, ".STRUCTASSIGN "); dasm_print_identifier(dasm, s->name); diff --git a/src/tools/ainedit/asm.c b/src/tools/ainedit/asm.c index 909c70b..8b4ec64 100644 --- a/src/tools/ainedit/asm.c +++ b/src/tools/ainedit/asm.c @@ -63,19 +63,19 @@ const struct instruction asm_pseudo_ops[NR_PSEUDO_OPS - PSEUDO_OP_OFFSET] = { MACRO(PO_LOCALREFREF, ".LOCALREFREF", 1, 10), MACRO(PO_LOCALINC, ".LOCALINC", 1, 10), MACRO(PO_LOCALDEC, ".LOCALDEC", 1, 10), - MACRO(PO_LOCALASSIGN, ".LOCALASSIGN", 2, 16), + MACRO(PO_LOCALASSIGN, ".LOCALASSIGN", 2, 18), MACRO(PO_LOCALDELETE, ".LOCALDELETE", 1, 24), MACRO(PO_LOCALCREATE, ".LOCALCREATE", 2, 34), MACRO(PO_GLOBALREF, ".GLOBALREF", 1, 10), MACRO(PO_GLOBALREFREF, ".GLOBALREFREF", 1, 10), MACRO(PO_GLOBALINC, ".GLOBALINC", 1, 10), MACRO(PO_GLOBALDEC, ".GLOBALDEC", 1, 10), - MACRO(PO_GLOBALASSIGN, ".GLOBALASSIGN", 2, 16), + MACRO(PO_GLOBALASSIGN, ".GLOBALASSIGN", 2, 18), MACRO(PO_STRUCTREF, ".STRUCTREF", 2, 10), MACRO(PO_STRUCTREFREF, ".STRUCTREFREF", 2, 10), MACRO(PO_STRUCTINC, ".STRUCTINC", 2, 10), MACRO(PO_STRUCTDEC, ".STRUCTDEC", 2, 10), - MACRO(PO_STRUCTASSIGN, ".STRUCTASSIGN", 3, 16), + MACRO(PO_STRUCTASSIGN, ".STRUCTASSIGN", 3, 18), }; struct string_table { @@ -570,6 +570,7 @@ void handle_pseudo_op(struct asm_state *state, struct parse_instruction *instr) asm_write_opcode(state, PUSH); asm_write_argument(state, asm_resolve_arg(state, PUSH, T_INT, kv_A(*instr->args, 1)->text)); asm_write_opcode(state, ASSIGN); + asm_write_opcode(state, POP); break; } case PO_LOCALDELETE: { @@ -623,6 +624,7 @@ void handle_pseudo_op(struct asm_state *state, struct parse_instruction *instr) asm_write_opcode(state, PUSH); asm_write_argument(state, asm_resolve_arg(state, PUSH, T_INT, kv_A(*instr->args, 1)->text)); asm_write_opcode(state, ASSIGN); + asm_write_opcode(state, POP); break; } case PO_STRUCTREF: { @@ -660,6 +662,7 @@ void handle_pseudo_op(struct asm_state *state, struct parse_instruction *instr) asm_write_opcode(state, PUSH); asm_write_argument(state, asm_resolve_arg(state, PUSH, T_INT, kv_A(*instr->args, 2)->text)); asm_write_opcode(state, ASSIGN); + asm_write_opcode(state, POP); break; } }