;UNSINGNED BINARY SUBTRACTION
;THIS ROUTINE SUBTRACTS A 16 BIT BINARY NUMBER FROM A
;32 BIT NUMBER. Y-Z=Y. ARGUMENT Y IS IN M(5,4,3,2) AND            
;ARGUMENT Z IS LOCATED IN M(1,0).
;THE RESULT IN 2'S COMPLEMENT NOT OBTAINED IF Z IS
;GREATER THAN Y. CAN ADD EXTRA CODE TO DO THAT.
;
; EDITTED MAY 11, 1994 - REVISED FOR NEW ASSEMBLER (ASMCOP v4.2) 
;

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


	LD	X,#002
	LD	B,#000
	SC
LOOP:	LD	A,[X]	;Y-Z=Y
	SUBC	A,[B]
	X	A,[X+]
	LD	A,[B+]
	IFBNE	#002
	JP	LOOP
	IFC	
DONE:	JP	DONE
	LD	A,[X]
	IFEQ	A,#000
	JP	BORROW
	DECA
	X	A,[X]
	JP	DONE
BORROW:	DECA
	X	A,[X+]
	LD	A,[X]
	DECA
	X	A,[X]
	JP	DONE
	.END
