It depends whats wrong with it. As long as the cylinders arent too beat up, you could put new pistons, rings and a new crank in it for $1,000. If you did that, you woul pretty much have a brand new engine that would last you another 10,000-15,000 miles or more.
Keep an eye out on Ebay. Sometimes you can find a complete motor that runs for pretty cheap.