If you want to do it pixel-wise, the Hugo-Elias link posted above explains it in a very straight-forward way

I even did this flowfire technique in Blitz Basic myself, it was fast enough to run at only 320 * 240 in Blitz.. Bmax may well do a better job.
Your version gives a similar kind of effect actually and I really like it a lot. It does look quite like fire with little sparks drifting upwards.