We present an N-body computer code-aimed at studies of galactic dynamics -
with a CPU-efficient algorithm for a continuous (i.e. time-dependent) stell
ar mass-loss. First, we summarize available data on stellar mass-loss and d
erive the long-term (20 Gyr) dependence of mass-loss rate of a coeval stell
ar population. We then implement it through a simple parametric form into a
particle-mesh code with stellar and gaseous particles. We perform several
tests of the algorithm reliability and show an illustrative application: a
2D simulation of a disk galaxy, starting as purely stellar but evolving as
two-component due to gradual mass-loss from initial stars and to star forma
tion. In a subsequent paper we will use the code to study changes that are
induced in galactic disks by the continuous gas recycling compared to the i
nstantaneous recycling approximation, especially the changes in star format
ion rate and radial in ow of matter.