second, you are the inventor of this software, therefore, patent holder. Using your own time and resource to develop this software will help your claim against your current employer. If it's very valuable, most likely there will be disputes of ownership.
third, you need to talk to a patent attorney. There will be patentability evaluation, and other tasks such as if you have used open source material etc. You need professional help. Patent cost varies -- from a few thousands dollards to millions, average 2 years in U.S. If you want to go for worldwide protection, the cost will be huge and process long. You need to think if you can afford it.
My suggestion: if you believe in your technology, start a company first, then look for funding by talking to angel investors and VCs. If it's on the verge of commercialization, VC will consider it. If it's still preliminary, angel investor is your best bet. Some law firms/attorneys will take equity in the company in exchange for legal service. (very rare now after IT bubble bursted.)
At last, best of luck.