-/*-----------------------------------------------------------------*/
-/* genNearPointerSet - emitcode for near pointer put */
-/*-----------------------------------------------------------------*/
-static void
-genNearPointerSet (operand * right,
- operand * result,
- iCode * ic,
- iCode * pi)
-{
- int size, offset;
- sym_link *retype = getSpec (operandType (right));
- sym_link *letype = getSpec (operandType (result));
-
- D(emitcode ("; genNearPointerSet",""));
-
- aopOp (result, ic, FALSE);
-
- /* if the result is rematerializable &
- in data space & not a bit variable */
- if (AOP_TYPE (result) == AOP_IMMD &&
- /* DCL_TYPE (ptype) == POINTER && */
- !IS_BITVAR (retype) &&
- !IS_BITVAR (letype))
- {
- genDataPointerSet (right, result, ic);
- return;
- }
-
- /* if the operand is already in hx
- then we do nothing else we move the value to hx */
- if (AOP_TYPE (result) != AOP_STR)
- {
- loadRegFromAop (hc08_reg_x, AOP (result), 0);
- loadRegFromConst (hc08_reg_h, zero);
- }
- /* so hx now contains the address */
- aopOp (right, ic, FALSE);
-
- /* if bit then unpack */
- if (IS_BITVAR (retype) || IS_BITVAR (letype))
- genPackBits ((IS_BITVAR (retype) ? retype : letype), right);
- else
- {
- size = AOP_SIZE (right);
- offset = size-1;
-
- while (size--)
- {
- loadRegFromAop (hc08_reg_a, AOP (right), offset--);
- accopWithMisc ("sta", ",x");
- if (size || pi)
- {
- rmwWithReg ("inc", hc08_reg_x);
- }
- hc08_freeReg (hc08_reg_a);
- }
- }
-
- freeAsmop (result, NULL, ic, TRUE);
- freeAsmop (right, NULL, ic, TRUE);
-
- if (pi /* && AOP_TYPE (result) != AOP_STR && AOP_TYPE (result) != AOP_IMMD */) {
- aopOp (IC_RESULT (pi), pi, FALSE);
- storeRegToAop (hc08_reg_x, AOP (IC_RESULT (pi)), 0);
- freeAsmop (IC_RESULT (pi), NULL, pi, TRUE);
- pi->generated=1;
- }
-
- hc08_freeReg (hc08_reg_hx);
-
-}
-