  In the presence of a D-brane a string theory develops a new subsector. We
show that for curved D-branes the corresponding sector is a (partially twisted)
topological field theory. We use this result to compute the degeneracy of
2-branes wrapped around $K3$ cycles as well as 3-branes wrapped around CY
threefold vanishing 3-cycles. In both cases we find the degeneracy is in accord
with expectation. The counting of BPS states of a gas of 0-branes in the
presence of a 4-brane in $K3$ is considered and it is noted that the effective
0-brane charge is shifted by 1, due to a quantum correction. This is in accord
with string duality and the fact that left-moving ground state energy of
heterotic string starts at $-1$. We also show that all the three different
topological twistings of four dimensional $N=4$ Yang-Mills theory do arise from
curved three-branes embedded in different spaces (Calabi-Yau manifolds and
manifolds with exceptional holonomy groups).
