When D.J. Carrasco's two high-and-tight pitches to Miguel Olivo sparked a benches-clearing brawl and Ozzie Guillen lost it on the umpiring crew during Sunday's White Sox-Royals game in Kansas City, plenty of baseball purists had to have been cringing or shaking their heads.

Not Ross Bernstein, who probably had a big smile on his face watching the highlights as he chalked yet another one up to "The Code."

Bernstein, a longtime sportswriter and author, has dedicated his latest book to the art of the age-old, controversial "Code" that permeates baseball behavior in between the lines, in the clubhouse, and, at times, elsewhere.

It's called "The Code: Baseball's Unwritten Rules and Its Ignore-At-Your-Own-Risk Code of Conduct" (Triumph, 240 pages) and it details everything you need to know about brushbacks, beanballs, charging the mound, sign-stealing, dealing with umpires, wearing body armor, players "showing up" other players and managers, media manipulation ... you name it.

"There's so many examples of The Code in baseball that it really warranted a book," says Bernstein, who also wrote a similar book about the National Hockey League.

"In baseball, when you run up the score late or pimp a home run or swing out of your shoes on 3-and-0 pitch, you're going to pay the consequences. Guys don't want to be shown up, and it's all about respect. It's always been fascinating to see that unseen side of the game and find out how this all came to be."

To that end, Bernstein conducted interviews with over 100 current and former Major Leaguers, umpires, "a lot of pitchers and catchers," and got their unique opinions.

He also got Rob Dibble, Jack Morris and Torii Hunter to contribute forewords, with each player offering their own insights on what The Code means to them.

"It was really a fun journey to talk to these players," Bernstein says. "I won't be winning any Pulitzers here, but I relied on the players to tell the stories. And I learned a lot.

"Baseball is its own animal. It's not like hockey, where they allow the game to police itself and fighting is allowed. In hockey, you're accountable for your actions and you might lose teeth. In baseball, there are countless ways to retaliate. And many of them seem juvenile, but they've evolved over the course of 150 years, so you don't argue with it."

Bernstein details quite a few of the most famous historical examples of The Code in action, including Nolan Ryan and Robin Ventura's brawl (the photo of which graces the book cover), Roberto Alomar spitting on umpire John Hirschbeck, Kirby Puckett being beaned by Dennis Martinez, Pete Rose running over catcher Ray Fosse in the All-Star Game, Ben Davis bunting to end Curt Schilling's perfect-game bid, and White Sox fans attacking Royals coach Tom Gamboa.

"It's fun to hear about what really goes on," Bernstein says. "You know, that no one gets drilled by mistake. That umpires keep notes of confrontational things, forcing teams to be creative about how they retaliate. That some managers and coaches keep notebooks that allow them to remember the details of how they were shown up. And when the wheels of retaliation are set in motion, The Code takes over."

Bernstein listed 30 codes in the book and they include new examples and "archaic" ones: not talking to a pitcher who's throwing a no-hitter, hard slides at second base and at home, the press not interviewing a pitcher on the day of his start, and many others.

"Some guys talked and some guys didn't," Bernstein says. "I totally respect that. For every guy who opened up the vault and spilled his guts, there was another who wanted to keep these things secret. And love it or hate it, it's a part of the game. Guys don't want to be dissed."

One of Bernstein's favorite anecdotes comes from former big-league player and coach Al Newman, who had to face Hall of Famer Ryan in his first game after being called up to The Show.

"So on the first pitch, he bunts, beats it out, gets all excited, and looks at his teammates. The umpire says, 'Foul ball!' So Al does this walk of shame, and Nolan walks over to him and just shoots this cutting stare at him.

"And sure enough, Nolan let him have it."

Bernstein concludes by saying that The Code is always changing and always open to interpretation, but one thing has remained the same forever.

"Baseball's a game of karma," Bernstein says. "If you play like a jerk, you're gonna get treated like a jerk."

This story was not subject to the approval of Major League Baseball or its clubs.