Get a spare spark plug, unplug #1 ignition wire and plug it into the spare plug; now lay the plug on top of the valve cover and have someone turn the motor over with the ignition key. You should see a good spark. Do this for all the cylinders. If they all check out good, then your ignition is OK.
The problem with the stalling may be due to a TPS system problem or the IAA adjustment. The first thing to check is the TPS harness connector pins. The connector is located on the passenger's side of the motor just above the throttle assembly. Look at the pins and see if there's oxidation on them. If so, clean them with fine steel wool then lightly coat them with 'dielectric lubricant' which you can get at most autoparts stores.
For a procedure on adjusting the TPS, go the
http://www.240sx.org web site, FAQ section and look up 'Throttle Position Sensor DOHC'.
To adjust the IAA, Fully warm up the motor. Shut motor off. Disconnect the TPS harness connector. Start motor. Check the idle speed. It should read 650 RPM; If not, adjust the idle screw until you get 650 RPM. The idle screw is located on the passenger's side of the motor near the firewall below the intake manifold. Stop the motor. Reconnect the TPS harness connector. Start motor. The idle speed should now be 700 RPM.
As a side note, make sure the air filter is clean. If it's got 15,000 MI on it, replace it.