The same way that they are calculated for short selling a Nifty Jan 8800 CE
Margins are calculated using SPAN (Standard portfolio analysis of risks), this is a model built by CME (Chicago mercantile exchange) and used by NSE.
You can use our SPAN calculator to know how much is charged.
Margins are charged for option writing because potential losses are unlimited. Hence a margin charged and MTM'd.
Check this chapter on Varsity: http://zerodha.com/varsity/chapter/margin-m2m/
I know bro, Chutiya Question, Chutyia Answer