Rough port over of core controller code to new statemachine2.  See to
exhibite basic operation.