Skip to main content

Subtract two 8-bit numbers

Subtract two 8-bit numbers

  1. LXI H, 2501H   :  "Get address of first number in H-L pair. Now H-L points to 2501H"  
  2. MOV A, M       :  "Get first operand in accumulator"  
  3. INX H          :  "Increment content of H-L pair. Now, H-L points 2502H"  
  4. SUB M          :  "Subtract first to second operand"  
  5. INX H          :  "H-L points 4002H"  
  6. MOV M, A       :  "Store result at 2503H"  
  7. HLT            :  "Stop" 

Comments