Description

Sorry I'm cheating by using the description of the MAME documentation as it explains this command quite well.

What it does is control how joystick values map to digital joystick controls. MAME accepts all joystick input from the system as analog data. For true analog joysticks, this needs to be mapped down to the usual 4-way or 8-way digital joystick values. To do this, MAME divides the analog range into a 9x9 grid. It then takes the joystick axis position (for X and Y axes only), maps it to this grid, and then looks up a translation from a joystick map. This parameter allows you to specify the map. The default is 'auto', which means that a standard 8-way, 4-way, or 4-way diagonal map is selected automatically based on the input port configuration of the current game.

Maps are defined as a string of numbers and characters. Since the grid is 9x9, there are a total of 81 characters necessary to define a complete map. Below is an example map for an 8-way joystick:

777888999 Note that the numeric digits correspond to the keys
777888999 on a numeric keypad. So '7' maps to up+left, '4' maps
777888999 to left, '5' maps to neutral, etc. In addition to the
444555666 numeric values, you can specify the character 's',
444555666 which means "sticky". In this case, the value of the
444555666 map is the same as it was the last time a non-sticky
111222333 value was read.
111222333
111222333

Alternative Command

-joymap

Example

mame <gamename> -joystick_map 777888999.777888999.777888999.444555666.444555666.444555666.
111222333.111222333.111222333

Command Format

<gamename> -joystick_map <map>

To specify the map for this option, you can specify a string of rows separated by a '.' (which indicates the end of a row), like so:

777888999.777888999.777888999.444555666.444555666.444555666.
111222333.111222333.111222333

However, this can be reduced using several shorthands supported by the <map> parameter. If information about a row is missing, then it is
assumed that any missing data in columns 5-9 are left/right symmetric with data in columns 0-4; and any missing data in colums 0-4 is
assumed to be copies of the previous data. The same logic applies to missing rows, except that up/down symmetry is assumed.

By using these shorthands, the 81 character map can be simply specified by this 11 character string: 7778...4445

Looking at the first row, 7778 is only 4 characters long. The 5th entry can't use symmetry, so it is assumed to be equal to the previous
character '8'. The 6th character is left/right symmetric with the 4th character, giving an '8'. The 7th character is left/right symmetric
with the 3rd character, giving a '9' (which is '7' with left/right flipped). Eventually this gives the full 777888999 string of the row.

The second and third rows are missing, so they are assumed to be identical to the first row. The fourth row decodes similarly to the
first row, producing 444555666. The fifth row is missing so it is assumed to be the same as the fourth.

The remaining three rows are also missing, so they are assumed to be the up/down mirrors of the first three rows, giving three final rows
of 111222333.

MAME's Default Setting

default