X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fz80%2Fgen.c;h=d2d02ba740cd46451b841ea5f523ddf1a7fa1812;hb=b68de0bae973fa412a8d4646cb5033200e5dba6e;hp=527f3c1e91b359e4ff06ad1613b651646895ff5a;hpb=fc00646a1654c5a9e580fd73be4f5d523e62391c;p=fw%2Fsdcc diff --git a/src/z80/gen.c b/src/z80/gen.c index 527f3c1e..d2d02ba7 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -4779,11 +4779,11 @@ gencjneshort (operand * left, operand * right, symbol * lbl) { while (size--) { - emit2 ("ld a,%s", aopGet (AOP (left), offset, FALSE)); - if ((AOP_TYPE (right) == AOP_LIT) && lit == 0) + _moveA (aopGet (AOP (left), offset, FALSE)); + if ((unsigned int) ((lit >> (offset * 8)) & 0x0FFL) == 0) emit2 ("or a,a"); else - emit2 ("cp a,%s", aopGet (AOP (right), offset, FALSE)); + emit2 ("sub a,%s", aopGet (AOP (right), offset, FALSE)); emit2 ("jp NZ,!tlabel", lbl->key + 100); offset++; } @@ -4798,13 +4798,18 @@ gencjneshort (operand * left, operand * right, symbol * lbl) while (size--) { _moveA (aopGet (AOP (left), offset, FALSE)); - if ((AOP_TYPE (left) == AOP_DIR && AOP_TYPE (right) == AOP_LIT) && + if (/*AOP_TYPE (left) == AOP_DIR &&*/ AOP_TYPE (right) == AOP_LIT && ((unsigned int) ((lit >> (offset * 8)) & 0x0FFL) == 0)) - /* PENDING */ - emit2 ("jp NZ,!tlabel", lbl->key + 100); + { + /* PENDING */ + /* MB: pending what? doesn't this need "or a,a"? */ + /* and I don't think AOP_TYPE(left) has anything to do with this */ + emit2 ("or a,a"); + emit2 ("jp NZ,!tlabel", lbl->key + 100); + } else { - emit2 ("cp %s", aopGet (AOP (right), offset, FALSE)); + emit2 ("sub %s", aopGet (AOP (right), offset, FALSE)); emit2 ("jp NZ,!tlabel", lbl->key + 100); } offset++;