How do I configure the keys?
Press Tab in-game and choose "Input: This Game". Select the input you want to configure, press enter followed by the key you want it mapped to.
More fancy key combinations can be made. To map this key OR that key, set one of the keys as before, wait until mame accepts it, then repeat for second key. To map so two keys have to be pressed at the same time, press both (or more) keys (or press them with a second of each other) after pressing enter. To map a NOT (key1 only if key2 is not also pressed), enter, press first key, then quickly press the second key(s) twice.
"Input: General" can be selected to change all games inputs, and mame's UI buttons.
This remapping will also work for joystick or mouse inputs if joystick or mouse support is enabled (see below).