	.TITLE	%BBCD
/
/BINARY-TO-BCD CONVERSION -
/     INTERNAL SUBROUTINE
/EXECUTION TIME: 76 MICROSECONDS
/CALLING SEQUENCE: JMS* %BBCD
/ENTRY: AC=15 BIT POSITIVE BINARY NUMBER
/EXIT: AC(0-15)=4 BCD CHARACTER
/               EQUIVALENT
/
	.GLOBL %BBCD
/
	.DEC
%BBCD	XX
	CLL
	IDIV        /GET THOUSANDS PLACE
	1000
	DAC REMAIN  /SAVE REMAINDER<1000
	LACQ
	RTR
	RTR
	RTR
	RAR
	DAC OUT     /SAVE THOUSANDS PLACE
	LAC REMAIN
	IDIV        /GET HUNDREDS PLACE
	100
	DAC REMAIN  /SAVE REMAINDER<100
	LACQ
	RTL
	RTL
	RTL
	RTL
	TAD OUT
	DAC OUT     /SAVE THOUSANDS AND
	            /HUNDREDS PLACES
	LAC REMAIN
	IDIV        /GET TENS PLACE
	10
	TAD OUT
	DAC OUT     /SAVE THOUSANDS AND
		/HUNDREDS AND
		/UNITS PLACES
	LACQ
	RTL
	RTL
	TAD OUT     /AC=FULL BCD
		/EQUIVALENT
	RTL
	JMP* %BBCD
OUT
REMAIN
	.END
