Eightbit is right. Trackballs will only work on games in mame that are looking for analog inputs (like trackball, spinners, 360 degree steering wheels, analog sticks, 270 degree steering wheels, and paddles).
I wonder if there is a mouse to joy program; there are opposite progs that let you control a mouse pointer with a joystick. If you could find a application that simulates a joystick with a mouse/trackball, and it's low enough that directX sees the joystick, you could use that and standard mame & mame32. If there's one that works in dos only, I guess you would be stuck with dmame. I don't know if one such program exists, though; sorry.

On the mame side, it
might be possible to hack mame to use mouse/trackball inputs as digital input (ie: most games' joysticks), but it would not be easy.