Create new custom payment module

I need to create a new custom payment module in Magento 1.9, just like cash-on-delivery. anyone can help me.