FictionTools/z88dk/src/sccz80/codegen.c
/* Multiply the primary and secondary registers */
/*      (results in primary */
Multiply the primary and secondary registers
(results in primary
Multiply the primary and secondary registers ( results in primary
void mult(LVALUE* lval)
{
    switch (lval->val_type) {
    case KIND_LONG:
    case KIND_CPTR:
        callrts("l_long_mult");
        Zsp += 4;
        break;
    case KIND_DOUBLE:
        callrts("fmul");
        Zsp += c_fp_size;
        break;
    case KIND_CHAR:
        if ( lval->ltype->isunsigned ) {
            if (c_cpu == CPU_Z180 ) {
                ot("ld\th,e\n");
                ot("mlt\thl\n");
                break;
            } else if ( (c_cpu & CPU_RABBIT) ) {
            } else if ( c_speed_optimisation & OPT_UCHAR_MULT ) {
                int label1 = getlabel();
                int label2 = getlabel();
                ol("ld\th,l");
                ol("ld\tl,0");
                ol("ld\td,l");
                ol("ld\tb,8");
                postlabel(label1);
                opjumpr("nc,",label2);
                ol("add\thl,de");
                postlabel(label2);
                outfmt("\tdjnz\ti_%d\n",label1);
                break;
            }
        }
    default:
        callrts("l_mult"); 
    }
}
void mult ( LVALUE * lval ) { switch ( lval -> val_type ) { case KIND_LONG : case KIND_CPTR : callrts ( " " ) ; Zsp += 4 ; break ; case KIND_DOUBLE : callrts ( " " ) ; Zsp += c_fp_size ; break ; case KIND_CHAR : if ( lval -> ltype -> isunsigned ) { if ( c_cpu == CPU_Z180 ) { ot ( " \t \n " ) ; ot ( " \t \n " ) ; break ; } else if ( ( c_cpu & CPU_RABBIT ) ) { } else if ( c_speed_optimisation & OPT_UCHAR_MULT ) { int label1 = getlabel ( ) ; int label2 = getlabel ( ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; ol ( " \t " ) ; postlabel ( label1 ) ; opjumpr ( " " , label2 ) ; ol ( " \t " ) ; postlabel ( label2 ) ; outfmt ( " \t \t \n " , label1 ) ; break ; } } default : callrts ( " " ) ; } }
Multiply the primary and secondary registers
(results in primary
Multiply the primary and secondary registers ( results in primary
// For Rabbit we want to use the mul instruction