We construct a moduli scheme for semistable pre-$\D$-modules with prescribed singularities and numerical data on a smooth projective variety. These pre-$\D$-modules are to be viewed as regular holonomic $\D$-modules with 'level structure'. We also construct a moduli scheme for perverse sheaves on the variety with prescribed singularities and other numerical data, and represent the de Rham functor (which gives the Riemann-Hilbert correspondence) by an analytic morphism between the two moduli schemes.