Two-dimensional simulation of the formation of the Princeton spheromak