labels.pop_back();
labels.pop_back();
}
if (a==2 || a==3) // операнд
{
Oper.a=a; Oper.b=b; Oper.c=c;
operand.push_back(Oper);
}
if (a==1 && c<7) // операция
{
Four.op=c;
Four.second[0]=operand[operand.size()-1].a;
Four.second[1]=operand[operand.size()-1].b;
Four.second[2]=operand[operand.size()-1].c;
operand.pop_back();
Four.first[0]=operand[operand.size()-1].a;
Four.first[1]=operand[operand.size()-1].b;
Four.first[2]=operand[operand.size()-1].c;
if (operand.size())operand.pop_back();
Oper.a=Four.result[0]=4;
Oper.b=Four.result[1]=0;
Oper.c=Four.result[2]=i; i++;
// вывод операции
if (Four.op==0) // +
{ if (Four.first[0]==3 && Four.second[0]==3)
{Four.second[1]=Four.first[1]+Four.second[1];
fprintf(out,"mov ax, "); printd(Four.second);fprintf(out,"\n");}
else
{
fprintf(out,"mov ax, "); printdata(Four.first); fprintf(out,"\n");
fprintf(out,"add ax, "); printdata(Four.second); fprintf(out,"\n");
fprintf(out,"mov res%d, ax\n", Four.result[2]);
}
}
if (Four.op==1) // -
{
fprintf(out,"mov ax, "); printdata(Four.first); fprintf(out,"\n");
fprintf(out,"sub ax, "); printdata(Four.second); fprintf(out,"\n");
fprintf(out,"mov res%d, ax\n", Four.result[2]);
}
if (Four.op==2) // =
{ if (Four.first[0]==3 && Four.second[0]==3) {fprintf(out,"mov "); printdata(Four.first); fprintf(out,", ax\n");}
if (Four.second[0]==3) {fprintf(out,"mov "); printdata(Four.first); fprintf(out,", "); printdata(Four.second);fprintf(out,"\n");}
else
{
fprintf(out,"mov ax, "); printdata(Four.second);fprintf(out,"\n");
fprintf(out,"mov "); printdata(Four.first); fprintf(out,", ax\n");
}
}
if (Four.op==3) // <=
{
fprintf(out,"mov ax, "); printdata(Four.first);
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.