Experiment-1: Basic Operations On 8-Bit Numbers.: Objective: Requirement: Theory
Experiment-1: Basic Operations On 8-Bit Numbers.: Objective: Requirement: Theory
Flowcharts:
Flowchart for Addition:
Flowchart for subtraction:
2
Procedure:
Procedure for Addition:
EXPERIMENTAL PROCEDURE: STEP WISE –
iv)Change data at 4250 and 4251 and execute each time and check for result.
ii) Enter data that is needed for execution at 4250 and 4251.
iii) Execute the program and check for results at 4254 and 4255.
3
iv) Try changing data and check results each time.
iv)Change data at 4250 and 4251 and execute each time and check for result.
Programs:
Program for addition:
# ORG 7000H
# ORG 7000H
LXI H, 7501 // Get address of ist no. in HL pair
MOV A, M // Move no. into accumulator
INX H // HL points 7502 H.
SBB M // Substract 2nd no. from Ist no.
INX H //HL points 7503 H.
MOV M, A // Move contents of acc. to memory
RST 1 // Terminate
4
# ORG 7000H
LHLD 7501 // Get Multiplicand in H-L pair.
XCHG // Exchange HL pair with DE pair
LDA 7503 // Get 2nd no. in acc.
LXI H,0000 // Initial product in HL=00
MVI C,08 // Count=08 in reg .C
up:DAD H // Shift partial product left by 1 bit
RAL // Rotate multi. by 1 bit. Is multiplier = 1?
JNC down // No, go to ahead
DAD D // Product=Product + Multiplicand
down:DCR C // Decrement Count
JNZ up // Jump until C=0
SHLD 7504 // Store result
RST 1 // Terminate
# ORG 7000H
5
# ORG 7501H // Store the inputs at the address
# DB 06,26 // Get the numbers from successive loc.