helpline |
Andrew Hewson answers add-on queries
IT IS inevitable, I suppose, that as more add-on hardware reaches the market, more people should write to me concerning their difficulties in running all the items in their collection at one time. When the Spectrum was released the only available add-on was the ZX printer. These days a cursory glance through the pages of this magazine will reveal the variety of items available to the willing purchaser - keyboards, sound units, speech units, light pens, joysticks and more joysticks, printer interfaces, to say nothing of the official Sinclair Interfaces One and Two.
The main difficulty people experience is plugging all the items in their collection into the back of their machines at the same time. Sometimes the difficulty is physical, in that the bulk of one item prevents a second item being plugged in, but too often it is because a manufacturer has omitted to provide a duplicate edge connector on the rear of the equipment, thus preventing a second or third item from riding piggyback. That seems particularly thoughtless to me.
In principle, the problem can be solved by an hour or so of careful work with a soldering iron, some edge connectors and suitable multi-way cable, but I doubt if most people care to be so adventurous. In view of the multiplicity of add-ons, my advice is that if it does not have a second edge connector, don't buy it. In the last resort, consult the small advertisements as there are some constructive firms supplying extension systems.
The main topic this month is joysticks. I have had a number of letters about them, including this cautious enquiry from Grahame Cox. He writes: I have not bought a joystick because the number of options is bewildering. Would you please advise me what are the advantages and disadvantages of the various arrangements?
The choice is bewildering, as he says, but probably the simplest arrangement is the keyboard clip-on type such as the Mechanical Stick from EEC or the Spectrum Stick from Grant Design. Those devices clip over the upper face of the Spectrum and contain plastic linkages which transmit the physical movement of a short joystick via appropriately-positioned feet direct to the arrow keys - 5, 6, 7 and 8.
That arrangement has three advantages. It is cheap, it is guaranteed to work with all the games which also use the arrow keys - and that means virtually all arcade games - and the rear edge connector remains free for use with other hardware. The devices rely on a crisp mechanical linkage and if, like me, you are enthusiastic when shooting aliens, you can distort the units all too easily so that the feet no longer press against the keys.
Assuming that you have decided against the clip-on type, the next step is to realise that there is a difference between the joystick and the electronic box of tricks - the interface - which connects the joystick to the computer. The joystick proper is essentially a stick with a limited degree of movement which closes one or more of a group of microswitches as the stick is moved within a frame.
For my money there is not much to choose between the various conventional makes, although some people have strong preferences. I find the stiffer ones with a strong tendency to self-centre easiest to control but that is probably because I like to wrestle with the stupid things. The Trickstick from East London Robotics is a novel idea and perhaps it points to the kind of finger-tip control which will become common in the future.
The greatest variation between manufacturers occurs in the interfaces. There are four types. Kempston, so called because Kempston was the first in the market to use the system - the joystick setting is returned by the IN 31 command; arrow keys - The joystick mimics the arrows keys 5 to 8 and the fire button mimics the 0 key; Sinclair interface two - the right-hand joystick mimics the top right half row - keys 6 to 0 - and the left-hand joystick mimics the top left half row - keys 1 to 5; programmable - can be set to mimic any five keys on the keyboard.
Logically, the programmable types should be recommended because they are the most flexible but resetting them can be a tiresome business. The arrowkey types make a good second best, because so many games use those keys. A number of games also use the Kempston system because that was the first joystick on the market. The company also markets a range of conversion tapes for a number of popular games. I would put the Sinclair arrangement last in order of preference although, as the company manufactures the computer, I suppose we must permit a certain leeway.
Andrew Church raises a common query. He writes: Last Christmas I was given a Quickshot joystick but many of the games I had acquired previously are not compatible. Can I convert them? Derek Ward has a similar problem with his Interface Two and Crack Shot joystick.
'There is not much to choose between the various makes' |
In principle any game can be converted provided you are able to "break" it so as to be able to analyse the program. If the joystick is read in machine code, you must disassemble the program and locate the IN instructions. Study page 160 of ZX Spectrum Basic Programming to determine the substitutions to be made to make the program compatible with your interface. If the joystick is read in Basic, make the appropriate substitutions in each INKEY$ or IN instruction.
Mike Harding raises an interesting point for discussion. He writes: I have noticed a great variation in the sophistication of the joystick control in various games on the market. Some are restricted to movement in one of four directions at right angles. In some, diagonal movement can occur and in some movement is possible in any direction. I have tried to emulate those effects in my software but I have not gone very far.
When I received that letter I turned to my colleague, Steve Turner, author of 3D Lunattack and other games, because he has made a study of joystick control features in the course of his work. This explanation is based on his comments. The initial problem is to achieve a balance between human reaction times and the speed of the game. If a single speed increment is used, so that for example moving the joystick to the left causes an object to move to the left at a constant speed, moving the joystick instantaneously to the right halts the object and moving the stick to the right again starts it moving to the right at a constant speed; the net result is a rigid, inflexible game with not much "feel".
Turner's solution is to read the position of the joystick as frequently as possible and to adjust the velocity of the object on the screen by a small amount in accordance with the current joystick position. When that technique is used, an object appears to accelerate gradually from rest to a maximum velocity in a given direction.
The rate of acceleration and the maximum velocity can be "tuned" by the programmer to make the game challenging to play without being impossible. It is also possible to include a decay constant so that the object slows gradually if the joystick is returned to the central position.
An additional feature of Turner's approach is that while it is necessary to read the joystick only in four directions at right angles, the object can be driven in any direction on the screen. Inspired by his comments, I had the Spectrum program listed in table one written to demonstrate the effects. The program can be adapted for use with either the Interface Two - lines 2000 to 2060 - or the arrow keys/keyboard clip-on type - lines 5000 to 5070. Notice how the IN command is used to read the hardware in each case.
The program includes two constants, CC1 and CC2, set in lines 1045 and 1046, which control the "feel". The first one determines the increment in the movement of the object each time the joystick is read and the second determines the rate of decay to rest.
|