Download presentation
Presentation is loading. Please wait.
Published byJulian Holt Modified over 9 years ago
1
The PC Game Adapter
2
The game adapter card typically contains a DB15 connector into which you plug an external device. The digital joystick is probably the least complex device you can connect to the PC’s game port. This device consists of four switches and a stick. Pushing the stick forward, left, right, or pulling it backward closes one of the switches. The game adapter card provides four switch inputs, so you can sense which direction (including the rest position) the user is pressing the digital joystick. Most digital joysticks also allow you to sense the in-between positions by closing two contacts at once. A joystick contains two pots connected with a stick. – Moving the joystick along the x-axis actuates one of the pots, – moving the joystick along the y-axis actuates the other pot. – By reading both pots, you can roughly determine the absolute position of the pot within its working range.
3
The Game Adapter Hardware The game adapter hardware is simplicity itself. There is a single input port and a single output port. The input port bit layout is: – The four switches come in on the H.O. four bits of I/O port 201h. – If the user is currently pressing a button, the corresponding bit position will contain a zero. – If the button is up, the corresponding bit will contain a one.
4
After all, how can we represent one of a large number of potential pot positions (say, at least 256) with a single bit? – Obviously we can’t. However, the input bit on this port does not return any type of numeric value specifying the pot position. Instead, each of the four pot bits is connected to an input of a resistive sensitive 558 quad timer chip. When you trigger the timer chip, it produces an output pulse whose duration is proportional to the resistive input to the timer. The output of this timer chip appears as the input bit for a given pot. The schematic for this circuit is
5
Using BIOS’ Game I/O Functions The BIOS provides two functions for reading game adapter inputs. Both are sub functions of the int 15h handler To read the switches, load ah with 84h and dx with zero then execute an int 15h instruction. – On return, al will contain the switch readings in the H.O. four bits (see the diagram in the previous section). – This function is roughly equivalent to reading port 201h directly. To read the analog inputs, load ah with 84h and dx with one then execute an int 15h instruction. – On return, AX, BX, CX, and DX will contain the values for pots zero, one, two, and three, respectively. – In practice, this call should return values in the range 0- 400h
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.