4 controller support on blitz
I remember some Blitz games do actually support 4 controllers ( Skidmarks comes to mind now, I think those Tennis Champ games were also coded in Blitz)
Yet on its manual all joystick functions only mention port 0 or 1, and trying to access any other "port" will give me an error. Is there any way to do it ? Also, does the CD32 supports this somehow ? I dunno if the CD32 has a serial port. |
The Amiga only has two joystick ports. 4-player games use a parallel port adapter to interface to the two extra controllers, so you have to access the parallel port. I think Blitz should have methods to do this? If you can read the parallel port pins directly, I think it should be fairly simple to read the extra joysticks.
Here's the pinout: http://www.tmeeco.eu/9X4EVER/GOODIES...iga4Player.htm The CD32 can also be used with a 4-player adapter if you connect an SX-1, SX-32 or other expansion which provides a parallel port. |
Yeah, I know its a parallel port cable (not Serial like I said in the OP, urgh)..... just thought there was an easy way to do it.
Blitz manual talks about the CIA chip and which register is responsible for the parallel port, but I have no idea of how to read that. I don't think many people with CD32s have a SX-1 or SX-32, right? |
Quote:
|
Reading the parallel port is pretty simple really, from memory it's just a matter of setting the pins high and then reading them back to read the port status. I used this method to read them in my ControllerTest program, which was written in Blitz. I can dig out the code for you if you'd like? I'm pretty sure (I hope) that I put the routine in a little function that you can easily use without worrying about how it works...
Actually, I have a vague memory of an add-in library for Blitz also offering 4-player joystick support, but it wasn't one of the standard libraries. I'll see if I can find that too... |
Quote:
|
No problem, I'll stick it here tonight, time permitting...
|
Use the RI Zonejoy library. It should already be in your deflibs.
Quote:
|
Here you go - this will give you two routines that will give you direction and button information for any port. Ports 0 and 1 are the standard Amiga ports, and 2 and 3 are on the parallel port adaptor. You could also use the existing Blitz commands and just use these for ports 2 and 3 if you liked.
The joydir{port.b} function returns a byte representing the direction of the selected stick, with the lowest 4 bits representing the 4 directions. Note that it will allow opposite directions to be read (e.g. left and right), even though with most controllers that's mechanically impossible. Bit 0 is up, bit 1 is down, bit 2 is left and bit 3 is right, and the bit is set when the controller is pushed that direction. For example: Code:
joybyte.b = joydir{i} Code:
btns.w = joybuttons{1} Code:
Poke.b $BFD200,Peek.b($BFD200) | %00000111 ; Handshake lines to output So the full code can look like this: Code:
; Initialisation |
Quote:
|
Hey, thank you guys. This will be very helpful!
|
All times are GMT +2. The time now is 21:34. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.