
;THIS ROUTINE PERFORMS 16 BIT   SIGNED BINARY SUBTRACTION.
;Y-Z=Z .ARGUMENT Y IS LOCATED IN M(3,2) AND Z IS IN M(1,0).
;IT WILL PROVIDE THE DIFFERENCE IN 2'S COPMLPEMENT IF Z IS
;GREATER THAN Y.
;
; EDITTED MAY 11, 1994 - REVISED FOR NEW ASSEMBLER (ASMCOP v4.2) 
;

	.TITLE  BSSUB
	.CHIP	ANYCOP
        .SECT   MAIN,ROM,INPAGE

	LD	X,#002
	LD	B,#000
	SC
LOOP:	LD	A,[X+]  ;Y-Z=Z  
	SUBC	A,[B]
	X	A,[B+]	
	IFBNE   #002
	JP	LOOP
	IFC 
DONE:   JP      DONE   
NEGRSLT:SC		;Z IS GREATER THAN Y
	LD	B,#000	;GET 2'S COMPLEMENT
COMPL: 	CLRA		;OF THE RESULT
	SUBC	A,[B]
	X	A,[B+]
	IFBNE	#002
	JP	COMPL
	JP      DONE

	.END
