Skip to main content

Add two 16-bits number with ADD and ADC instruction

Add two 16-bits number with ADD and ADC instruction

  1. LHLD 2501H   : "Get 1st 16-bit number in H-L pair"  
  2. XCHG         : "Save 1st 16-bit number in DE"  
  3. LHLD 2503H   : "Get 2nd 16-bit number in H-L pair"  
  4. MOV A, E     : "Get lower byte of the 1st number"  
  5. ADD L        : "Add lower byte of the 2nd number"  
  6. MOV L, A     : "Store result in L-register"  
  7. MOV A, D     : "Get higher byte of the 1st number"  
  8. ADC H        : "Add higher byte of the 2nd number with CARRY"  
  9. MOV H, A     : "Store result in H-register"  
  10. SHLD 4004H   : "Store 16-bit result in memory locations 2505H and 2506H"  
  11. HLT          : "Stop" 

Comments