Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Subtract two 8-bit numbers

Published on Nov 12 2009 // Learners

Statement: Subtract the contents of memory location 4001H from the memory location 2000H and place the result in memory location 4002H.

Program – 4: Subtract two 8-bit numbers

Sample problem:

(4000H) = 51H

(4001H) = 19H

Result    = 51H – 19H = 38H

Source program:

LXI H, 4000H : HL points 4000H

MOV A, M : Get first operand

INX H : HL points 4001H

SUB M : Subtract second operand

INX H : HL points 4002H

MOV M, A : Store result at 4002H.

HLT : Terminate program execution


4-Subtract two 8 bit numbers 

Related Programs for Beginners: (Click down)

Store 8-bit data in memory

Pack the unpacked BCD numbers

Left Shifting of a 16-bit data

Finding Two’s complement of a number