CS2 Practical
CS2 Practical
SYJC (Science)
3 Absolute Difference
7 Multiplication
10 BCD addition
11 Subroutine Program
AIM:-
A) A block of data is stored in memory location from C030 H to C039 H. Write
a program to transfer the data in Reverse Order to memory location starting
from C090 H.
B) Enter the program on microprocessor kit.
C) Execute the program. Write the contents of both data blocks before and after
execution as well as the contents of the registers used in the program after
execution and the bit contents of five flags individually. Verify the results.
ALGORITHM:-
1. Start.
2. Initialize HL pair by C039 H.
3. Initialize DE pair by C090 H.
4. Initialize Register C by 0A H.
5. Copy data from memory location pointed by HL register pair to
accumulator.
6. Store the accumulator data into the memory location pointed by DE
register pair.
7. Decrease HL register pair by 1.
8. Increase DE register pair by 1.
9. If C≠0 then go to step 5.
10. Stop.
PROGRAM:-
CONCLUSION:-
Thus we have executed the program for transfer of data in reverse order.
Teacher Signature :
Practical No.: 2
AIM:-
ALGORITHM:-
1. Start.
2. Initialize HL register pair by C030 H.
3. Initialize DE register pair by C090 H.
4. Initialize Register C by 0A H.
5. Copy the contents of memory location pointed by HL pair to B register.
6. Copy the contents of memory location painted by DE pair to accumulator.
7. Copy the contents of accumulator to memory location pointed by HL pair.
8. Copy the contents of B register to accumulator.
9. Store the contents of accumulator into memory location pointed by DE pair
10. Increment HL pair by 1.
11. Increment DE pair by 1
12.Decrement C register by 1.
13. If C ≠0 then go to step 5.
14. Stop.
PROGRAM: -
REGISTER VALUES:-
Register Contents Register Contents
A 20 H C0
B 20 L 3A
C 00 SP
D C0 FFEb
E 9A PC
F 54 C014
FLAG REGISTER:-
S Z X AC X P X CY
0 1 0 1 0 1 0 0
CONCLUSION:-
Thus we have executed the program for the exchange of two memory block.
Teacher Signature :
Practical No: - 3
AIM:-
A) Write a program that subtracts the number stored in C031 H from the
number stored in C030 H. Store the absolute difference in memory
locationC090 H as result.
B) Enter the program on microprocessor kit.
C) Execute the program. Write the contents of both data blocks before and after
execution as well as the contents of the registers used in the program after
execution and the bit contents of five flags individually. Verify the results.
ALGORITHM:-
1. Start.
2. Initialize HL pair by C030 H.
3. Copy the contents from memory location pointed by HL pair into
accumulator.
4. Increase HL pair by 1.
5. Subtract the data of memory location pointed by HL pair from the contents
of accumulator.
6. If the difference is positive than go to step 9.
7. Complement the content of accumulator.
8. Increment the content of accumulator.
9. Store the data of accumulator as a result in memory location C090 H.
10. Stop.
PROGRAM:-
OBSERVATION TABLE:-
REGISTER VALUES:-
Register Contents Register Contents
A 03 H C0
B 00 L 31
C 00 SP
D 00 FFEb
E 00 PC
F 14 C00F
FLAG REGISTER:-
S Z X AC X P X CY
0 0 0 1 0 1 0 0
Execution II [Negative diffrence]
REGISTER VALUES:-
Register Contents Register Contents
A 03 H C0
B 01 L 31
C 00 SP
D 00 FFEb
E 00 PC
F 05 C00F
FLAG REGISTER:-
S Z X AC X P X CY
0 0 0 0 0 1 0 1
CONCLUSION:-
Teacher Signature :
Practical No. 5
AIM:-
A) A block of data is stored in memory location from C031 H. The length of the
block is stored at C030 H. Write a program that searches for first occurrence
of data type ‘AB H’ in the given block. Store the address of this occurrence in
HL pair. If number is not found, then HL pair must contain FFFF H.
B) Enter the program on the microprocessor kit.
C) Execute the program. Write the contents of both data blocks before and after
execution as well as contents of register used in the program after execution
and the bit contents of five flags individually. Verify the results.
ALGORITHM:-
1. Start.
2. Load HL pair with C030 H.
3. Copy the contents of memory location pointed by HL pair in to C register.
4. Increase the contents of HL pair by 1.
5. Copy ABH in to A register.
6. Compare the contents of accumulator with the contents of memory pointer.
7. If Z=0 then jump to stop.
8. Increase the contents of HL pair.
9. Decrease the contents of C register by 1.
10. If Z≠0 then jump to back.
11. Load HL pair by FFFF H.
13. Stop.
PROGRAM :-
OBSERVATION TABLE:-
FLAG STRUCTURE:-
S Z X AC X P X CY
0 1 0 1 0 1 0 0
FLAG STRUCTURE:-
S Z X AC X P X CY
0 1 0 1 0 1 0 0
CONCLUSION:-
Thus, we have executed the program to find first occurrence of data type ‘AB H’
in the given block.
Teacher’s Signature:
Practical No.:- 6
AIM:-
A) The block of data is stored in memory location C031 H. The length of block is
stored at C030 H. Write a program that counts the occurrence of the number
‘AB H’ in the given block. Store the result in C090 H.
B) Enter the program on the microprocessor kit.
C) Execute the program. Write the contents of both data blocks before and after
execution as well as contents of register used in the program after execution
and the bit contents of five flags individually. Verify the results.
ALGORITHM:-
1. Start.
2. Load HL pair with C030 H.
3. Copy the contents of memory location pointed by HL pair in to C register.
4. Initialize A register with AB H.
5. Initialize B register with 00 H.
6. Increase the contents of HL pair by 1.
7. Compare the contents of accumulator with the contents of memory pointer.
8. If Z≠0 then jump to step 10.
9. Increase the contents of B register by 1.
10. Decrease the contents of C register by 1.
11. If Z≠0 then jump to step 6.
12. Copy the contents of B register in to accumulator.
13.Store the contents of accumulator at C090 H.
14.Stop.
PROGRAM :-
REGISTER TABLE:-
FLAG STRUCTURE:-
S Z X AC X P X CY
0 1 0 1 0 1 0 0
CONCLUSION:-
Thus, we have executed the program to find total occurrence of data type ‘AB
H’in the given block.
Teacher’s Signature:
Practical No.:- 11
A) Write a program that uses keyboard subroutine 02E7H to accept two digits
from the keypad as input. Store them separately in the consecutive
memory locations C030 H and C031 H. Store the 1 byte result to the
immediate next memory location.
B) Enter the program on the microprocessor kit.
C) Execute the program. Write the contents of both data blocks before and after
execution as well as contents of register used in the program after execution
and the bit contents of five flags individually. Verify the results.
Algorithm:
PROGRAM :-
OBSERVATION TABLE: -
REGISTER VALUES:-
Register Contents Register Contents
A 53 H C0
B 50 L 32
C 00 SP
D 00 FFEB
E 00 PC
F 04 C017
FLAG STRUCTURE:-
S Z X AC X P X CY
0 0 0 0 0 1 0 0
CONCLUSION:-
Thus, we have executed the program to accept two numbers from keypad
and successfully display the merged 1 byte result at given memory
address.
Teacher’s Signature:
Practical No.:- 12
Algorithm:
Program:
Observation :
CONCLUSION:-
Teacher’s Signature:
www.eazynotes.com Gursharan Singh Tatla Page 1 of 6