The Home Computer Advanced Course (01)

24
J 'I'll.. I LII I Pill I1111 11_1u BIS Publication

description

Vintage Computer Magazine, 1984

Transcript of The Home Computer Advanced Course (01)

Page 1: The Home Computer Advanced Course (01)

J 'I'll..ILII

I Pill I1111 11_1u

BIS Publication

Page 2: The Home Computer Advanced Course (01)

Next Week• We continue our BASICconversion course forSpectrum users,concentrating on functionsand control structures.

• Widely acclaimed as the

j

t of the microcomputer•ed wordprocessingkages, Micropro'srdstai can turnany CP/Med machine into a very

Werful text processor.

mongst the educationals of computers, onelication is particularlyactive to the home user -mination revisiontware, We look at this fast-

expanding field.

Overseas rea _ . - this special offer appliesto readers in the U.K., Eire and Aust ralia only

CONTENTS

APPLICATION

FIT FOR THE FUTURE An overview ofthe increasing relevance of computers toour everyday lives

HARDWARE

BEST OPTION An introduction to diskdrives, and how they work 4COMMODORE 64 We examine thispopular home computer and look at its 10portable counterpart, the SX-64

0SOFTWARE

ATTACKED BY ANTS A maze-chasegame universally acclaimed 6

COMPUTER SCIENCE

THE ALGEBRA OF DECISIONMAKING The first step towards 8understanding program design

JARGON

FROM ACCESS TO ADA The first partof a glossary of computing's terms 13

PROGRAMMING PROJECTS

THE SPECTRUM OF ZX BASIC A lookat the characteristics of this BASIC dialect 14

MACHINE CODE

INTRODUCING FIRST CONCEPTSCommencing a course of instruction in this 16lowest common denominator of computerprogramming

PROFILE C

BILL GATES — SETTING THESTANDARD An insight into one of theworld's most prolific suppliers of software

Editor,onatharHilton ConsulhmtE•OIOOaGarethJeffeson. Richard Pa,vson. ArtDkrtdorDaviiWhelan, Deputy EdltorAoger ;Ord; ProductinEdltorCatherineCardwelC SWterribleBrianMorris: PlctveEdrtorClaudia2en: DeaipneeHazel 6enningttn: Sub Editors Robert'ickerin3, Kern Pans' Art Assstent La Dixon Editorial Assistant Stepnen Malone: Rpearcfae Melanie Dave Contributors Lisa Kelly, Steven Colwit. Marti' Hnprn_- Groep AR DheCEm P`r yNeville: Wnadng Director Stephen England: Published by Drills Publishing Ltd: (diterfal Director Roan Innes: Project DereNpmsnt ueter Bmokesmth Executive Editor This Cooper: Production Co-ordlnatbr Ear Paton: CirculationdreetutDavidBreed MarkaBrgDMdv Michael Joyce, OesignedandxoducedbyBurch Parlvci Ui;Edlbor Office85Charlotte Street. London W1.91954by0rh11114 h" LutlypsnelhyUnNene;ReproductionbyMeelHsMorganLtd; Printed In Great &Naln by Artisan Preu Ltd, Lafceeter

HOW COMPUTER ADVANCED COURSE - Pr:ce UK 80P IR £ 100 kUS 51.35 NZ 92.25 SA R1.95 SINGAPORE S4.50 USA and CANADA SIRSNow to ohtriin your eopis of HOME COMPUTER ADVANCED COURSE - Copes are obtainable by placing a re)ular order at your newsagent, or by taking out a subscription. SLbscripten rates: for six nonths (26 issues) £23.80. for one year (52sues) £4760 Send your order and remittance to Punch Subscription Services, Watling Street, Bletchley, Millon Key nes, Bucks MK2 28W, being surf to state the number of the first issue required.Beer fimbern UK and Ebe - Back numbers are obtainable from your newsagent or from HOME COMPUTER ADVANCED COURSE. Back numbers, Orbis Prblishine Limited, 20122 RedforJbury, LONDON WC2N 4BT at :over price.AUSTRALIA: Back numbers are obtainable from HOME COMPUTER ADVANCED COURSE. Back numbers, Gorgon & Gotch (Ass) Ltd, 14 William Street, PO Box 7676 Melbourne, Vic3001. SOUTH AFRICA. NEW ZEALAND, EUROPE &MALTA Back r,mbers are ava,.able at cover prce from your newsagent. In case of difficulty write to the address in your country given for binders. South African readers should add sales taxNowtDobtain Indent forHOM(CCAMPUrERAOYANCED CWRSE- UK and Eire: Details o' how to obtain your binders (and of our special offer) are in issue 5. EUROPE: Yrritewith remittance of £5.00 per binder(incl. p6p) payable to OrbisPublishing Lim zed, 20/22 Bedf ordbury, LONDOV WC2N 46T. MALTA: Birders an obtainable thrcugh your local newsagent price £3.95. In case of difficult/ write to HOME COMPUTER ADVANCED COURSE BINDERS, MCI er (Malta) Ltd. M.A.Vassalli Street, Valletta, Malta. AUSTRALIA: For details of how to obtain your binders see inserts in early ssues or write to HOME COMPLTER ADVANCED COURSE BINDERS, First Post Pry Ltd. 03 Chandos Street, Sr. Leonards, NSW 2065.The birders supplied are those illustrated in the magaz ne. NEWZEAIAND: Binders are available through your local newsagent or from HOME COMPUTER ADVAN JED COURSE BINDERS, Gordon & Gotch (NZ) Ltd, PO Box 1595. Wellington.SOUTF AFRICA: Binders are available through any brarch of Central Newsagency. In case of diTiculty write to HOME COMPUTER ADVANCED COURSE BINDERS. Intemag, PO Box 57394, Springfieli 2137.Nob - 3inders and bars numbers are obtainable subject to availability of stocks. Whilst every attempt is made to veep theprice of the issus and b nders constant, the publishers reserve tie right b increase the stated prices at anytime whencircumstances Jictate. Binders depictec in thispublicatbe arettose produced fcrtheUKmarketonly and may not necessarily be dentica to binders produced forsale outside theUK. Binders and issues maybe subjectto import duty and/orlocal taxes, whch a re rot included in the above prices unless stated.

20cnvrR PHDTOGRAPH v BY IAN McKINNELL I RINITRON COURTESY OF SON° SUPERROBOT 28 COURTES` OF HARRODS

Page 3: The Home Computer Advanced Course (01)

INTRODUCTION /APPLICATION

FIT FOR THE FUTURE

Most people over school age find learning anew subject from basic principles adaunting prospect, especially when theentire concept of that subject bears littlerelation to anything in their presentexperience. So how does the newcomer tothe field of computing come to grips withthe complexities of the subject?

It's difficult enough for the computerprofessionals — the operators, the programmersand systems analysts — to keep up with all thelatest developments in computing, but at leastthese people can expect support from theiremployers and the suppliers of the equipmentwith which they work. Where do the amateursand the hobbyists who must educate themselvesin their own time and at their own cost, turn forunbiased advice?

What to do first? Go out and buy an

inexpensive computer? There are so many, it'sdifficult to decide on a particular model withoutreliable advice. And having taken the plunge,what next? Perhaps the machine in questionoffers more than one programming language.Which one is most applicable to the user's needs?Which software packages offer the best value formoney? Cartridges or programs on tape? Shouldthe user buy a disk drive? Or will a cassette tapedrive be sufficient? Do you really need a printernow, or should you wait until more refinedprinters come down in price? If you havechildren, how do you cope with their constantdesire to play game after game, if you feel that thepoint of the investment was to foster computerliteracy and help them with their school work?

The revolutionary advance of computertechnology has been so fast and its encroachmentinto our everyday environment — home, office,factory and car — so comprehensive that many ofus endow it with a mystique. It is, after all, not

Advance And Be RecognisedIn the course of less than adecace, the computer hasbecome an ntegral part of thefabric of our society — andevery year changes anddevelopments become moreand more extensive. Keepingabreast of the situationdemands a considerable effort,but for the newcomer the task iseven more caunting. A wellpacec, compreheisive homestudycourss is a great help

THE HOME COMPUTER ADVANCED COURSE 1

Page 4: The Home Computer Advanced Course (01)

APPLICATION/INTRODUCTIONi

s tiii £is i£_£i£i?itiiii£33ts...» :!!!}aiffl._. s. sc

!B Bl aiii'`..1 tIt•• idii lBit_}Biti wi{iB di!iiiiiil»:EiiiiiI

LY.^^••••••i

!fslm!!!t m"t

itimii£11^{i

{i..:.. m}•• ;'£3illilii4^:ii^

•:.ii: ^p^giuli2 !l3E »

tiis ett

i• llt l^ ITZE-'"'1l1l{ ._...:ifl !

witst iiS2

; t•••7.•••::i:f'.imii

9?:sue 3idi£i i!!lli? ^1 Bf? »°u3us^iiiR

i=ttrmi { .ate F g^i

?'s M I_Iii ll!!

1 lllli ill iiiy^^ E!£?i^— !

t::..c^£S

t

ii:R i I• t} S

lfi

"s

!tdiil6 l..,iiei » £:s:lui?iit a imjl^lifSi3I ^q; p

^ !!!! = . l^l B

!cl:: c

iii il.tl

i IEli ' = ;^ 9ili 19i11111ME- 1 ri 3dts iiiitE !i}- 1 t t 1 1

IdiidB'•""''d:i

t ii "r:"£3fid

7

^,i£fiiilBB^1^Ili[!i3s:i:tmm:l:l^^ ii ::1 1 1 1

1 . 1 • ,t

^^^^ i'"W^'•''i}jalt'.»"'.. lli}2tP.6»: ^^l9 1 1 1 1 1

ii}tFiiii$il;i•.' 111 1 . 1'Iii Gi•

StmL'1^127

1 1111 . 1 • 1

i ili llf

1 1 1 11 1

1 1 11 -

»' ;^p^ 3l:?!:t;t^ ii3Eli1}^i 3IilFl ai:iidiR i}lib

, ... Ili Illl l=.11

il'.i m::'•::•' it R° •-i

i Jpfmil!l^Ilt mill'1:1111 R=' i:it6•ffi

3 t:• 2tl! gE333.......tua FF ii 38H£iiiB°B =B° =

^s g

^ iiiti

^ F^ i6:dttt ^,}isii ::satHll!!'3:311dli{t_, i2=113illtldlliu ^

.—H;

-•IS

ilt

i'li=^j3

!!E—tlil

i itli

11!l^^^^t

Fiiiilt'A.:

pU^^^I''

•..

p^

lI Y ^ 3i {t g8e lll3

:^{^iii

I 6f tlel ain ^q11

^a t•

::s m 13!,Ei:!1?££II

I =3!

=

111'12;'

3PIi ».m

^I

Ij:{BB£!!^,^ £•?•tfj ijlp£f?}? !!^ ^^:^^^'B 1i'

:=3iiipi}}3 ^s ii slrsxIIU'iaiii3i!l ii IliE^i•!sinliu

^g!rr °u^1^9....? p

1l^:i.•::?^}

m:ir. 'iH3

i!!^!m:

1 . 1 • 1 • „ ' 2119tItttlttttmL212{^::: EHISZ7f71t t:sdii! ::

i13t tt=C • iil iiiiiii ^ ^i£ iiici^ !! : lf€

SI1?I...

um:i SHi

