+/*-----------------------------------------------------------------*/
+/* genGetAbit - generates code get a single bit */
+/*-----------------------------------------------------------------*/
+static void
+genGetAbit (iCode * ic)
+{
+ operand *left, *right, *result;
+ int shCount;
+
+ D(emitcode ("; genGetAbit",""));
+
+ left = IC_LEFT (ic);
+ right = IC_RIGHT (ic);
+ result = IC_RESULT (ic);
+ aopOp (left, ic, FALSE);
+ aopOp (right, ic, FALSE);
+ aopOp (result, ic, FALSE);
+
+ shCount = (int) floatFromVal (AOP (IC_RIGHT (ic))->aopu.aop_lit);
+
+ /* get the needed byte into a */
+ MOVA (aopGet (left, shCount / 8, FALSE, FALSE));
+ shCount %= 8;
+ if (AOP_TYPE (result) == AOP_CRY)
+ {
+ if ((shCount) == 7)
+ emitcode ("rlc", "a");
+ else if ((shCount) == 0)
+ emitcode ("rrc", "a");
+ else
+ emitcode ("mov", "c,acc[%d]", shCount);
+ outBitC (result);
+ }
+ else
+ {
+ switch (shCount)
+ {
+ case 2:
+ emitcode ("rr", "a");
+ //fallthrough
+ case 1:
+ emitcode ("rr", "a");
+ //fallthrough
+ case 0:
+ emitcode ("anl", "a,#0x01");
+ break;
+ case 3:
+ case 5:
+ emitcode ("mov", "c,acc[%d]", shCount);
+ emitcode ("clr", "a");
+ emitcode ("rlc", "a");
+ break;
+ case 4:
+ emitcode ("swap", "a");
+ emitcode ("anl", "a,#0x01");
+ break;
+ case 6:
+ emitcode ("rl", "a");
+ //fallthrough
+ case 7:
+ emitcode ("rl", "a");
+ emitcode ("anl", "a,#0x01");
+ break;
+ }
+ outAcc (result);
+ }
+
+ freeAsmop (left, NULL, ic, TRUE);
+ freeAsmop (right, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
+}
+
+/*-----------------------------------------------------------------*/
+/* genGetByte - generates code get a single byte */
+/*-----------------------------------------------------------------*/
+static void
+genGetByte (iCode * ic)
+{
+ operand *left, *right, *result;
+ int offset;
+
+ D(emitcode ("; genGetByte",""));
+
+ left = IC_LEFT (ic);
+ right = IC_RIGHT (ic);
+ result = IC_RESULT (ic);
+ aopOp (left, ic, FALSE);
+ aopOp (right, ic, FALSE);
+ aopOp (result, ic, FALSE);
+
+ offset = (int)floatFromVal (AOP (right)->aopu.aop_lit) / 8;
+ aopPut (result,
+ aopGet (left, offset, FALSE, FALSE),
+ 0,
+ isOperandVolatile (result, FALSE));
+
+ freeAsmop (left, NULL, ic, TRUE);
+ freeAsmop (right, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
+}
+
+/*-----------------------------------------------------------------*/
+/* genGetWord - generates code get two bytes */
+/*-----------------------------------------------------------------*/
+static void
+genGetWord (iCode * ic)
+{
+ operand *left, *right, *result;
+ int offset;
+
+ D(emitcode ("; genGetWord",""));
+
+ left = IC_LEFT (ic);
+ right = IC_RIGHT (ic);
+ result = IC_RESULT (ic);
+ aopOp (left, ic, FALSE);
+ aopOp (right, ic, FALSE);
+ aopOp (result, ic, FALSE);
+
+ offset = (int)floatFromVal (AOP (right)->aopu.aop_lit) / 8;
+ aopPut (result,
+ aopGet (left, offset, FALSE, FALSE),
+ 0,
+ isOperandVolatile (result, FALSE));
+ aopPut (result,
+ aopGet (left, offset+1, FALSE, FALSE),
+ 1,
+ isOperandVolatile (result, FALSE));
+
+ freeAsmop (left, NULL, ic, TRUE);
+ freeAsmop (right, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
+}
+