Personal Computer World magazine Computer Answers column 1 by Simon N Goodwin Next column ComputerAnswers


ComputerAnswers Column 1


Copyright 1984-1989 Simon N Goodwin


I have read that interpreted Basic programs on the IBM Personal Computer are limited to a total size of 64k for the program and data. What is the point of buying, say, a 128k machine if a program has to fit into 64k? Can you also say if dBase II or dBase III has a similar limitation. I am trying to decide on a language to develop some programs for business use. J S Norris, Fulwood, Sheffield.

You are quite right. Both MBasic and dBase II allow a maximum of 64k for programs and data; if you are only going to use those languages there is not much point in buying the extra memory.

The 64k limit exists because both languages are translations of programs for smaller (CP/M) micro systems, which can only support 64k. The changes that would be needed to make use of the extra RAM are quite major, partly because of the way the programs are designed and partly because of the messy way the 8088 processor handles extra memory: it works with 64k 'segments' and special machine instructions are needed to switch from one segment to the next.

The extra RAM will come in useful if you purchase a word-processor or other package written specially for the IBM machine. Newer programs (such as Lotus 123 and Symphony) are able to make use of all the free memory. Most language compilers allow you to use two 64k areas - one for data, and one for the program.

Remember that this 64k limitation only applies to the information in the computer's memory at any instant - it is possible to 'overlay' programs and data from the disk drives, swapping them back and forth so that their total size can be much greater than 64k.


Are there any Logo or Lisp packages available for the Vic-20? If so, where, and how much are they? Grant McFarlane, Clydebank, Scotland.

The small memory of the Vic 20 means that languages for the machine are rare. Even if you've got a 16k expander you've still not really got enough memory to run Lisp, which is a notoriously greedy language. If you upgrade to the Commodore 64 you can obtain an good implementation of Logo from the manufacturers, at a price of #34.95, but this is only available on disk. Commodore could give no definite information about a Lisp interpreter for the 64, although we suspect that there may be one under development. Once again, you'll probably need a disk drive to run it.

It used to be possible to buy a Lisp interpreter written in Basic for the Apple II, but this is apparently no longer on the market. Microsoft have implemented a package called MuLisp on a wide range of computers with the Z80 processor, and the language is also available from the manufacturers of the QL and BBC Micro.


In the May issue of PCW there was an article called "Monitoring progress", which explained how to turn Pye or Philips TVs into composite video monitors.

This is something I should like to do with my TV but unfortunately I have a Decca set. Could you please explain how it can be done on my TV (if at all). Kiaran Smyth, Prestwich, Manchester.

In principle it is possible to convert most modern TV sets into monitors using the approach outlined in the article, but in practice it can be a very hazardous business. We can't give specific instructions for a Decca TV since the alteration needed varies between models.

Old sets, especially valve ones, may have a 'live chassis' - this means that the entire metal frame of the TV is connected to the mains while the set is plugged in. Even if this is not the case dangerous voltages can remain inside a set for several minutes after it has been disconnected - it takes a while for large charges to die away. Don't even experiment with a valve TV, since these are the most likely to be dangerous and the least likely to accept a computer signal without major changes.

If you do want to experiment, make sure that the TV has been unplugged for several minutes before you venture inside, and confine your investigations to the area of the aerial socket, and the circuit board immediately connected to it. Avoid anything connected to the picture tube. It is a good idea to keep one hand in your pocket throughout - this minimises the chance of a fatal shock passing between your arms and through your heart.

Video monitors give better pictures than TVs because they accept the 'raw' video signal, rather than a mixture of video and UHF 'carrier'. The carrier signal enables a TV to distinguish between channels - each channel uses a different carrier, so that you don't get all the TV channels at once when you turn on your telly. The carrier is obviously not needed when the only thing connected to the set is your computer. You get a better picture if the video doesn't have to go through electronics to add the carrier (a 'modulator') and then more electronics in the set to take it away again (the 'demodulator').

A composite video signal is what the computer feeds into its modulator. It will be accepted by the TV if you can skip over the demodulator, which is usually the section between the aerial socket and the tuning controls. You may need a few resistors or a small amplifier if the signal levels in the set don't quite match those from your computer.

It is certainly possible to convert most portable TV sets into video monitors, but you run the risk of injuring yourself or your computer unless you are very careful. PCW can accept no responsibility for the consequences if you do decide to dissect your TV.


I am presently thinking of buying a BBC Model B computer, mainly to get the hang of computers. I would like to know if it is possible to fit this model with a music synthesiser to make a computer synthesiser. What software or add-ons are neccesary for it to work? Can any synthesiser be used or does it need a special adapter or socket on the back of the synthesiser? B S Greener, Jarrow, Tyne and Wear.

A year ago there were very few micros which could meet your specification - now there are many, following the publication of a new standard called MIDI, which stands for Musical Instrument Digital Interface.

