What code of conduct did knights follow?

They followed the Knights Code of Chivalry.