Why would an 1989 Beretta idle roughly and in hot weather make a popping noise lurch like it's out of gasthen die?

i recently had this poblem with a 90 that i had just bought and it ended up being that the firing order was wrong.