MIDI is a standard which allows computers, sequencers and synthesisers to communicate down a simple two-wire cable. Almost all new synthesisers are being built with a MIDI socket as standard, although it does not appear on older models. A lead or interface is needed to connect computer and synthesiser together.

The MIDI interface is available from a number of firms for the Commodore 64, Spectrum and BBC Micro. It costs about 50 pounds, with software. The interface itself is quite simple (in fact two resistors are all that are needed if you have a Spectrum and Interface 1), so the quality and versatility of the software should guide your choice.

Most popular micros have built in 'synthesisers' capable of playing three-part music, but the range of sounds available is fairly limited and they all sound distinctively like 'computer music'. The Spectrum is probably weakest in sound facilities, and the Commodore 64 is strongest.

You should also consider the new range of Japanese MSX microcomputers, some of which come from major synthesiser makers like Yamaha. The standard sound facilities of MSX are pretty average, but versatile add-on keyboards and synthesisers are being launched, and these could be exactly what you want. Check out the Yamaha CX5 computer with the SFG01 synthesiser add-on. This has the advantage over MIDI that computer and synthesiser were designed together. MIDI should also be available for MSX computers soon.


My son and a friend are currently developing certain adventure programs and wish to be able to market the software on a commercial basis. I would be most grateful for any advice you may be able to offer, especially on the legal aspect of marketing the software.

As the software writers are only 15 years of age I am particularly concerned as I feel that I may be legally responsible for the actions of my son as he is of such an age.

Secondly, they propose to market the tapes by advertising in the computer press under a "house name", and again I feel that this may not be legal unless a proper company is set up. A Freeman, Stonehaven, Scotland.

Your best bet is to talk the plan over with a bank manager, or contact the Small Firms Advisory Service - they can be reached via the Telecom 'freephone' service, and they don't charge for the first few consultations.

You are legally responsible for your son's actions until he reaches the age of 16, and for some of them until he is 18. To a great extent it will be your business rather than his, although it is worth discussing this in detail with a financial advisor. Remember that your tax affairs will also be affected.

Make sure that you are not distributing any copyright material as part of your programs - some software houses sell programming tools such as 'dungeon generators' or language compilers, and then insist that they are paid or credited if the tools are used in commercial software. It is not clear whether or not such restrictions are legal, but in general you should play safe, and ask permission before putting any part of someone else's program on your tape.

You are allowed to use a trading name as long as the name of the real owner of the business appears on your letterhead, and on cheques. Your chequebook might read: A FREEMAN T/A UNDERAGE SOFTWARE or something similar - the abbreviation T/A stands for 'Trading As'. Once you have opened an account of this kind you can pay in cheques made out to the trading name alone.

If you turn out to have taken someone else's trading name you can be forced to stop, or even pay compensation, so it is worth spending a few pounds at your local Chamber of Commerce, having a 'search' performed to make sure that no one has pipped you to the post. If you're uncertain you can always add a place-name, and become: UNDERAGE SOFTWARE (STONEHAVEN). If you're prepared to spend a hundred pounds or so you can set up or buy a limited company - otherwise you are personally liable for all trading debts. The cheapest way to become 'limited' is to buy an existing, non-trading firm 'off the shelf'. You don't get any choice of name, hence the odd-sounding names of a few micro parent-companies, but it does mean that you are only liable for company debts up to a certain, 'limited' amount. You can still use other names under the 'limited' umbrella, but you must print the main one (and its number) on your advertisements and notepaper. Limited companies also bring extra responsibilities, so you should take professional advice before buying one.

Be warned - it isn't until you set up a company that you realise how complicated and boring the publishing industry is!


I have a BBC Micro Model B and I am wondering if it is possible to use an Apple printer, monitor and disk drives on it. If not, is there an interface available to do it? Martin Singleton, Bromley.

Disk drives, printers and monitors use a fairly standard scheme of interconnection, so in theory you should be able to use peripherals designed for one machine on another. The BBC Micro has a wide range of interfaces, which makes things easier. In practice you'll need to do some electrical experimentation - the exact amount required will depend on the models of disk, printer, and so on which you've already got. Disconnect the power supply to both machines before you start wiring things up.

If the video monitor is a monochrome one it should be compatible with the 'composite video' output of the BBC machine - you'll just need a connecting cable to tie the two sockets together.

Most Apple printers use either the Centronics or RS-232 interface. On a BBC Micro the RS-423 does the job of an RS-232. If there are ten or more wires between the printer and the Apple it is almost certainly a Centronics printer, and should be connected to the socket under the BBC keyboard. An IDC connector is needed at the Beeb end, and (with luck) an Amphenol plug at the printer - this is a fairly standard lead, available from most computer shops. If there are less than ten wires the interface is probably an RS-232, and you should connect the printer to the five pin DIN socket at the back of the BBC Micro. If it doesn't work at first, turn the DIN plug upside down and re-insert it. There are two different ways of wiring up an RS-232, depending upon whether the printer or computer is 'boss' - the BBC Micro uses a reversable plug so that you can try both ways without tearing the plug to bits.

