How to modify this program to display 5 or 6 or 7 digits?

changing the:

Code:
Register=Decode_Reg		' Point to BCD Decode Register
R_Val=%00111111			' Decode the first 6 digits
Gosub Transfer			' Transfer this 16-bit Word to the MAX7219

and

For Position=5 to 1 step -1			' Start at Farthest Right of Display

and

	If Digit>=5 then Digit=0			' We only need the first four digits
changes nothing, only 4 digits are lit.