Sounds like it's trying to use the number pad, where MAME now uses the arrow keys for Player 1. The best way to get this fixed:
1. Start a game in MAME.
2. Press TAB
3. Input (General) should be highlighted. Press ENTER (keyboard).
4. Use the arrow keys (keyboard) to select Player 1 controls. Press ENTER.
5. For each of the 4 main directions (Up, Down, Left, Right), highlight it and press enter. Then press that direction on your control stick and wait a few seconds for that key to pop up (being number pads, this'll be 2, 8, 4, and 6). Now that direction is set to work with your joystick in every game (that uses a regular joystick).
Tip- If you set a direction, and press ENTER again before moving off the menu item, you can set multiple keys to that button. For example, for UP, you can press ENTER, then Joystick up, wait, then ENTER again, then arrow up on keyboard. Now the game thinks you're pushing up if you use either the joystick or the arrow keys.
If you scroll off the menu option, then go back to it, whatever you put in will instead overwrite it.