You are on page 1of 9

MNI LAB-5

Sheikh Abuzar Amjad


19-CP-6
Lab Manual # 05
Advance use addressing modes in different language
programs using EMU8086.

Lab Tasks

Execute the following tasks CLO [1]

TASK 1:
Run the following code and observe the registers/
memory locations:
org 0x100

mov ax,10

mov bx,10

mov [200h], ax

mov [201h], bx

ret
CODE

STEP1:
Move value of 10 in the register AX
Move value of 10 in the register BX
Move the data in memory the memory location is 0200h. The data is present in AX.
Move the data in memory the memory location is 0201h. The data is present in BX.
STEP2:
After successfully running the program we can see there will be change in the value of flag
register “IF” and value “0A=10” is stored in registers “AX” and “BX” located at memory
locations “[200]” and “[201]”

TASK 2:
Write a code to add first ten natural numbers starting from the
memory location 0200H?

CODE
STEPS:
 IN Step 1, we use “BX” register as memory location and initialize it by starting address “[200h]”
 In next step, I stored “1” first element of “[BX]”.
 Then in next step, I used LOOP For 10 values by Giving “CX=10”;
 Then in Loop We used next memory location of “BX” as “[BX+1]=1” and there is increment in
the value of BX that is [201h] and [BX+1] which is same and then in its location 1 is added and
in this way 10 natural numbers are stored in BX and its sum is stored in AX = “37”.
TASK 3:
Write a code to transfer a block of data from source memory block to
destination memory block. Use any starting address.

CODE

SOlUTION
STEPS:
 In this program, we firstly store “BX=10” as a data source and store it into source
memory location i.e. “[0170h]” then we moved that source block into “AX”
register then all the contents of “AX” will be shifted to destination block that is
“[0180h]” i.e. 0A = 10.
TASK 4:
Write a code to perform addition on 8-bit data stored in consecutive memory
locations (10) and store result in next memory locations. Use any starting
address.

CODE
SOlUTION
STEPS:
 Move the data 200h in the register BX.
 Store 8-bit data in consecutive memory location (10) the memory location is 0200h by using
this [BX].
 Then we used a loop of 10 iterations as “CX=10” and then contents of array named 8bit will
be stored in SI .
 Firstly, contents of [SI] into DL and that content will be stored into [BX].
 And then value of next consecutive memory location i.e. [SI + 1] will be added with previous
DL value and result is stored in next consecutive memory location i.e [BX+1].
 Then the values of bx and SI will be incrementing by 1 until loop doesn’t get terminated.
 Then from 200h the ten values of 8bit will be stored in next 10 memory locations and result
will be stored in next consecutive location.
TASK 4:
Write a code to sort the given array in ascending order?
10,5,13,1,15,16,5,2

CODE

SOlUTION
THE END

You might also like