DATE:
AIM:To write an Assembly Language Program for the following 16 bit arithmetic
operations using 8085 Microprocessor kit.
16 bit Addition.
16 bit Subtraction.
16 bit Multiplication.
16 bit Division.
ALGORITHM:16 BIT ADDITION
Start.
Initialize Register D content to 00 for storing the carry content.
Load the addends lower order 8 bits to accumulator from 9000.
Move accumulator content to Register C.
Now load the addends higher order 8 bits to accumulator from 9001.
Move accumulator content to Register B.
Now load the augend to HL Register Pair from 9002.
Now add HL and BC Register Pair contents using DAD instruction.
Now store the HL content to 9004 using SHLD instruction.
If there is any carry out of this operation, increment the Register D content.
Move Register D content to accumulator.
Store the accumulator content to 9003.
stop
16 BIT SUBTRACTION
Start.
Initialize Register D content to 00 for storing the barrow content.
Load the minuend to HL Register Pair using LHLD instruction from 9102.
Load the accumulator with subtrahends lower order 8 bits from 9100.
Now subtract accumulator content with Register L content.
Store the resultant from accumulator to 9104.
Now subtract higher order 8 bits along with the barrow from lower order
subtraction.
Store it in 9105.
If there is any barrow out of the above operation, increment Register D
content.
Transfer the Register D content to accumulator and store it 9106.
Stop.
OP-CODE
16 00
3A 00 90
4F
3A 01 90
47
2A 02 90
09
22 04 90
D2 15 80
14
7A
32 06 90
76
COMMENT
Initialise Register D to 00
Load lower addend to accumulator
Move accumulator to Register C
Load higher addend to accumulator
Move accumulator to Register B
Load the augend to HL Register Pair
Add HL and BC contents
Store HL content to 9004
Jump on No Carry to END label
Increment Register D
Transfer D content to accumulator
Store accumulator content to 9006
Halt the program
OP-CODE
16 00
2A 02 91
3A 00 91
95
32 04 91
9C
32 05 91
D2 14 81
14
7A
32 06 91
76
COMMENT
Initialise the Register D to 00
Load the minuend to HL Pair
Load subtrahends lower byte to A
Subtract accumulator with L content
Store accumulator content to 9104
Subtract A and H along with barrow
Store accumulator content to 9105
Jump on No Barrow to END label
Increment Register D content
Transfer D content to accumulator
Store accumulator content to 9106
Halt the program
16 BIT MULTIPLICATION
Start.
Clear BC Register Pair for storing the carry.
Load HL Register Pair with the multiplicand.
Transfer HL Register Pair content to Stack Pointer.
Now load HL Register Pair with the multiplier.
Transfer it to DE Register Pair.
Clear HL content.
Perform repeated addition between HL and Stack Pointer.
If there is any carry, increment BC Register Pair.
Transfer Register E content to accumulator and OR it with Register D.
Perform the repeated previous three steps until the above step becomes Zero.
Store the HL content to 9204.
Transfer the BC Pair content to HL Pair and store it in 9206.
Stop.
16 BIT DIVISION
Start.
Clear BC pair content for storing the reminder.
Load the divisor to HL Pair from 9302.
Transfer to DE Register Pair.
Load the dividend to HL pair from 9300.
Transfer Register L content to accumulator and subtract it with Register E
content.
Store accumulator content in Register L.
Transfer Register H content to accumulator and perform subtraction with D
content and barrow content.
Transfer accumulator content to Register H.
Increment BC Register Pair.
Repeat all the above steps until a barrow occurs.
Decrement BC Register Pair.
stop
OP-CODE
01 00 00
2A 00 92
F9
2A 02 92
EB
21 00 00
39
D2 13 82
03
7B
B2
1B
C2 0E 82
22 04 92
60
69
22 06 92
76
COMMENT
Initialise the BC content to 0000
Load HL content with 9200
Transfer HL content to Stack Pointer
Load HL content with 9202
Transfer it to DE Register Pair
Clear HL content
Add HL content with SP content
Jump on No Carry to END label
Increment BC content
Move E content to accumulator
OR A content and D content
Decrement the DE Pair content
Jump on Non Zero to LOOP label
Store HL content to 9204
Move B content to H content
Move C content to L content
Store HL content to 9206
Halt the program
OP-CODE
01 00 00
2A 02 93
EB
2A 00 93
7D
93
6F
7C
9A
67
03
D2 0A 83
0B
22 04 93
60
COMMENT
MNEMONICS
LXI B, 0000
LHLD 9302
XCHG
LHLD 9300
MOV A, L
SUB E
MOV L, A
MOV A, H
SBB D
MOV H, A
INX B
JNB LOOP
DCX B
SHLD 9304
MOV H, B
8319
831A
831B
'
MOV L, C
SHLD
HLT
69
22 06 93
76
AUGEND
9002
9003
FF
FF
AA
AA
SUM
9004
FE
54
9005
FF
55
CARRY
9006
01
01
16 BIT SUBTRACTION:SUBTRAHEND
MINUEND
9100
9101
9102
9103
EE
EE
FF
FF
BB
BB
AA
AA
DIFFERENCE
9104
9105
EF
EF
11
11
BARROW
9106
01
00
16 BIT MULTIPLICATION:MULTIPLICANT
MULTIPLIER
9200
9201
9202
9203
EE
EE
FF
FF
BB
BB
AA
AA
PRODUCT
9204
9205
ED
EE
26
7D
CARRY
9206
12
2E
16 BIT DIVISION:DIVIDEND
9300
9301
EE
EE
BB
BB
QUOTIENT
9304
9305
00
00
01
00
REMINDER
9306
9307
EE
EE
0F
00
DIVISOR
9302
9303
FF
FF
AA
AA
9207
11
D8
RESULT:
Thus an Assembly Language Program to perform the following 16 bit
arithmetic operations is compiled using a 8085 microprocessor kit and the outputs are
verified.
16 bit addition.
16 bit subtraction.
16 bit multiplication.
16 bit division.