Added some more comments. Cleanups based on PR feedback. Comment was unclear.
This add support for SD protocol 2 while staying compatible with protocol 1.01. Most of this is quite hacky, but it seems to be working well. The original implementation was quite confusing, so I didn't touch most of the stuff I did not understand.