- /* get the condition into accumulator */
- loadRegFromAop (hc08_reg_a, AOP (IC_JTCOND (ic)), 0);
- freeAsmop (IC_JTCOND (ic), NULL, ic, TRUE);
- /* multiply by three */
- pushReg (hc08_reg_a, FALSE);
- emitcode ("lsla", "");
- emitcode ("add","1,s");
- transferRegReg (hc08_reg_a, hc08_reg_x, TRUE);
- loadRegFromConst (hc08_reg_h, zero);
- pullReg (hc08_reg_a);
+
+ if (hc08_reg_x->isFree && hc08_reg_x->isFree)
+ {
+ /* get the condition into x */
+ loadRegFromAop (hc08_reg_x, AOP (IC_JTCOND (ic)), 0);
+ freeAsmop (IC_JTCOND (ic), NULL, ic, TRUE);
+ loadRegFromConst (hc08_reg_h, zero);
+
+ emitcode ("lda", "%05d$,x", jtabhi->key + 100);
+ emitcode ("ldx", "%05d$,x", jtablo->key + 100);
+ transferRegReg (hc08_reg_a, hc08_reg_h, TRUE);
+ emitcode ("jmp", ",x");
+
+ hc08_dirtyReg (hc08_reg_a, TRUE);
+ hc08_dirtyReg (hc08_reg_hx, TRUE);
+ }
+ else
+ {
+ adjustStack(-2);
+ pushReg(hc08_reg_hx, TRUE);
+
+ /* get the condition into x */
+ loadRegFromAop (hc08_reg_x, AOP (IC_JTCOND (ic)), 0);
+ freeAsmop (IC_JTCOND (ic), NULL, ic, TRUE);
+ loadRegFromConst (hc08_reg_h, zero);
+
+ emitcode ("lda", "%05d$,x", jtabhi->key + 100);
+ emitcode ("sta", "3,s");
+ emitcode ("lda", "%05d$,x", jtablo->key + 100);
+ emitcode ("sta", "4,s");
+
+ pullReg(hc08_reg_hx);
+ emitcode ("rts", "");
+ _G.stackPushes += 2;
+ updateCFA();
+ }