According to the Midi Manufacturers (http://www.midi.org/) there are books you can purchase with the specifications and some are posted on the net as well. However, a quick look didn't show links to the e-text.
Midi Web (http://www.midiweb.com/index2.html) is probably a better place to start - there's a tech corner and some programming stuff.
Those links should lead you in the direction of what you're looking for.