FictionTools/z88dk/src/sccz80/codegen.c
/* Subtract the primary register from the secondary */
/*      (results in primary) */
Subtract the primary register from the secondary
(results in primary)
Subtract the primary register from the secondary ( results in primary )
void zsub(LVALUE* lval)
{
    switch (lval->val_type) {
    case KIND_LONG:
    case KIND_CPTR:
        if ( c_speed_optimisation & OPT_SUB32 && !IS_8080() && !IS_GBZ80() ) {
            ol("ld\tc,l");        
            ol("ld\tb,h");
            ol("pop\thl");        
            ol("and\ta");
            ol("sbc\thl,bc");
            ol("ex\tde,hl");
            ol("ld\tc,l");
            ol("ld\tb,h");
            ol("pop\thl");
            ol("sbc\thl,bc");
            ol("ex\tde,hl");
        } else {
            callrts("l_long_sub"); 
        }
        Zsp += 4;
        break;
    case KIND_DOUBLE:
        callrts("fsub");
        Zsp += c_fp_size;
        break;
    default:
        if ( c_speed_optimisation & OPT_SUB16 && !IS_8080() && !IS_GBZ80()) {
            swap();
            ol("and\ta");
            ol("sbc\thl,de");
        } else {
            callrts("l_sub");
        }
    }
}
void zsub ( LVALUE * lval ) { switch ( lval -> val_type ) { case KIND_LONG : case KIND_CPTR : if ( c_speed_optimisation & OPT_SUB32 && ! IS_8080 ( ) && ! IS_GBZ80 ( ) ) { ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; } else { callrts ( " " ) ; } Zsp += 4 ; break ; case KIND_DOUBLE : callrts ( " " ) ; Zsp += c_fp_size ; break ; default : if ( c_speed_optimisation & OPT_SUB16 && ! IS_8080 ( ) && ! IS_GBZ80 ( ) ) { swap ( ) ; ol ( " \t " ) ; ol ( " \t " ) ; } else { callrts ( " " ) ; } } }
Subtract the primary register from the secondary
(results in primary)
Subtract the primary register from the secondary ( results in primary )
/* 13 bytes: 4 + 4 + 10 + 4 + 15 + 4  + 4 + 4 + 10 + 15 + 4 = 78T */ /* 3 bytes: 100 + 17T = 117t */