From DOSBoxWiki
Jump to: navigation, search

Remapping the keyboard and joystick

When you start the mapper (either with CTRL-F1 or -startmapper as a commandline argument to the DOSBox executable) you are presented with a virtual keyboard and a virtual joystick. These virtual devices correspond to the keys and events DOSBox will report to the DOS applications. If you click on a button with your mouse, you can see in the lower left corner with which event it is associated (EVENT) and to what events it is currently bound.

Event: EVENT
BIND: BIND (the real key/button/axis you push with your finger/hand)

                                    Add   Del
mod1  hold                                Next

  • EVENT: The key or joystick axis/button/hat DOSBox will report to DOS applications. (the event that will happen during the game, (eg. shooting/jumping/walking)
  • BIND: The key on your real keyboard or the axis/button/hat on your real joystick(s) (as reported by SDL), which is connected to the EVENT.
  • mod1,2,3: Modifiers. These are keys you need to have to be pressed while pressing BIND. mod1 = CTRL and mod2 = ALT. These are generally only used when you want to change the special keys of DOSBox.
  • Add: Add a new BIND to this EVENT. Basically add a key from your keyboard or an event from the joystick (button press, axis/hat movement) which will produce the EVENT in DOSBox.
  • Del: Delete the BIND to this EVENT. If an EVENT has no BINDS, then it is not possible to trigger this event in DOSBox (that is there's no way to type the key or use the respective action of the joystick).
  • Next: Go through the list of bindings which map to this EVENT.


Q1. You want to have the X on your keyboard to type a Z in DOSBox.

A. Click on the Z on the keyboard mapper. Click "Add". Now press the X key on your keyboard.

Q2. If you click "Next" a couple of times, you will notice that the Z on your keyboard also produces an Z in DOSBox.

A. Therefore select the Z again, and click "Next" until you have the Z on your keyboard. Now click "Del".

Q3. If you try it out in DOSBox, you will notice that pressing X makes ZX appear.

A. The X on your keyboard is still mapped to the X as well! Click on the X in the keyboard mapper and search with "Next" until you find the mapped key X. Click "Del".

Examples about remapping the joystick:

You have a joystick attached, it is working fine under DOSBox and you want to play some keyboard-only game with the joystick (it is assumed that the game is controlled by the arrows on the keyboard):
  1. Start the mapper, then click on one of the left keyboard arrow. EVENT should be key_left. Now click on Add and move your joystick in the respective direction, this should add an event to the BIND.
  2. Repeat the above for the missing three directions, additionally the buttons of the joystick can be remapped as well (fire/jump).
  3. Click on Save, then on Exit and test it with some game.

You want to swap the y-axis of the joystick because some flightsim uses the up/down joystick movement in a way you don't like, and it is not configurable in the game itself:

  1. Start the mapper and click on Y- in the first joystick field. EVENT should be jaxis_0_1-.
  2. Click on Del to remove the current binding, then click Add and move your joystick downwards. A new bind should be created.
  3. Repeat this for Y+, save the layout and finally test it with some game.

If you want to remap anything to your d-pad/hat you will have to change joysticktype=auto to joysticktype=fcs in configuration file. Maybe this will be improved in the next dosbox version.

If you change the default mapping, you can save your changes by clicking on "Save". DOSBox will save the mapping to a location specified in the configuration file (the mapperfile= entry). At startup, DOSBox will load your mapperfile, if it is present in the DOSBox configuration file.