Parul University Faculty of Engineering and Technolgoy COMA (203124210)
Parul University Faculty of Engineering and Technolgoy COMA (203124210)
Parul University Faculty of Engineering and Technolgoy COMA (203124210)
EXPERIMENT: - 1
ALGORITHM:
1. Start the program by loading the first data into Accumulator.
2. Move the data to a register (B register).
3. Get the second data and load into Accumulator.
4. Add the two register contents.
5. Check for carry.
6. Store the value of sum and carry in memory location.
7. Terminate the program.
PROGRAM:
MVI C,00
LDA 2010 // A=EFH
MOV B,A // B=EFH
LDA 2011 //A=FFH
ADD B //A=A+B
JNC IF //JUMP IF NOT CARRY
INR C //INCREASE C BY 01
IF: STA 2090
MOV A,C
STA 2091
HLT
# ORG 2010H
# DB EFH,FFH
OBSERVATION:
Input: 2010H: EFH
2011H: FFH
Output: 2090H: EEH
2091H: 01H
CONCLUSION:
We can add 8bit numbers and its result and generated carry we can store in memory
EXPERIMENT:- 2
ALGORITHM:
1. Load the lower part of first number in B register
2. Load the lower part of second number in A (accumulator)
3. Add both the numbers and store
4. Load the higher part of first number in B register
5. Load the higher part of second number in A (accumulator)
6. Add both the numbers with carry from the lower bytes (if any) and store at the
next location
PROGRAM:
# ORG 2000H
# BEGIN 2000H
MVI C,00
LDA 2021 //LOAD 02H
MOV B,A //MOVE 02 IN B REGISTER
LDA 2022 //LOAD 03H
ADD B //A=A+B
STA 2050 //STORE VALUE IN 2050 LOCATION
LDA 2023 //LOAD 01H
MOV D,A //MOVE 01H IN D REGISTER
LDA 2024 //LOAD 02H
ADC D //A=A+D
JNC NEXT //JUMP AT NEXT IF NOT CARRY
INR C //OTHERWISE INCREMENT C
NEXT: STA 2051
MOV A,C
STA 2052
HLT
# ORG 2021H
# DB 02H,03H,01H,02H
OBSERVATION:
Input: 2000H: 01H
2001H: 02H
2002H: 03H
2003H: 00H
Output: 2090H: 3AH
2092H: 00H
CONCLUSION:
Thus, the program to addition of two 16bit numbers was executed
EXPERIMENT:- 3.1
ALGORITHM:
PROGRAM:
# ORG 0000
# BEGIN 0000
MVI E,00 //E FOR CARRY
LDA 1001 //LOAD ACCUMULATOR AT 1001
MOV B,A //MOVE VALUE A TO B
LDA 1002 //LOAD ACCUMULATOR AT 1002
MOV D,A //MOVE VALUE A TO D
SUB A //A=a-a
L1: ADD D //A=D+A
JNC L2 //JUMP IF NOT CARRY
INR E //INCREMENT E
OBSERVATION:
Input: 1001H: 04H
1002H: 05H
Output: 2000H: 0EH
CONCLUSION:
Thus, the program to multiply two 8bit numbers was executed
EXPERIMENT:- 3.2
ALGORITHM:
1.Load HL pair with 4150H
2.Move memory to B reg
3.Increment HL pair with(4151H)
4.Mov memory reg to accumulator
5.Compare reg B with A
if A is greater than store the result at 4210H
6.Apply subtraction
7.Increment the reg C
PROGRAM:
LXI H,4150
MOV B,M // B=03
MVI C,00 // Clear C - reg for quotient
INX H // Increment HL pair of registers
MOV A,M // A=0F
NEXT: CMP B // Compare Accumulator with B
JC LOOP // Jump on carry to LOOP
SUB B // Subtract A reg from B reg
INR C // Increment content of register C
JMP NEXT // Jump to NEXT
LOOP: STA 4152 // Store the rem in Memory
MOV A,C // Move Content of C Reg to Accumulator
STA 4153 // Store the quotient in memory
HLT
# ORG 4150H
# DB 0FH,03H
OBSERVATION: -
Input : 4150:0FH
4151:03H
Output: 1003:90H
1004- Z Carry 9
CONCLUSION:-
Thus, the program to DIVIDE two 8bit numbers was executed
EXPERIMENT 4
ALGORITHM:
1. Start the program by loading then first data in accumulator
2. Move the data to a register
3. Get the second data and load into accumulator
4. Add the two register contents
5. Check for carry
6. Store the value of sum and carry in memory location
7. Teminate the program
PROGRAM:
# ORG 2000H
# BEGIN 2000H
MVI C,00 // CLEAR THE REGISTER C
MVI D,05 // store 05 value in d reg
MVI A,00 // clear the register A
LXI H,2050 // LOAD THE MEMORY LOCATIO
AGAIN: ADD M //
JNC NEXT
INR C
NEXT: INX H
DCR D
JNZ AGAIN
LOOP: STA 2055
MOV A,C
STA 2056
HLT
# ORG 2050H
# DB 30H,10H,10H,10H,05H
OBSERVATION:
INPUT: 2050H – 30H
2051H – 10H
2052H – 10H
2053H – 10H
2054H – 05H
OUTPUT:
2055H – 65H
CONCLUSION:
The assembly language program to add blocks of 8 bit data stored in memory location is
successfully executed.it gives output as 30 after getting input as 30H,10H,10H,10H,05H.
EXPERIMENT 5
ALGORITHM:
PROGRAM:
OBSERVATION:
INPUT: 6050H – 03H
6051H – 09H
OUTPUT: 6060H – 03H
CONCLUSION:
The assembly language program to find the minimum from two 8-bit numbers successfully
executed.it gives output as 03 after getting input as 3.