83.3k views
2 votes
Assembly (Procedure and Conditional Processing). For the following program, what are outputs for register EAX, EBX, ECX, and EDX in decimal? include Irvine32.inc .code main proc mov eax, 10 mov ebx, 10 mov ecx, 10 mov edx, 10 call proc1 call DumpRegs exit main endp proc1 proc uses ebx ecx L1: add eax, 1 add ebx, 1 loop L1 cmp ebx, 20 jne return mov edx, 20 return: ret proc1 endp end main EAX = ____________________ EBX = ________________________ ECX = ____________________ EDX = ________________________

1 Answer

2 votes

Answer:

See explaination

Step-by-step explanation:

Given data:

.code main

mov eax, 10 means eax=10,(now eax register contain 10)

mov ebx ,10 means ebx=10

mov ecx, 10 means ecx=10

mov edx, 10 means edx =10

call proc1 measn invoke the proc1 function

call DumpReg means Display the register

exit main endp means main function closed

///// now proc1 function part'

L1 means it's start a scope as loop

add eax, 1 means increament one or eax=eax+1 => 11 ( because eax was 10 )

add ebx , 1 means ebx=ebx+1 =>11

Loop L1 means this is loop

cmp ebx ,20 compare ebx with 20

jne return means if ebx==20 then jump onto return statement else go ahead

mov edx 20 means edx=20

retunrn : ret proc1 endp endp main means when return statement come it will end then proc1 and redirect to main function;

after exicute this code :

EAX contain 11

EBX contain aslo 11

ECX contain 10

EDX contain 20

User Rollingthedice
by
5.8k points