
WARNING: Backup your old lowlevel.library! This version is only a small rewrite
to support PC type game ports and may not be compatible. I tested each library
function and played BoulderDsh RTX with it. There is a good chance that all
other games work, too.

PLEASE NOTE: Most games are using "Unit 2" as default which is the joystick port
when using a normal Amiga.

PLEASE NOTE: On amithlon the current audio drivers are resetting the game port
setup made by GamePortEnable. This causes that GamePortEnable within the
user-startup isn't working. You need to run GamePortEnable after bootup and before
starting the game. The upcoming audio drivers will fix this problem.

PLEASE NOTE: Some games are using the original "audio.device" or the paula
hardware and not AHI. On Amithlon these games are causing the CPU emulation to
slow down up to 50%. When using "baer" from the Amithlon distribution the games
are running up to twice as fast and the game port timing is working again!

PLEASE NOTE: GamePortEnable is using the openpci.library, which currently has
big problems with IO memory. That's the reason for the complicated offset to
address handling. Currently there is no other way to fix it.

;----------------------------------------------------------------------------------

 History

41.18 Added LowLevel Prefs

41.19 Improved LowLevelPrefs

      Added GamePortEnable tool, which enables sound blaster game ports

      Added some missing options to the preferences GUI.

41.20 New game pad visualisation fields.

      Reworked the timeout mechanism.

      Added a few game pad profiles within the preferences menu for easy
       setup.

      Now it's possible to calibrate within the preferences. By setting the
       calibration to fixed, it's possible to save the calibration. This is
       very useful when using a game pad, which does not need to be recalibrated
       each time.

      Added a warning requester (amithlon only) when a non config space address is
       used. This should avoid crashes when using totaly wrong inputs.

      GamePortEnable now only outputs the port offset! Due an API lack it's not possible
       to find the real address here. Use GamePortFind on non Amithlon systems. On Amithlon
       simply use $00efxxxx where xxxx is the offset returned.

41.21 Fixed calibration gadget.
      Improved calibration to work with single side axis buttons. (named X or Y 
       on the game pads)

41.22 Fixed openpci workaround within GamePortEnable.
      Some minor optimisations.

41.23 Added thresshold gadgets for the axis. This allows to setup values especialy
       for joysticks which avoid the maximum movement of the stick to cause a reaction.
      Small GUI optimisations.

41.24 Fixed the preferences version check.
      Removed some unused library core functions.

41.25 Fixed QueryKeys() function, which was the only not implemented in may test
       tool which helped (thanks to Murphy) to keep this bug undetected. (reported
       by Chris S Handley)

41.26 GamePortEnable now supports "VT82C686 Audio Codec 97" game ports.
      Fixed problem with non Amithlon IO addresses.

41.27 Added Amiga port support.
      Added Catweasle support.
      Selecting the game port is now more comfortable.
      Reworked the profile menu.
      Improved the gadget disable code.

41.28 Some catweasle fixes.
      Added 4 player interface support.
      Fixed possible library crash when a game was using an 
       illegal game port number.

;----------------------------------------------------------------------------------

This is a lowlevel.library for pci based amiga systems like Amithlon, MorphOS or
Amiga with PPC board. It's also a replace driver for original Amiga game ports.

The new tool GamePortEnable try's to find some sound card (currently only card
made/licenced by Creative) by using the openpci.library. I actually cannot
garantee that this is working on non Amithlon systems, because I worked around
several openpci problems on Amithlon only. This openpci problem may not be
present on non amithlon systems, but be warned.

On Amithlon the onboard game port is normaly available at 0xef0201. It's
required to enable the port via bios setup. There is no simple way to find any
game port available. Some audio board will be detected and activated by 
GamePortEnable, which needs to be startet once after reboot. (-> user-startup)

I added a very (very) simple tool (GamePortFind) to find a port within the
IO space.

On Amithlon just start GamePortFind within CLI/Shell. Make sure all buttons and
auto fire options are disabled and press return until the next message tells you
to press the buttons. Just press and hold as much buttons as possible and hit
return until the next message pops up. This time there should be at least 1
address. This is the key to the city! If your game port isn't listed, then you
may have a card that using a different location. Simply increase the stop
address and try again. It may also be possible that the gameport is disabled and
GamePortEnable is unable to activate the port.

Now you can start LowLevelPrefs. Simply choose the known game port by using the
selection bar and skip the axis setup. It's save (and sometimes required) to use
the same game port address for different units.

The axis gadgets allow to setup the direction control. Normaly the X/Y of axis 1
are used for direction input. Choose "Joystick X" and "Joystick Y". Some game
pads and joysticks use the 2 left axis for button input. Simply choose "Button56"
and "Button78" to remap the values to the desired buttons below. If the
direction is wrong (left goes right and right goes left), then use the "<>"
version of the desired axis to swap directions.

When using an Y interface then use two units with the same game port address.
The first unit is using the first axis as direction control, the second is using
the other axis. Make sure you deactivate the unused within each setup to avoid a
mixup. There are joystick profiles available within the preferences menu.

The thress hold slider allows a setup for joysticks. The default is 16 just in
case you changed them by accident. Please note that the maximum and minimum
values aren't very useful. Setting the thresshold to big is causing
movment/button press even if the stick is centered. Minimum values may never be
reached even if the stick is moved at maximum. Values between 8 and 90% should
work all the time. As I said before a value of 16% is working perfect then using
normal game pads.

The buttons below allow to select which button on your game pad is representing
which type of button on the original CD32 pad. Please note that the RED button
is equal to the left mouse (fire)-button and BLUE is equal to the right mouse
button.

Please also note that the buttons 5 to 8 are only available for game ports. If
you setup one of the axis gadgets to create such button action. The buttons 5 to
8 require calibration. Simply press and hold or tap the buttons for calibration.

If there is no game port reaction within the button/axis display, then try other
ports.

If the way above does not deliver any adresses, or you are using MorphOS or PPC
Amigas, then you should start your pci scan utility to find the pci board
containing the game ports and it's IO base address. Normaly there is an base
address and a size. If your entry contains "io memory 0x12340000 size 0x50",
then simply use

GamePortFind start $12340000 Stop $12340050

WARNING: Even if the auto detect is only reading, it may create a system crash
or freeze, because some adresses may cause action when being read. GamePortFind
is only required for finding the exact port address, so this shouldn't be a
problem. Once you found the port you can forget this dirty little helper.

PLEASE DON'T CONTACT ME FOR TELLING YOU THE EXACT ADDRESS!

I don't know! It's even possible that the gameport on your sound card is
disabled by default. In such case there is no way to activate the driver without
any knowledge on the card hardware. I don't have any time for such experimental
research. The included GamePortEnable is enabling some soundblaster and other
game port pci boards. If your board isn't working, then sent in a pci dump. In the
most cases I can extract the card ids and your game port will be enabled, too.

After the game is running you need to calibrate your joystick/game pad. Just
circle around a few times with maximum radius. That's all! It's possible to
avoid this circle stuff by performing the calibrating within the preferences and
turning the calibration switch to fixed *after* all buttons and directions are
working. When using the "Button56" or "Button78" modes, these buttons need to be
pressed a few times to calibrate, too.

Compatibly list:

QuickShot   QS-123
Medion      MD9823
Saitek      X6-31M
Saitek      X6-36


 Guido Mersmann (geit@gmx.de)

