Microprocessor and Microcontroller Lab
Prepared By
Dr. S.Murugan, Associate Professor
Department of Computer Science,
AlagappaGovernment Arts College, Karaikudi.
(Affiliated by Alagappa University)
Mailid: muruganjit@gmail.com
2. 16 Bit Addition
Addition of two 16 bit numbers
Memory Location Hex
Code
Mnemonics Comment
1000
1001
1002
2A
00
11
LHLD 1100 ; Load the contents of memory locations
1100 and 1101 into registers H and L.
(Load the first 16 bit number)
1003 EB XCHG ; Exchange the contents of register pair
HL with the DE register pair
1004
1005
1006
2A
02
11
LHLD 1102 ; Load the contents of memory locations
1102 and 1103H into registers H and L.
(Load the second 16 bit number)
1007 19 DAD D ; Add the contents of the DE register pair
to the HL register pair (HL = HL + DE)
1008
1009
100A
22
00
12
SHLD 1200 ; Store the contents of registers H and L
into memory locations 1200 and 1201
100B 76 HLT ;Halt the program execution
Addition of two 16 bit Numbers - Result
Input Output
Memory
Location
Hexa
Decimal
Decimal Memory
Location
Hexa
Decimal
Decimal
1100 FF 255 1200 3A 58
1101 01 01 1201 04 04
1102 3B 59
1103 02 02
Assembly Language Program for 16_bit_Addition

Assembly Language Program for 16_bit_Addition

  • 1.
    Microprocessor and MicrocontrollerLab Prepared By Dr. S.Murugan, Associate Professor Department of Computer Science, AlagappaGovernment Arts College, Karaikudi. (Affiliated by Alagappa University) Mailid: muruganjit@gmail.com
  • 2.
    2. 16 BitAddition
  • 3.
    Addition of two16 bit numbers Memory Location Hex Code Mnemonics Comment 1000 1001 1002 2A 00 11 LHLD 1100 ; Load the contents of memory locations 1100 and 1101 into registers H and L. (Load the first 16 bit number) 1003 EB XCHG ; Exchange the contents of register pair HL with the DE register pair 1004 1005 1006 2A 02 11 LHLD 1102 ; Load the contents of memory locations 1102 and 1103H into registers H and L. (Load the second 16 bit number) 1007 19 DAD D ; Add the contents of the DE register pair to the HL register pair (HL = HL + DE) 1008 1009 100A 22 00 12 SHLD 1200 ; Store the contents of registers H and L into memory locations 1200 and 1201 100B 76 HLT ;Halt the program execution
  • 4.
    Addition of two16 bit Numbers - Result Input Output Memory Location Hexa Decimal Decimal Memory Location Hexa Decimal Decimal 1100 FF 255 1200 3A 58 1101 01 01 1201 04 04 1102 3B 59 1103 02 02