_vemit2 (const char *szFormat, va_list ap)
{
struct dbuf_s dbuf;
- const char *buffer;
+ char *buffer;
dbuf_init(&dbuf, INITIAL_INLINEASM);
dbuf_tvprintf (&dbuf, szFormat, ap);
- buffer = dbuf_c_str(&dbuf);
+ buffer = (char *)dbuf_c_str(&dbuf);
- _tidyUp ((char *)buffer);
+ _tidyUp (buffer);
_G.lines.current = (_G.lines.current ?
connectLine (_G.lines.current, _newLineNode (buffer)) :
(_G.lines.head = _newLineNode (buffer)));
case AOP_PAIRPTR:
setupPair (aop->aopu.aop_pairId, aop, offset);
if (aop->aopu.aop_pairId==PAIR_IX)
- SNPRINTF (buffer, sizeof(buffer),
- "!*ixx", 0);
+ tsprintf (buffer, sizeof(buffer), "!*ixx", offset);
else if (aop->aopu.aop_pairId==PAIR_IY)
- SNPRINTF (buffer, sizeof(buffer),
- "!*iyx", 0);
+ tsprintf (buffer, sizeof(buffer), "!*iyx", offset);
else
SNPRINTF (buffer, sizeof(buffer),
"(%s)", _pairs[aop->aopu.aop_pairId].name);
assignResultValue (operand * oper)
{
int size = AOP_SIZE (oper);
- int i;
bool topInA = 0;
wassertl (size <= 4, "Got a result that is bigger than four bytes");
else
{
if ((AOP_TYPE (oper) == AOP_REG) && (AOP_SIZE (oper) == 4) &&
- !strcmp (AOP (oper)->aopu.aop_reg[size-2]->name, _fReturn[size-1]))
+ !strcmp (AOP (oper)->aopu.aop_reg[size-1]->name, _fReturn[size-2]))
{
size--;
_emitMove ("a", _fReturn[size-1]);
aopPut (AOP (oper), _fReturn[size], size-1);
size--;
}
- for (i = 0; i < size; i++)
+ while(size--)
{
- aopPut (AOP (oper), _fReturn[i], i);
+ aopPut (AOP (oper), _fReturn[size], size);
}
}
}
emit2 ("!enterxl", sym->stack);
else if (sym->stack)
{
- if (optimize.codeSize && sym->stack <= 8 || sym->stack <= 4)
+ if ((optimize.codeSize && sym->stack <= 8) || sym->stack <= 4)
{
int stack = sym->stack;
emit2 ("!enter");
letype = getSpec (operandType (left));
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
- /* assign the amsops */
+ /* assign the asmops */
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
+ setupToPreserveCarry (ic);
+
genCmp (right, left, result, ifx, sign);
+ _G.preserveCarry = FALSE;
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
- /* assign the amsops */
+ /* assign the asmops */
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
+ setupToPreserveCarry (ic);
+
genCmp (left, right, result, ifx, sign);
+ _G.preserveCarry = FALSE;
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
else
{
/* we need to extend the sign :{ */
- const char *l = aopGet (AOP (right), AOP_SIZE (right) - 1,
- FALSE);
+ const char *l = aopGet (AOP (right), AOP_SIZE (right) - 1, FALSE);
_moveA (l);
emit2 ("rla ");
emit2 ("sbc a,a");
//disable interrupt
emit2 ("!di");
//save P/O flag
- emit2 ("push af");
+ _push (PAIR_AF);
}
}
else
{
//restore P/O flag
- emit2 ("pop af");
+ _pop (PAIR_AF);
//parity odd <==> P/O=0 <==> interrupt enable flag IFF2 was 0 <==>
//don't enable interrupts as they were off before
emit2 ("jp PO,!tlabel", tlbl->key + 100);