Exp 4 New
Exp 4 New
2
Experiment No. (4)
Student Name:
Date:
Experiment 4 pre-Lab.
Objective:-
Practice at home with the following using DEBUG program:
1. Find The Contents of AL at Each Step of the Following:
a) MOV AL,55h AL= . . . . .. . .. .. . .. .
b) AND AL,1Fh AL= . . . . .. . .. .. . .. .
c) OR AL,C0h AL= . . . . .. . .. .. . .. .
d) XOR AL,0Fh AL= . . . . .. . .. .. . .. .
e) NOT AL AL= . . . . .. . .. .. . .. .
4. What are the results that are produced in the destination operands by executing instructions (a)
through (f)? Use DEBUG commands to alter the contents of memory & registers prior to
operation as follows:
AX=0000h BX=0010h CX=0105h DX=1111h SI=0100h DI=0200h CF=0
DS:100h=0Fh DS:200h=22h DS:201h=44h DS:210h=55h DS:211h=AAh
DS:220h=AAh DS:221h=55h DS:400h=AAh DS:401h=55h
a) ShL DX,CL DX= . . . . . . . . . . CF= . . . . .
b) ShL BYTE PTR [0400h],CL [0400h]= . . . . . . . . . . . . . . . CF= . . . . . .
c) ShR BYTE PTR[DI],1 [DI]= . . . . . . . . . . . . . . . CF= . . . . . .
d) ShR BYTE PTR [BX+DI],CL [BX+DI]= . . . . . . . . . . . . . . . CF= . . . . . .
e) SAR WORD PTR [BX+DI],1 [BX+DI]= . . . . . . . . . . . . . . . CF= . . . . . .
f) SAR WORD PTR [BX][DI]+10h,CL [BX+DI+10h]= . . . . . . . . . . . . . . CF= . . . . . .
g) What are the results that are produced in the destination operands by executing instructions (a)
through (f)? Use DEBUG commands to alter the contents of memory & registers prior to
operation as follows:
AX=0000h BX=0010h CX=0105h DX=1111h SI=0100h DI=0200h CF=1
DS:100h=0Fh DS:200h=22h DS:201h=44h DS:210h=55h DS:211h=AAh
DS:220h=AAh DS:221h=55h DS:400h=AAh DS:401h=55h
a) ROL DX,CL DX= . . . . . . . . . . CF= . . . . .
b) RCL BYTE PTR [0400h],CL [0400h]= . . . . . . . . . . . . . . . CF= . . . . . .
c) ROR BYTE PTR [DI],1 [DI]= . . . . . . . . . . . . . . . CF= . . . . . .
d) ROR BYTE PTR [BX+DI],CL [BX+DI]= . . . . . . . . . . . . . . . CF= . . . . . .
e) RCR WORD PTR [BX+DI],1 [BX+DI]= . . . . . . . . . . . . . . . CF= . . . . . .
f) RCR WORD PTR [BX][DI]+10h,CL [BX+DI+10h]= . . . . . . . . . . . . . . CF= . . . . . .
code segment
assume cs:code
code ends
end start
Notes:
➢ Use the above structure.
➢ Each solution should not take more than half an hour.
1. Count the number of “1” bits in the register AX and save the result in BL.
2. Separate the odd numbers from the even numbers of the 100 bytes stored in memory.
Count each of them and store the number of odds in CL and the number of evens in CH.
Assume the first byte is stored at the location 30000h and each number consists of single
byte. Save odd numbers at 50000h and the even numbers at 40000h.
Test them using DEBUG, write them on LAB paper with comments and describe the results.