void addsub_asm(ofstream &out,string dsf,string op,string dst,string dsc)
{
out<<" mov BL,"<<dst<<endl;
if(op == "+")
out<<" add BL,"<<dsc<<endl;
else
out<<" sub BL,"<<dsc<<endl;
out<<" mov "<<dsf<<",BL"<<endl;
}
//乘法
void mul_asm(ofstream &out,string dsf,string dst,string dsc)
{
out<<" mov AL,"<<dst<<endl;
out<<" mov BH,"<<dsc<<endl;
out<<" mul BH"<<endl;
out<<" mov BL,1"<<endl;
out<<" div BL"<<endl;
out<<" mov "<<dsf<<",AL"<<endl;
}
//除法
void div_asm(ofstream &out,string dsf,string dst,string dsc)
{
out<<" mov AL,"<<dst<<endl;
out<<" CBW"<<endl
out<<" mov BL,"<<dsc<<endl;
out<<" div BL"<<endl;
out<<" mov "<<dsf<<",AL"<<endl;
}
乘法中
out<<" mov BL,1"<<endl;
out<<" div BL"<<endl;
out<<" mov "<<dsf<<",AL"<<endl;
这三行代码的意义和意思解释。