Complex sentence: Gambling has been legal in Macau for a long time beginning around 1850 where there was a licensing system for gambling houses until 1863.
Split into simpler sentences: Gambling has been legal in Macau since around 1850. There was a licensing system for gambling houses until 1863.