llII I lei'3! il3 l 1 . 1 . 1 • 1 l'i•.{ ^^;;•;• ^l {ll ^{{{:?'Wl^i j t{E f c^ 1

l l! } Iru: {g ^

fl{

i IU! !E^I :.nsHI

N it.'Mill!!9M!

!?B iS ;^lFflili£3_i?{{{^ d!d-• » Rg3

"' ' ^^^ :: : i£s33l^^!l 13g if f 333l13i:f • ilEi£ii ^ `

piii II 1^3

f

tf:utetay -

d^

'

g^^i^^l: °^^i^tii { !!li ;2 I

1 1 L 1 , 1 utt:::a tL tila• t::

?3?33£ii£ ^3t:33ii3ii# ® lE'sBEE

•m

m£ I^iF•i t IPIvii j ; ri=.d y }

^Ctit E!^3 itlC m

':1 :I ::3t!31 S&S3!^7^^}

I 1Sti ^ii! ^7^[Iti ^ ':" I^^^ iiiiiflF F^ ^^6

t dii t it;^y u.}

^

:ilt 1 :1 1 1 1 .; it;:•• i ikff E

IE!! iiiE1 11i(

1 It }I.iii6 =i

i}

33!?i ^'!

33i3iiii3HB^: i '

i:"ii^tlf8Ei3^li^!lusmr. 31l^lfiiii3ie:. sttsii! lEti

isi^ l 39!!i!d fd!!!!!id 3!!l! ::msuur^ !'3€B3iiiiif lSSt d311lilitfl!# :::!s:sH

i.

!t Q— t,!33t {i [u,i I !!^j{ ^ dii{E---

tssttrs::its mr.;^{^ iffis^ E iBt s { iai 1 ! : !i! ! :i(^A ' e..:.i11BB.

ll^ll.:i

iisr i iHii iiI

1^5

''' •3 73

3}1{ m213ELC

;• i 3^i3 ff ssd

::::?{S^t^L:!!^}flptiC2Si!£

€dil

------ l} £qi£t :iCiLp• ^ .^ !!!£l3}ml!^l^l^ltF t^

1 llll# iil Hldi ^^ ^3ii39i

^:.'t{: p^ l ly._.....::^11l12Km g l 3 £t i9 it .Ii

6i'ii^f^^E 89ii as Hilii^ ^liii

stlQ msy^ty{{H i^ jii!!; i^^1!!335id

'i^l^i [ss?333lE ^ iii^'^

3^^111 ? {'' ':

it :,:nsns isn

^,sn mal,uuniiII

ttttmtt119111

}^ 3i;B

{;s •:

i1 1 11

1 1 1 : t

`, g }li { }^^^^ .nme,m:::n„mr •' dddi3i3^^: Ei I !'l I ::. iii }iidE& III li £ :£5

i Iii I : J i l!€i I

^f^iih ^I first"

i'' 1 ° ti ^ ^ u. es;.li^i 84:

ft t:u nsmat:um I dpdidddi^^^i 1':

i•M Il£igniiiiii lIl

1 ' 1 11MIi 111

0ip i^ l.s s

i lilt "g3 s ':3: 1. 11 1 1 11 1333 I ! lH i iil:} J^Illlli^l.l.s::w_s3'iliiifl :::

U I 19 is' =s II}

I'1^^^'111 ORE

^i c{Brtia^}^}ItttQ}i t

i

€tf€..

lllilss;"

^^^ }u^a}i €l

sii 1 / 1^

!! :i:: c i m t.°«•

S ,,, i}iiifiQi Sit #^i IBI! Iii i il1£it:£ ;IllH100ti: t» S• g^ }}lt:t »}?i 4': ' is 11:11 Iid111iKm

Iii did.'_} 'i } !!!isiiiillllii l::'ta

sCui3III]HEmii s n

* iu,£HN

^^l}}}iii :;. t p}t

^^^^^H^t t: twii i; 11W31911iHHal'£iiilFiE33331:: er ^ ^ '

•3 13 1^1{l^^tllE ^ssuttttl^^^ t i

Hi' £

IH£ ti ? €

t ! f ^ ^ ^ ££1"

!li€il^lll^ : £itt l^

1 .... igt'F{ui. tl!i

t° l, 6 i:iBBBiiP i3fsl_ ifii :: :. R1I ? ». I1i11113 "::l..; mtt,ai£

i^iili^ lii?^: ^ iE?i^££3:::

It1'mac^

11118:n::::: 's.=00

17III

^1siIlifiii?:I?"•°"•3aIId

f ^^:^:{

mmi

^ ^6}s3iiii!!lfHiil^^ liiiiil !11

it{!dllidl

:::::i 11

II Zr

^^tl:::m:££3£Smau

II :.

Ri:l:=1`•i 11t1f1 Pi^ :iiiit lilt.'i .lBlBl iii !i£}! :!!.t!!!!i!BdIF ??

^g {F ;p^ :1111 :• t sm III { j .::i:::. i-

I1I! l^s 41 • e^i!!Ni! Bill

I lit

hi i! i t^3^l 1::

mss ^ iit

at

g {^F&i=tiliI

?t ^. i[s^l;

i` 3f

pn tsm:::t:m« }3 i^g yt} :am s 3iq3^ !ii^!plp6g L^ 3!331£ t'tt i3 MINptE I;:=ii.N } o{p 3 's y s!!::le3i!!!F^!!!l :li!!1!!!!!!! ^diiil.^g^g lif1 8::i:t ^t£:

3!::::^=s}li'tll ;l^?l^E ; ?ilit!':::: r^•i::t}

ss^III

^

liiid^

{

l$ t 111 iddiiiI

¢ e?i !li1^ 9341l1l2 Ieili RI I

c

:::II ?l :IiiEi :I :I:1 i ^E::::: 3?iB3 n:i.! iiE:

i^ursa'B

ii^x II i 1

tltm=i!1111

t €j p^••' }}^ }}{i

i t::iE::-R

.I "7:iQ ^l^^^^'^SIBwu:•

1?tS}L"": 7 t ''5•• II i

:r c:: ^^^ :i

Et

^4lIl ii^ d:.._£.^ii BIBQ 1 1 1^`!"99 l ; { , . µ H!^Eit

' IIHI i

p, g

fi}i l.1 03^ ii • 1 l#'t'ii ^ E^ is f ^

• I, E{ildl

i i Illlli l}t f{ 1 lisII !fl l ' ii^^:::=. = z g ^lli#i » iilFII

•1 1 1

jadd,t, ^{^{ i iiw" SfSFE ^$^¢]t ttiiiim7-fi f! ^£= ae !!1lIEi$iiii^££E

!!!!! H} ii!$E 1 • 1 • 1 !:3 . •:

,1I c 1'!1:

00s:{^g { u ..._.» ...{

}^;1 ^.: 3ii!1° 'uI IR•

^!gii3if ^^ qj131llHI•{:in:

! ^iiit}.1!:;:¢i^i

' 1

i :, ti^N

!^^.dtS^

P^,

•*

`! VI I

l!i t tiljhI

Bi i^l^iElHi

t^, fj4£[E^ i i

= ' z^s } ai£'s

t. iilHllllll ItllNNttl9 s!!lIIfas^d

' ' It 131; ;^^ ! !B£:"»?:::{ :

3I ..'

LNIl^llai l ri ddd

i,qr !!!!!lt:: ? Bi ! li3i :.: iii^fitsH ieff E : i^:ut ttt!p!B,^^:{

1 1 . 1 ri m::'•• iid ! i :tttNNi..itl .. !! W3£^^t£i i iilif ^ ^! ^iliEi p Iii li{i

`fFzMInEtR i rsl"tii HE 09i3i „c.t=

1 . 1 • 1::^^^^

d!l...!!B^t{8^^

^g }

'. il i t X 4 5!"

} ii

t^

jII

l^lli ^^^ ?3^i1'II

?i , •1

llfl €Bii

111 1IlI^gIII ^lltIi S {E^' f }l . ^_. -_Vii}££ii i :t': t: ::'.•^

^

T?iEri`^!,t,

y^p:, 7i^^iiFii:ti

•^:i$: 33^^1!!liii^-t I

^^l^Eiti':g^ :!!!i.:u

Ii.

it,

£ Ui :

8lild q^ ii £g ^3 t !FF^ £^sit.::r{.'i,.:Ir.:iitlsi^8lN#f^^31Ei^,d£ii3?idf611

, ai!I 1 I. a t^€ O R ^f

i1,

r ^lJIlIt I n (^ (^il i

8, I^lr^imo ra s

1 4i^a

ii1:!!l^L:t,n:rsi

fj!B}iEdi£iild idi °

::n:: €

}pp{c^! 1}!11^si..t:;:3 i!,!:1kEiis :I:::iai

=1111Il11III!IIi!d

ti I u u .11IIIliE

3 Ii iUIit

HHi t.:

$i ¢s q£tq^t^t}t

:dl:dllt^ttm

it ^in^outr:

L

iilld i:iiii ^3ilRi'3sititt[$!i!

stt mini »csffFF411i

3=

:

1 i ivy t lIBlEe lilfIII ^^^ t 11

.^`c.8£E s ll,

!ilium' to.:. ' ii! ^ ^I

!t mm!sa:::I IRISii:i{ul

:

? 3 fd: ::• .. s s

7mtii: ::::mFAiii}£?a£33!}iii8631iif

^q:iiii33'^

t ii•'••3lBll #

^uU •••di '1r

»• • •I i

-^. .. ,. , ;. ',. --.tll --

easy to come to terms with a `motive force' that isinvisible in action, unlike the satisfying spectacleof, say, a car engine or a hydraulic pump inoperation.

True, more and more people are being trainedto operate computers and computer terminals.But there is a huge difference between trainingand education. Training implies learning a task byrote. Education allows a leap beyond the boundsof the mere task at hand into a broadunderstanding of how the systems work, theirpotential and limitations.

To many people working in the computerindustry and in schools and colleges the answerseems to be a planned course of computereducation presented in such a way as to be

2 THE HOME COMPUTER ADVANCED COURSE

understandable to all from the outset. Individualinstruction manuals for specific machines cannotprovide a balanced overview that relates one typeof computer to another. Nor will they point outthe pitfalls inherent in the multiplicity ofmachines available, or advise you fully on how tomake the most of your purchase. After all, whatsort of manufacturer is going to give free publicityto his rivals' products?

Following a properly planned home studycourse, perhaps backed up by a weekly session atan Adult Evening Institute (many of which offerintroductory courses in computing and computerprogramming), is a convenient and inexpensiveway to a sound education in computing.

The object of such a course should not simply

Page 5: The Home Computer Advanced Course (01)

THE HOME COMPUTER ADVANCED COURSE13

INTRODUCTION/APPLICATT

be to learn how to program and operate a homecomputer, but to gain a wider appreciation ofhow computers are used in everyday life. As wellas providing instruction in programming andbasic systems analysis, it should offer an overviewof all the computers in use at the moment ratherthan concentrate on the machine one happens tobe using. It should introduce the peripherals andextras available for all of them, with anexplanation of their operating principles. Toplace the computer in context, one must examinein depth the tasks to which it is now applied andthe software that makes those applicationspossible. Finally, the course should includeelements of formal logic, number systems andsomething of the history of computing andcomputers. In short, a home study course shouldcover all the topics that would be dealt with in aconventional course in computer studies.

In THE HOME. COMPUTER ADVANCED COURSE

we have set out to provide the material for justsuch a course. Building on the average homecomputer user's knowledge of BASIC and somemachine-specific experience of computergraphics and sound synthesis, we aim to take youthrough the other high-level languages found inmicrocomputers — PASCAL, FORTh, woo and c, forexample — and to provide grounding in machinecode programming, the key that unlocks thepower of the microprocessor.

A knowledge of machine code enables us toexamine the ways in which the higher levellanguages are defined. Then, when we havestudied the way in which compilers andinterpreters work, we can amalgamate these twobranches of knowledge to start defining our ownlanguage and writing a compiler for it.

We won't neglect BASIC, however. We'll look atthe refinements of the language and workthrough projects that will result in the generationof useful applications software and screen-basedand Adventure games.

In addition to the internal functions of thecomputer, well explore file-handling methods,both on tape and on floppy disk, using theexperience gained in defining data structures andhierarchies within the computer's internalmemory. In this way we can expand the capacityof even the smallest home computer into a seriousinformation processing system.

Bearing in mind that it's not enough to study asubject in isolation, we will consider in depth thewide choice of software packages now available -spreadsheets, word processors, databasemanagers and the like — with a view both tounderstanding their operation and methods andto learning more about professionalprogramming techniques, in order to includethese in our own programming.

Some attention will be given to basicelectronics, examining the function and design ofindividual components and the ways in whichthey are combined to make up computers andtheir peripherals. We'll look at the machines

themselves, too: the popular microcomputers,both for home and business use, and theirperipherals, examining their price andspecification, and assessing their impact oncomputing in general. We won't neglect thehuman side of the computer industry, however.The people who design the software and build themachines, and even the computer users who havemade a contribution to the field, will have spacein the course devoted to them.

If you are interested in learning aboutcomputers with a view to increasing youremployment opportunities, then a home studycourse can be an effective replacement for thefirst module or two of a formal course incomputer studies, Because it allows the student toproceed at his or her own pace, it is of equal valueto the fast learner, as well as those who perhapsneed a little more time to come to grips with whatis, after all, a complex subject.

Finally, if you simply wish to be betterinformed about a technology that is set to changesociety in the course of your lifetime, then THE

HOME COMPUTER ADVANCED COURSE offers acomprehensive guide. In addition to thefundamentals of computer study, we shall beexamining the impact of the new technology onsociety at large. How will the advent of computersin our everyday lives change the way peoplerelate to each other? What political changes willresult from an `information explosion' madepossible by the low-cost microprocessor? It isdifficult to obtain reasonable answers to thesequestions. Newspaper articles and televisionprogrammes tend to trivialise them, manycomputer publications seem to make them morecomplicated than they need be. THE HOMECOMPUTER ADVANCED COURSE sets out to give youaccess to the essential information to answerthem for yourself.

A Leap ForwardAnnounced to the world's pressat the begiining of 1984, but notscheduled for delivery until wellinto the spring, Sinclair'sQuantum Leap broke thatcompany's long assoc ationwith the Z80 microprocessor.Fittel instead with a version ofMotorola's 32 bi: 68000, it has128 <bytes of RAM (w th afurther 512 Kbytes ava fable),and two OL Microdrives built -in.Also abandoned is Sinclair'sidiosyncratic single-key-entryBASIC

Page 6: The Home Computer Advanced Course (01)

HARDWARE,USING DISKS

BEST OPTION

Until recently, floppy disk drives and so-called stringy floppies were beyond thebudget of most home users, but advances indisk technology have reduced the relativecost of purchase, while the advent of theSinclair Microdrive has bridged the gap. Inview of the power of such devices it is worthlooking at them in some detail.

Similarly, cartridges are available for somecomputers containing low-power CMOS(Complementary Metal Oxide Semiconductor)RAM chips that retain stored information via abattery contained within the cartridge.

The main argument against EEPROM andCMOS RAM storage is that they are expensive -collecting a modest library of such cartridgeswould cost at least as much as an appropriatefloppy disk drive.

Remember not to put floppydisks close to anything thatcontains a magnet. Evensomething as seeminglyinnocuous as the telephonecontaims electromagnets(they are used to ring thebelt), and a domestic hi-fispeaker has very powerfulones indeed /

BBC Disk DriveBefore d sk drives of this typecan be used with the BBC ModelB, the DOS (Disk OperatingSystem) ROM must be installedin the machine itself.'I ntelligent' disk drives, on theother hand, come equipped witha DOS chip already on-board

Microcomputers are highly versatile tools formanipulating data. However, data manipulation isof little use without a means of storing informationwhen a particular set of data is not required for themoment or when the computer is switched off.This can be achieved in a number of ways. Anyoneaware of the real potential of home computing willhave acknowledged the limitations of the ROMcartridge and ordinary cassette tape as methods ofpermanent storage and will wish to investigate themore sophisticated facilities of magnetic disks.

But before discussing the merits of disks we willconsider the alternative systems.

CARTRIDGEThis method of storage is of little use to theprogrammer. Most cartridges contain a type ofPROM (Programmable Read Only Memory) thatprovides only a means of inputting data to thecomputer, usually in the form of games written incomplex and lengthy machine code, or extrafacilities such as extensions to BASIC. It is possible,however, for cartridges to contain ElectricallyErasable PROMS (EEPROMs) that can bewritten to and read from in a similar manner tointernal RAM but which are `non-volatile' in thatthe information is retained when they are removedfrom the computer or the computer is switched off.

CASSETTE TAPEOriginally provided because disk drives were veryexpensive, cassette tapes are still by far the mostpopular storage media, mainly because they arecheap, freely available and portable audio cassetteplayers and tape cassettes are familiar to mostpeople. Usually any cassette player of reasonablequality will suffice, although some manufacturers— notably Commodore and Atari — only allowyou to use their own specially designed units.

Programs and data are stored in binary form assequential files via the cassette unit's normalrecord facility, using different tones to represent Osand is. Normally, identified information such asthe file name (and possibly the internal memoryaddress from which the file is copied) is recordedfirst, followed by the file itself, one bit at a time inone-byte blocks that are further formatted into256-byte segments. Many computers incorporatean error-checking facility in each segment knownas a `checksum', which can be compared withcalculations made within the computer duringverification to ensure that there have been norecording errors.

Typical commands are SAVE to record files andLOAD to play back and retrieve them, Somesystems provide additional cassette commands forvarious special functions, including a facility toread a tape and produce a catalogue of the filenames stored, and command formats for storingand retrieving different types of data.

The low cost and easily understood commandformat of tape cassette storage is offset by anumber of major inconveniences:

1.In the majority of cases the user is required tooperate the cassette unit controls manually forstorage and retrieval and this often demandscareful timing of button pressing and accuratevolume setting.

2. As information is stored sequentially,retrieval of a specific file (except in the case of thesoftware-controlled Hobbit cassette recorder andthe Epson HX-20's built-in micro cassette)involves either careful monitoring of an accuratetape counter (if one is supplied!) to enable fast

4 THE HOME COMPUTER ADVANCED COURSE

Page 7: The Home Computer Advanced Course (01)

4

C

forward/rewind to a point just before the desiredfile, or a search by the computer for the file namefrom the beginning of the tape. Sequential storagealso means that it is impossible to store dataefficiently that needs to be read in small sectionsfrom any point in a file without processing thewhole file. The type of storage that can achieve thisis known as `random access' and is necessary forany effective database filing system such asaddress listings or stock control entries.

3. The above, in conjunction with the smallnumber of bits that are stored/retrieved persecond using cassette storage — typically between300 and 1,200 bits — means that a cassette tapesystem is excruciatingly slow in operation. Quitesmall programs of, say, five Kbytes could takebetween one and three minutes to load or save.This also means that it is inconvenient to makeback-up copies of programs, although this is highlyrecommended.

4. Even when it has been recorded correctly inthe first instance, data can be corrupted after anunpredictable number of replays, owing to wearby the tape head.

5.Because the characteristics of cassette playerscan vary from manufacturer to manufacturer, datarecorded on one model may not play back onanother. In addition, cassette tape is frequentlydamaged by the crude tape transport systems ofmany portable cassette units and breaks easily.

FLOPPY DISKCompared with the cassette and cartridge storagesystems, disk storage has few major drawbacks.Floppy disk drives are complex and delicate intheir construction, and expensive — from £150upwards. Floppy disks themselves are also costlyat between £2.50 and £4 each. But the user gains areliable, flexible and fast means of storing largeamounts of data, operating at 50 to 200 times thespeed of tape storage and retrieval.

All disk drives have a form of Disk OperatingSystem (DOS), which contains a routine thatformats the distribution of information on a diskinto tracks. There are usually between 35 and 80tracks per side, each track divided into a varyingnumber of arcs called sectors. There are fewersectors on the shorter tracks near the middle of thedisk than on the long outer tracks. Each sectorconsists of a block of data, usually 256 bytes.

The DOS `remembers' where all theinformation contained on the disk is stored. This isusually achieved by the creation of a BlockAvailability Map (BAM), either stored on the diskor held in memory, and a catalogue or directory.The BAM holds a record of the blocks currently inuse and those free for new storage. The catalogueis a list of the file names, file types and track andsector locations for each file. It is usually held onthe central track and can be loaded into computermemory for reference. The DOS positions theread/write head after reference to the BAM, andcatalogues and manages the storage and retrievalof data.

The layout of the information in tracks andsectors and the accurate positioning of the read/write head enables the DOS to offer randomaccess filing. Data can be recorded and extractedin chunks as small as a byte at a time, if required. Inbroad terms, differences between disk drives areconfined to the amount of data that can be stored— typically between 100 and 400 Kbytes; thespeed at which data can be transferred; and themeans by which the user can control storage. andretrieval using DOS.

There are three main methods of implementinga DOS. The most efficient is to include it in ROMform within the disk drive, under th. control of thedrive's own microprocessor with associated RAM.This is known as an `intelligent' disk drive; onreceipt of an instruction from the central processorit can process complex disk-handling routinesindependently, allowing the processor to continuerunning a program. All current Commodore diskdrives are intelligent in this manner and use nointernal computer memory in operation.

A more popular system is the type that loads theDOS from disk into computer RAM on commandor automatically when the computer is switchedon. The third method includes a form of DOS inthe computer's own operating system. Spectrumshave this facility and Acorn Computers supply aDOS for the BBC Micro called the Disk FilingSystem that provides limited disk control. Disk-handling routines include SAVE and LOADcommands, a CAT (or directory) command, acommand to format a disk (or tape cartridge) andvarious random access and sequential file creating,handling and deleting commands.

In A SpinFloppy diskettes are composedof Myla , or a similar stretch aidtear resistart plas:ic sheet,coated with a metallic oxidecapable of holding a magneticcharge. Enclosed nsideaprotective square plasticenvelope, the disk is spun fromthe hub. The recording surfaceis accessible to th., readrwritehead through the slot shown atthe bottom of the illustration

t PROTECTIVE ENVELOPE

2 PROTECTiPERMIT SLOT

3 SECTOR

4 REGISTRATION HOLE

5 TRACK

6 ACCESS SLOT

THE HOME CO1PUrER .ADVANCED COURSES

Page 8: The Home Computer Advanced Course (01)

t My Hero!On :he first pass through thegame, the'victin isconveniently placed adjacentto the gateway to the city. Aquick hop over the protectivewall, and the protagonist -male or female — is greetecwith a cry of 'My hero — takeme away from all thi

Fomli-dable Ant - iclimaxSometimes, the fact that antscan't climb stairs is veryuseful indeed — though whyour hero has climbed quite sohigi, one can only speculate.Climbing obstacles like thisallows the protagonist to lobgrenades at the attacking antswithout fear of retribution, butremember that you areplaying against the cluck

;i SOFTWARE/ANT ATTACK E

ATTACKED BY ANTS

The significance of Quicksilva's AntAtttack, a three-dimensional maze gamedesigned for the ZX Spectrum with 48Kbytes of RAM, lies not in its obviousgraphic quality, but in the subtle applicationof the algorithm that generates the fabric ofits maze-like playing ground.

Software writers and publishers have never beensatisfied with the protection accorded them by thecopyright laws - hence the many and variousattempts to safeguard programs from beingcopied. The author of this game, Sandy White, hasattempted to prevent his work from beingplagiarised, by using another method – applyingfor letters patent on the software technique thatproduces the screen graphics, Since the 1977Patents Act specifically denies protection of thissort to computer programs (noting that theycannot be considered to be inventions), one is ledto the conclusion that the patent in question coversa mathematical formula or algorithm.

This in itself is interesting because one wouldnot normally require a complex algorithm for agame of this sort. What is it about Ant Attack thatrequires a radically new approach to softwareprotection?

His remarkably forward-looking package was,surprisingly, rejected by Sinclair Research, whocould not evaluate the videotape of Ant Attackthat White sent them because, they said, they hadno video cassette recorder!

The first novel feature of Ant Attack that a userwill encounter is that it allows the player to choosethe sex of the chief protagonist. And the firstoversight follows hard on its heels. Whether youopt to be a girl or a boy, the opening frame of thegame, which sets the scene in 30 or so words,explains how you hear a call of distress 'irresistable(sic) to a hero like you'. One can forgive thespelling mistake, but the program's inability tosubstitute `heroine' for `hero' is evidence of a lackof attention to detail. Further evidence is to come.

The protagonist, chased by monster ants, candefend himself (or, of course, herself) by throwinggrenades. Unfortunately, there is no consistency in

Ant Attack is also unusual in that it is notdescended directly from any arcade game. Mostpopular games for home computers have theirroots in the conceptions of Atari, Taito and theother manufacturers of dedicated gamesmachines. Ant Attack was conceived by agraduate from the Edinburgh College of Art whoprotests his ignorance of the arcade gamestradition. Sandy White had never previouslywritten games software and his efforts at marketresearch were restricted to inquiring of friendswhat it was they liked about such games.

the effect these grenades have on the ants, Whilethis might result from a deliberate randomisingfactor, it is more likely to be the result ofindiscriminate programming. Moving theprotagonist anti-clockwise through 90 degrees isachieved by pressing the Spectrum's M key, andthe Symbol Shift key next to it turns the figure theother way. The Spectrum's moulded rubbermembrane keys do not give proper control overthis transformation, which . invariably results infrustration for the player.

It would appear that Ant Attack was developedin advance of the launch of Sinclair's Interface 2,which accepts two Atari-standard joysticks. Thegame would benefit greatly from being updated toutilise these peripherals, though it would need twojoysticks to handle the command structure.

In addition to revolving the token, moving itforward, making it jump or throw grenades (youcan also choose between four distances of throw),the player can choose one of four points of view —

6 THE HOME COMPUTER ADVANCED COURSE

'A

Page 9: The Home Computer Advanced Course (01)

Z

Master MindsAnt Attack was a first a ttempt atcommercial software writing forits author, Sandy White. Sandy,just 23 years old when thepackage first appeared in late1982, had graduated trimEdinburgh College of A rt with adegree in sculpture when heconceived the notion of creatinga games program for homemicrocomputers. A friend,Angela Sutherland, collaboratedin thu design of the structuresthat make up the city ofAntescher

it ANT ATTACK/SO}11W (iJ

each centred on the token.It is this section of the program's graphics

generation that sets it apart from most other gamesoccupying less than 48 Kbytes. Thetransformation is virtually instantaneous,completely overshadowing the normal run of 3Dgraphics generators available for Spectrum. Theability to change points of view is essential to thegame. Without it a considerable portion of theplaying ground would often be hidden from view.

The author is understandably unwilling toreveal too much about the working methods thathe and his collaborator Angela Sutherland haveadopted. He does imply, however, that the playingground is not, as one would expect, held as a 128 X128 X 6 array. Evidence of this is apparent if,rather than entering the city, the player token ismade to turn round and head off into the desert.After a short walk, he or she comes to another city,and then another, and so on.

And so to the object of the game itself. It is set inthe City of Antescher (named by the game'sauthors in tribute to the Dutch artist and designerM. C. Escher, who drew ingenious delusivestructures that were impossible to actually build).Standing outside its gates, you hear the cries of aperson in distress. You jump over the low wall intothe city and go off in search of the victim, jumpingonto obstacles or turning to avoid them as you go.The city appears in isometric projection and noattempt is made to keep faith with perspective.

Only a small portion of the city is in view at any

one time, the frame scrolling across as the figuremoves left, right, up or down. The scrolling actionis excellent, as is the animation of the figures. Fullmarks, too, for a good sense of humour in thetreatment of the animation.

It soon becomes apparent that the city ispopulated by huge ants whose bite, though notimmediately fatal, will cause death if you sufferenough of them. If an ant becomes aware of you, itwill follow you. You can shake it off if you areskilled enough, otherwise you have to resort to therather unreliable grenade. Don't throw it at thewall immediately in front of you, because youcould blow yourself up.

On the first pass through the game the figure tobe rescued is in full view opposite the gate. Onsuccessive passes it gets harder to find, and harderto reach, It is invariably located above groundlevel. The rescuer may jump up only one level at atime, so if the victim is not directly accessible fromthe ground — by a stairway, for instance — therescuer is in real trouble. The only way is to wait tillthe ants attack at a suitable spot, paralyse one, andjump onto its back, using it as the first step up.

The rescuer can also get a `leg up' in this wayfrom the victim, should it be necessary — the antswon't attack the victim, The pass finishes whenrescuer and victim are both outside the city.

Despite its few failings, Ant Attack is worthy ofthe accolades that greeted it when it appeared onthe market just before Christmas 1983. It is a fineexample to all would-be software authors.

Riddle Of The SandsThis plan of the entire ci ty of Sutherland have given namesAntes,her was constructed to the chief structures, butafter painstakingly also note that a copyrightphotograph ng the monrtor notce — ©SW — appearsinscreen huncreds of times, the top left-hani corner!making a ccmplicited ^photomontage of the results,and then commissioning anartist's impression of thescene. Authors White and ^< 1 B

^3 y12

0

13

^_% f 10 15 50

-+ 1s1. THE WATCHTOWER 11. THE MONJMENT 172. PHOSPHOR HENGE 12. ANT EDEII r3 TH E OUAI 13 ARGON'S LEAP4. TABLE ANTCHAIR 14. ARTANT'S VILLA5. THE FORUM 15. THE ANTIMATTER CUBE6. THEANTICHAMBER 16. DROXTRAP7. SKAZ YANDOR 17. ACRIANT'S WALL8. THE PYRAMID 18. BCNZAI WALK9. THE ANCIENT 19. THESUUARENA

'0. OXYMINE 20. THE CRYPT

THE HOME COMPUTER ADVANCED COURSE 7

Page 10: The Home Computer Advanced Course (01)

COMPUTER SCIENCE /BOOLEAN LOGIC

THE ALGEBRA OFDECISION MAKINGComputers carry out their given functionsby passing a series of high or low voltagesaround electronic circuits. These voltagescan be interpreted in terms of the binarydigits (or bits) 1 and 0. Some functions, suchas addition, require specially designedcircuits to produce specific outputs for anygiven input. These are termed `logic' circuits.

JACK CAN GO JILL CAN GO JOHN WILL 6010 THE MATCH

FALSE FALSE =ALSETRUEFALSE TRUE

TRUE FALSE TRUETRUE TRUE TRUE

The third logical operation (NOT) performs avery simple function. Consider this statement:

If it is NOT dark then I will go out.

Boolean algebra, the branch of mathematicsconcerned with true/false logic, is the theoreticalbasis from which computer architecture isphysically realised. The concepts and rules ofBoolean algebra are few and easily understood.

In the first instalments of this course, we willstudy in detail the theoretical and practical aspectsof logic circuit design, together with examples ofthe basic circuits at work inside your own homecomputer. The rules of Boolean algebra are basedon three simple logical operations: AND, OR andNOT These three logical operations conformclosely to the way we use these words in everydayEnglish. Look at this statement:

If it is fine AND it is a Saturday, David will gofor a walk.

If David is to go walking or not depends on twothings: whether it is fine, and whether it is aSaturday. Incoming to a decision about going for awalk, David is only concerned with whether thestatements `it is fine' and `it is a Saturday' are trueor false. There are four possible combinations andonly one will result in David taking a walk. A tablewhich shows all the possible combinations of aseries of statements is called a `truth table'. Here isthe truth table for our logical AND statement:

IT IS FINE R IS A SATURDAY DAVID WIU GO FOR A WALK

FALSE FALSE FAL EFALSE TRUE FALSETRUE FALSE FALSETRUE TRUE TRUE

A similar process can be undertaken to illustratethe function of the logical operation OR. Considerthis statement:

If Jack OR Jill can go, John will go to the match.

Once again there are two conditions that willdetermine whether or not John goes to the match:whether Jack can go, or whether Jill can go. In thesame way as the AND statement, we can constructa truth table for the OR statement. Since there aretwo conditions, each of which may be true or false,there are again four possible combinations. Thetruth table for the statement will look like this:

This time the only condition to consider is whetherit is dark. This may be true or false; hence there areonly two possible conditions for our truth table.

LOGIC GATESThe simple electronic devices that make upcomputer logic circuits are called `logic gates'. Thethree simplest logic gates mimic the function of thelogical operations AND, OR and NOT. Thesegates function by representing a TRUE conditionby the binary digit 1, and the FALSE condition bythe binary digit 0. So, for each logic gate we canconstruct a truth table showing all the inputcombinations together with the resulting output.Each gate has a circuit symbol associated with itand can be written as a Boolean expression.

The truth table and diagram for the AND gatewith inputs A and B and output C is:

A B C THE AND GATE

A

AND C

B

0 0 0

0 1 0

1 0 0

1 1 1

The function of the AND gate can be described inwords as: `the output will be 1 if both inputs are 1,and 0 otherwise'. The Boolean notation for theoutput from an AND gate is A.B.

The truth table and diagram for the OR gate is:

A B C THE OR GATE

A

OR C

B

D 0 0

0 1 1

1 0 1

1 1 1

RISDARK I WILLGOOU.T

FALSE TRUETRUE FALSE

8 THE HOME COMPLIER ADVANCED COURSE

Page 11: The Home Computer Advanced Course (01)

BOOLEAN LOGIC/COMPUTER SCIENCE

I

The OR gate can be described by the followingstatement: `The output will be 1 if either or both ofthe inputs are 1'. The Boolean expression for theoutput from an OR gate is A+B.

Unlike AND and OR, the NOT gate has onlyone input and one output. The truth table is thesimplest of the three:

A BTHE NOT GATE

0 1 A HoT B

1 0

In words, the NOT gate is expressed as: 'the outputwill be the opposite of the input', The Booleanexpression for the output from a NOT gate is A.

COMBINING LOGIC GATESJust as several logical statements can be linkedtogether, we can link together logic gates to makecombinational and sequential logic circuits. Theseare in turn combined to produce the computerarchitecture. Any logic circuit can be representedby a truth table that describes what output can beexpected for any possible combination of inputs.Look at this simple logic circuit:

A X

AND NOT C

B

In this circuit there are two inputs, A and B. andone output, C. To help to construct the truth tablefor the circuit the output from the first gate hasbeen labelled X. As there are two inputs to thecircuit this means that there are four possiblecombinations of input.

A B X C

0 0 0 1

0 1 0 1

1 0 0 1

1 1 1 0

The output from the AND gate, X, is put throughthe NOT gate to produce the final output, C.

Here is a more complicated circuit and its truthtable. Notice that, as there are only two inputs, thenumber of possible input combinations is still four.The second half of this truth table (columns P, 0and C) is a rearrangement of part of an OR gatetruth table.

PA NOT

OR C

AND

B Q

A B P Q C

0 0 1 0 1

0 1 1 0

0

1

1

0

1

1 0 0

1 1 0

The use of truth tables is not limited to two inputand one output circuits but can be extended to anycircuit. Here is an example of a three input, twooutput circuit.

As there are three inputs to this circuit we mustconsider eight possible combinations:

X Y Z M N S T0 0 0 0 1 1 1

0 0 1 0 1 1 1

0 1

1

0 0 0 1

1

0

0 1 0 0 1

1 0 0 0 1 1 1

1 0 1 0 1 1 1

1 1 0 1 0 0 01 1 1 1 0 0 1

EXERCISE 11)Construct a truth table for the folloning situation:'Janes may drive a car if he has passed his drivingtest OR he is accompanied by a quali'ied driver'.

2)Construct a truth table for this situation: 'A programcan be loaded into a computer if there is a casse tt eplayer OR a disk crive available AND the program isNOT wri tten to run on a different computer'.

3) Const uct a truth table for this logic circuit:

PA

^ AND

OR

B Q

THE HOME COMPUTER ADVANCED COURSE 9

Page 12: The Home Computer Advanced Course (01)

` HARDWARE /COMMCDORE 64

COMMODCAt £200, the Commodore 64 contains a lotof hardware — 64 Kbytes of memory,sophisticated sound and graphics facilities.It is a very suitable machine for the serioushome computer enthusiast, and with theaddition of suitable peripherals, could beused for small business applications ,too.The design makes use of `bank switching' tosqueeze the memory into the spaceavailable.

The physical similarity between the Commodore64 and the Vic-20 is deceptive. Although there is ameasure of software compatibility between thetwo, in hardware terms the 64 represents aconsiderable advance. Let's begin by looking atthe 64 Kbyte of RAM from which the computerderives its name. This feature is a considerableadvantage in selling terms since it was, until theadvent of the 16-bit microprocessor, as muchRAM as was available on any businessmicrocomputer. However, there is a certainamount of difficulty associated with equipping ahome computer with this much memory. Thoughan eight-bit microprocessor such as the widely-used 6502 can address a total of 64 Kbytes, thismust include all the ROM and the input/outputchips for controlling keyboard, screen andperipherals in addition to the RAM.

The answer lies in `bank switching', a techniquewhereby sections of memory are switched into and

out of the addressable memory map as they are

needed. There is no theoretical limit to the total

amount of memory that a computer canincorporate using this method, but because themicroprocessor can still only address 64 Kbytes at

Box Of TricksThe SX-64 is a self-contained portable version of theCommodore 64, which can be purchased in a variety of differentc)nfigurations. The most popular version features one disk drive(the space above can be used for storing diskettes) and a fiveinch colour monitor. The SX-64 will run disk or cartridge basedsoftware from the standard Commodore 64 withoutmodification.

In nany aspects it is one of the best designed 'luggable'computers — a phrase coined to distinguish them from trulyportable machines such as the Epson HX-20 and Tandy Model100. Tfe keyboard features fully sculptured keys with thegraphics legends inscribed on the front, and it is detachablef rom the main unit, There is a slot in the top of the casing to takeROM cartridges; when not occupied the opening is covered by af ap to keep out dust.

The casirg itse f is bcth rugged and compact, resembling theportable test equipment used-by service engineers, particula•lyii the way that the carrying handle doubles up as a stand. Thehandle is ridged to prevent it from slipping on the desk thoughthis makes it slightly uncomfortable :o carry. Overall, thephysical des gn is :he best to have ccme from Commodore todate, and is marred only by the fact that the mairs cable andplug cannot )e stored anywhere inside the casing

10 THE HOME COMPUTER ADVANCED COURSE

Page 13: The Home Computer Advanced Course (01)

COMMODORE 64

Approx £200

404x216x15mm

6510

64K RAM, of which 39K isavailable for BASIC p ograms.20K of ROM including thecharacter generator

25 rows of 40 columns. In lowresolution, 16 colours areavailable from tie keyboard forcharacters, border andbackground. Maximum highresolution is 323x200 pixels. Upto eight sprites can be defined andused

Joysticks (2) plus light pen,RS232 (adaptor needed), 8-bitpara lel, cassette, serial (for dis<and printer), composite monito',audio input and output, TV,cartridges

BASIC, FORTH, LOGO, 6502Assembly language

Typewriter-s ty le, with cursor keysand four programmable functionkeys

The computer comes with anadequate instruction manual, butto taKe fuli advantage of thefunctions, you should purchasethe Programmer's ReferenceGuide, or one of the manyindependently published guidesto the Conmodore 64

Large standard memo ry. Spritegraphics. Sophisticated soundcontrol. Quality keyboard. Goocrange of peripherals. Morebusiness software available thanfor most home computers

ReqLires manufacturer's casseheunit. BASIC weak on usefulcommands (unless you purchasea cartridge add-on). Limitedchoice of graphics modes andresolutions. Disk unit slow

COMMODORE 64/ HARDW E q

any one time, the more memory there is, the moreswitching of banks there wi ll need to be, and thatwill subsequently reduce efficiency.

What this amounts to on the Commodore 64 isthat if you want to run a program in BASIC, theROMs containing the BASIC interpreter will needto be switched in, and this will reduce the amountof available RAM to 40 Kbytes (and systemvariables and screen RAM will still need to comeout of this allocation).

Though bank switching has been added to quitea few home computers by way of a modification, itis achieved on the Commodore 64 by using aspecial microprocessor. The 6510 is very similar tothe 6502 that has proved so popular in homecomputer design . The instruction set is identical,and it features an eight-bit data bus, 16-bit addressbus, and various control signals. However, it alsosports an eight-bit programmable input/outputport. This means that there are eight additionalpins on the chip, each of which can be set to 1 or 0,or can be used to read values placed onto them byan external device. Normally such ports areimplemented by means of a special chip (called aPIO, PIA or VIA depending on themanufacturer), and a typical home computer willinclude several of these to handle the keyboardand peripheral ports.

The port appears as the lowest two memorylocations in the map ($0000 and $0001). Theformer is for reading and writing the individualbits, while the latter location indicates whethereach bit is set as an input or an output. Having thisport built into the microprocessor means that the6510 would be ideal for incorporation intonumerous domestic devices — from dishwashersto programmable toys. On the Commodore 64, itis used to select between the banks of memory (see

W panel). You could do this with BASIC POKEstatements, but there is a distinct possibility of`crashing' the system, forcing you to reset thecomputer. Most memory switches are therefore

lisp aying barcharts of the figures in any column on theBusiness Mileage

mA large proportion of the Comoro ore 64's software base can bespreadsheet, and works three dimensionally. That is to say, several pages of memory co g be h e ld in memcry at once, and it

said to have been inherited from its predecessors, the PET and is p to together figures from all these sheets .Vic-20. The BASIC interpreter is more or less identical on all too,, is —

Magpeie s a fairly outstanding piece of softwareMagpie,

tiree machines, and there is much common ground in the disk fallirg into the category of applications generators. Ancperating systems, too. Because the business scftware,

cation

appl cation is defined by drawing the layouts for screen recordsceveloped for the PET range could only be u sed on ing forms on the screen, then specifying theandprintedandCommodore's maclines, it is hardly surprising that the software relationships between the fields withi n those documents;cevelopers were so quick to take advantage of the potential new "VAT=TOTA.15 /3, for examplenarket opened up iy the 64.

For business application, there isa wide choice of wordprocessing packages, several cf which have spelling checkers. n cam.e pr ce5 F s^ rTwo of most popular examples are EasyWrite/EasySpell fromthe examples price iill.S

ii t er f ie I

Commodore, and V'izaWrite/VizaSpell. Two other popularSan ease auto:

: rpackages, but without the speliing option, are Paperclip 64 and w..l.d Pr.cesWordcraft 40. The latter is different from most word processors, `

o

G i^r. z'« °^^ ^ F _in that the screen displays the text in the format in which it will ,tprl f jeId5 FIf Wally be printed, whilst most others display

a.=o.p^^^ S Pr ed

controls' — single character symbols to signify a carriage return,E.. t oc uf!

r_= p, crthata heading is to be centred on the page. get

page auto..F

Spreadsheets are available starting from just a few pounds GeSe«° ~=` FIFnd of Procedure

W

One package, however, is worth special mention. At over £100 YCalcResult is more expensive than most spreadsheets for low-cost m cros, but it works in full colour, inclides a facility for

THE HOME COMPUTER ADVANCED COURSE 11

Page 14: The Home Computer Advanced Course (01)

p

Cassette PortAll Commodore compurequire the manufacturecassette unit. When it v

Audio/Video Socket marketed, the Commo(A composite video si)nal is system was faster andprovided to drive a colour reliable than a domesticmcnitor ithouch not an RUB Now the opposite is tru

This port has two functions.First, it can mplement a fullRS232 serial interface, thoughan add-on is needed to :onvertthe 64's voltages to those usedon most serial devices. It canalso double up as a parallel portthat can be used forexperimentation

Ca rt ridge PortIf a FOM cartridge (up to 16Kbytes) is Mugged in here, itwill effectively override anyothe' men ory that occupies thesame locations. if the first ninebytes of the ROM contain aspecified sequence of valuesthen the program will'automatically start wrenswitched co. This is how gamescartridges work

HARDWARE/COMMODORE 64

mcnitor), and there is aseparate audio output that canconnect with a hi-fi system.There is also an audio input line

Serial BusThis is a special interface

that allows you to mix recorded des gned by Commodore to

music with synthesised sounds drive several devices ;includingtheir disks and printers)simultaneous

l y The protoc)l isd dN Output similar to the IEEE4 8 )tan ar

Unlike the Vic-20, the except that there is just one

Commodore 64 contains a built- (serial) data line instead of eight

in RF modulator, so that the parallel ores

output can be ccnnect^ddirectly to a TV

performed in machine code.Three other chips between them account for the

rest of the 64's features. There is a 6526 CIA(Complex Interface Adaptor), which is a moresophisticated version of the PIAS and VIMpreviously mentioned. In addition to the usualprogrammable input/output lines, it includestimers and shift registers to convert between serialand parallel data. There is also a 24-hour clockwith a programmable alarm, of which the BASICinterpreter appears to make no use at all.

The graphics and video display are handled byanother chip, the 6566, which is a furtherdevelopment of the Video Interface Chip, fromwhich the Commodore Vic-20 derives its name.This delivers different modes for both textual andhigh resolution graphics displays, and the spritegraphics have been well documented. Though itcan handle only eight sprites at once (comparedwith 32 on the Memotech MTX512, for example),it is possible to simulate rather more. Sprites aredefined as a block of bytes in memory, and theirlocation is indicated by POKEing the address intothe Vic-II chip's registers. It is relatively easy toswitch the pointer rapidly and repeatedly betweendifferent sets of values to simulate more th an eightunits.

The 6581 chip is referred to as the SID, orSound Interface Device, and contains functions agreat deal more advanced than some of the earlypurpose-designed music synthesisers. As well asfull ADSR control over the volume envelope ofeach sound, the functions include filtering,different waveforms and ring modulation -modifying one sound with another.

Memory MapThe 64K of ava fable'nemoryspace is iividei up into sixzones, three of which areusually configured as RAM. Theother three contain ROMs for

Zone 1Permanently contains 32K ofRAM

the BASIC, the operatingsystem, and the I/O chips, but Zone 2for each one there isa 'shadow'area of RAM that car be 32K RAM

Normally 8K RAM. If an 8K ROMcartridge is inserted this will

switched in under software ove•ride tie RAMcontrol. This is only practicable,however wher using machinecode and the FOM isn't needed Zone 3

Normally8K ROM, containingthe BASIC interareter It will beoverridden if a 16K cartridge isinserted. Alternatively, 8K bfRAM can be switched in toreplace the ROM

Zone 4Permanently 4K of RAM

8K RAM Zone 5Normally contains all the I/O

_______ -

-

r

chips and some RAM. Undersof'ware control, however, theROM-based character generator

8K BASIC ROM car be switched in here

4K RAM Zone 6When the machine is switched

4K I/O RAMon, this contains 8K of ROM,including the Kernel - a minimaloperating system designed to

be used on all futureCommocore hardware. When

8K KEF NAL ROM using machine code it can bereplaced with 8K of RAM

12 THE HOME COMPUTER ADVANCED COURSE

Page 15: The Home Computer Advanced Course (01)

iiiACCESS - ADA/JARGON

i6

ACCESS TIMEThis refers to the time taken to locate a particularitem from within a whole collection of data. Theterm is most commonly used when referring to thelength of time needed to locate any particularrecord within a file — especially in databaseapplications. For many business applications, theefficiency of a program will be far more stronglydetermined by the average access time of the diskthan by the clock speed of the CPU.

The access time is quite different from the datatransfer rate' — which is the speed at which bits willbe transmitted from disk to computer once theitem has been found. On the Sinclair Microdrive,for example, the average access time of a piece ofdata is 3.5 seconds. The minimum is zero, if thedata is opposite the read-head mechanism whenthe request is made; and the maximum is sevenseconds, if it has to wait for a complete circulationof the tape loop. This is very slow when comparedwith a floppy or hard disk unit, where the averagemight be nearer to half a second. However, thedata transfer rate of the Microdrive (16 Kbytes persecond) is very fast, and is as good as any disk.

ACCUMULATORInside a microprocessor or CPU there are severalregisters. These are individual bytes of memorythat perform all the arithmetic and logicalfunctions of the processor. Probably the mostactive and important of these is the accumulator,which is linked directly into the Arithmetic LogicUnit (ALU). The chief function of theaccumulator is its ability to accumulate values:that is to say the contents of a byte can be simplyadded into, or subtracted from, this register. To theBASIC programmer, the accumulator is bothinvisible and inaccessible (although it will be usedby the BASIC interpreter thousands of times everysecond). To the machine code programmer,however, the majority of instructions in everyprogram written will involve some manipulationof the accumulator.

ACOUSTIC COUPLERThe transmission characteristics of a telephoneline are such that it can only be used to transmitfrequencies in the range 300 Hz to 3400 Hz — therange required to transmit normal speechintelligibly. This `bandwidth' also determines themaximum rate at which binary data can betransmitted. Some system is needed, therefore, to

ensure that the signal to be sent always falls withinthis range. This is called `modulation'.

One system of modulation represents a binaryzero as a tone in one frequency (let's say 1000 Hz),and a binary one is represented by another tone ina different frequency (e.g. 2000 Hz). The devicefor converting between binary data signals andthese audio frequencies is called a `modem'(MOdulatori DEModulator). For best results themodem should be wired directly into thetelephone line, but this can only be done for apermanent installation. For portable applications(such as salesmen transmitting the day's figuresback to central office, or journalists sending copyto their editors) an acoustic coupler is necessary.

An acoustic coupler is simply a modem withtwo rubber cups (one for the mouthpiece and onefor the earpiece) into which a telephone handset ispushed. Were you to remove the handset during atransmission, you would be able to hear the databeing transmitted in the form of tones. However,by interrupting the flow of data, you would createerrors in the received data.

ACRONYMBASIC is an acronym, so is PET, and FIFO, RAM,EPROM and SNAFU. An acronym is a wordformed by taking the initial letter from each wordin a description or title. Acronyms seem to be verypopular in the computer industry, both forbuzzwords and for proprietary names forproducts. One suspects, however, that often thefinal acronym has been thought up first, and thenthe component words have been fitted to that.Who would really want to call a programminglanguage Beginner's All-purpose SymbolicInstruction Code, or a new computer the LocallyIntegrated Software Architecture?

ADAIn the late 1970s, C.I.l. Honeywell Bull in Francedesigned and specified a programming languageprimarily for use by the U.S. Defense Department.It was intended to replace all the otherprogramming languages they were using at thetime, and was therefore also intended to vary aslittle as possible between machines. The languageis very highly structured — it is described by someas a kind of super PASCAL, but by others as`unwieldy '. It is named in honour of Countess AdaLovelace, who was a close friend and companionof Charles Babbage and is credited with being thefirst programmer.

THE HOME COMPUTER ADVANCED COURSE 13

Page 16: The Home Computer Advanced Course (01)

referred to collectively as a$. The length of thisvariable will always be 12, and assignments to itwill be padded with spaces or truncated on theright as necessary to preserve this length. Supposewe write:

DIM a$(12): LET a$="123456789"

then aS will actually contain the characters`123456789' followed by three spaces, making 12characters in all. If we write instead:

DIM a$(12):LET aS="ABCDEFGHIJKLMN"

then a$ will actually contain only the 12 charactersABCDEFGHIJKL' — the string quantity ABCDEFGHIJKLMN' has been truncated on the rightto fit into the DIMensioned length of a$. If we nowwrite:

LET a$(2 TO 5)="1234"

then aS will contain `Al234FGHUKL'. This showsthe power of Sinclair string handling — all stringsare treated as single-dimension string arrays, thearrays can be subscripted or not, and individualelements of an array can be accessed — singly or as

part of a sub-string — by subscripts. It also showsanother major divergence from other versions ofsnsic. Elsewhere DIM aS 12) creates 12 separatestring variables called a$(1), a$(2), etc., each ofwhich has the length of the expression assigned toit. If nothing has been assi gned to a particularstring variable, then its length is 0, and it containsonly the null string,

In other BASICS this way of h andling stringsrequires the various string functions, LEFTS,RIGHTS, MID$, and sometimes INSTR, to enablesub-string manipulation and string-slicing in theway demonstrated. But this is not so in SinclairBASIC. The Sinclair equivalents of these stringfunctions are:

LEFT$(A$,N) = AS(TO N)

(meaning the N leftmost characters of A$);

RIGHT$(AS,N) = A$(LEN AS-N+1 TO

(meaning the N rightmost characters of AS); and

NIIDSiA$,P,N) = AS(P TO P+N-1)

(meaning the N characters from position Ponwards in AS).

LET S=INSTR(AS,"teststring")

(meaning find the starting position in AS of thesubstring "teststring") can be replaced by:

LET Y$=A$:LET Z$="teststring":GOSUB 9900:LETS=^OSN

9900 LET ZL=LEN ZS:LET SL=LEN YS-ZL+1:LET

PROGRAMMING PROJECTS/SPECTRUM BASIC

THE SPECTRUM OFZX BASIC

BASIC has become the standard language ofmicrocomputers, but almost every machinehas its own- variation — or dialect. In thisseries of articles we will be looking at someof these variations and their func tions, aswell as explaining how they can be`translated' from one dialect to another.This first article looks at the most widelyused dialect — Sinclair BASIC.

We begin with variable names — always a sourceof confusion between BASIC dialects. In SinclairBASIC, string variable names must have only oneletter, and there is no distinction between upperand lower case letters. This means that thevariables aS and AS refer to the same memorylocation. String array names follow the same rulesas simple variables, and pre-empt them, so thatonce you've DIMensioned the string array HS, allfurther mentions of H$ in the program will betaken as referring to the array HS. This followsfrom the fact that Sinclair BASIC regards all stringvariables as array-type variables, some of themformally DlMensioned, and others not.

Numeric variable names are less constrainedthan those of string variables: they must begin witha letter, and they must consist of letters or digits,but they may be any length. They may includespaces, and they may be a mixture of upper andlower case letters, but although these factors arehelpful to the programmer, they are of nosignificance to the machine, which will ignorethem. Some valid numeric variable names are:

gwert, ub40, advanced computer course

and the following are exactly equivalent:

QWERT, UB 40, Advanced Computer Course

Numeric array names must be single letters, butthis does not preclude numeric variables of thesame name: the array variable v(8) is quite distinctfrom the simple numerical variable v. Single-letternon-arra

y numerical variables such as v must beused as the counters of FOR. . . NEXT loops, so FORV=1 to 9... NEXT V is legal, but FOR Ioop=1 TO 9 isillegal.

The main differences between the Sinclairdialect and other BASICS he in the treatment ofstring quantities. Let us start with the effect of theDIM statement. In Sinclair BASIC, when thestatement DIM aS(12) is executed, 12 bytes ofmemory are set aside exclusively for the use of thevariable a$, and these bytes are initialised withspaces. Each of these bytes can be referred to as asubscripted variable, or the whole 12 bytes can be

14 THE HOME COMPUTER ADVANCED COURSE

Page 17: The Home Computer Advanced Course (01)

50 DIM A$(12) DIM AS(12) in Spectrum1 2 3 4 5 s_ a 9 io 11 1 BASIC creates afixed-length

1T 7 string variable, AS, whichinitially contains 12 spaces

100 LET A$ = "ABCDEFGHIJKLMNOP" If you tryto assign a string

1 2 3 .4 _ 6 7 8 $7_1O/_>7_21 1quantityongerthan125T j characters to AS, it will be

rA7 D C D E F G H I J K L truncated at the right to fitinb A$

150 LET AS = "*?! +" If you assign a shorter string

1 2 6- 7 g g 1 11 12quantity to AS, it is stored7_3 ,7 4,7_ 5

T left-justified in S. The

at ? ! + E F G H I J K L remaining characters of ASare unaffected

I200 LET A$ = " 11 Setting AS equal to' ", the

1 2 3 4_ 5- 6 7 8 T 9 10 11 12T Tnull -strirg, should reduce itslength to 0, and its contentsto' ", instead, its lengthrenains at 12 characters, andit is filled with spaces

I SPECTRUM BASIC%PROGR.AMMING PROJECTSa

POSN=O

9910 FOR K=1 TO SL9920 IFY$(KTO K+ZL-1)=ZS THEN LET POSN=K:LET

K=SL9930 NEXT K:RETURN

Notice in this subroutine that the string variable YSis treated as a subsc ripted a rray-type variable, eventhough it has not been DIMensioned. Since inSinclair BASIC all string variables are array-typevariables, a string va riable that is not DIMensionedis implicitly a variable-length single-dimensionarray of single characters; if it is DiMensioned, itselement length is fixed by the last number in theDiM statement. Whereas in other BASICS DIM x$ (8,7)creates a two-dimension array, in Sinclair BASIC itcreates a single-dimension array of eight elements,each of them fixed in length at seven characters.

The strict attention paid to the length ofDIMensioned string variables by Sinclair BASICmeans that seemingly simple statements can havediffering effects, depending upon whether a DIMstatement has been executed or not. If aS is asimple string variable, then LET aS='" makes thecontents of aS equal to the null string ("') and thelength of aS equal to zero. If DIM aS(7) has beenexecuted previously, however, then LET a$=`makes the contents of aS equal to seven spaces,and the length of a$ equal to seven (which it willalways be, following the DIM statement).Furthermore, in such a case, even though LETaS=""has been executed, a test such as:

IF aS="" THEN PRINT 'null-string"

will fail, and nothing will be printed — aS is equalto seven spaces, not the null-string.

If you need to test string array elements in thisway, then it's probably best to set aside a stringvariable for the purpose, DIMension it to the lengthof the longest array variable used in the program,and test your array variables against it, like this:

100 DIM a$(12,34)120 DIM bS(7,56)140 DIM NS(56)150 REM NS will be used as the emp ty string

... r ..............

580 IF b$(3)=N$(TO 56) THEN PRINT "empty"59C IF aS(11)=NS(TO 34) THEN PRINT "empty"........................

Here NS is used only as the empty string, and if itwasn't used in this way then the tests in lines 580-590 would have to use literals, thus:

58C IF bS(3)=" " THEN PRINT "empty"58E REM 56 spaces between the quctes

This is inconvenient and prone to error. Analternative to using NS in this way is to DIMensionall array variables with one more element thanthey need, and use that l ast element as an emptystring for tests of that array, so that line 590 mightbe:

SuperBASICWhile Sinclairs SuperBASIC has a considerably enhanced rangeof commands over ZX EASIC, the most significant feature is itsabandonment of the single-key reserved word entry systemcommon to the ZX80, ZX81 and Spectrum. This was origin2llyintroduced as an econo'ny measure for users (if was felt thatpressing a single <ey ra:her than typing a whole word wouldprove attractive). Thelsystem dictated that a variety of different'modes' would be necessary to allow the entry of singlecharacters to be differentiated from the entry of key words. Thissystem was attractive to Sinclair users who had never previouslyencountered a keyboard, but for these who had used a typewriterit proved to be a source of frustration

assuming that a$(12) is never used and so containsonly spaces.

Notice lastly that, in Sinclair BASIC, the firstelement in any array has the subscript one,whereas in some other BASICS the first element inan array has subscript zero. In the next instalmentof the course, we will conclude this look atSpectrum BASIC.

Procrustean St ringsThe mythical Greek characterProc

,ustes was an innkeeper

who kept only ore size ofbed, and stretched ortruncated his guests to fit it

590 IF a$(11i=a$(12) THEN PRINT "empty" I fs-^---' ITHE HOME COMPUTER ADVANCED COURSE 15

Page 18: The Home Computer Advanced Course (01)

Machine code programming is the key to thereal power of the microprocessor, allowingthe programmer direct control over all themachine's functions. This first part of acomprehensive course, covering both 6502and 180 operation codes, will lead to a fullunderstanding of the fundamentals ofcomputer programming.

Machine code is a programming language, and itlooks Re this:

INSTK: SBC SD9FA,X ;Outport flag value

or like this:

DE23 FD FA D9

or like this:

11011110 00100011 11111101 11111010 11011001

Sometimes it looks like this:

1240 LET ACC=ACC-FLAG (X)

and sometimes like this:

PERFORM FLAG-ADJUST THROUGH LOOP1

It's all code of a sort, and since it's destined for acomputing machine it's called machine code. Tothe machine it doesn't actually look like anythingat all, being simply a pattern of voltage levels or acurrent of electricity.

What we usually mean when we say machinecode is Assembly language, and the first examplewe gave in this article is an instruction in 6502Assembly language. The point of giving all theother examples was to demonstrate that there is nospecific machine language as such, only a numberof different ways of representing a sequence ofelectrical events, and representing them in waysthat we find more or less easy to understand. Sothe first thing to learn about machine code (orAssembly language — we won't worry about thedistinction for the moment), is that it's just anotherprogramming language. However, theprogramming must always come before thelanguage: whether you write your programs inIBM Assembler, Atari BASIC, or VenusianPsychoBabble, you have to solve theprogramming problem in your mind before youtouch a keyboard. The programming language inwhich you then express your solution willobviously influence the form of the final program.Indeed you may choose among various possiblelanguages precisely to make the coding of yourprogram easier, or shorter, or more readable. Butthe solution must always come first: content must

16 THE HOME COMPUTER ADVANCED COURSE

- MACHINE CODE /PART

INTRODUCINGFIRSTCONCEPTS

precede form.In that case, why call it machine code, and why

bother to use it at all? We give the language thisname because its instruction set correspondsexactly with the set of `primitive' or fundamentaloperations that a particular microprocessor canperform. We use the machine code when it isimportant to direct the operation of themicroprocessor exactly, step-by-step, rather thanallowing a program language interpreter to controlit in a more general way.

The commonest reason for wanting to use it isspeed: if your program addresses the processormore or less directly, then you avoid the relativelylengthy business of program translation. In otherwords, by cutting out the middleman you savetime. Program execution time, that is. The actualcoding, testing, debugging, modification andmaintenance of a machine code program is likelyto take at least twice as long as the same operationswould on a high-level language program. Theunfriendliness and intractability of machine codestimulated the development of languages such asCOBOL and BASIC.

If the set of machine code instructions is the setof processor operations, then what are theseoperations, and what does the processor do? Inthe simplest terms the Central Processing Unit(CPU) of a computer is a switch that controls theflow of current in a computer system between andamong the components of that system. Thosecomponents are the memory, the ArithmeticLogic Unit (ALU), and the Input/Outputdevices, When you press a key on the keyboard,you are inputting some information; in themachine, however, you are simply generating apattern of voltages in the keyboard unit. The CPUswitches that pattern from the keyboard to part ofthe memory, then switches a correspondingpattern from elsewhere in memory to the screen sothat a character pattern appears on the screen. Toyou this process may seem like operating atypewriter, but in a typewriter there is amechanical connection between hitting a key andprinting a character, whereas in a computer thatlinkage exists only because the CPU switches theright voltage patterns from place to place.Sometimes pressing a key doesn't cause a singlecharacter to appear on the screen: the keypressmay destroy an asteroid, or save a program, ordelete a disk file, or print a letter. The operationdepends on how and where the CPU switches theelectric current.

In this simplistic view the CPU is at the heart ofthe system, and all information (or electricalcurrent) must pass through it from one component

Page 19: The Home Computer Advanced Course (01)

ONE /MACHINE CODE

to another. In fact, the CPU and the system aremore complicated than that, but it's not amisleading view. You can think of the CPU as amaster controller that sets lesser switchesthroughout the system to control the flow ofelectricity, and thus controls the flow ofinformation indirectly, rather than routing allinformation physically through itself.

The effects of the CPU's switching operationscan be classified for our purposes as: arithmeticoperations, logical operations, memoryoperations, and control operations. Theseoperations are all the results of switchinginformation through different paths in the systemand in the CPU, and to the CPU they all seem likethe same sort of thing.

Arithmetic operations are really the mostimportant feature of the machine. The CPU canadd two numbers together, or subtract one fromthe other. Subtraction is achieved by representingone of the numbers as a negative number andadding that negative number to the other number;7+5= 12 really means:

(plus 7) added to (plus 5) equals (plus 12).

7-5=2 really means:

(plus 7) added to (minus 5) equals (plus 2).

Multiplication and division are regarded asrepeated additions or subtractions, so the CPUcan be programmed to simulate these processes aswell. If the CPU can cope with the four rules ofarithmetic, then it can cope with anymathematical process. It is well to remember,however, that all its mathematical potential relieson the ability simply to add two numbers.

Logical operations for our present purposescan be described as the ability to compare twonumbers: not merely in terms of relative size, butalso in terms of the pattern of their digits. It's easyto see that seven is bigger than five because we cantake five away from seven and still have a positiveresult. The CPU has the ability to do that sort ofcomparison, and it can also compare 189 with 102and recognise that both numbers have the samedigit in the hundreds column. It may not seem avery useful ability as yet, but its use will becomemore evident later.

The CPU can perform essentially two memoryoperations: it can copy information from amemory location into its own internal memory,and it can copy information from its internalmemory to another memory location. By doingthese two things one after another it can thereforecopy information from any part of memory to anyother part of memory. For the memory to be anyuse, the CPU must be able to do both these things,and these two operations are all it needs forcomplete management of the memory.

Control operations are really decisions aboutthe sequence in which the CPU performs theother operations we have described here. It's notimportant at the moment to understand them anybetter than that: if you accept that the CPU can

make decisions about its own operation, then thatis sufficient at this stage.

So the CPU can do arithmetic, it can comparenumbers, it can move information around inmemory and it can decide its own sequence ofoperations. This is a simple list of procedures, andyet it completely descibes or specifies an idealcomputing machine! If the CPU can do those fourthings, then by doing them in the right sequencesit can perform any computable task. The rightsequence, of course, is the computer program forthe particular task, and that's where we asprogrammers come in. If the CPU had the abilityto generate its own operation sequences, thenthere would be no need for us.

You may not be convinced that the four typesof operation we have described are a sufficientdescription of a conceptual computer, so let'sthink about a BASIC program in terms of thegeneral operations performed. What are thesefundamental operations? In any program youhave variables, which are simply the names ofplaces in memory where information is stored.Most programs perform some sort of arithmeticupon some of these variables. Having done thearithmetic, a program will often compare twopieces of information and as a result will executeone set of instructions or another. Informationusually comes into a program from the user at thekeyboard, and goes out to the user via the screen.

Except for the sentence about input andoutput, this description contains no more than thefour elemental CPU operations put into differentwords. And, if you accept for the moment that tothe CPU all Input/Output devices are just specialareas of memory, then the picture of the idealcomputer executing actual programs is complete.Consequently, the execution of a program can bedescribed as a directed flow of information into,around, and out of the computer; you supplysome information via the keyboard, thatinformation is manipulated by your program, andsome information appears on the screen.

If the idealised computer is just a CPU andsome memory, then before going any further weshould investigate computer memory: what is it,and how does it work?

Imagine a simple electrical circuit consisting ofa battery, a switch, and a light bulb: if the switch isclosed the light goes on, and stays on until thebattery runs down or until the switch is opened.Then the condition of the light bulb — ON orOFF — is a piece of information, and the wholecircuit is a memory device recording thatinformation. Suppose now that the switch isplaced at the entrance to a factory, and the light isplaced in the Manager's office. When the firstemployee arrives at the factory, he or she closesthe switch at the entrance, and the Manager in theoffice can see that the light is on and thereforeknows that someone has turned up for work. TheManager doesn't have to be in the office when thelight goes on; he or she can look at the light bulbat any time to find out whether someone has

[HE HOME COMPUTER ADVANCED COURSE 17

Page 20: The Home Computer Advanced Course (01)

MACHINE CODE /PAST CNF

arrived. The information that someone has turnedup for work is stored in the circuit.

That's almost exactly how information is storedin computer memory: all information reduces tothe presence or absence of electricity in a circuit.Naturally there's more to it than that, so let'simprove the management information system.Suppose we have four separate switch/bulbcircuits (the four switches in a row at the door, andthe four bulbs in a corresponding row in theoffice), so that closing the leftmost switchilluminates the leftmost bulb, and so on. Nowimagine that every employee is told to close theswitches in a unique way, so that when Catherinearrives she closes the first and second switchesand opens the third and fourth; Richard closes thefourth switch and opens all the others; Bobbycloses the first and third and opens the second andfourth; and so on for all the employees. The lightsin the office now show the Manager which of theemployees has turned up for work.

Suppose that the OFF position of each switch islabelled 0, and the ON position is labelled 1:therefore Catherine has to set the switches 1100(first two switches ON, third and fourth OFF),Richard has to make the pattern 0001 (fourthswitch ON, the others OFF) and Bobby has to set1010 (first and third ON, the other two OFF). Ifthe Manager reads each light bulb as 1 if it's ON,and 0 if its OFF, then both the employees and theManager will be speaking the same identificationlanguage. `0001' means 'Richard' to both people.

How many unique patterns of switches arethere? Each switch can be in one of two positions,and there are four switches, so there are2X2X2X2=16 different patterns. Let's considerall the possibilities:

0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111,1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111

Try as you like, you can't make any more patternsthan these, and there are 16 of them.

Notice how quickly we've moved from theconcrete picture of light bulbs in a room, to theabstract matter of patterns of 1's and 0's. If we canabstract a little further we can turn these patternsinto numbers.

Think about counting and writing down as youcount. You can count from nought to nine veryeasily because each of those numbers has a uniquename and a symbol to represent it, But what doyou write down after nine? You have a name, ten,for that number, but no separate symbol torepresent it. Therefore you must re-use some ofthe other symbols: 10, 11, 12, and so on until 99,when you run out of possibilities again, so the nextnumber has three columns (100). This seemstrivial, but you may remember how difficult it waswhen you learned it at school: all that squaredpaper with Hundreds Tens and Units written atthe top of each sum? You now know that thenumber 152 means "1 in the Hundreds, 5 in theTens, 2 in the Units", or 100+50+2=152.Counting works like this because we have ten

18 THE HOME COMPUTER ADVANCED COURSE

digits (0,1,2,3,.. .,9) which we arrange torepresent all possible numbers.

How does counting work, however, if there areonly two digits: 0 and 1? We can count to I easily,but how can we represent the next number? Wehave run out of unique digits, so we must re-usewhat we have (just as we did when counting withten digits), and write the next number as 10. Nowwe know that the next number is called `two', so inthis system 10 represents the number two. Thenext number as we count is three, and we mustwrite that as 11. Then what? We've run out of two-digit combinations, so the next number, four,must be represented as 100; five must be 101, sixis 110, and seven is 111. Here, we are counting indecimal numbers (nought, one, two, etc), butwe're writing these down in binary numbers(0,1,10,11,100,101,...).

In the same way as a decimal number such as152 means: (1X100)+(5x10)+(2x1), the binarynumber 101 means: (1X4)+(0x2)+(1x1).Instead of having hundreds, tens, and unitscolumns for our numbers, we must use columnsmarked: fours, twos, and units. In a decimalnumber the value of a digit is multiplied by ten forevery column it moves to the left; in a binarynumber the value of a digit is multiplied by twofor every column it moves to the left.

So that's the binary system: just a different wayof representing numbers. If you know Romannumerals you don't find it hard to accept thatthere are VII dwarfs in Snow White; so why notwrite 111 dwarfs? The actual number of dwarfs isnot changed by the way we represent it, but it is agood idea to say the binary number as `binary oneone one', and to write it as `111 b' so that you don'tconfuse it with a decimal representation.

Now we can return to our original analogy ofhow the factory workers switch patterns, anddecide on a method of making these a little easierto use. The most sensible thing to do is to treatthese patterns as four-digit binary numbers. Thismeans that Catherine's signal is 1100 binary,which is 12 decimal. Richard's signal is 0001binary (1 decimal), and Bobby's signal is 1010binary (10 decimal). When the Manager looks ata pattern of lights in the office, he or she can readit as a binary number, convert it to its decimalequivalent, and look down the list of employees tosee who that number corresponds to. Thus we cansay that information is stored in the current ofelectricity, and the switches make it meaningful.

Our analogy has given a simple picture of howinformation is represented in a computer: to thecomputer it's just patterns of voltages (i.e. lightsare ON or OFF), but we humans find it easier toconsider those patterns as binary numbers. It's alla matter of representation. If you now think of1010 as the code meaning `Bobby', then you maystart to see how all of this relates to machine codeitself. In the next instalment of the Machine Codecourse, we will look at how binary numbers areused to represent information inside your homecomputer.

Page 21: The Home Computer Advanced Course (01)

61 3SdflOD Q33NYACIY 2 3MMOJ 3WOH 3H.L

Z08TIk^E1F^FiFaFIF#dE-IF^kiF^Fik#dFaFdE^tiEil'rrN3i!

*Nnd 0d38 0088 3AVS* TORT+136*NOd 380832 80ad 3t\tiS*43d OOST

it^Fi4iF*** *#*##&**iFR^F* dO 1S 0061X 1X9N 0091

(9SZ113Sjj011NISZSZl1Sdd00dI3009113 -1 W3H1 9

LI+13S-AiC=l3Sdd0 13'1 OObI

t1S asn= iWy_

d

3N3d 0°ZI136830'1.0 x WO 0011

811 O1 0=0=131880 131 0001

X LX3N 00r

OW'X+tlS 3NOd 00'3W ^V3 a 00'

TT 01 0=X 803 00T0Z'91T'L5

O'p , i£ g 6S , O r 4T,£'p'i d1tlQ OS

Z d3dWO8 CC

L+((Ttald)N33d*95Z1+(alc

H33d=tlS 131.5£9tZ=ald 131 0

iF^fiFiEi4i#+(;t#444tif'itiFk#**'#it*#W3'^

y '0 088 0NINNa a31dd *W3a

I 314I, 1SI-1 ION Oa *W3a

****3aO3 0!l WnM173dSIF*

********* ** **^ KK* IHl 3 '1 bS {N 3N TO£C)q

* *** Nbn13 a 6 Z09

'N'ZZ 3:10d:^41 Q b

3N OSi0901 Hb_,l8 3 'd 04TGq22`8

02'Zr ZZ'bb bOd C9T0o

2 ' 6T £ZZ'Oy^

09

ZSZ' 0L'2' hS2r59T bdbQ 0 6^£T

'GSZr. 0 z gOZ`TS2'pf BpZisZ'16i9

tr'r r ^' jbQ Ori' ° bS':£ sSH ° 49T`

S$8^ 6ZT `Sq r09,H zi

S0 , Zl 8 q k 3

b8 SZ?y ^. 00109

NSawd:W **625S-j03'8T,Q8 ^ S:G

8Z 3dOd °Z 09b3a o-1 W iF

*aF# W U opo0009

dl'g lh 1S OU60

SH`r b^ 3NOd ^r^bb 3HOd 009 Td31y S52 pj S 3?fpd:S^.bS

0d 00 r

000 3N:HJ °S a4y.6

01 T=dl d U° d

" oI SFJg by bMO b^2fiL 3a lIh$b: , dNOISb311

0 ^Lr)gbl r^NddNJ

o0T13J 13', QgZ! .Jo

dI:d 'L 3N OOT

d Wj °01 L ?

3HOd 00aapNy y^ 0 d j Z

W3b: rSHJ:l^ 0_33 009

33MJ5^ 3Hb1 : .NO 6i0p009 1NI^JdI0oN

Mb3lJ waa: M SIH1 SNSO'J 006

l #******K**** IGbT1tbN3 1NI6d 0°£

** ** *** ku*ifK W ^

QO W *^*N3^ Toy****iF**i^ OO KW3e; 001

^9 p,^Q^*o".l^3ao6oNWWW^

OL*X#*^t#W3a T

0 tr0t##If**** ** NINN1a pd*W3a GobOS* n ; Wtla0

3NI' O 1SI"1 ION a 66L0£#TFi ^E ##iFIF^F^FiF^E*^ ^k#W3 T 000£

#a313tl o0T

^,*W3a

#Y *^FIF^kY ^

r^^f^(k^F^t OOLCL

*#^(iFX I4 kIF^k#IF*^Foad- k^E# *W a

3ad3fl 3ntl5 66ZOL

ONINNntI ******##*^F^FW3a* ^ Naf13a oOZOL

AS##TF*1FF^E*^Y1FkY* 1 > 3N 08 -

^Vo OLT0LOW=(/.fi1Z 0^fla0A 09101

Zzt1a1Sd O1 La1SdZ2 dtl3b OS'•0£

96

'691 d1tlQ 0£101

r96'96`STZ'8oZ'ZTI`LLtZZ£`SOZ`ZTT `d(IIO£

r dl OZ

`96`T°80Z'SII`L6QOZ`t' ' 6 sr

'

' 69T'Z ^ I 0£Z LTT`S9I<< yltl6 01101

s -OLZ`Z`SOZ`bTT OL^S9T`ZTT`LLI

9TT`S9T yTT

SSZ`LZZ`ZL Z

T dltla

cooL

`Z'ObZ`b`Sb` 9TT=t'

dTbTZ

`

! al O1NI=H- 0Z00o

j^:SHIF9SZ-?l1Sn'S"1:(9S

yn

alSn:8+3`Obd1a15d****w N OTOO£

a3Qtl OW*****^FW3?! 00001Z6ItW3

WIH=aOIs 0061

#ik##alSd15 LX3N

o08Tc°f nOn 00LI

(lalsdl8Sn=AWWn(1 0p9T

dH=l1+tl3IL'3, IHS'.^ OObTS1=SH=cI,dSIu* 0_n

80d OOLT

Ol =fl a0d STNOISaan

01 15 SSZ S^0'$d COZT

Nan13a LIN .LndNI

d3OOil

3x00 3NIH7tlW

ap3IdH1.,:l£T)Stl1aL1X3N 0001„OIS

dS SeM IH1j. 006

ZLb+N1 °(d•W.."=.A 008

O 6409Z6T=>I( N3H1 6L9p1^ 016 I=c a03 OOL

finS00000016 300W 00'_

bSZ Al

* %T5\

itIF^F^^k*

#it*#x#^F^F*

*W3a OS\^F^F^F*^^F*##fit## 083

OW3d 3800 J/W

#x^^FX^FW3a 6bT

* ^F^F*##kiFF#^F^iFItX#X^F^F^F iF ^E ^FM ***##OdflX^t^#*fit*** #iFW3a*001

*»# * *##* # * ** oa^^I X88^k ^F # ^F

uaaios a i l uo I(wnlloadS)s>oolq:n°looio'(a88

pue )Jopowwoy)1as Jaloeieaaaa^lueaq !aqua6ui/eldsip

cq apo3 eu!L 1 pue 3 ISV8LaaMI;q uo i lejado )o peals

U! aOuaJapp aq alellsuow3p'y9 a.opowwo 3 ayl

JO) iaglo 941 pue 01a!W 388;g1ao{ auo 'wnipadS Xi jol auo'swei6oid ljogs eaiul esaal

peagd iuipeads

3 oo 3NIHY WZ 3NO ,L2^^Id

Page 22: The Home Computer Advanced Course (01)

I GUIDING PRINCIPLES

In 1970, at the age of 28,Shiina Takayoshi abandoned

a promising career in themilitary and formed the SurdCorporation (1982 sales: $40million). He immediatelyformulated 11 guiding

principles to help him govern

his oew computing business,These included:'The company's foremostobligation is to humanity.The company must do its

best to determine whatproducts and services arebest for society, and providethese at a reasonable east.'There must be no divisionbetween labour and

management. All persons in

the company must respectone another and co-operatefor The benefit of all

_ ^ OFM/MICR0S0FT

BILL GATES-SETTINGTHE STANDARDMicrosoft has become, in one shortdecade, the world's most influen tialsupplier of microcomputer software. It wascourted by the world's biggest supplier ofcomputers, IBM, and effectively helpedshape the specification of the IBM PC, theworld's largest-selling personal computer.

The Microsoft company, now a multi-milliondollar operation, is a classic story of enthusiastsmade good. Bill Gates, at 28 the chairman of theboard, was in 1972 only a talented amateur.

At Seattle High School, where the parent-teacher association had the foresight to equip thestudents with a timesharing terminal attached tothe popular DEC PDP-11 minicomputer, Billlearned about the workings of computers. Hewent to Harvard University and on hisgraduation went into business back in Bellevuewith schoolfriend Paul Allen. The firm they setup was called Traff-O-Data, and their work wasto monitor traffic flow for the Seattle publicauthorities. It was a momentous period in thedevelopment of the microcomputer: the firstmicroprocessors were making an appearance andthose with imagination and enthusiasm saw agreat future for devices such as Intel's 4004 and,later, 8008 chip. Bill was by now thoroughlyfamiliar with the DEC PDP-11 and one of hisfirst jobs was to track down bugs in thiscomputer. It occurred to him that it would be agood idea to adapt its BASIC for use on the 8080.He had no development system, and the firstoccasion on which the code and the machinewere mated was when Gates took the tapes downto Altair in Albuquerque, New Mexico.Incredibly, it ran first time. Thus was born MBASIC,which has ever since been the standard to beat.

Microsoft was becoming known as a softwarehouse with expertise at fitting new computerswith operating systems — filling the empty box, asit were — and IBM contacted Gates to ask for his

advice on how to specify and equip a single-userpersonal computer. Initially, Gates suggested thatGary Kildall of Digital Research, riding high onthe burgeoning success of CP/M, was the manfor the job. But eventually IBM came back toMicrosoft. Microsoft rewrote PASCAL, FORTRAN

and MBASIC for the 16-bit implementation, andalso came up with the GW (for `gec-whizz') BASICwith its extended music and graphics capabilities.

At the same time, Gates realised that an untidybut powerful multi-user OS by Bell Laboratoriescould be usefully adapted for the more powerfulmicros based on the new 16/32-bitmicroprocessors, and transformed Unix intoXenix. Both Tandy and Apple adopted Xenix intheir own 16/32 bit models in 1983. It eventranspires that Microsoft did much of the workfor Apple's newest creation, Mackintosh.

Microsoft has a firm footing in the hobbymarket, too. In 1981 it set up ASCII-Microsoftwith a keen young Japanese, Kay Nishu, to selltheir OS and BASIC to far Eastern manufacturersof the new generation of lap-held micros like theNEC PC 8201 and Tandy Model 100. Out of theJapanese manufacturers' desire for a commonstandard, not only in languages, but in interfacesto desirable home peripherals such as colourplotters and printers, lightpens, joysticks,trackballs, robot arms, FM tuners and so forth,came the common MSX standard. Now, it seems,we shall soon have a standard common diskformat from Microsoft that will enable data to betransferred among the three principal operatingenvironments — MSX, MS-DOS, and Xenix.With its emphasis on software that is easy to use,illustrated in such phenomenal advances asscreen windows and the mouse, Microsoft wouldappear to have a bright future ahead of it.

Industry StandardBASIC — Beginners' All-purpose Symbolic Instruction Code —was developed in 1965 at Dartmouth College, US, by J Kemenyand T Kurtz, and thus predates the microprocessor by at leastseven years. While many dialects of :his language have beenformulated, MBASIC, Microso't's own version, has come to berecognised as the industry standard.

Microsoft established its reputation with the success ofMBASIC. and has continued to thrive by producing a seriouschallenger to Digital Research's CP/M in MS-DOS, an operatingsystem designed to be applicable to a wide range ofmicrocomputers.

Following the lead given by Xerox's Star terminal system. anddeveloped by Apple with Lisa, Microsoft has novi diversifiedslightly and orodu ed a package tha: combines software wits ahardware device necessary to its operation — MS-WINDOWSand th y; mouse. M crosoft's mouse, ike that of its two

competitors uses a trackball-like arrangement couples with twoselectors to 'Bove the cursor around the screen

20 THE HOME COMPUTER ADVANCED COURSE

Page 23: The Home Computer Advanced Course (01)

[!JE

The Home Computer AdvancedCourse will take you far beyond thenovice stage, widening yourknowledge and making you a moresophisticated user.

To help you keep your copiesimmaculate, we will be making a very

special free binder offer in Issue 5— besure not to miss it!

Overseas readers: this special offer appliesto readers in the U.K., Eire and Australia onlyBinders may be subject to import dutyand /or l ocal tax.

Page 24: The Home Computer Advanced Course (01)

ALL YOU HAVE TO DO

"AH! DRESS THE APE RIGHT,"EXCLAIMED AMOS, BUGLE SALES MANAGER.

This crazy sentence contains anagrams of four familiarpieces of computer jargon.Each week for the next four weeks we will be featuringthe particular parts of the above sentence that makeup one of the four words or phrases.

"ADERS IN THE U.K. AND EIRE ONLY

aM

ream p

Warn h1Wa

in*aTargJt wntqAsirreIeye$!WIN — 1st Prize, an I.B.M. P.C. system to

the value of £5,000.

WIN — 2nd Prize, a holiday for two in the U.S.A.with a visit to Silicon Valley. r----

WIN — 3rd Prize, one of ten high resolution This week (issue 1), the well-known computer word or

colour monitors, phrase is hidden in the words "EXCLAIMED'AH' '

HOW TO ENTERTo enter the competition, first you must correctly identifyeach week until issue 4 all four hidden words or phrases.Then use your skill and knowledge of computing and yoursense of humour to invent a new piece of computer jargon,no more than 5 words long, and give its definition in nomore than 15 words.

REMEMBERRetain your answers to issues 1, 2, 3 and 4. Issue 4 willcontain the address and rules for competition entries.

THIS COMPETITION IS OPEN TO