The civilian transponder has just two modes, well three I guess now...
The civilian modes are: A, C and S
A is the 4 digit octal code that you put in either 1200 or whatever ATC assigns. Mode C is the altitude in hundreds of feet that your transponder encodes. I don't understand how S works, so I won't discuss it, but I believe that's what TCAS uses to handle traffic conflicts. I remember in some other discussion that there was mode B or something like that but it's not used.
The military transponder or IFF has 5 modes: Modes 1, 2, 3/A, 4, and C
Mode 1 is a 2-digit octal code
Mode 2 is a 4-digit octal code
Mode 3/A is a 4-digit octal code where the pilot can put in a squawk if ATC assigns one to the aircraft. This is the same mode that civilian pilots put into their transponder.
Mode 4 is an encrypted code
Mode C is the altitude in hundreds of feet
Mode 4 used to be the primary means of positively id'ing a friendly aircraft because if you had a valid Mode 4 then the only way you could get it was if you had the crypto loaded. But the crypto for Mode 4 has been decertified, so it's still available, but it's not the sole determining factor on determining whether this is a friendly aircraft or ship.
The pilot can't change Modes 1, 2, 4 in the cockpit, but he can turn them off so that he looks like a normal civilian aircraft squawking just modes 3 and C, just like you can turn off your transponder in your cockpit.
The military transponder does respond to TCAS interrogations so when they are doing intercepts, it's in the SOP for the fighters to turn off the Mode C to prevent a TCAS TA
/RA with a TCAS equipped aircraft.
Bonus animus sit, ab experientia. Quod salvatum fuerit de malis usu venit judicium.