;
; BCD ADD ROUTINE
; THE 4 BYTES FROM DATA MEMORY LOCATIONS 24 THRU 27 ARE SUBTRACTED 
; FROM THE 4 BYTES IN DATA MEMORY LOCATIONS 16 THRU 19. THE RESULTS 
; REPLACE THE DATA IN MEMORY LOCATIONS  24 THRU 27.
; THE BCD PRE-CONDITIONING OF ADDING (ADD) THE HEX 66 IS NECESSARY.
;
; EDITTED MAY 11, 1994 - REVISED FOR NEW ASSEMBLER (ASMCOP v4.2) 
;

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

	LD	X,#16	;NO LEADING ZERO                 
	LD	B,#24	;INDICATES DECIMAL
	RC
LOOP:	LD	A,[X+]
	ADD	A,#066	;ADD HEX 66
	ADC	A,[B]
	DCOR	A	;DECIMAL CORRECT
	X	A,[B+]	
    	IFBNE	#12
	JP	LOOP
	IFC
	JP	OVFLOW	;OVERFLOW IF C
