Writing custom "uppercase" function

Mac OS X does not support ${VAR^^} and its variants, so I need to do
this by hand.  I only care about ASCII, so the task is not too daunting.