It's not quite clear what 0 and 2 mean here - maybe reuse the REG, DEREG, CAPAB constants from elsewhere?