Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ssembly Language x86: 1.) Implement the following express... Assembly Language x

ID: 3914913 • Letter: S

Question

ssembly Language x86: 1.) Implement the following express...

Assembly Language x86:

1.       ) Implement the following expression in assembly language:

           Y = an array of size 20          

for (i = 4; i > 0; i--)

     {

                                      for(j = 5; j > 0; j--)

                                        {

                append i+j in the array y

          }

      }

o    Final value of y should be [9, 8, 7, 6…]

o    Submit the following:

§ Lastname4.asm

Hint: implement nested for loop and add the counter of both inner and outer for loop and store in y. Use ESI to move to next position of the array.

Explanation / Answer

Lastname4.asm :

IDEAL
MODEL small
STACK 100h

DATASEG

intArray db 10 dup (0)
index db 0

CODESEG

start:
mov ax, @DATA
mov ds, ax
intArray db 10 dup (0)
index db 0
...
loopArray:
movzx bx, [index]
mov [intArray+bx], bl ;Give the BX-th array element the value BL
inc [index]
cmp [index], 10
jb loopArray
exit:
mov ax, 4c00h
int 21h
END start