
Page 1 of 2
Lab Session 5 March 29
Note: every number is in hexadecimal. Define code at 1000:100
Bit0 is the first bit in a byte / word
Part A
Write the code to implement a search of number 07 in the memory 2000:300 (10 bytes)
02 30 50 01 07 50 60 70 0A 07
Using loope and then using loopne
1. observe the contents of CX and Zero flag before the execution of loopne
instruction. Write down the contents. Now trace the code and check when the
loop terminates write the contents of CX now.
2. now use loope instruction and proceed the same as you did in 1. what is the
difference you feel in both commands. Observe the contents of zero flag and CX
3. now update the memory 2000:300 (10 bytes) as
02 30 50 01 05 50 60 70 0A 80
and search the number 07 again use loopne instruction. Now check when the loop
terminates. And write the contents of CX and zero flag
Part B Write a subroutine which copies the positive number to the location 3000:700 and
the negative number to the location 3000:800 from a memory location 2000:500 (10
words)
2000:500 30F0 FF02 2080 AE03 20D0 1E03 20A1 207E 50B3 0293
1. what are the contents of status register before and after the execution of compare
instruction when a positive number is found
2. Trace the code and show the contents to the lab instructor.
Part C
1. Enter the following code
MOV AX,2000
MOV SS,AX
MOV SP,0010
MOV AX,10
MOV BX,20
CALL 0200
NOPNOP
2. Enter the following code in the memory location 1000:0200
ADD AX,BX
RET
MOV CX,2
3. before execution of the code observe the contents of SP and memory locations
SP-1, SP-2 and write down. Now trace the code in 1. Immediately after the
execution of CALL 200, check the contents SP and the memory location SS:SP
and SS:SP+1 and write down. Did the contents of stack modify after the
execution of CALL 0200. What do these contents represent? Also check the
contents of IP and write down. What is the next instruction to be executed and
what is its off-set address?
4. What is the next instruction to be executed immediately after the execution of
RET instruction?
5. What do the second and third bytes of the machine code of CALL 0200 represent.
What did u observe?
6. Is it different from NEAR jump instruction?
Part D (NEAR CALL)
1. Enter the following code in the memory location 1000:0100: