We define and study the stack U-g,g(ns,a) (possibly singular) projective curves of arithmetic genus g with g smooth marked points forming an ample nonspecial divisor. We define an explicit closed embedding of a natural G(m)(g)-torsor (u) over tilde (ns,a)(g,g) over U-g,g(ns,a) into an affine space, and we give explicit equations of the universal curve (away from characteristics 2 and 3). This construction can be viewed as a generalization of the Weierstrass cubic and the j -invariant of an elliptic curve to the case g > 1. Our main result is that in characteristics different from 2 and 3 the moduli space (u) over tilde (ns,a)(g,g) is isomorphic to the moduli space of minimal A(infinity)-structures on a certain finite-dimensional graded associative algebra E-g (introduced by Fisette and Polishchuk).