+static void fetchPair(PAIR_ID pairId, asmop *aop)
+{
+ fetchPairLong(pairId, aop, 0);
+}
+
+static void fetchHL(asmop *aop)
+{
+ fetchPair(PAIR_HL, aop);
+}
+
+static void setupPair(PAIR_ID pairId, asmop *aop, int offset)
+{
+ assert(pairId == PAIR_HL || pairId == PAIR_IY);
+
+ switch (aop->type) {
+ case AOP_IY:
+ fetchLitPair(pairId, aop, 0);
+ break;
+ case AOP_HL:
+ fetchLitPair(pairId, aop, offset);
+ _G.pairs[pairId].offset = offset;
+ break;
+ case AOP_STK: {
+ /* Doesnt include _G.stack.pushed */
+ int abso = aop->aopu.aop_stk + offset + _G.stack.offset;
+ if (aop->aopu.aop_stk > 0) {
+ abso += _G.stack.param_offset;
+ }
+ assert(pairId == PAIR_HL);
+ /* In some cases we can still inc or dec hl */
+ if (_G.pairs[pairId].last_type == AOP_STK && abs(_G.pairs[pairId].offset - abso) < 3) {
+ adjustPair(_pairs[pairId].name, &_G.pairs[pairId].offset, abso);
+ }
+ else {
+ emit2("!ldahlsp", abso +_G.stack.pushed);
+ }
+ _G.pairs[pairId].offset = abso;
+ break;
+ }
+ default:
+ wassert(0);
+ }
+ _G.pairs[pairId].last_type = aop->type;
+}
+
+static void emitLabel(int key)
+{
+ emit2("!tlabeldef", key);
+ spillCached();
+}
+