You have no items in your shopping cart.

Subtotal: 0.00

8-BIT Subtraction

AIM

To perform 8-bit Subtraction of two 8-bit data and store the result in memory.


THEORY

In this experiment, the HL register pair is first initialized to the start address of memory at which the data is stored. Then data is brought to accumulator A and the other one is subtracted from memory itself. The result from A is then stored into memory again using the HL register. The SUB instruction sets and clears flags according to result.


 
ASSEMBLY PROGRAM TO ADD TWO 16 BIT NUMBER

ADDRESS

OPCODE

MNEMONICS

8500

21 50 86

LDA 8650

8503

7E

MOV A,M

8504

23

INX H

8505

96

SUB M

8506

23

INX H

8507

77

MOV M,A

8508

76

HLT


PROCEDURE

  • Key in the opcodes from the address specified.
  • Enter data that is needed for execution at 8650 and 8651.
  • Execute the program and check for results at 8652.
  • Try changing data and check for results each time.

EXAMPLE

Let the data to be subtracted be 24 from 49.
DATA: (8650) = 49
(8651) = 24
RESULT: (8652) = 25


RESULT

Thus the Subtraction of two 8 bit numbers is stored in the resultant memory