  The prepotential of N=2* supersymmetric theories with unitary gauge groups in
an Omega-background satisfies a modular anomaly equation that can be
recursively solved order by order in an expansion for small mass. By requiring
that S-duality acts on the prepotential as a Fourier transform we generalise
this result to N=2* theories with gauge algebras of the D and E type and show
that their prepotentials can be written in terms of quasi-modular forms of
SL(2,Z). The results are checked against microscopic multi-instanton calculus
based on localization for the A and D series and reproduce the known
1-instanton prepotential of the pure N=2 theories for any gauge group of ADE
type. Our results can also be used to obtain the multi-instanton terms in the
exceptional theories for which the microscopic instanton calculus and the ADHM
construction are not available.
