The Multi Joystick Interface ============================ The Multi Joystick Interface is, as you probably already know, a device to connect six digital joysticks to your personal computer. This file desribes a) how to configure MULTIJOY for your computer b) how the hardware of the interface works c) how use the interface with your own programs d) how to use the MULTIJOY and MINIJOY modules with your own programs e) details of the emulation of joysticks using the keyboard f) how to contact us g) how to get the multijoy games h) credits a) How to configure MULTIJOY for your computer ----------------------------------------------- All information MULTIJOY needs is to be stored in DOS environment variables. This way, you only have to configure MULTIJOY once and all games will run fine without configuring them individually. These environment variables are: MULTICFG tells MULTIJOY which config file to use. Config files store information about the hardware of your specific interface. There's also a file named KEYBOARD.CFG that puts MULTIJOY into joystick emulation mode. MULTIPATH tells MULTIJOY where on your disk to look for the config file. MULTIPORT tells MULTIJOY which printer port the interface is connected to. MULTIPORT is optional, if you don't set it, MULTIJOY uses the first printer port. MULTIDELAY Don't care about this variable. Your TTL-based interface will work well without setting it. However, some of the early, CMOS-based interfaces are slower, so the computer has to wait for them. As the speed of computers is steadily increasing, in times to come MULTIDELAY may be of more importance. MULTIDELAY is optional, too. It states the number of NOPs that will be executed in a tight loop between setting the printer port and reading it. For example, a MULTIJOY user would add the following lines to his AUTOEXEC.BAT: SET MULTIPATH=D:\MULTIJOY SET MULTICFG=MULTI007 SET MULTIPORT=2 To try out a game on the computer of a friend who has no interface yet, one could type from the DOS prompt: SET MULTIPATH=A:\JETFIGHT SET MULTICFG=KEYBOARD You will find that most multi joystick games use the path provided by MULTIPATH to save the names of the players. This is very convenient as you don't have to enter all your friends' names again and again while you switch through the games during a gaming session. b) How the hardware of the interface works ------------------------------------------- Apart from some elements that are responsible for the power supply, the Multi Joystick Interface mainly consists of two multiplexors. The data lines D0 to D3 of the Centronics port are used to provide the address for both multiplexors. Each of the multiplexors switches one of the joystick direction lines to it's output. The output of the first multiplexor is connected to Centronics BUSY, the one of the second to Centronics PAPER EMPTY. By running through the (16) addresses $00 to $0F, 32 joystick switches can be read, enough for 6 joysticks. To be precise, 2 switches more than enough. These switches are used for a second fire button for the first two joysticks. The extra buttons are available on pin 7 so that Sega, Amstrad and MSX joysticks work with the interface. Pin 7 of the remaining four joystick ports is used to supply the joysticks with +5V (Atari/Commodore compatible). Some fancy autofire joysticks depend on this power supply. The power supply is also useful if you want to connect old Atari Trakballs (tm), though special software is required to utilize them. (If you are interested in this rather special application, contact us for some routines dealing with trackballs). It also should be possible to connect up to four Commodore type mouses to the interface, but we haven't tried that yet. Because pin 7 is used for different purposes, it's important that your Amstrad joystick has a resistor of about 330 Ohms in line with the extra button. Though it's very probable that the joystick you want to use is equipped with this resistor, it's not guaranteed, and you could blow the fuse of your interface without it. c) How use the interface with your own programs ------------------------------------------------ After you've read b), this may read like a repetition: To read all joysticks once, write $00 to $0F to the printer port and read out it's status register immediately after writing each address. The status of the two joystick switches belonging to the address you wrote is returned via the PAPER EMPTY and the BUSY bit. On MSDOS computers, PAPER EMPTY (bit 5) is set and BUSY (bit 7) is cleared when the corresponding joystick switches are closed. To determine which joystick switch belongs to a given address, you need the table supplied by the MULTI007.CFG file. It reads like this: 0 6 r 4 u 1 6 l 2 d 2 6 d 2 r ... 15 5 f 3 l ^ ^ ^ ^ ^ | | | | |action | | | |joystick on BUSY | | |action (left/right/up/down/fire/extra button ('*')) | |joystick on PE |address As config files are used to adapt the software to improvements of the hardware, it's a good idea not to hardcode the table but to read it from the CFG file when starting the program. The files MINIJOY.PAS and MINIJOY.C are examples of basic modules for reading the Multi Joystick Interface. MULTIJOY.PAS has some extra features, the most useful being the emulation mode in wich you can use the keyboard to emulate the first two joysticks. d) How to use the MULTIJOY and MINIJOY modules with your own programs ---------------------------------------------------------------------- MULTIJOY.PAS and MINIJOY.PAS are Turbo Pascal units, MINIJOY.C is a Turbo C file which can be compiled and linked into your programs. To get information about the joysticks, your program has to call the GetAllJoyState routine regularly. GetAllJoyState saves the status of the joysticks in the JoyState record/struct. x, y, knopf and xtra depict the status of x axis, y axis, button (german knopf=english button) and extra button at the time of the call, the variables ending on -hit are set if the appropriate switches are closed now but were not closed at the time of the previous call of GetAllJoyState. (This is useful when you don't want a continuous movement but only a step whenever the joystick is pushed into any direction). If you want to support joystick keyboard emulation, you must use MULTIJOY instead of MINIJOY. See e) for details. A very, very basic example of MULTIJOY usage: program multijoy_demo; (* minimal drawing program *) uses crt, multijoy; (* joystick will be used for drawing *) var x, y : integer; (* screen position *) begin x := 40; (* center of screen *) y := 12; ClrScr; repeat GetAllJoyState; (* request status of joysticks *) x := x + JoyState [1].x; (* x movement controlled by joystick 1 *) y := y + JoyState [1].y; (* y movement *) GotoXY (x,y); if JoyState [1].knopf then begin (* pen down when the knopf is pressed *) Write ('X'); GotoXY (x,y); end; Delay (50); until keypressed; end. e) Details of the emulation of joysticks using the keyboard ------------------------------------------------------------ If you don't have an interface yet and want to try out the games to see what awaits you, you can use the keyboard to emulate the first two joysticks. Emulation mode is invoked by setting MULTICFG to KEYBOARD or another keyboard config file. The standard CFG file KEYBOARD uses the following keys: Joystick 1 (cursor keys) Joystick 2 up ^ E left/right < > S F down v D fire CTRL TAB MULTIJOY additionally has two procedures, EmulationOn and EmulationOff, that are necessary for the joystick emulation to work correctly. As MULTIJOY has to take control of the keyboard in emulation mode, the keyboard is not longer available for entering data or starting the program. To circumvene this problem, the game program has to switch the emulation off in the menu part and to switch it on again for the game part. If MULTIJOY is not in emulation mode, it ignores these switches. Keyboard config files look like that: keyboard <- keyword KEYBOARD l 75 <- joystick 1 left (cursor left here) r 77 u 72 ... d 80 f 29 <- joystick 1 fire (control here) l 31 <- joystick 2 left r 33 u 18 ... d 32 f 15 <- joystick 2 fire ^ ^ | | keyboard scancode | dummy character to remind humans of the expected sequence of keys f) How to contact us -------------------- You can contact us by email at incr@asterix.rz.tu-clausthal.de or by snail mail at Christof Ruch Rollplatz 19 38678 Clausthal-Zellerfeld Germany g) How to get the multijoy games -------------------------------- Don't miss the multijoy games, they are not included in this package. You can find them at ftp.tu-clausthal.de /pub/msdos/games/multijoy For those of you without ftp access, there is also a mail server. Just mail a message with 'help' as body to mail-server@ftp.tu-clausthal.de to see how it works. If you plan to spread the multijoy software you have written, you should upload a copy to this server (/pub/msdos/incoming). This way, all multijoy software will be available at one place. Multijoy enthusiasts will find it easy to keep track of the latest developments. h) Credits ---------- The Multi Joystick Interface was conceived and realized by: Friedrich Fiege design of first interface Peter Fiege realization of the first interface, chemical engeneering Felix Meyer many contributions of great value Christof Ruch original idea and restless production of software Henning Ruch basic Multijoy software and PCB design Peter Waldheim original idea and first Multijoy game, TRON, which existed long before our hardware