E COMPUTER NCED COURSE
RES
\
NA
= oO g@: oOo o so o - pa = = ~=€6hD aS ne > 5. eo 55 q so Sod ats 0 5 e Bb Feet oS fees.
1 oO o OD ov Se “= © a6 v a a Ss = & aon a “be BN 8 nee - oO 3 a = Pas a | oo S89 KES ee ce 2) 34s 5 ee Seu Voke a or co 5&8 ae = Bes — ‘5 42EQ oe BE an | OS 505 sy p> S Zsko fos > gs en See Ee So BE
Cd oO =| ‘a Bo ~ O ‘OT oS mod S ORBEA e & > = 2S =3 pcs
ood a500 cE: a, On | pe ob AMo”g ne oe 2 cS oe by a Os re i ca 3 > al Ze ZY =Ken- :
1.5.2 NOB ‘5 4 C SPR ae : Aa 35 a O'S ae Eh no sé g a oe = 50 0 Oo a Oo as mo fae BaF (2s ee moe ae Sao 2? pm oleh
A a SS “ : eg52 MBsies BeeS B Se es |e zee, ee ES
“OO 9 2's a5 ms nhl A oO w rE BESS Mes cos Faas & 40 8 z< 6 HEA s ‘| OBS:
— a er =o im = =) F Mone) | M@s¢
22s Ono amas Ek as iss o/s wen
S3e2 MES 25 MSss Boos MES kes Bs >see
COVER PHOTOGRAPHY BY CHRIS STEVENS
COMPUTERS IN PUBLISHING APPLICATION
THE PRINTED PAGE
We conclude our short series on the introduction of new technology § in publishing by looking at the reduction in production costs that can be achieved using a microcomputer-based layout and design system. We also demonstrate how such a system works using the PageMaker package for the Apple Macintosh.
The introduction of the printing press to Britain by William Caxton in 1476 was such an important event because it made the written word accessible to a much greater number of people. Before this, of course, the only books available were laboriously produced by hand, either written by scribes or made from blocks of wood into which individual letters had been carved. This meant that there were very few copies of any given volume available and the expense of producing them was prohibitively high. Johan Gutenberg’s movable type printing press technique, which Caxton brought to England, drastically reduced the unit production costs and so made copies of the work much more practical and affordable.
We can’t reasonably equate the significance of recent advances in print production with the invention of the printing press, but there are nevertheless some analogies that can be drawn.
Primarily, the new production methods that rely on computer technology can produce material similar in quality to that produced by traditional printing methods, but at a much reduced cost. But while Caxton’s initiative made books more widely available, it is likely that the computerised production process will have a different, though by no means less important, effect.
The cost of magazines and books is relatively low and so it is unlikely that reducing the price of printing material will lead to significantly increased sales. But for publishing companies, reducing production costs means being able to sell fewer copies to recoup its production expenses. This in turn may lead to an increased number of specialist publications catering for smaller audiences, which were previously not economically viable.
In the previous instalment (see page 1561), we outlined the general processes involved in producing a magazine and looked at some of the changes currently taking place in this area. Taking the idea of a streamlined production system one step further, we turn our attention now to a single,
TONY SireP
SG atelbsy gcore!. ce
expensive, they are now readily available at reasonable cost.
Digitised image The digitised image of the Digitisers enable the user to photograph shown here was siore and then reproduce produced using the
images to be used in page Thunderscan system, which design. Previously prohibitively costs less than £300
THE HOME COMPUTER ADVANCED COURSE 1581
stand-alone microcomputer that can be used as word processor, layout designer and controller ofa high-quality printer.
The Apple Macintosh, equipped with 512 Kbytes of memory (the ‘Fat’ Mac as it is known) has had several sophisticated pieces of software developed for it with this very purpose in mind. Included in these is a package called PageMaker; if a high-quality printer is added to this package, it becomes possible for a small group of people to produce near typeset-quality publications significantly faster and cheaper than by traditional methods.
HOW PAGEMAKER WORKS
The Macintosh, with its windows, icons and mouse approach, is an ideal environment for applications like PageMaker. The familiar pull- down menus and screen windows are present when PageMaker is loaded and the Mac’s screen is set up as a desktop complete with tool box for the page designer to work on.
Normally, a designer works by starting with a layout grid, which is the standard page of a publication, and includes positional lines to assist in the placing of text columns, running heads, page numbers and so on. Copies of the grid can then be used to make up each page in the publication, ensuring that the publication has a uniform look. Traditionally, the designer’s grid is drawn by hand when a publication is first launched and then
remains standard until a new style is agreed upon.
This familiar design method is replicated in PageMaker, which allows you to define ‘master pages’. On these you select the page size (for example, A4) and the orientation (high or wide),
_ position column guides, define margin widths and
TIANNIMOW NVI
mark positions for page numbers, logos and running heads. Once a master page for a particular publication has been set up, it can be called back at any future time to act as the designer’s grid.
At this point, the individual pages of the publication can be designed. A designer will use a scalpel to cut and position text and pictures onto the grid, whereas PageMaker allows text and
1582 THE HOME COMPUTER ADVANCED COURSE
graphics to be loaded from disk. And because it is compatible with other Mac packages, an article could be written with the MacWrite word processor, loaded directly into PageMaker and positioned on the board. Graphics designed on MacPaint and MacDraw, like a number of illustrations in this publication, can also be loaded by PageMaker and positioned on the page.
Once the various components that will go to make up the page have been loaded, you can use the various devices contained in the toolbox in the corner of the screen. These tools, for example, allow you to add or edit text on screen by selecting the A icon from the toolbox or, by selecting the ‘cropping tool’ icon, let you shrink, enlarge or trim graphics to fit into the space available. Using the mouse, text and graphics can be picked up and moved around the design grid at will and even ‘laid down’ on the desk surface temporarily while another job is being done.
PageMaker’s toolbox also includes facilities that allow you to add special touches to the page, such as drawing borders around specific sections. It includes icons that control the drawing of lines, circles, ellipses and rectangular boxes with or without rounded corners. The thickness of the lines can also be selected by pulling down the appropriate menu. Once these shapes are drawn they can be filled with black or white, various shades of grey, or patterns. Although an incredibly useful tool for professional designers, PageMaker is simple enough for the inexperienced designer to use with success.
A Fat Mac, a LaserWriter (see page 1529) and the page processing software needed to set up a one-micro production system would cost in the region of £10,000, but the introduction of cheaper
=
>
Invoice Icons
This invoice was designed and printed using copy directly generated by an Apple Macintosh. Icon design is often an important feature of publications such as The Home Computer Advanced Course, making different sections readily identifiable. Similarly, company logos and product symbols are often used in invoices and letterheads
~ Jan McKinnell
Sportscene Publishers Ltd 14 Rathbone Place Wl
S % MacUser
Kawasaki
Tottenham Court Road Lond
Original conimissioned photography for the tirst Wola
hen, Shen, She,
legis ne) >: Or: ined ises Le Aeon
5a
Sub Total Plus VAT. e15% TOTAL _
VAT Reguatration No“ 226 3642 73
Tmo
Portable Pixels
Files created by programs such as MacDraw and MacPaint can be stored on disk and then loaded into PageMaker and manipulated prior to being printed out. Both MacDraw and MacPaint provide the designer with powerful facilities, which can be used to create illustrations such as this (see page 1273 for a further example of an illustration generated using MacPaint)
WIMP-based machines, such as the Atari 520ST (see page 1549), which incorporates the GEM environment, is likely to result in dramatic price reductions for such systems. Even at current prices
the time and attendant labour costs saved by
producing a publication using
computerised page
design § systems _ significantly undercut
conventional production costs.
THE HOME COMPUTER ADVANCED COURSE 1583
Ne
Attenuator Designs To increase the range of our basic voltmeter we need to design an input attenuator that will scale the voltage down to a level that is acceptable to the main A/D conversion circuit. Both use a number of resistors that can be switched into the circuit to tap a proportion of the input potential. We will use the first of the two designs shown here, because the second design has the disadvantage of requiring a special input protection circuit (although it ~ can incorporate solid-state analogue switches)
— Attenuator Circuit
Use a small piece of 0.1in matrix board to construct the input attenuator. The resistors should
‘have 1% tolerance on the values - stated. Mount the resistors in a line along the board and tap off at the ends of the 910 K-ohm and 91K-ohm resistors to a three- pole double-throw switch. The positive and negative outputs should be tied to the main circuit board (See page 1553) with short lengths of covered wire. The three remaining tags on the double-throw switch should be connected to the decimal point pins on LEDs 3, 4 and 5 of the display (see page 1572). These connections enable the decimal point in the display to be automatically repositioned when a new range is selected
ot
eee
VERSATILE MACHINE
behind the workings of A/D converter chips, developed a practical circuit for building a digital multimeter and shown you how to assemble it. In this penultimate instalment, we begin to look at add-ons that can increase the meter’s versatility.
As it stands, the digital multimeter can measure voltages from 0.0000v to 1.9999v, which is why we say it has a basic sensitivity of 2v. By attenuating the signal to be measured, it would theoretically be possible to measure voltages up to 19,999v (20 Kvolts). Such high voltages can be extremely
1584 THE HOME COMPUTER ADVANCED COURSE
dangerous so we've limited the upper range to 199.99v
You may have noticed from the diagram in the last instalment (see page 1572) that there were three wires left unconnected from three of the LEDs. These are connected to the decimal points that appear to the right of the digit on the LEDs and are used to switch the decimal point on when required. A one-pole three-way switch ‘ganged’ to the input attenuator switch makes sure that the appropriate decimal point is on for the sensitivity selected. First let’s consider the input attenuator
— circuit itself.
Basically, there are two ways of making an input attenuator. Both of them involve the construction of a potential divider network that spreads the input voltage over a number of resistors, with a fraction of the input voltage being tapped off for measurement as appropriate. These two types of attenuator are shown in diagram 1. The first type has the advantage of simplicity, as well as being readily adaptable to the measurement of current and resistance. This is not true for the second
attenuator. In an auto-ranging circuit (where the input attenuation is switched automatically), the _ second type has the advantage of being able to use state analogue switches, whereas the first can only use mechanical switches. We'll be using the second type in our design because of the ease with which it can be adapted to make measurements.
The actual circuit (shown in diagram 2), together with the decimal point switching, can easily be constructed on a small piece of matrix board, substituting and connecting the components specified in the parts list for the items in the circuit diagram. The resistors specified are metal film types with one per cent tolerance. Layout is not critical, but it is advisable to keep all lead lengths short as the input impedance of the A/D chip is very high and long leads act like an antenna for spurious signals.
This attenuator network is simple in design and ~ uses readily available resistor values. It has the disadvantage, however, of presenting a relatively low load to the circuit being tested (just over 1M-ohm) but this isn’t a serious limitation — it works out at a drain of about 5uA if a 5v signal is being measured.
The circuit we’ve presented can measure DC volts in three ranges — 2v, 20v and 200v. Relatively simple changes or additions to the basic circuit will allow many other units to be measured, including ohms, AC volts and temperature. We provide a number of possible additions to the basic circuit, but these are in circuit diagram form only.
To measure AC volts using a DC voltmeter (such as our DVM), you only need to rectify the AC signal to DC and measure it. Unfortunately, a simple diode rectifier will not do and what is known as a precision rectifier is required. One
| eee fas
possible circuit is shown in diagram 3. It is based on the well-known and very low-cost 741 integrated operational amplifier. The only disadvantage here is the need for a + 15v power supply, but this could be derived from the 12v AC output of the mains transformer; the current requirements of the 741 are very low.
Measuring ohms on a conventional analogue voltmeter is easy, since the voltage dropped across a resistor being measured is proportional to its resistance. It is not so easy to do with a digital voltmeter, however, and so an ohms converter
circuit is required. The ohms converter (see diagram 4) works by applying a constant voltage to the input attenuator ladder, which generates a
constant current across the resistor being measured. Since a constant current across an unknown resistor will drop a voltage across it that is proportional to the resistance, this voltage drop can be read directly by the DVM. Again, an operational amplifier will be required, and it will need to be an ultra-high input impedance type. By applying the output of the ohms converter to the attenuator ladder, four ranges of ohms can be
measured: 2 K-ohm, 20 K-ohm, 200 K-ohm and |
2 M-ohm. (That’s why two separate resistors were used at the bottom of the ladder instead of the single 10 K-ohm resistors that would have been adequate if only three voltage ranges had been required.) Naturally, a four-way attenuator switch
would be required instead of the three-way switch — |
specified.
THE HOME COMPUTER ADVANCED COURSE 1585
LANGUAGES
While early languages such as FORTRAN and COBOL may seem far removed from today’s micros, their concepts and developments have much bearing on modern
programming theories. We begin here a series devoted to these early languages, starting with a general discussion of their history and development.
To most of us the idea of ‘programming’ a computer is fairly commonplace. Even if we cannot do it very well, we at least know something of what it is all about. Things were very different during the late 1940s and early 1950s, however, when the concept of a programming language was first developed. This early period produced a number of languages which are still in use today.
The object of this series of articles is to examine how these languages have developed into their present form, as well as tracing some of their influences on more modern languages and discovering their relevance to modern microcomputers. We will take a close look at two of these languages in particular, CcopoL and FORTRAN, which are not only still used but account for more actual lines of code being written than all other languages put together. We will also look
1586 THE HOME COMPUTER ADVANCED COURSE
briefly at ALGOL, which remains an important language but has been superseded by pAscAL for practical purposes. First, let’s consider the early days of computing and see how the idea of a computer ‘language’ developed.
If we omit the very early stages, in which ‘programming’ meant rewiring the hardware for each different job, the first real programs were completely numeric and usually written in octal (base eight) as a convenient shorthand for binary. These were laboriously entered using switches on a front panel or, later, using paper tape or punched cards. Each new program was written completely from scratch at the lowest possible level and often programmers found themselves writing the same routines time and time again. From this, the concept of a subroutine library developed — though the term ‘subroutine’ was not then in use. These ‘libraries’ would be kept in notebooks and copied out into each new program as required, and often each ‘programmer’ would keep their own libraries with only occasional sharing.
A big step forward was taken in Manchester when the EDSAC system was built in 1951 and the work of Wheeler, Wilkes and Gill resulted in a consistent set of general subroutines to go with the machine. Now that everyone used the same subroutines, programs became easier to write and began to show structural resemblances to their modern counterparts. Blocks of code performed the particular task with subroutine calls to carry out the standard functions such as input, output and numerical calculation, which were common to most programs.
When the memory capacity of the machines increased, it became possible to store the subroutine libraries internally, or at least on-line, and from here it was only a short step towards the development of a code that allowed the programmer to specify the subroutines required using alphabetic characters and a mathematical notation. A program would look at each line of this code, determine the subroutines required, call them, and then go back to the next line. This is essentially the way that a modern Basic interpreter works. An example of this was the ‘Short Code’ produced by John Maunchly in 1949 on the BINAC computer and later the UNIVAC.
A further refinement of this early technique took each subroutine as required, but instead of performing it directly, it was first copied to an output device, thus ending up with a complete executable program. It was at this stage that the first compilers were developed, with the term ‘compile’ referring to the way in which the program was put together from a number of components arranged into a logical order, in the same way as youd compile a set of essays.
EARLY COMPILERS
One of the earliest successful compilers was the A-2, developed by a team led by Grace Hopper at Remington Rand in 1955. This used the ‘three address’ concept, in which each operation had a
en
mnemonic name followed by three addresses — two for source data and one for destination. In some respects, it was very similiar to an assembler except that the instructions didn’t fit onto any specific machine architecture. This language was later developed into ARITH-MATIC, which was followed by a similar language from Remington Rand — AT3, or MATH-MATIC.
By about the end of 1951, a number of people had realised that from the point of view of the outside user, the computers were in effect running programs that had been written using a different code to the native machine code. The fact that the computer was doing a translation job first was irrelevant. |
In this case, you might as well design your new language in order to make the programmers’ task of writing easier, rather than to make the job of translation easier, especially since the hardware was getting faster and bigger, and _ the programmers couldn’t keep up.
The next problem to be tackled was that there was no form of standardisation, because each machine used its own language geared to a particular small set of problems. The next step was therefore the development of a language independent of any particular hardware specifications to cater for a wider class of problems. This approach was begun in 1954 and led to ForTRAN (IBM mathematical FORmula TRANslation system), the first real programming language.
ForTRAN is a mathematically based language, well suited to the largely numerical work that was currently practiced and similar to many of the autocodes around at the time. It was, however, still based to a large extent on the machine architectures available. The business community was becoming interested in the possibilities of using computers for large scale data processing, but they needed a language that more closely resembled common business English.
It’s amusing to think that at this time there were a number of programmers who thought this impossible as there was no conceivable way to make the computer ‘understand’ words instead of numbers. They were soon proved wrong, however, by (among others) Grace Hopper, who developed a language called FLow-matic, which could be read and understood by management as well as by programmers. By 1956, this had developed into cosor (COmmon Business Oriented Language). These languages had rigid specifications.
LANGUAGE THEORY
By this time, the numbers of computers and programmers had increased dramatically and people began to look more closely at the theoretical aspect of programming languages, trying to find the most efficient and elegant way of expressing algorithms. This led to the development of atcot (ALGOrithmic
Language) in 1958. Atco never achieved the
widespread popularity of FORTRAN Or COBOL, but it nevertheless occupies an important place in the development of languages. It was ALGoL that first embodied the principle of sound program design, which has been a major consideration in all subsequent languages.
A number of other languages were developed in those early days, many of which still remain in use. One of the best examples is Lisp (LISt Processing language) which was developed in the period 1956 to 1958. It’s not only still in use but of
increasing importance in the field of artificial
intelligence. The three languages, FORTRAN, COBOL
and ALGOL, however, have represented the mainstream of programming over the last two
decades. They have all undergone a number of
revisions over the years to incorporate new
features and to reflect modern trends in language
design. The current revisions are FORTRAN 77
(specification issued in 1977), copo, 74 and
ALGOL 68.
In 1964, a much simplified version of FORTRAN (with some influences from ALGOL) was introduced at Dartmouth College in the US to make the task of learning to program much simpler, and to use the new time-sharing multi- user systems that were becoming available. This became known as Basic (Beginners All-purpose Symbolic Instruction Code).
When the new 1968 standard for ALGOL was being prepared, Niklaus Wirth disagreed with the way in which the language was being made more complex and argued in favour of a simpler and more elegant approach. ALGOL 68 is generally believed to be too complex for normal use and is rarely found outside the highest reaches of academia. However, Wirth’s much simplified version, PASCAL, has attained great popularity.
Cosot has not spawned derivatives in the same way, since, in its own field, it has been used almost exclusively. The enormous volume of code that is written in COBOL has meant that it has been used as a vehicle for a number of developments in the area of program and system design; for example, program generation, structured program design
and the use of databases.
THE HOME COMPUTER ADVANCED COURSE 1587
BBC HULTON PICTURE LIBRARY
eae ; ; — : = Pert ene ? : sas eee s scieeremmnenananaes Soe — OS — Ss cS Ses < Se : — Ss : —
os
=
i _ |.
Seat Reservations We show here listings in three different high-level languages — FORTRAN, ALGOL and COBOL — demonstrating program structure and some comparative features. Each program accepts a seat number as input, checks to see if the number has previously been entered (‘booked’) and, if not, marks that seat as taken
1588 THE HOME COMPUTER ADVANCED COURSE
Unlike most MSX-standard micros, the Pioneer PX-7 personal computer features a wide range of interfaces. These allow it to control the Pioneer LD-700 and LD-1100 laser disc players and the SD-26 television system — making it much closer to the original MSX concept of a complete home entertainment system.
We have already looked at the way laser discs controlled by computers offer new possibilities in the fields of education and home entertainment (see page 201). Pioneer’s PX-7 personal computer, linked to the LD-700 (as shown here) or the more sophisticated LD-1100 laser disc player, offers a realisation of those possibilities at a price within reach of the home user. The PX-7 is a highly developed MSX home computer, while the LD-700 is a budget-priced laser disc player that uses Phillips-style 12in laser discs.
The PX-7 is very unusual for an MSX computer, being the first to have a detached keyboard. This allows the CPU unit to be stacked near or on a video recorder, laser disc player, television set or hi-fi system. Accordingly, the CPU unit is designed to look more like a hi-fi component rather than a home computer, and the keyboard is connected via a generous five-foot lead. On the front of the machine is an overall volume control, a socket for headphones and a mixing control, which adjusts the balance between sound generated by the computer and that coming from an external source such as the laser disc. An audio-video through switch effectively cuts off the computer allowing external video and audio signals to pass straight through to a hi-fi and television connected to the unit.
Inside, however, is a standard 32 Kbyte MSX computer, which can be used with the full range of MSX software and peripherals now available. Surprisingly, despite the sophisticated laser disc technology, the PX-7 uses cassettes to store its programs and information. For those that do wish to delve deeper into the micro’s potential, a second cartridge connector on the rear will accommodate disk drives and other add-ons.
Theres a complete range of computer interfaces for television, composite or RGB monitor, cassette, twin joysticks, two cartridges and Centronics printer. In addition, the unit has stereo connections for a hi-fi and a ‘system control’ interface. The latter is a general purpose interface and can be used to connect to laser disc players, video cassette recorders and so on. As new equipment becomes available, the interface
PIONEER PX-/ HARDWARE
Social Interaction Pioneer's PX-/
to standar cont
sequences Call b
displayed. and soun
computer control
aser Tracks | wt (constant angular velocity)
etic discs, ser discs, like magn = direct access ie) any part of the disc. The controlling
n locate mechanism Cal se individual sections On the disc
surface by referring to Tee tracks shown here. Each ring the disc corresponds to 4 ee of the programme ee ae corresponding pat track holding the frame number
THE HOME COMPUTER ADVANCED COURSE 1589
with the video output fr disc player t0 produce interactive Video under
MSX home
rol the laser disc player SO
individual frames OF ? that individ es a
Computer graphics dan also be mixed
om the
Mission Control
One of the original intentions of the MSX standard was to allow computers to form the control centre for a complete home entertainment system comprising video and audio components. The Pioneer PX-/ is the first USX machine to be sold in the UK that can be used in this way. The addition of P-BASIC, an extension to standard MSX BASIC, allows software to control real video images and sound. These can be mixed with computer- generated graphics, thus opening the door to video adventures games, interactive video teaching programmes and more realistic simulations
and its controlling software will allow it to be added to the system. Several devices can be connected at once, each having a unique “device code’ to allow a program to specify the device for which an outgoing command is intended. Controlling the interface is made easy by a set of extensions to the MSX sasic held in ROM. When the computer is first switched on, you can choose to run ordinary MSX sasic or p-BASIC (MSX BASIC with system control commands). The new commands take the form of CALL statements, so
PICTURE INPUT
that MSX sasic itself remains standard. Most of the 16 new commands deal with controlling the video and audio connections of the computer. It is possible to show the computer’s display, the incoming video display (such as a laser disc) or superimpose the two. This allows computer graphics and text to appear over the top of pictures coming from the laser disc or video tape. You can also flip between the computer, video and superimpose modes, using four extra keys on the keyboard — the only additions to an otherwise standard MSX layout.
The sound commands allow you to mute one or both stereo channels and adjust the balance between them. There’s a set of extras to enhance MSX Basic — commands that clear the screen in a variety of ways, save and load the display to a cassette unit and so on. However, the most important command is CALL REMOTE, which sends an instruction to a device connected to the system control interface.
There are a number of commands specifically for laser disc control. For example, CALL SEARCH (0,F,2000) will ask the player to search for frame 2000 on the disc. CALL FRAME is the most sophisticated command. Once executed, the subroutine specified will be automatically executed when the player shows a particular frame or chapter on the disc. This allows a program to be closely tied to the laser disc system. For example, in an educational program, the computer could ask Do you want to know more about this? whenever a student played a particular part of the disc, and
re a o |
oe .
<<. -
——
a fe)
<< Hi
AUDIO INPUT AND OUTPUT
KEVIN JONES
y stereo
could go on to show some other section of film.
The LD-700 itself is a standard laser disc player and can be bought and used separately from the PX-7 computer. Each 12in disk can store up to 54,000 frames, and this means that it can show entire films, as well as offer single frame, slow and fast motion of a much higher quality than is possible with video. The remote controller supplied with the unit allows frame and chapter searching (a chapter being a division on the disc). Eacn disc carries two audio tracks, allowing it to store the soundtrack in two languages — although some discs use the second track to store a ready- made computer program.
Pioneer’s hardware is well built and finishéd, although the computer ran very hot when operating in a stack with the laser disc player. Pioneer offers the PXTB-7 graphics tablet and a cartridge-based graphics pack called Video Art, allowing you to design programmes that use computer graphics superimposed on laser disc pictures. However, the standard of the software is disappointing — the package is slow, awkward to use and restricted in its abilities.
~The PX-7 makes it very easy to create and run
interactive video programs in the home, office or
classroom. Writing appropriate software using the built-in extensions to BASIC iS So easy it’s almost trivial, and MSX Basic 1s itself sophisticated and
reasonably fast. Speed is not much of a problem
however since the player takes about two seconds to search for a particular frame.
Rather than being a limited budget system, the PX-7 and LD-700 provide the potential for full interactive video programs. You could produce laser disc games, like those that have been so successful in amusement arcades, set up a vast pictorial database and so on. The system will also cope with CPE (computer program encoded) discs — those having a ready-made computer program stored on one of the two audio tracks.
However, the cost of mastering discs is likely to prohibit many from designing their own discs, and users will have to rely on commercial products from film companies or software houses. As is usual with new technology, it takes time for the software that will fully exploit the new hardware to become available. In the meantime, the Pioneer PX-7 is one of the most interesting MSX computers available, and coupled to a laser disc it represents the future direction of home entertainment and educational computing.
THE HOME COMPUTER ADVANCED COURSE 1591
INTERFACES
LANGUAGES AVAILABLE
DOCUMENTATION
WEAKNESSES _
CAROLINE CLAYTON
STARTING GRID
looked at the design of spreadsheets in general, and gave the listings for the graphics routines for the Commodore 64. We turn our attention now to the programming of the screen displays for the Amstrad CPC 464/ 664, BBC Micro and Sinclair Spectrum.
Close To The Edge
The flowchart above shows how our spreadsheet program controls the cursor on the ‘sheet’. As the screen is only a window onto the spreadsheet, action must be taken to move on the next portion of the sheet when the cursor reaches the top, bottom, left or right edges of the visible screen area
1592 THE HOME COMPUTER ADVANCED COURSE
Because the micros for which the spreadsheet has been designed have different methods of producing screen displays, we'll be giving the graphics routines for each independently. (The Commodore 64 version was given on page 1563.) The main functions of this part of the program are to print the spreadsheet grid on the screen, — together with the row and column numbers, and to control the movement of the spreadsheet cursor across the grid.
Included in the cursor-handling routines are sections that move the cursor left, nght, up and down. The screen can only display a portion of the spreadsheet at a time (it is useful to think of the screen as a window through which you can see only a part of the sheet), and so the cursor routines will also handle movement of the window across the spreadsheet.
Lines 1000 to 1080 form a subroutine that prints out the spreadsheet grid. The next section, beginning at line 1100, is the main program control loop, which essentially scans the keyboard for a keypress. Keys can be used to move the cursor around the sheet or to select a function, such as inputting a formula to a particular cell. The appropriate subroutine is thus called from this section.
CURSOR MOVEMENT
Most of the spreadsheet functions are the subject of later instalments and so attempting to select these at this stage will simply cause the program to crash. However, the subroutines included in this instalment — at lines 1200, 1300, 1400 and 1500 — will allow you to move the cursor around the screen, since they are the cursor-movement routines for RIGHT, LEFT, DOWN and_ UP, respectively. These four routines are similar, so let’s just look at the first one to get an idea of how they all work.
On pressing the move-right cursor key, the program jumps to the subroutine at line 1200, and line 1210 checks to see whether the cursor has reached the edge of the sheet. It does this by testing the x co-ordinate to determine if it has reached its maximum value of 15. If this is the case, control is returned to the main program loop — otherwise, the routine continues. The next step is to see if the cursor is at the right-hand end of the current screen window. The variables H1 and H2 are used for the lower and upper horizontal limits of the window — for example, if H1=2 and H2=6, then columns 2 to 6 of the sheet are visible on the screen. If x has reached the value held in H2, the following chain of events is set in motion: the cursor is turned off, the value of x is incremented, the values of H1
and H2 are incremented, new row and column numbers are printed by the subroutine at line 1800 and the new cell data is printed onto the sheet. Finally, the cursor is turned back on.
DISPLAY OF THE CURSOR
The subroutines at lines 1600 and 1650 are of necessity different for each of the four computers, and they control the switching on and off of the spreadsheet cursor. In all versions, the cursor is Shown by inverting the foreground and background colours in the appropriate cell, but the way in which this effect is achieved is peculiar to the display hardware and firmware of each machine.
On the Spectrum, foreground and background colours in each character cell are controlled by a byte in an area of memory called the ‘attribute
map’. The lowest three bits of the attribute byte control the INK colour and bits three to five control the PAPER colour. Thus, to reverse the colours, it is only necessary to locate the group of attribute bytes that correspond to the current spreadsheet cell and POKE in appropriate values.
On the Amstrad and BBC Micro versions, the process is a little trickier, because the value in the cell must be reprinted in the cell after turning the cursor on or off. The cell values are held in the array M(,); the correct value for the current cell must be found and converted to a string ready for printing. On the BBC Micro, the colours can be swapped using the COLOUR command. On the Amstrad, a control character, CHRS(24), is available and can be incorporated into a PRINT statement to exchange the current PEN and PAPER values.
THE HOME COMPUTER ADVANCED COURSE 1593
nm nn fan pond NILE TD Iwi
1
i
M4 RY tee
IMI @inmia
Detain i }
. y
g
1 1 1 Y } i i i 1 4 r)
wrt as &
fons 4
&
imigia
°
1594 THE HOME COMPUTER ADVANCED COURSE
00000
00000000
-ADVANCED COURSE 1595
THE HOME COMPUTER
- OBES ~ PROGRAM
: In the Bias anohastaaeNes we SeLininel he tree structures required for object manipulation (See page 1575). We give here the listings that enable these structures to be entered into our program, and suggest some alterations to liven up the Dog and Bucket.
Our obj ect manipulation tree can be programmed as Shown by adding the various lines to the core listings printed on pages 1507 and 1508. The key lines here are lines 210 and 220, 2430 and 2440, and 5030 to 5090. Let’s examine each of these key pieces of code in turn.
First, lines 210 to 220 set up the arrays needed to store the data for our tree. Remember that unlike some of the earlier trees we examined 1n this series, this tree tests many different conditions, regardless of the level of descent or the node number. We therefore need to store for each node a record of the conditional value it is testing and the nodes it will lead to, depending on whether the condition is true or false. The c array holds the
- different conditional values, and each node tests
an element of that array. The number of the element to be tested 1s read into the array k(number of trees, max number of choice nodes).
Lines 2430 and 2440 initialise the c array. These lines constitute a subroutine that must be called for each character, since the value of the conditions will obviously vary for each individual case.
We traverse the tree in lines 5030 to 5060. Line 5040 checks the current node number, and if itis a terminal node (that is, ifit is numbered higher than
21) then itjumps out of the tree to select the routine at lines 5070 to 5090. Line 5050 checks to see if
_ the node is testing condition 12, which indicates a random node, and if so calls the random number routine to assign a value (either one or two) to the condition. Line 5060 then performs the most
important part of the operation, selecting the new node number from the t array and then jumping back to line 5040.
Running the complete program will show you the character handler in action. Enter Y in answer to the prompt Default values? and see what happens. The character editor at line 2350 is not fully compatible with the character handler as it stands. We shall examine its application in more
detail in the next instalment. You can change
location by pressing 1, 2 or 3.
At this stage, you may find the action somewhat repetitive, but this will soon change when we add the final two routines — the ‘interaction’ routine and the ‘plot routine — in the remaining instalments.
1596 THE HOME COMPUTER ADVANCED COURSE
THE HOME COMPUTER ADVANCED COURSE 1597
Synchronicity
tanm AFTER THE EVENT
show the sequence of operations performed by the operating system (top) and the main program (bottom) for the processing of synchronous events
Operating system
Rear address
CAROLINE CLAYTON
Main program
Pe Oe Nee Ot Gt
> RAAAAAAA: ete be da Aiea Soe
+
> SHAN MAAANAAARANNAAARAANRAARAARAAANRAM AAA ANS
Must be zero
In the previous instalment we looked at the
Amstrad operating system’s use of interrupts — the method of system timing controlled by the hardware and introduced events, the software equivalent of interrupts. Here, we conclude our discussion of the usefulness of events to the Amstrad machine code programmer.
We have already described how the Amstrad OS accesses software events via an ‘event block’,
which consists of seven contiguous bytes located —
anywhere within the central 32 Kbyte block of RAM. Event blocks are set up by the user by calling the routine KL _INIT_EVENT at SBCEF, having previously reserved the seven bytes required. The routine is called with the HL register pair containing the address of the block, B containing the event class (in bit-significant form, as shown below), C containing the ROM select (0 if in RAM); and DE holding the address of the event routine to be called. The listing provided
Express
Asynchronous
gives an example of this operation.
The event class, as 'passed in the B register, is shown in the diagram. Once an event has been initialised, exactly when the routine is called by the operating system depends on the type (synchronous/asynchronous) and priority (normal/express) of the event. Generally, the routine to be called may be anywhere in RAM or in any ROM and the address of the user field in the event block is passed to the event routine for its own use.
The way that the operating system deals with synchronous and asynchronous events differs considerably, so they are best described separately — although, of course, both types of event may be used for any given application.
The ‘kicks’ — increments of the event count — may come from one of four distinct sources: the fast ticker interrupt, the ticker interrupt, the frame flyback interrupt or the jumpblock entry KL_ EVENT. The three timer interrupts each have an associated list of events that need to be kicked when the interrupt occurs. The routines to set up the lists are called via jumpblock entries. It is
1598 THE HOME COMPUTER ADVANCED COURSE
Iie aaa maaan nce
possible to either initialise a new event block and add it to a list, or to add an existing block to any of the lists. Event blocks may be set and initialised separately by using KL _INIT_EVENT. The routine KL_EVENT is general purpose and may be used to kick any event.
ASYNCHRONOUS EVENTS
Associated with normalasynchronous events is an interrupt event pending queue. This queue is used to hold all the asynchronous events that have been kicked during the external interrupt.
As an example consider a normal asynchronous event block that has been arranged to be kicked by the ticker interrupt. When the ticker interrupt occurs, the operating system looks for any events that need to be kicked. In this case, our event will be kicked. If, after kicking, the event count 1s found to be greater than zero, then the event will not be dealt with immediately but will be placed on the interrupt event pending queue. After the Operating system has performed all the tasks associated with the ticker interrupt, each routine on the event pending queue will then be called in turn. Because the ticker interrupt is re-enabled before the event routines are called, any further kicks will be noted. Therefore, the routine may take as long as it needs without missing any further kicks. After an event routine has been called its count is decremented.
If an express asynchronous event is kicked and has a count greater than zero, then it is not put on the event pending queue but its event routine is called immediately while the interrupts are disabled. However, if the event routine is too long then any further external interrupts will be missed — therefore, the routine should be as short as possible. This type of.event is generally not used.
SYNCHRONOUS EVENTS
The main program decides when synchronous events should be processed. Because of this, the operating system simply kicks the event and, if greater than zero, puts it onto the synchronous event pending queue according to the priority assigned to it in the event block. Express synchronous events are merely arranged to have priority over the normal type.
The operating system provides several jumpblock entries to enable a main program to process synchronous events, to optionally clear the queue and to prevent particular events from occurring. Additionally, all normal synchronous events may be disabled if need be.
When the main program decides to process synchronous events it performs the tasks outlined
emeiimivniesy
in the flow diagrams. Firstly, the KL_NEXT__SYNC jumpblock entry is called to obtain the next outstanding event from the queue. The event is then processed by calling KL_DO_SYNC; this routine looks up the address of the event routine from the event block and calls it. The KL _DONE_ SYNC entry is then called to signal to the operating system that the processing for that event has finished. At this stage the event count is decremented and if the count remains greater than zero the event block is placed back on the synchronous event queue.
DISABLING EVENTS
At some point it will be necessary to disable or prevent particular events from occurring. The operating system allows for this with a variety of
jumpblock entries. For asynchronous events, the
entry KL __DISARM_EVENT sets the event count for the given event block to a negative value, thereby
preventing any further kicks from causing the event routine to be called.
Three entries allow synchronous events to be disabled. The first, KL_SYNC_RESET, clears all outstanding events from the synchronous event- pending queue but does not alter the event count. This effectively disarms the event, since the event count cannot be decremented unless the event is on the queue. Another entry — KL_DEL_ SYNCHRONOUS — disarms and removes any event that happens to be in the event queue. The final entry, KL —EVENT_DISABLE, stops any normal synchronous events form being put in the queue, but still allows the events to be kicked.
Events may appear complex at first, but they protect the programmer from the complications normally associated with interrupts, although care must still be taken when using express asynchronous events to avoid data clashing with the main program. 7
THE HOME COMPUTER ADVANCED COURSE 1599
SERIAL INPUT/OUTPUT
In an eight-bit computer, most transmissions are performed via parallel data lines, though often when a computer is communicating with peripherals or other attached devices, the machine will use serial transmission when the bits need to be sent sequentially. Therefore, in order to convert the signal from parallel to serial format, serial input/output techniques have to be employed.
When a computer receives a serial data stream, the information is read into a shift register. This can be of any length but is usually eight bits long (or a multiple of eight). The amount of data arriving is measured against an external clock, and when the shift register is full, the computer activates a read enable line and the information will then be transferred onto the machine’s parallel data bus. The shift register will then be ready to receive the next set of data from the serial line.
It is often necessary to re-transmit the data through a serial output line. In this case, the process is reversed. The eight-bit parallel data is fed into another shift register, which is again synchronised by a clock. Once all the bits are transmitted down the serial interface, the process may be repeated. These serial conversion circuits are kept on a single chip known as a UART (universal asynchronous receiver transmitter).
SERVER
This is a node within a local area network (LAN; see page 969) that handles the management of a peripheral or supervises the entire network. Server stations are particularly useful when large pieces of equipment aren’t needed by each computer all the time.
There are several basic types of server. A ‘file server’ will control disk drives (usually hard disks) through which each computer within the network can gain access to the information held on the disks. Similarly, a ‘printer server’ will be connected to a printer, enabling resources, which might otherwise be devoted to providing each terminal with its own printer, to be devoted instead to a single high-speed, high-quality device. A ‘communications server’ is used to link the local area network to other LANs (via a modem), public databases or other mainframe computers.
SERVO MOTOR
A type of motor widely used to perform mechanical work under computer control, servo motors are particularly useful in such applications because they move in response to digital signals received from a computer, in the form of pulses. Typically, the servo motor has three lines connected to it: a power supply that varies depending on the size of the motor, a control line through which the pulses are transmitted and a common return line for both the power and control lines.
The angle of movement of the servo motor depends on the length of the pulse transmitted from the computer, which can vary, but is
1600 THE HOME COMPUTER ADVANCED COURSE
generally between one and two milliseconds. These values correspond to the minimum and maximum angles of rotation permitted by the servo motor, and the longer the pulse, the greater the angle of movement from the minimum position. It should be noted that servo motors cannot rotate through 360°. In order to maintain the motor at a given position, it is necessary to send a ‘refresh’ signal via the control line at regular intervals, which is generally every 20 milliseconds a transmission frequency of 50Hz.
SET
Any group of elements which have been collected together is called a set. Elements in a set are usually written as x eS, where x is a member of set S. Conversely, if x is not an element in set S, we can write x¢S. Sets having the same members and the same number of members are called ‘identical sets’.
Sometimes sets will not be identical but they may have some members in common. This group of common members is known as the intersection between the sets, and is written x M y = z, where x and y are sets and z is the intersection. Alternatively, when sets are joined together to form a common set, it is known as the union of the sets and written as x Uy = z, where z is the union. Finally, the elements in one set y may ail be members of a second set x, although the sets may not be identical. In this case, we can say that set y is a subset of set x, and can be written as y C x.
Sets are particularly useful in describing logical operations. For example, an intersection between two sets is equivalent to a Boolean AND operation, while a union 1s equivalent to OR.
5. pnqns Set Points Sets are represented pictorially in Venn diagrams. The oblong border of each diagram is regarded as the boundary of the Universal set (the set from which the members of any set can be taken). Sets are usually shown as circles, and any given element, x, can be seen to be a member of a Set by being drawn inside it (1) or shown not to be a member if it is outside the circle (2).
Two or more sets can be shown to intersect by shading the regions where they overlap (3 or 5); shaded in their entirety, they have been unified into a single set (4 or 6)
6. puqus
aaa ease sacaaacacaaaaaaaaaaaaaaaaaaaaacasaaaaaaasaaaaaamamaaaaaaaaaaaaaaaaaaaaaaaaaamaamaaaaaaaaaaaas sass mss
CAROLINE CLAYTON
gal Ci tt Ly ua nal
@
: ma ~< ©
1 sie m sats
=, ij =, ) SB VEE ACENEE—_F-#-F RR 0X Sale Se es See A ee Se Se Se iv = Sen) ivi may, : 24
Ur POSITE, VOU WILL BE SENT VOLUME 7 BINDER NOW.
i ee ee es» ORDER FOR £3.95 (WHICH FN-E-E-U=D-E-S—P-0-S AGE AND 28
PACKING). X = -L WOULD ALSO LIKE TO
sieht 1D OR THEY ARE ISSUED. meee E Lue PAY ME) ENT ADV ue ee . cas D PACKI ee ie one ON SA au E : NO-STAMP NECESSARY Ad
A] 1 oe en we ES A Aa Fa BAN eo oe Ee eV \ Lr BY A Ee EEE" EES 5 46
PUBLISHING, AND SEND TO US TODAY. |
48
HOMME r Soren perenne.
¢ ar % = f
fiers
eee seas pasatoSS Senet ee ee
seo EASA ERR ES EPI SREP PIERRE SITTER OE
he | 1 ge | , H | | ' a | § ; i |
RASS tS ee
SH LESS ISPSUN SST IBIS SAS
SPER REDE ISO EB EIS
i
Meieeyeee
fos
( my, t \ |
SSIES IASB ASCE VTE DT EIA:
es.
%
\,
Wm
oe : ae ae
oo e ARSON
‘roe 8 8 =Shlthltlti‘“(‘(‘(‘é;wwOwOUmmhmmLmUmUmUmUmUm™C™C~— .=—i—_O—Os<assSsS "| GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE _ Postage © GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE
_ INSTRUCTIONS {| Wilbe DonotaffixPostageStampsifpostedin Gurr e eee ee 1 Ae _——sopaid by © Gt. Britain, ChannellsilandsorN.Ireland. ‘ 7 AG ATE licensee : | _ . GUARANTEE GUARANTEE GUARANTEE GUARANTEE _Ifyouarenotentirely — satisfied with your binder, send it backimmediately | anditwillbeeither — BUSINESS REPLYSERVICE = : Ben «= exchanged, or, ee LicenceNo.SW4035, st” pm 6 preter, your money will | : : be refunded in full. |
The Home Computer | i i GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE
d dC , Bit d 1 | E A E t UNTEE apenas eee URRANTEEL:
GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE
London WC2N 4BR . GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE
GUARANTEE GUARANTEE GUARANTEE GUARANTEE GUARANTEE