1) Convert the following pseudo-code to assembly language:
a = 0 b=2
for (i=0, i<=9 , i+2)
{
a=a+b
cout<<"number="<<a<<endl;
a++
}
;MS Visual Studio 2017
INCLUDE irvine32.inc
.data
.code
main PROC
mov eax, 0 ; a = 0
mov ebx, 2 ; b = 2
mov ecx, 0 ; i = 0;
forI:
add eax, ebx ; a=a+b
call writeDec
call crlf
inc eax ;a++
add ecx,2 ; i+2
cmp ecx, 9
jle forI
call crlf
call crlf
call waitMsg
exit
main ENDP
END main
Comments
Leave a comment