Well, if you're only concerned with mame, it does the mapping internally, unless you specify something else via a U360 plug-in. So there is a default diagonal mapping in mame for Q-bert, already.
.....I think, anyways. If not, look up Mamejoymap by Headkaze.