Perform the subtraction of two 16-bit numbers using ALP.

;           F6 96 H

 ;       -  C6 79 H

 ;      =  30 1D H

 ;R1=30H(MSB),    R0=1DH(LSB)


ORG 0000H

CLR C

MOV A,#96H

MOV R6,#79H

SUBB A,R6

JNC GO

CPL A

INC A

GO:MOV R0,A

MOV A,#0F6H

MOV R7,#0C6H

SUBB A,R7

JNC GO1

CPL A

INC A

GO1:MOV R1,A

END


 

Comments

Popular posts from this blog

Wire wound strain gauge

Foil type strain gauge

Do an ALP to compare two eight bit numbers NUM1 and NUM2 stored in external memory locations 8000h and 8001h respectively. Reflect your result as: If NUM1NUM2, SET MSB of location 2FH (bit address 7FH). If NUM1 = NUM2, then Clear both LSB & MSB of bit addressable memory location 2FH.