Can you figure the code behind this?...

Code:
	BCDByte=DecimalByte DIG 1
	BCDByte=BCDByte<<4
	BCDByte=BCDByte+DecimalByte DIG 0
When DecimalByte=12, then BCDByte=$12

or put another way...

Code:
	BCDByte=((DecimalByte DIG 1)<<4)+DecimalByte DIG 0