Thank you for not taking offence alex f...... I have seen better welcomes LOL.....
welcome to the forum anyway ! sounds like a guy tired of playing with it and just wants it to run right ! ...... Idles then dies sounds like dirty pilot jets in the carb to me....or the entire passage way.... typical on these things.
personally I don't care how much money you have to throw at the bike unless YOU do some work on it , or pay someone to work on it it will never be right again.... it won't fix itself,..... and the best action is fix it yourself and save your money !
I have an 83' Special which has the TCI ignition and it's so reliable I seriously doubt that the ignition is your problem ...Unless you've been running it on one cylinder with the other spark plug lead disconnected and dangling..... (that will fry the coil)
the system built into these bikes is darn near impervious ! not a whole lot can go wrong with a TCI system ...But some Have failed,... no doubt.
if You want to fix the bike there is a Technical section on this site that will show you how to fix practically anything and everything that could go wrong with the bike..... if you don't want to work on it then find an experienced Yamaha Mechanic that has experience on the XS650 and have him do it.
that is about your only 2 options....
Good luck to ya !
.....
Bob...........