The disk drives are the trickiest parts to wire up, since they involve the most wires and the fastest transfer of data. If in doubt, don't try. Both computers use drives based on the 'Shugart 400' interface, and they both supply power to the drives from the computer. The Apple uses a combination cable to carry power and data, whereas the BBC Micro conveys the two separately.

In my experience the BBC supply is a little temperamental, so it is best to set up a separate supply if you can. Both machines need internal changes before disks can be added - on an Apple a plug-in card is used, while on the BBC a group of integrated circuits must be added, inside the case. These parts are available from Acorn, Watford Electronics, and a number of other BBC micro suppliers. The next step is to find a lead to join the devices together. The cable goes from the underside of the Beeb to an edge-connector on the inside of the disk drive. If a standard cable won't fit exactly, you're well advised to seek professional help.

As a final comment, we'd warn you that your eventual system will be quite unweildy - you'll need to swap a lot of cables around every time you want to use the other computer. In view of the hassle and potential for accidental damage, it might be a good idea to save up for separate peripherals for each machine.


I have recently advanced into the world of machine-code on my Vic 20. I do not understand fully about counting the number of bytes when using jumps. Paul McLeod, South Shields, Tyne and Wear.

This seems to be the all-time favourite question among learner programmers - 6502, 6809 or Z80 - so I have tried to explain it in detail. All of these machines use a technique called 'relative jumping' or 'branching', which is very useful but can be a little hard to understand.

Most branch instructions consist of two bytes. The first one tells the computer that a branch may be needed - perhaps only under certain circumstances, like if the least result was zero, or overflowed. The second byte tells the computer where to go if the circumstances are right - whether to go back or forward in the program, and how far back or forward to go. If the conditions are NOT right the program just carries on with the instruction immediately after the branch instruction.

The topic is confusing because of the way that the new destination is specified - using something called a "two's complement relative offset".

A "relative offset" is just a distance, in bytes, from one instruction to another. Thus, if one instruction is at location 100 and the other is at 87, the relative offset is 13 bytes. The "two's complement" part just means that the destination can be either side of the start - earlier or later in memory. A mathematical trick is used to represent earlier locations.

It's easy enough to represent a jump three bytes ahead - the relative offset is three, so that such a jump skips over three bytes. The code would be: jump byte offset 3 skipped 1 skipped 2 skipped 2 carry on The computer would execute that by finding the jump byte at the start, and then looking for the 'offset' which must follow it. This is the value 3. The next byte the computer would look at is called 'skipped 1', but the branch instruction tells it to add an offset of 3 to 'where it is looking'. The result is that three bytes are skipped, and execution continues at 'carry on'.

Notice that the 'relative offset' is relative to the byte AFTER the jump instruction, not relative to the start of the jump instruction. People often forget this. In relative jumps and branches the 'offset' is the number of bytes skipped, not the distance between the start and the destination.

We now have a system for skipping over any number between 0 and 255 bytes. In practice it is useful to be able to jump 'backwards' as well as to skip forwards. The answer is to allow values from 0 to 127 to represent forward jumps, and 128 to 255 to represent backward ones. But here things get confusing, because we can't put negative values in a byte.

We need to represent negative values from -1 to -128. The way we do it seems odd, but it keeps the computer simple. To convert a negative value between -1 and -128 into a positive value between 128 and 256, we add 256 to the negative version. Thus, to jump back four bytes (ending up two bytes before the start) we use an offset of 256-4, or 252. To jump back 128 bytes (to 126 bytes before the start) we use an offset of 256-128, or 128. This seems mad at first, but like most computer madness (K=K+1?) it soon becomes second-nature.

Let's say we wanted to write a program to do absolutely nothing. Unless we use a hardware approach (like turning the machine off) we can use a branch that jumps straight back where it comes from. Since the branch itself is two bytes long, we need an offset of minus two. This gets stored as 256-2, or 254, so that the bytes: jump byte 254 will leave the computer twidling its thumbs for ever.

Note for clever programmers: what happens when the jump byte is 255? This corresponds to an offset of minus one, so that the computer jumps back into the middle of the jump instruction! Normally this is a disaster, but if you are programming a Z80 processor it turns out to have an interesting consequence.

The byte 255 represents an instruction called RST 56 - a one-byte instruction which tells the computer to make an immediate jump to location 56. Consequently, if the conditions are right for the jump, the computer goes directly to location 56, even if it is thousands of bytes away. So what you've got, quite by accident, is a conditional jump to location 56, all in two bytes! This isn't often useful, but it's interesting.

The byte 255 represents an instruction called RST 56 - a one-byte instruction which tells the computer to make an immediate jump to location 56. Consequently, if the conditions are right for the jump, the computer goes directly to location 56, even if it is thousands of bytes away. So what you've got, quite by accident, is a conditional jump to location 56, all in two bytes! This isn't often useful, but it's interesting.

Link to the top of this document    Link to the main index
Next column ComputerAnswers