Move manual bit-banging debug code to separate file