8051 ALP to subtract two 16 bit numbers| 8051 assembly code

8051 ALP to move a block of data from internal memory to external memory
Below Code is Complied and Verified in Keil uVision 3.
The .asm file is given below after the code. For clarifications and suggestion comment in the comment section



;   8051 ASSEMBLY CODE -- CODESARENA BLOG
;	ALP TO SUBTRACT TWO 16 BIT NUMBER
;	BELOW CODE SUBTRACTS AB20H - 65DE = B942H 

ORG 0000H
CLR C	  		;MAKE CY=0
MOV A,#020H		;LOWER BYTE OF OPERAND 1 IN A
SUBB A,#0DEH	;SUBTRACT LOWER BYTE OF OPERAND 2 WITH A
MOV R1,A		;STORES LSB OF RESULT IN R1
MOV A,#65H		;HIGHER BYTE OF OPERAND 2 IN A
SUBB A,#0ABH	;SUBTRACT WITH HIGHER BYTE OF OPERAND 1
MOV R0,A		;STORES MSB OF RESULT IN R0
END

No comments:

Powered by Blogger.