kiuhnmgtrdcv
دوشنبه 25 خرداد 1388, 22:39 عصر
سلام من میخواهم این کد سی به اسمبلی تبدیل کنم ولی به مشکل برخوردم لطفا راهنماییم کنید
#include<iostream.h>
#include<conio.h>
void main()
{
int K,row,star;
K = 4;
for(row=5;row>=1;row--)
{
for(star=1;star<=row-K;star++)
{
cout<< "*";
}
if (K>0)
K=K - 2;
cout <<endl;
}
getch();
}
کد اسمبلی
.model small
.stack 64h
.data
.code
main proc far
mov cx,5 ;row
mov ax,1 ;star
mov bx,4 ;k
lf1:
cmp cx,1
jl l2
dec cx
lf2:
push cx
sub cx,bx ;Err
cmp ax,cx
jg l2
inc ax
mov dl,"A"
mov ah,2
int 21h
pop cx
jmp lf2
jmp lf1
cmp bx,0
jl l2
sub bx,2
mov dl," "
mov ah,2
int 21h
l2:
mov ah,4ch
int 21h
main endp
end main
#include<iostream.h>
#include<conio.h>
void main()
{
int K,row,star;
K = 4;
for(row=5;row>=1;row--)
{
for(star=1;star<=row-K;star++)
{
cout<< "*";
}
if (K>0)
K=K - 2;
cout <<endl;
}
getch();
}
کد اسمبلی
.model small
.stack 64h
.data
.code
main proc far
mov cx,5 ;row
mov ax,1 ;star
mov bx,4 ;k
lf1:
cmp cx,1
jl l2
dec cx
lf2:
push cx
sub cx,bx ;Err
cmp ax,cx
jg l2
inc ax
mov dl,"A"
mov ah,2
int 21h
pop cx
jmp lf2
jmp lf1
cmp bx,0
jl l2
sub bx,2
mov dl," "
mov ah,2
int 21h
l2:
mov ah,4ch
int 21h
main endp
end main