Question: was the knights code of chivalry written down

Answer: Yes, Chivalry, or the chivalric code, is an informal, varying code of conduct developed between 1170 and 1220, never decided on or summarized in a single document, associated with the medieval institution of knighthood; knights' and gentlewomen's behaviours were governed by chivalrous social codes. The ideals of chivalry were popularized in medieval literature, especially the Matter of Britain and Matter of France, the former based on Geoffrey of Monmouth's Historia Regum Britanniae which introduced the legend of King Arthur, which was written in the 1130s. All of these were taken as historically accurate until the beginnings of modern scholarship.