For years now, any knight character in movies or in hobbies with a set of morals have been slammed with the "knights were just cavalary with a title! The chivalric code is a sham!", but is that really so?
I recall many a moon ago I was looking into the issue and found some online resources talking about how while the idea of the chivalric knight wasn't fitting of the early medieval ages, the later medieval ages ended up inspired by their own PR with many adopting such a romanticised code of honours as inspired by old tales. But I now that I'm older, I can't seem to find them anymore and I'm starting to question the validity of the sources I found back then.
A helpful anon suggested I may have been thinking of the Courts of Love, but I'm unsure.
Can anyone shed some light on the progressing relationship between knights and a code of honor, and/or perhaps provide from resources that I can look into? Thank you very much in advance.
Before answering, it's important to point out that there is not an agreed-upon 'code of chivalry' that a knight adheres to before taking up the title. Also, one can't just 'take up the title' without sufficient financial backing - warhorses and armor are not cheap. But even having a horse, a spear, some armor, and a shield do not make you a knight. The title of knight would come with privileges generally not afforded your average mounted cavalry (who most likely are a part of a knight's retinue). Before adhering to any sort of 'code of chivalry' a knight must first swear an oath to a liege lord who will employ him to keep the peace and serve in times of war. As a reward for doing so, the knight is usually awarded land which can help generate money for his arms and armed followers.
This question of chivalry has been pursued before here by u/J-Force: https://www.reddit.com/r/AskHistorians/comments/oremrs/edward_of_woodstock_the_black_prince_is_famous/
As far as the chivalric code being in and out of favor, it actually fluctuates a lot depending on what time in history you're in.
While I can't answer this from a historical perspective, I can give you some insight into part of your question; namely, where does the idea of the "chivalric code" come from?
In looking at the idea of chivalry, it's important to recognize that as u/Porkbut notes, there was never an agreed upon "code" of behavior, and more importantly for this answer, there was never a uniform code of behavior in the literary world of romance.
There is another important piece to start with; the chivalric ideal was always nostalgic ~ whenever we see a discussion of any kind of chivalry, it was always already in the distant past. Consequently, when Malory in Le Morte d'Arthur gives his famous lines, "Ryghte soo fareth loue now a dayes / sone hote soone cold / this is noo stabylyte / but the old loue was not so / men and wymmen coude loue to gyders seuen yeres / and no lycours lustes were bitwene them / and thenne was loue trouthe and feythfulnes / and loo in lyke wyfe was vsed loue in kynge Arthurs dayes /" he is already, in 1460 or so, imagining that the courtly ideal of love was lost to the past.
If we step further back, to Chretien de Troyes writing in the court of Marie de France (c. 1160s), here again we find that the Arthurian tales that explore the courtly ideals are imagined as being in a past time; likewise, Geoffrey of Monmouth's De gestis Britonum or Historia Regum Britanniae (History of the King's of Britain c. 1136), which is generally considered the origin of the Arthurian world as a complete concept, imagines the Arthurian world in the context of a larger English history, and thus as part of the past.
So, if the idea of the chivalric knight (Arthurian or otherwise) was already a lost concept in 1136, what time might they be referring to? One answer is to look even further back, to the continent and Carolingian Empire. Around the same time that Geoffrey and Chretien are writing their works, The Song of Roland (a chanson de geste or "song of deeds") emerges (c. 1040-1115) and lionizes a hero of Charlemagne's fighting against the Moors in Spain. This would be around 778 during the Roncesvalles Campaign (the poem itself is not meaningfully historical).
In other words, the Arthurian, and more generally courtly, ideal was created piecemeal by different authors in different times, and in every case was placed in an imaginary past that doesn't correlate with any actual period or place or people.
However;
It is certainly true that other people wrote and attempted to quantify some aspects of the courtly ideal. One example is Andreas Capellanus' De Amore or De Arte Honesti Amandi ("On Love" or "The Art of Virtuous/True Love") which comes from the same court as Chretien de Troyes ~ Marie D'France. Written in the late 1180s, it purports to explain what "love is" and proceeds to give a lengthy series of rules about what is or is not proper in love, based on gender and class.
There are a number of problems with interpreting this text, including his treatment of women and the lower classes. It has been argued, given that the name of the author means "Andre the Chaplain" that the work is meant to be satirical rather than serious. In any event, there are certainly other works that attempt to codify chivalry (Geoffrey de Charny's Livre de Chevalerie for example, c. 1350), but all of them are late, and none of them represent a coherent view of the "chivalric ideal" as it is expressed literarily.
In short, the "chivalric ideal", whether in the Arthurian world, the Tristran and Isolde world, or anywhere else, is always a nostalgic expression for a lost time/place that never really existed. Consequently, the late medieval attempts to create actual "codes" are a-historical attempts to create something that never really existed.