Affiliation on a paper written mostly in previous position
There are no fixed rules but I would opt for your option (2). The affiliation is intended to aid in facilitating contact with the author but is of course useful to a department to show count the paper as a product from that institute. By listing your former address first indicating that that is where you did most of the work and then adding the second as present address provides the best and useful information for all parts. Option (1) means your present location is not disclosed which is a missed opportunity to locate you. Option (3) has the disadvantage that your former department are not associated with the work you performed there. So although all are acceptable, (2) would be the best (most polite and useful) way in your situation.