0x05 ( 5 )  Peripheral 1 Setting
  
BitsDescription
7:6Joystick 1 mode (LSB)
5:4Joystick 2 mode (LSB)
3Joystick 1 mode (MSB)
250/60 Hz mode (0 = 50Hz, 1 = 60Hz, Pentagon forces 50Hz)
1Joystick 2 mode (MSB)
0Enable scandoubler (1 = enabled for vga, 0 for crt)
Mode Notes:
Joystick modes:
  000 = Sinclair 2 (12345)
  001 = Kempston 1 (port 0x1F)
  010 = Cursor (56780)
  011 = Sinclair 1 (67890)
  100 = Kempston 2 (port 0x37)
  101 = MD 1 (3 or 6 button joystick port 0x1F)
  110 = MD 2 (3 or 6 button joystick port 0x37)
  111 = User Defined Keys Joystick

* Joysticks can be placed in i/o mode via nextreg 0x0B

* Programming the user defined keys joystick is done through the ps2 keymap interface on nextreg 0x28, nextreg 0x29 and nextreg 0x2B: 1. Write 128 to nextreg 0x28 2. Write 0 (left joystick) or 16 (right joystick) to nextreg 0x29 3. Write twelve bytes to nextreg 0x2B in order. The bytes correspond to the twelve buttons on an md pad (MODE=11 X Z Y START A C B U D L R=0) 4. Each byte written identifies a key in the 8x7 membrane; bits 5:3 select the row and bits 2:0 select the column with 111 meaning no action

* In kempston and md modes, excess buttons on a controller not read via ports will generate key input if so programmed