Follow Minwahs suggestion.
It is not too hard to accidently remap the config function to another key when using the config menu. I did it just last week.
By deleteing the default.cfg, you will force mame to reset to the original settings. Note this does not affect the individual game settings when you do this.