No one can fault you (or, at least, no one should) for whatever level of cooperation you chose to show the police.
That officer was either ignorant of the law or hoping you were. When he found out that you knew the law (and that he probably did not), he wisely chose to change tack.
You may not know the code numbers, but you know the law. If an officer thinks he knows the law and you don't, having it on paper won't help you make the case. Several officers in Alabama have expressed the notion that they won't believe what a citizen has to say about the law, even if they have printed up citations. Having printed up literature would be a good memory-jogger for you as to section numbers and names of decisions, but not worth much else.
Definitely get a recorder. I don't mind letting the officer know that I am recording the encounter. To me, the open recorder is like an OCed firearm. It is designed to prevent trouble, not so much to deal with trouble after it happens.
Shame on the officer for starting off confrontationally, even if he ended well.
Anyway, thanks for sharing. You represented well.