  In math.SG/0605587, we studied Yang-Mills functional on the space of
connections on a principal G_R-bundle over a closed, connected, nonorientable
surface, where G_R is any compact connected Lie group. In this sequel, we
generalize the discussion in "The Yang-Mills equations over Riemann surfaces"
by Atiyah and Bott, and math.SG/0605587. We obtain explicit descriptions (as
representation varieties) of Morse strata of Yang-Mills functional on
orientable and nonorientable surfaces for non-unitary classical groups SO(n)
and Sp(n). It turns out to be quite different from the unitary case. we use
Laumon and Rapoport's method in "The Langlands lemma and the Betti numbers of
stacks of G-bundles on a curve" to invert the Atiyah-Bott recursion relation,
and write down explicit formulas of rational equivariant Poincar\'{e} series of
the semistable stratum of the space of holomorphic structures on a principal
$SO(n,\bC)$-bundle or a principal $Sp(n,\bC)$-bundle.
