Sabtu, 14 Januari 2012

Diposting oleh Yeni Mulyani di 07.24

Translating Nested Control Structures

Translate the following high-level control structure into assembly-language code:

while (a <= b) {

a++;

if (b == c)

a = a + b

else {

b = b - a

c--;

}

}

Start_while

mov eax, a

mov ebx, b

mov edx, c

cmp eax, ebx

jg end_while

inc eax

cmp eax,edx

jne else_part ;while body

add eax,ebx ;if_part

jmp end_if

else_part

sub ebx,eax ;else_part

dec edx

end_if

jmp start_while

end_while

0 komentar:

Posting Komentar

 

Just For Share Template by Ipietoon Blogger Template | Gadget Review