I think I might have this nailed now. Still need to investigate potential problems with PUTS_SCI0, but all of the tests I'm throwing at it now are sending back the expected flags.