Translate the following statements into assembly instruction
Translate the following statements into assembly instruction: Assume that the variables are 16 bits. You may use any number of registers you like. I = 2; sum = 0; WHILE SUM
Solution
MOV I,2 ;transfer value 2 to variable I
MOV 0,SUM ; transfer value 0 to variable SUM
jmp loop1 ; jump to condition first
cloop1 nop ; Execute the content of the loop
loop1 cmp sum,0x0E ; Check the condition
jg end
beginning:
add SUM,1
mov SUM.SUM
add I,2
mov I,I
end:
