I just want to start by agreeing with the others who have said that you did not commit a mortal sin by staying out of you friends’ conversation. I do not think you even committed a venial sin based on your description of events.
I think the main thing you must keep in mind is that we all need to “pick our battles”. Sometimes you can intervene and it will produce good results, i.e. the person will realize their error and repent. Other times if you get involved it can either produce no results or negative results (i.e. being ignored, putting someone on the defensive and making them less open to changing, etc.).
As someone who has quite a few friends who are atheists or agnostics I know it can be difficult at times to maintain such friendships when the most important part of your life separates you from them. However, if they are truly friends of yours they will respect your faith and perhaps even be willing to talk to you about it in a polite and honest way. Try to admonish them with thoughtful kindness before taking a more serious tone. Realize that “they know not what they are doing” and that you must first cure their ignorance before you can hold them fully accountable for their foolishness.
I maintain an understanding with my non-religious friends that there are no questions they can ask me that are off-limits as regards my faith. I will answer their questions thoughtfully so long as they are willing to listen thoughtfully. Aside from educating them about the faith (even if they continue to believe it to be false) it also helps dispel the common believe that religious people aren’t “logical” or that they base their faith entirely on “warm fuzzy feelings” and bristle at the slightest questioning of their beliefs.
Though I have several friends who do not believe in God, over time they have learned not to disparage God in my presence unless they want a friendly debate to begin (I often like pointing out the foolishness on their part for talking badly about God since they claim they do not believe He exists.) Not only are they more respectful of religion now than they once were, but they are more open to asking questions instead of just parroting lies they’ve heard about faith or the Church.
I honestly think these talks will one day help bring some of them to God. I like to think of it as planting seeds. So perhaps the next time your friends are blaspheming you can try this approach and plant some seeds too? It might not work, but I think it’s a more effective approach than any of the others I’ve seen. Just make sure you’re ready to respond to any inquiries, and if you don’t know the answer to a question they pose be honest and tell them you’ll look into it for them (if it’s a question that can be answered). If nothing else these friends will likely respect your faith more even if they do not go out and convert.