Black smoke means it's running rich. +1 for pulling codes as a place to start, though it's entirely possible the computer has no idea what's wrong either. If a sensor's way out, but not out of its allowable range, the computer trusts it and the engine runs like crap because it's calculating its fuel mixture based on inaccurate sensor readings. My first suspect would be the temp sensor, the two-pin one on the upper coolant neck (the one-pin is for the gauge on the dash). Check the plug for any obvious damage or corrosion, and try to start the truck with it unplugged. That should force the computer to guess the engine temp, and if the sensor's hoopajooped, the computer's guess should be better than the data it was getting. (It'll fudge data for a few sensors if they're not hooked up, I think the temp sensor is one of them.) There's also a resistance check in the service manual for the sensor itself (also the procedure to pull codes from the ECU). If it's not that, plug it back in and do the same checks on the MAF and the oxygen sensor (the plug for the O2 sensor is on the passenger's valve cover, three wires, I think it's two white and one black but I may have that flipped around).
Idling fine but crapping out when you boot it makes me think the fuel filter's clogged, but that would make it run lean, not rich. I've heard of the fuel pressure regulator failing and sending gas through the vac line into the intake, but it seems like that would cause the most trouble at idle.
Also check your spark plugs. Plugs won't cause a rich condition, but if some are richer than others, that might point towards a solution. Also, running extremely rich can foul spark plugs to where they don't work properly.