• Vol'. 4, lssue 2, SepternlJer 1/83
• ' or
•
• •
YOUR CAMEL YOUR CAMEL IS YOU HA'JE ARRIVED
LIKES THIS PACE BURNING ACROSS AT A WATERHOtE •. THE DES'ERT SANDS 'tOUR rCA'MEL EATS WARNING HAPPILY WHILE YOU YOU NEED A DRINK REFJLL YOUR
• WATER-BAG
Also i�n th,is issue,: DEPARTIM'E',NTS:
• Conserving BASIC Memory A �B�it of Lower Case
PROGRAMMING: 8, Theory and Techniq,ues of Sorting � Part
Sol',,I ' ,,' ' ,' •
• Format ion Level II
• • Othello Colour
• �•� �ord,er�i��n�g� �Pr�i�oriti'es Level ,'lil' • • Regist er Display Program Peach • Towers of HanoJ Colour ***** ABOUT MICR0-80 *****
EDITOR: RYSZARD WIWATOWSKI ASSOCIATE EDITORS : SOFTWARE CHARLIE BARTLETT HARDWARE EDWIN PAAY
MICR0-80 is an international magazine devoted to the Tandy TRS-80 Model I, Model III and Col our mi crocomputers , the Dick Smi th System 80/Video Geni e and the Hitachi Peach. It is avai lable at the fol lowi ng prices:
12 MONTH SUB. SINGLE COPY MAGAZINE ONLY $ 26-00 $ 2-50 CASSETTE PLUS MAGAZINE $ 65-00 $ 4-00 (cass. only} DISK PLUS MAGAZ INE $125-00 $1 0-00 (disk only}
MICR0-80 is avai lable in the United Ki ngdom from : U.K. SUBSCRIPTION DEPT. 24 Woodhi ll Park, Pembury , Tunbridge Wel ls, KENT TN2 4NW
MAGAZINE ONLY £ 16-00 £ 1-50 CASSETTE PLUS MAGAZINE £ 43-60 £ N/ A DISK PLUS MAGAZINE £ 75-00 £ N/ A
MICR0-80 is avai lable in New Zeal and from : MICRO PROCESSOR SERVICES , 940A Columbo Street , CHRISTCHURCH N.Z. Ph 62894 MAGAZINE ONLY NZ$ 43-00 NZ$ 4-00 CASSETTE PLUS MAGAZINE NZ$ 89-00 NZ$ 5-00 DISK PLUS MAGAZINE NZ$175-00 NZ$1 5-00
MICR0-80 is despatched from Austral ia by ai rmai l to other countri es at the fol lowi ng rates :
(12 MONTH SUB} MAGAZINE CASS + MAG DISK + MAG PAPUA NEW GUINEA Aus$40-00 Aus$ 83-00 Aus$ 143-00 HONG KONG/SINGAPORE Aus$44-00 Aus$ 88-00 Aus$ 148-00 INDIA/JAPAN Aus$49-00 Aus$ 95-00 Aus$ 155-00 USA/MIDDLE EAST/CANADA Aus$55-00 Aus$102-00 Aus$ 162-00
Speci a 1 bu 1 k purchase rates are a 1 so avai l ab 1 e to computer shops etc. Please use the form in this issue to order your copy or subscri ption.
The purpose of MICR0-80 is to pub 1 ish software and other information to hel p you get the most from your TRS-80, System 80/Video Genie or Peach and its peri ph era 1 s. MICR0- 80 is in no way connected wi th any of the Tandy , Dick Smi th or Hitachi organisations.
** WE WILL PAY YOU TO PUBL ISH YOUR PROGRAMS ** Most of the 1 nformat1 on we pub 11sh 1 s prov1ded by our readers , to whom we pay royalti es. An app 1 i cation form contai ni ng fu 11 detai ls of how you can use your mi crocomputer to earn some extra jncome is included in every issue.
** CONTENT ** Each month we pub 1 ish at 1 east one app 1 i cations program in BASIC for each of the mi era computers we support. We a 1 so pub 1 ish Uti lity programs in BAS IC and Machine Language. We publ ish articles on hardware modifications , constructional articl es for useful peri pherals, arti cles on programmi ng techniques both in Assembly Language and BASIC, new product revi ews for both hardware and software and we pri nt letters to the Editor.
** COPYRIGHT ** All the maten a 1 pub 1 i shed in this magazine is under copyri ght. This means that you must not copy it, except for your own use. This app 1 i es to photocopyi ng the magazine itself or maki ng copies of programs on tape or disk.
** LIABILITY ** The programs and other arti cles in MICR0-80" are publ ished in good faith and we do our utmost to ensure that they function as descri bed. However, no 1 i abi 1 i ty can be accepted for the fai lure of any program or other arti cle to function satisfactori ly or for any consequenti al damages arisi ng from thei r use for any purpose whatsoever. VOLUME 4, NO. 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 1
***** CONTENTS *****
REGULARS PAGE
EDITORIAL 2 PEEKING (UK) - From our U.K. Correspondent 2 INPUT/OUTPUT - Letters to the Edi tor 2
WHAT YOU HAVE MISSED 8 MICROBUGS 14
DEPARTMENTS
KALEI DOSCOPE 4 PEACH BOWL 5 GROUP ONE 6 FORM THREE 7
PROGRAMMING THEORY AND TECHNIQUES OF SORTING - Part 8 9
SOFTWARE
- TOWERS OF HANO I ...... •...... CC 14 & 19 OTHELLO .....•...... •...... •...... CC 15 & 21 TOWERS OF HAND I ...... •...... PEACH 14 & 23 REGI STER DISPLAY...... PEACH 15 & 24 DESERT CHASE .•...... L2/ 16K 16 & 25 FORMATION ...... •...... L2/ 1 6Kml 16 & 27 ORDERI NG PR IOR I TIES ...... L2/1 6K 18 & 23
MICR0-80 PRODUCTS CATALOGUE CENTRE
NEXT MONTH1 S ISSUE 35
CASSETTE/DISK EDI TION INDEX 36
ORDER FORM 36
MICR0-80 is Regi stered by Austral ia Post - Publi cation No. SBQ2207
AUSTRALIAN OFFICE AND EDITOR: MICR0-80 P.O. BOX 213 GOODWOOD, SOUTH AUSTRALIA, 5034. TEL. (08) 21 1 7244
U.K. SUBSCRIPTION DEPT: 24 WOODHILL PARK, PEMBURY, TUNBRIDGE WELLS, KENT TN2 4NW
Pri nted by: Shovel & Bul l Pri nters , 379 South Road, MILE END , S.A. , 5031
Publ i shed in Austral ia by: MICR0-80 433 Morphett Street, Adel aide, SA., 5000 VOLUME 4, NO. 2 (SEPTEMBER, 1983} MICR0-80 PAGE 2
***** EDITORIAL *****
With the announcement of a new range of computers, Tandy Austral ia offers somethi ng to interest everyone from the MC-10 Mi cro Colour Computer for $199.95 (avai lable in November}, through the new Model 4 to the Model s 12 and 16. There•s even a portable computer for the travel ling busi nes man.
The word • portab 1 e • takes on a new meani ng wi th the Mode 1 100 which is about the size of its own manual but lighter. It has a LCD di spl ay of 8 lines of 40 characters (wi th graphics capability} and is battery powered wi th a non-vol ati le memory. The basic hardware consi sts of a good keyboard, 8K of RAM (expandable to 24K} , a clock wi th cal endar , and interfaces to accommodate a Centronics printer, a RS-232-C port and a cassette recorder for data storage. The 32K of ROM pro vi des a BAS IC interpreter, a word processor, an address and appoi ntment faci lity and communications software. Once you become fami liar wi th these, I image that you can take and use the Model 100 literal ly anywhere.
The new Model 4 wi ll be avai lable in three configurations - l6K cassette (for $1 ,799}, 64K singl e drive (for $2, 799} and 64K two drive (for $3,299}. Model 3 owners can upgrade their computers with a ki t that includes a new keyboard , a new CPU board wi th 64K memory and the TRSDOS 6. 0 operating system wi th Di sk BASIC and sel ls for $1 ,299. CP/M Pl us for the Model 4 is expected within two to three months.
Meanwhi le, in the U.S. Tandy has released a new , smart-looki ng 64K Col our Computer (featuring a good qual ity keyboard} and the OS-9 real -time, multi -taski ng, multi -user operating system providing access to a broad range of existing appl ications software. The Multi -Pak Interface (priced around $US1 80} is an accessory al lowi ng the Colour Computer user to select one of four ROM packs at the fl ick of a switch or under software contra 1 . Undoubtedly these too wi ll be avai lable in Austral ia in the near future.
- 0000000000 -
***** PEEKing (UK} - by Tony Edwards *****
You wi ll remember the universal programmi ng language NOS-BASICODE reported in an earl ier issue of MICR0-80. Rather than die, thi s 1 anguage is sti ll deve 1 opi ng and the 1 a test deve 1 opment is NOS-BASICODE-2 , which includes the earl i er. version. These programmi ng languages have their origi n in the Dutch Broadcasting Corporation • s program 11Hobbyscoop11 (pronounced Hobby Scope}. Programs on computing, incl udi ng the transmi ssion of programs in BAS ICODE are output regul arly by Radi o Hi 1 versum 2 and 4 on the medi urn and VHF wave bands for reception in Hal l and , but these are easi ly recei ved in other European Countries.
For our readers in other parts of the world short-wave transmi ssions were tri ed but were not successful. However, the programs are now transmi tted to radi o stations worl d wide for re-trans mi ssion local ly. The program to look for is .. Radi o Activity .. , a 15 mi nute Engl ish language program which is re-transmi tted for local reception in Austral ia, USA, Canada, and parts of Africa and Asi a, as wel l as Europe. The local stati ons broadcast at suitabl e local times but the internal Dutch program is transmi tted at 1710 GMT on Sundays in the summer , and at 1810 on Sundays in the wi nter. It wi ll be found at 747kHz ( 401 metres ). Good 1 i steni ng ! The mai n program is in Dutch but it includes short expl anations in Engl ish.
- 0000000000 -
***** I NPtJT /OUPUT *****
From: John Veldthi us - Taranaki , N.Z.
Let me fi rst say what a fantastic magazi ne you have. Now for my question. I have bought the adventure game ca 11ed Asyl urn and have been going nutty for the last two months. I am stuck in the fi rst maze and cannot fi nd any way out. I have read the hints in Vol. 3, Issue 11 (October 1982} but these have been of no he 1 p at a 11. I have mapped the maze so far but sti 11 can • t fi nd anythi ng el se. Please hel p as I may end up in the 11 I nstitute11 at thi s rate.
From: Steven Bauer - Upwey , Vic.
These are questions which, hopeful ly, you wi ll answer or , if not , maybe one of your other readers wi ll be abl e to help.
Asyl um - how do I get out of the fi rst maze; please expl ai n each and every step.
To Bri an L. Hi 11 - Where did you buy the components? (for the 32K mod}. Di ck Smi th • s pri ce is over $23. VOLUME 4, NO. 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 3
From: Nick Lambropoulos - Mi ldura, Victori a.
It • s getti ng a bit monotonous,. I know , but I • m hoping, before everyone packs up and forgets about Asylum (?), which is usual ly widely tal ked about nowadays. I CRY OUT one final time for someone to te 11 me whereabout s the matches could be found in the Asyl urn, if it • s not too much trouble. I • m al so having troub 1 e figuri ng out what the hint means in the Guru • s room and what is in the other Dark Room. I would appreci ate any help given. Keep up the great work , Micro-80.
From: Jeremy Terhoeve - Townsvi lle, Qld.
Please can anyone te 11 me how to get past the gori lla in the second maze of Asyl urn? I cannot ful ly understand the hint the program gives here. Do you need a special object?
(To answer these questions , we need to refer to a profession a 1 by the name of Ron Hack who was gl ad to help by providi ng specific answers. Thanks very much, Ron. -Ed. )
From: Ron Hack - Reynel la, S.A.
To assist those readers sti ll seeking clues for the "Asylum" adventure and to refresh my own memory , I decided to p 1 ay the adventure agai n and answer the questions asked as I proceeded. Here goes -
GENERAL HINTS:
As you are aware, the adventure must be completed within a certain time. If you wi sh to take a break duri ng the game (for a cup of coffee or to write some c 1 ues for a magazine) ca11 up the vocabul ary as thi s stops the clock.
To John Veldthius, Taranaki , __ N.Z. _ On a large b 1 ank piece of paper draw 1 i ght penci 1 lines across and down the page equa 1 spaces apart , making a grid. As you proceed to move down the passages draw heavy 1 i nes marki ng the wa11 s as if you were looking down from above. Remember you wi 11 hyperspace in certai n p 1 aces and droppi ng things al ong the way wi ll help you to sort out where thi s occurs.
To Steven Bauer, Upwey , Vic.
It is impossible to give step by step instructions on getting out of the 1st maze (it would take up too much magazine space and possibly spoi l the adventure for others).
Hints: - You wi ll need to fi nd a key - Murderers can read - There are ei ght different corridors off the revol ving doors and not four as I thought for a long time. - Having mapped al l the maze you should fi nd it forms a rectangle.
To Nick Lambropou1os, Mi ldura, Vic.
The hint in the Guru's room is in Latin (so I've been told) and translated roughly means - In the dark , horses 1 ook 1 ike cows (and , as we know , donkeys 1 ook 1 ike horses) . Thi s tends to mean something once you meet the inmate outside the room ful l of water. Having met thi s inmate I suggest you try some tradi ng.
The matches are in the 2nd maze but you wi 11 have to so1 ve the my stery of the 20 room corridor before you find them. Refer to earl ier clues (MICR0-80 Oct. '82 ).
As to the other dark room and its contents - if you are curious try lighting a match to fi nd out.
To Jeremy Terhove, Townsvi lle, Qld.
You do need an object to he 1 p you pass the gori 11a in the 2nd maze and you • 11 fi nd it in that maze. You al so need an object you are already carryi ng assumi ng , of course, you have not dropped something si nee entering 2nd maze. The hint given at this stage of the adventure is a good clue as to what object may help you.
To Grant Barnes, Moe , Vi c.
You are wasting your time looking for the Professor 's Office unless you are up to this stage of the adventure. For what it's worth , the offi ce is in the final smal l maze and when you reach that stage you wi ll fi nd it easi ly enough.
Well , that • s it for now. I '11 just get in this strange contraption and...... WHEEEE - I wonder where I'll land! ! - 0000000000 - VOLUME 4, NO. 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 4 DEPARTMENTS ***** KALEIDOSCOPE *****
In this month 's issue we publ ish for the first time a program for the Colour Computer (Othel lo) submitted by one of our readers and we look forward to bri nging you more programs from our readers that show how they use their computers and how to improve your programmi ng skill s and your knowl edge of the Col our Computer. Towers of Hanoi - an interesting puzzle for you to try on your computer - demonstrates the use of recursive programming in BASIC and is worth looking at more closely. For those of you who cannot find the time to type in the programs from the magazine listings , and would prefer an easier method , we have good news - the Cassette Edition of the magazine, commencing with thi s issue, wi 11 inc 1 ude a 11 the Col our Computer programs contained in that issue! The cost of the magazi ne, pl us cassette subscription with be $65 for 12 issues and single cassettes wi ll be avai lable for $4.00 each.
Most of the Level 2 programs that we have converted are intended to run on a 16K Col our Computer with Extended Colour BASIC, but we seem to have slipped up with one of these quite unintentional ly. Here at MICR0-80 our Colour Computer consists of a 32K Extended Colour BASIC machine with one di sk dri ve. The Leve 1 2 programs are transferred, edited to remove the reserved words not used in Col our BASIC and to accommodate the sma 11er 32 x 16 di sp1 ay , and then tested on thi s machine. In most cases, what was a l6K Leve 1 2 program works fi ne on a l6K Co 1 our Computer, but in the case of "Sink the Enemy Navy", the memory requi red to run the program crept just over the l6K. How can you get a program to use less memory? Read on to find out.
BASIC PROGRAM MEMORY USAGE
To run a BASIC program, four wel l -defined and di stinct uses are made of the avai lable memory in your machine. These are illustrated in the fol lowing di agram:
Bottom of BAS IC memory
Program storage
Vari abl e storage
Free memory BAS IC interpreter 's Stack Space at RUN time Space reserved for storage of Stri ngs Top of avai lable memory
BASIC MEMORY USAGE
When you type in your BASIC program, the 1 i nes are tokeni zed to conserve memory and stored in the program storage area. However , if the program is to run successful ly (assumi ng there are no programmi ng or syntax errors) suffi cient memory must be avai lable for storing program vari ables, String storage and the BASIC stack, otherwi se the program wi ll stop during execution with an Out of Memory or Out of Stri ng Space error (the BASIC interpreter constantly checks the amount of free memory and, if it fal ls below a certain lower limi t, termi nates the program with an error ).
REDUCING MEMORY REQUI REMENT
When a program ha1 ts with an OM error , the answer is not necessari ly to rush out and buy more memory (an expensive sol ution but one almost guaranteed to work ). You can overcome the problem by making more efficient use of your avai lable memory by a combi nation of the fol lowing methods. Natural ly, there are compromi ses in some of these and a few viol ate what is known as "good pro gramming practice .. but I thi nk that under these circumstances the end justifi es the means.
1. Program Storage
Comments within a program are ignored by BASIC and serve only as documentation for the programmer. If you run out of memory , start by removing a 11 comments from the program (but keep a backup copy wi th the comments for future reference). However , be careful that you do not introduce other errors by doi ng thi s. For example, consider the fol lowi ng program segment : 20 REM CHECK KEYBOARD 30 A$=INKEY$: ....etc.
100 GOSUB 20
Deleti ng the remark line 20 wi ll produce an error at run time since line 100 references a non exi stent 1 i ne number. Line 20 can be del eted but 1 i ne 100 must a 1 so be changed to GOSUB 30 to produce the desired effect. VOLUME 4, NO. 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 5
Each BASIC line incurs a 5 byte overhead for the interpreter1 s use. By pl acing several statements on one 1 i ne you can save a good de a 1 of memory in the program storage area. For ex amp 1 e, the fol l owi ng portion of the program 11 Sink the Enemy Navy.. could be rewritten to use much less memory:
30 DIM C(l4,9 ) 40 DIM Bl (5) 50 DIM B2 (5) 60 DIM Cl (5) 70 DIM C2 (5) 80 DIM Dl (5) 90 DIM Dl (5) 100 DIM Sl (5) llO DIM (S2(5)
can be repl aced by:
30 DIM C(l4,9) , Bl (5), B2 (5), Cl (5) , C2( 5) , Dl (5), D2(5), Sl (5) , S2(5)
The total memory saved amounts to 40 bytes, not to mention the slightly faster execution time!
2. Stri ng Storage
The amount of stri ng space used and the amount requi red by a program are not necessari ly the same. However , there is good reason for al locating a generous amount of string space. Duri ng program executi on the interpreter makes use of stri ng space somewhat extravagantly. To illustrate, suppose A$ consists of the first 25 1 etters of the a 1 ph abet and you want to append the 1 etter uzu. You can do thi s wi th the statement A$=A$+11 Z11• What actual ly happens in the Stri ng Storage section is that the first string of 25 characters is di scarded as garbage and a new string of 26 characters is created and stored. If the amount of the string space is exhausted , the interpreter begins a .. garbage col l ecti on.. routine. Frequent use of this routine slows down program execution speed. The moral of the story is that if you can afford to be extravagant then a 11ow a generous amount of stri ng space in your CLEAR statement , but if memory is scarce, use only what is requi red.
3. Vari able Storage
Each time a new vari able is used within a program addi tional memory is used in the vari abl e storage area. When writing a 1 arge program you can be reasonably certai n that it wi ll use most of your avai lable memory. It would be wi se to consider your total vari able requirements (both in number and in use) at the outset and try to use as few as passi b 1 e to conserve memory and improve the execution speed of the program. As a general rul e, try to re-use exi sting vari ables whenever possi b 1 e because each new vari ab 1 e used within a program consumes some memory for the duration of the program, even if it is used only once. It is much easier to consider these needs in the initial stages of program devel opment than it is to make extensive changes to vari ables in an almost complete program.
There are occasions where the creation of a new vari ab 1 e can actual ly be used to save memory. To illustrate, suppose your program uses the number 20000 frequently, say, for exampl e twenty times in different parts of the program. You can save a substanti al amount of memory (about 80 bytes) by assigning V=20000 at the beginning of the program and using the vari able V in pl ace of the number 20000 el sewhere in the program. Not only does thi s save memory , but as a bonus, it increases the speed of the program and saves some typing as wel l.
IN SUMMARY
The p 1 ace to start when you 1 re tryi ng to save some memory is within the program storage area. More often than not , you can free enough memory here to use the program effectively without having to resort to more drastic measures. If you must economi ze in vari able usage and string space allocation, then perhaps the option of increasing your amount of physical memory should be considered. There are other ways to conserve memory such as abbrevi ating instructions and messages, or del eting parts of the program that you can do without, but these are more a matter of personal taste rather than techniques of programmi ng. So if you1 ve been frustrated by some large program that just wouldn1 t fit your 16K Colour Computer, try trimmi ng some of the fat!
- 0000000000 -
***** PEACH BOWL *****
Many who are new to BASIC find programmi ng in that language difficult and the idea of programmi ng in assembly 1 anguage (or machine 1 anguage) seems total ly out of the question. Thi s month we present .. Regi ster Di sp 1 ay11 which is a reasonably short machine 1 anguage uti 1 i ty that , apart from bei ng useful , may serve to teach you a little about this low-level programmi ng language. When you wi sh to 1 earn how to program in machine 1 anguage the p 1 ace to start is wi th a good book that expl ai ns the fundamental s and the instruction set of the processor you1 re using (in this case, the Mot oro 1 a 6809 ). A good ex amp 1 e is the book 11 Programming the 680911 by Rod nay Zaks which tends to be 1 ess formi dab 1 e than Mot oro 1 a 1 s own pub1 i cations. The Peach pro vi des VOLUME 4, NO. 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 6
an adequate machine code monitor that wi 11 a 11ow you to deve 1 op and test short m. 1. programs that you have assembled by hand.
For those of you who like puzzles, we have a version of "Towers of Hanoi .. for the Peach that should keep you amused for hours. The original puzzle would take innumerable lifetimes to solve, but thi s version is somewhat abbrevi ated. And good news for those of you who cannot fi nd the time to type in those long magazine listings - our cassette edi tion now includes the Peach programs pub 1 i shed in that issue of the magazine, commencing with thi s issue. The prices for cassettes will be the same as shown inside the front cover - $4.00 for a single cassette and $65.00 for a subscription that includes magazine plus cassette.
SECTOR EDITOR CORRECTION
If you had any prob 1 ems with thi s program after making the amendments pub 1 i shed 1 ast issue , then perhaps thi s correction may sol ve that probl em:
Change
60130 DATA 36,30,10,C6,0F,34, ...
to 601 30 DATA 36 ,30,10,C6,10,34, ...
Geof Drury , who developed the amendments to Sector Editor, al so passed on thi s correction.
The di scussion on conserving memory in Ka 1 ei do scope wi 11 a 1 so be of interest to new Peach users. (The Peach too uses a Microsoft BASIC interpreter ) . In the case of the Peach , it may be added that although the use of long vari able names does improve the clarity of a program, more memory is used to store the longer name and, in the case of very long programs , execution speed increases.
- 0000000000 -
***** GROUP ONE *****
Whi 1 e 'Desert Chase ' and 'Ordering Priorities ' are re 1 at i ve ly straightforward Leve 1 2 programs and should run in di sk systems without changes, the machine language uti lity 'Formation' is defi nitely for Level 2 systems only as presented. For di sk users, the changes required to use this uti lity with di sk BASIC involve rel ocating the program (not very diffi cult if you have an Editor/Assembler), modifying the initi aliser and using a different reserved word (such as NAME which doesn 't appear to be used by some di sk BASICs) and rewriting the I/0 routines to make use of di sk instead of cas sette. We would be pl eased to publish any adaptations devel oped by our di sk system readers.
If you are a novice computer enthusiast , or even perhaps a more seasoned user , you may fi nd the di scussion on conserving memory in thi s month's Kaleidoscope of particular interest. Al l of the mi crocomputers that we support use a version of Microsoft BASIC and the information presented there is equal ly appl icabl e to the Z80-based machines.
THE CASE OF THE LOWER CASE
At some stage in our rel ationships with our computers, many of us wi ll take a step further inside the machine and begi n to dabble with a hardware modi fi cation of some sort. More often than not, the apparent simplest of modi fi cations wi ll lead to a smal l hiccup that gradually grows to mammoth proportions the longer we struggle to overcome the diffi culty. Mr. Wi l son , one of our readers rel ates one such experience:
" I have instal led a lower case modi fi cation as descri bed in 11THE CUSTOM TRS-80 & OTHER MYSTERIES" which was advertised and purchased through your magazine by a fri end of mi ne. The mod was successfu 1 , because runni ng the sample program gives me lower case letters.
A 1 so running the short program as descri bed in MI CR0-80 November 1980 (Issue 12, page l 0), enab 1 es me to type in 1 ower case 1 etters , so everything in thi s department seems okay.
Now the problem is if I try to 1 oad the MICR0-80 Lower Case Dri vers (May, 1981 ) I get the message fol lowed by four and a ha1 f 1 i nes of garbage on the screen , fol l owed by the second prompt *? I type "/" then ENTER, the screen gi ves a fl i cker , it then sits there and does nothing. The writing stays on the screen and the only way to get any more keyboard action is to power down the computer.
So thi s bri ngs me to a few questions. Oh! by the way , my computer is a VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 7
Level II 16K TRS-80 (cassette based ) "G" board.
1. Is my tape faulty? 2. Is thi s mod compatible with yours? 3. If not , could you send me info on how to make it compatible? 4. If the tape i sn • t faulty and my mod is compati b 1 e with yours, H-E-L-P���
Keep up the good work on the best magazine out for • 80 users. Long 1 i ve the '80!� "
What would you say is the problem? Of course, it had to be a faulty tape; we ' ll send the man a new cassette but, as it was 1 ate in the afternoon , that waul d have to wait unti 1 tomorrow. For some reason, which now escapes me , I decided to take the tape home and check it on my System 80 - a stupid idea, upon reflection, as my internal cassette deck of early vintage is extremely fussy and wi ll fai 1 any tape that has the s 1 i ghtest flaw. But , 1 o and beho 1 d � Each dump 1 oaded perfectly!
More al armi ng than that was the fact that when executed , the results were exactly as reported by Mr. Wi l son in hi s 1 etter. For the record, my System 80 was fitted with a MICR0-80 1 ower case modifi cation over two years ago and which has recently been repl aced by a nameless brand because I now prefer an underline cursor. After thoroughly investigating the software aspect of thi s di lemma, which is where I assumed the trouble was , I took a long, hard look at the inst&l lation instructi ons and di scovered to my surpri se: NOT ALL LOWER CASE MODIFICATIONS ARE EQUAL�
The original design of the TRS-80 and System 80 used a video RAM block that was only seven bits wide with bit 6 mi ssing. Instead , hardware was used to generate bit 6 from bits 5 and 7. :!"he typical lower case modifi cation invol ves the instal lation of an extra RAM chip for bit 6, a new character generator ROM (if required ), a 1 itt 1 e bit of wiring on the board to enab 1 e bit 6 and a software driver to enab 1 e you to make use of the new 1 ower case capabi 1 i ty. I expected to fi nd that when you write a zero into bit 6 of video RAM, you can read a zero from the same location (assumi ng that the chip is not faulty). A close look at the modification on p.108 in "The Custom TRS-80 and Other Mysteries" shows that what goes into bit 6 is not necessari ly the data on the bus. With thi s modifi cation you cannot store the val ues 0-31 in video RA;�, even though it's now 8 bits wide.
As the MICR0-80 Lower Case Driver loads into video RAM (expl aining the "garbage" \'Jhich is real ly a machine 1 anguage program) and executes from there to re1 ocate i tse 1 f to the top of memory , thi s situation is disastrous. No wonder the system hangs and needs to be powered down. The sol ution is to perform the other modification given in the same book on p.107 which simply connects the new chip to bit 6 of the data bus and a 11ow s video RAM to be used just 1 ike any other RAi�. Try the fol lowi ng program to see what happens in the video RAM of your '80:
1 0 CLS: AD%=15360 20 FOR I=0T0255 II. 30 PRINT@896 ," ' 40 POKE AD% ,I 50 IF PEEK(AD% )<> ITHENPRINT@896 ,"IN=";I;"OUT=";PEEK(AD% ); 60 FORJ=1T0200: NEXTJ 70 NEXTI
In the top left-hand corner of the screen , the character corresponding to the val ue OUT is di spl ayed and at the bottom you can see if your video RAM is 7 bits wide ( ab 1 e to store only 32 - 95 and 128 - 191), funny 8 bits (able to store only 32 - 255) or true 8 bits (able to store 0-255).
When it comes to hardware you must be careful not to make any fal se assumptions. If some problem deve 1 ops then you must check very carefully the hardware changes and any software you are trying to use. It is interesting to note how, in this case, the combination of hardware and software led to such a subtle problem. To accommodate lower case ASCII characters, the video RAM· must be ab 1 e to store va 1 ues in the range 32-1 27. Va1 ues in the range 0-31 (contra 1 codes) are not normal ly stored but are acted upon by the video driver routi ne. Therefore , thi s particul ar modifi cation made no provi sion for stori ng control codes. In writing the universal Lower Case Driver routi nes , Eddy sought to provide maximum flexibility by al lowi ng you to load them at any time without di sturbing any other uti lities or programs already in memory. �he logical p 1 ace to put them was into the video RAM and to re 1 ocate them from ther to free h1 gh memory. So the MICR0-80 lower case modification provided a true 8-bit video RAM which would allow you to store a m.l. program which could be executed from there (making video RAM Just like the rest of your RAM) .
- 0000000000 -
***** FORM THREE *****
For our Mode 1 3 readers, • Desert Chase • and • Ordering Priorities • are two Leve 1 2 programs that VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 8
should run with no probl ems but the machine language uti lity 'Formation' wi ll defi nitely not run without modifi cation . However , changes simi lar to those described in the October '82 Model 3 Movie Microbug (p .20) should enable you to use thi s uti lity on your Model 3.
Why don • t Mode 1 1 machine 1 anguage programs a 1 ways work on a Model 3? The two mai n reasons are that the Model 3 ROM takes up more user RAM from 42E9H to 43E8H and that the Mode 1 3 has an extra 2K of ROM to pro vi de extra features . The extra ROM and different hardware architecture of the Mode 1 3 required changes to the ori gina1 12K ROM found in the Model 1 . Thi s means that some ROM calls and entry poi nts are different on the Model 3, preventing many Model 1 m.l. programs running on the Mode1 3. I compared the contents of the ROM in our Mode 1 1 to that in our Mode 1 3 for addresses in the range 0000-2FFFH and the resu 1 ts are set out be 1 ow (Note that thi s may depend on the particular ROMs present ):
0003 - 0004 01Fl - 01Fl 124C - 124D 000E - 000F 01F3 - 01F4 1918 - 1918 0047 - 0048 01F8 - 020F 191C - 191C 0050 - 0062 021 2 - 0231 l B5D - 1 B5F 0066 - 0070 0235 - 0245 206D 206D 0082 - 0082 0247 - 025E 2073 2073 00AA - 00AA 0264 - 0282 2075 - 2075 00AE - 00AE 0284 - 02A7 2077 - 20B8 00B2 - 00B4 02E2 - 02E4 20BC - 20BC 00C6 - 00C6 03C2 - 03E9 20F7 - 20F7 00EA - 00EA 03EB - 0468 213B - 213B 00FF - 0101 046B - 0494 2167 2167 0106 - 010A 0496 - 049E 2B85 - 2B88 010D - 010F 04A0 - 04B7 2B8C - 2B8E 0112 - 0115 04B9 - 050C 2B9l - 2B93 01 18 - 011B 050E - 0532 2ClF - 2C42 01 1D - 0121 0534 - 05CF 2C7A - 2C7F 01 25 - 012C 05Dl - 05D3 2C8l - 2C82 01DA - 01EF 0674 - 0707 2C8A - 2C8C
Model 3 vs. Model 1 ROM differences
The tab 1 e above shows only the addresses (in Hexadeci rnal ) where the Mode 1 1 and Model 3 ROMs differ . Notice that the bul k of the changes are in the first 2K of the ROM {where the I/0 driver routines reside) whi le changes to the BASIC interpreter itself are rel atively minor . Although many entry poi nts for common routines have been mai ntai ned , the Model l 066CH entry to BASIC can no longer be used {the entry 1Al 9H should be used instead).
Adapting Model l m. l . programs is then a matter of changing ROM ca 11s and entry poi nts where they differ and moving those programs that reside at the bottom of BASIC's memory up to clear the extra scratch pad RAM area. With the aid of an Editor/Assembler and the source code listi ngs in the magazine, most Model l m.l . programs can , with a little effort , be made to run on your Model 3. If you have any additional information or a patch that you have developed , send it in to us and we wi ll include it in this section for the benefit of al l our Model 3 readers .
- 0000000000 -
***** WHAT YOU HAVE MISSED *****
Set out bel ow is a list of some of the programs publi shed in early issues of MICR0-80 magazine. Back issues are avai lable for $2.50 each or at the annual subscription rate for 12 or more copies . Cassette editions are avai lable for al l issues for $4.00 each whi lst di sks are avai lable for a 11 issues from September 1981 onwards. For 12 or more magazines with cassettes/di sks ordered at the same time, the relevant annual subscription rate appl ies. Programs for the Hitachi Peach/ TRS-80 Colour Computer were fi rst publ i shed in the Apri l 1982 issue.
Issue 6 - * May 1980 Issue 15 - February 1981 Issue 18 - May 1981 * Some issues incorrectly PINBALL {Ll ) ARITHMETIC (L 1) label led Apri l. KEYNOTE (Ll ) SORTING { L l) LEVEL II TBUG UPDATE (L2 ) NORMAL DISTRIBUTION {L2) SUB ATTACK (Ll ) MICROHEX (L2) DISASSEMBLER {L2) SPACE DRIVE {Ll ) SEA WOLF (L2) 12 HOUR CLOCK (L2) TRIG/BAS (L2) ASTRONOMY (L2) BONES {L2.) SUPER SIZZLER (L2) MURDER {L2) PHILATELIC ADVISER {L2 ) TIC-TAC-TOE (L2) UNI VERSAL LOWER-CASE HOUSEHOLD ACCOUNTS {L2) DRIVER ROUTINES (L2) CONNECTA and CONNECTX (L2)
Ll - Level l program CC - Colour Computer L2 - Level 2 program HP - Hitachi Peach VOLUME 4� NO. 2 (SEPTEMBER� 1983) MICR0-80 PAGE 9
The fol lowing back issues of MICR0-80 magazi ne are sti ll avai lable:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov De.� lk
'79 0 I
'80 I I I X I I I X I X X I
'81 I I I I I I I I I I I I Q '82 I I I I I I I I I X
'83 I I
-.------
( - means never publ i shed� I means issue avai lable� x means issue out of pri nt).
- 0000000000 -
PROGRAMMING
***** THEORY AND TECHNIQUES OF SORTING - PART 8 ***** by Bernie Simson
In Part 7 of thi s series, it was shown how records from an input fi le for sorting were extracted , sorted in mai n memory and stored away in a workfile for later merging. Thi s arti cle will examine in more detai 1 the processes i nvo 1 ved in storing sorted sub 1 i sts of records in workfi 1 es , and some merging methods.
PRODUCTION OF SORTED SUBLI STS.
Since the external sort phase (merging) involves a great proportion of the total sort time due to di sk operations , it fol lows that to optimi se the sort , the total number of disk operati ons should be kept to a mi nimum� in particular, track seeks. Thi s occurs when the read/write head is instructed to find or write a record based on a random address, rather than a read or write of the next sequenti al record. Thi s is not always an easy criterion to al low for in a restricted di sk-based system, whi ch is usual ly the case with most microcomputer configurations.
A restricted di sk system is defined as a system having 1 ess than four head actuators. A head actuator refers to the mechani sm in a disk drive that control s the movement of the read/write head� notthe read/write head itself.
The reason for thi s is expl ained later; a system having four logical drives in two double sided di sk drives has only two head actuators, and is therefore considered a restri cted di sk system
Delimiter identifier Pointer, or Figure 1 - Typical workfile structure Sortkey entire record t 1 sorted sublist Merge or -- sublist workfile J
Delimiter record X
sorted sublist
Delimiter record X
I I ' I ' ' I , I VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 10 for optimum merge time purposes.
When a sub 1 i st has been sorted in memory and is ready for storage in a workfi l e, the records (or AD DROUT poi nters) are written out with the same sort key used to determi ne ordering in the internal sort phase. Thi s same sortkey is used to determi ne ordering during merging. Now, depending on which vari ation of merge technique is used , which is governed by the number of �ead actuators avai lable, the sorted sublist is written out to one workfi le, or several different workfi les. Also, a subl ist del imiter is written at the end of each sublist to separate them in the same workfi le. The del imi ter would obviously have to contai n some unique identifier to avoid it becomi ng confused with a sub 1 i st record. Figure 1 shows the format of a typical workfi le.
If more than one workfi le is used to store the sublists, then they are used in an alternating fashion , so that the subli sts are di stri buted fai rly evenly over the workfi les.
When al l the records from the input file have been extracted and sorted in memory , the result should be one or more workfi les contai ning sorted sublists separated by del imi ters. The workfi le(s) are then used as input to the merge process.
MERGING TECHNIQUES.
Thi s is where most of the di sk operations occur, so it is wi se to devote some extra thought to optimi sing thi s aspect of the sort if you are designing a sort package.
Two merge techniques wi 11 be shown, with some vari ations app 1 i cable to restri cted disk systems. The two merge types are :
Linear Merge, and Tree Merge.
LINEAR MERGE.
Li near merging is shown in Figure 2. Only one sub 1 i st workfi 1 e is required as input. It involves reading the sub 1 i st records and merging them with records in the merge workfi 1 e that was created
Figure 2 - Linear Merge SUBLIST WORKFIIE
pass p+l LTh"'EAR � MERGE MERGE WORKFILES
Sorted. sublist records (only (a) Linear Merge FI& sortk.eys shown) - � Merge workfiles B D G P 1----pass 1 1------
A R v X B D G P I L pass 2--t> - c G L M A B D G p R v x 1 Cpass 3 F R T v ---£> A B c D G G L M p R v x L l pass 4--t> A B c D F G G L M p R R T v v X I I l I
(b) Linear Merge TRACE VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 11 during the previous merge pass, to produce a new merge workfi 1 e. Thi s is then used as input to the next merge paSS9 together with the next sublist in the subl ist workfile. The merge workfi le output from each merge pass grows in a linear fashion.
Do not confuse sublist workfiles with merge workfi les. Subl ist workfi les are created when sorted subl i sts are stored on completion of each subl ist memory sort , whereas merge workfi les are temporary files created by the merge process. The internal operation itself is quite simple, and is common to both merge types. At any one point in time, two records from each fi 1 e to be merged are compared , and the one with the sma11 est sort key va1 ue is written out to another merge workfi 1 e, and the next record from the workfi 1 e from which the written record came , is read , and the com pari son repeated. A three-way merge could be imp1 emented if desired , i nvo1 vi ng reading 3 fi 1 es at one time, and writing out a record depending on the result of a three-way compari son , but this di scussion is restricted to a two-way merge to avoid confusion (if you aren 't confused alt�eady ).
A vari ation to thi s merge technique i nvo1 ves reading a11 the records in the sub1 i st workfi 1 e into memory , and using thi s array as one of the inputs to the merge (with the merge workfi 1 e). Thi s assumes that the enti re subl ist wi ll fit into memory. It should do so, as it was ori gi nal ly wri tten out from memory in the i nterna1 sort phase, un1 ess the sub1 i st was produced according to the process descri bed in Figure 2(A) of the previous arti cle (Part 7). You wi ll notice that in this case, the ori ginal input fi le is referenced to retrieve the entire record using the poi nter in the array as index , thereby creating a sub 1 i st in the workfi 1 e that is 1 arger than the sorted array.
Thi s variation is useful where only two head actuators are avai lable - one to read the merge workfi 1e, the other to write the new merge workfi 1 e, whi 1 e actua1 merge is taking p1 ace. Track seeks wi ll not occur , even though 3 fi les are involved , because the reading of the subl ist workfi le is not simultaneous with the reading and wri ting of the merge workfi les.
TREE MERGE.
Tree merging is shown in Figure 3. A1 though the sorted sub 1 i sts are distri buted over 2 sub 1 i st workfi 1 es, the structure of each is sti 11 consistent with Figure 1. However , you wi 11 noti ce the different algorithms as evi dent in the merge pass traces in Figure 2(B ) and 3(B). The tree merge creates multiple merge workfi les, agai n distributing them over another 2 new merge workfi les
Figure 3 - Tree Merge
Merge TREE workfiles Sublist workfiles MERGE
(a) Tree Merge FLOW
Sorted sublist reoords (only sortkeys shown) PASS 2 PASS 3
ABCDFGGI.MPRRIWX
ABBCDEfFGGHJKLLMOPPQRRRRRSS'ITWX
Final sorted file BEFHJKLOPQRRRSST
(b) Tree Merge TRACE VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 12 in an a 1 ternati ng fashion in the same way that the sub1 i st workfi 1 es were produced. These 2 new merge workfi 1 es are then used as input in the next pass to produce 2 more merge workfi 1 es , thi s time rep 1 acing the 2 merge workfi 1 es used as input in the previous pass. Thi s technique produces sub 1 i sts that are conti nual ly doub 1 i ng in size, unti 1 only 2 sub 1 i sts exist in separate workfi les, when they are fi nal ly merged to produce the final sorted fi le.
Now in order to e 1 imi nate track seek, the four workfi 1 es active during any one pass must exist on separate di sks under the contro 1 of separate head actuators. A doub 1 e sided drive has only one head actuator , so unless 2 workfi les are pl aced on the same tracks on each side of the di sk, track seek wi 11 occur. I don 1 t know of any DOS that wi ll al l ow , without comp 1 exi ty , contro 1 over where on the disk a fi le is pl aced.
If 1 ess than four head actuators are avai 1 ab 1 e, then it may be better to have only one sub 1 i st workfi 1 e, as in the Linear merge , rather than incur an overhead of two extra fi 1 es on the di sk. Track seek wi ll occur anyway.
If thi s vari ation is adopted , two subli sts are read simultaneously for merging, so it wi ll be necessary to mai ntai n some information as to the starti ng address of each subl ist, maybe by using a 1 inked 1 i st that is updated when the sub1 i st workfi 1 e is created. The output from thi s vari ati on is also just one workfi le, which is used as input for the next merge pass. The algorithm is the same as for the four-fi le Tree merge - doubl ing the subl ist sizes on each pass.
COMPARISON OF THE TWO MERGE ALGORITHMS.
The Linear merge is the simp 1 er to imp 1 ement , but the Tree merge is the more efficient. Thi s is usual ly the case in life .... deci sions , decisions.
The sort package designer must decide on a trade-off between simpl icity or efficiency, also taking into account the envi ronment in which the sort package wi ll be implemented , in particul ar , the likely number of head actuators avai lable.
To assi st the budding designer , I have prepared a table givi ng the maximum number of subl i sts servi ced by one head actuator duri ng a merge pass, for the two al gorithms. The smal ler the number , the less track seek activity.
MERGE TYPE : LINEAR LINEAR VARIATION TREE TREE VARIATION
NO. HEAD 4 l 1 l 2 ACTUATORS 2 2 l 2 2 1 3 2 3 3
Thi s gives an indication of the likely track seek activity for a given envi ronment , which wi ll have a bearing on the overal l effi ciency of a particul ar algorithm - for instance, the Tree merge algorithm, al though bei ng more efficient than the Linear variety as demonstrated bel ow , may turn out to be less efficient if bogged down in a multi tude of track seeks in each pass.
EFFICIENCY ANALYSES.
For the purposes of these ana lyses , it is assumed that track seek activity is the same for both al gorithms , and therefore does not enter into the compari sons.
An accurate measure of the effi ciency of a merge a 1 gori thm can be made by ex ami ni ng the average number of times any particul ar record in a workfi le is moved from the first pass to its pl acement in the final sorted fi 1 e. That 1 s what merging is a 11 about - moving records from one fi 1 e to another.
Thi s can be done by determi ning the number of passes that wi 11 be necessary to merge a 11 the subl ist records, governed by :
N. .. The number of records in the ori gina1 input fi 1 e (and therefore , the number of records in al l the subl ists),
S... The size of each sub 1 i st , which is governed by the internal sort array size (i.e. memory size).
Then the total number of records output in al l the passes is calculated , and final ly, thi s is divi ded by N to give the average times each record is moved.
LINEAR MERGE.
From the Trace in Figure 2(B), it is evi dent that each pass involves wri ti ng 4 more output records than in the previ ous pass, i.e. the output merge workfi le grows by the size of the input subli st.
If you were to list the number of output records for each pass, you would noti ce that the numbers represent an ari thmeti c progression, where the subl ist size is the first term, and al so the VOLUME 4� NO . 2 (SEPTEMBER� 1983) MICR0-80 PAGE 13 common difference.
So , substituting the vari ables in the arithmetic progression formula: Sum = (N/2)*(2*A + D*(N-1)) Where N = number of terms , A = First term� D = common difference� we get: Sum = (N/(2*S) )*(2*S + S* ((�/S)-1)) Because the number of passes = N/S (Al so the number of terms in the progression)� the fi rst term is S, and the common difference is also S.
Thi s formula can be simpl ified to: Sum = N* (S+N)/(2*S) Thi s represents the total number of records output in al l the passes, so the average number of records moved is: Ave = (S+N)/(2*S) Now for the Tree merge analysi s.
TREE MERGE .
From the trace in figure 3(B) , a rel ationship can be seen between the number of passes required to produce the fi na1 sorted fi 1 e, and the number of sub1 i sts in the workfi 1 e ( s) at the start of the first pass. Thi s rel ati onship is exponential , and is defined by: p 2 = L Where P = number of passes, and L = number of ori gina1 sub lists. Si nee L is defined by N/S (tot a1 number of records in the ori gina1 unsorted fi 1 e divided by size of each sub1 i st), the number of passes is derived as: P = LOG(N/S)/LOG(2) or LOG(N/S ) to Base 2.
For the purposes of thi s analysis, it is assumed that the number of sub1 i sts before the fi rst pass is a power of 2, i . e. 2 3 . Thi s is where the Tree merge a1 gori thm becomes more camp1 ex to implement , when the number of subl i sts is not a power of 2, so that during merging, a sublist is left unpai red and must be kept track of for merging in the next pass.
The rel ationship in Figure 3(B) is very simi lar to the number of accesses required to traverse a binary tree or to do a binary search, to locate an e 1 ement . Si nee in each pass, each sub list doubles in size, and the number of subl i sts are halved , the total number of output records written in each pass remains the same as N (total number of original records ). Therefore, the tot al number of records output is: N* ( LOG(N/S ) to Base 2) and the average number of times each record is moved is: Ave = LOG(N/S ) to Base 2, which al so happens to be the number of passes , a fact that is evi dent from the trace in figure 3(B) .
Now that the formulae have been derived for the 2 algorithms , thei r efficiencies can be compared, given different sort fi le sizes , and sub list sizes (i.e. memory sizes). Using the formulae, the average number of times each record is moved in the entire merge is:
N s LINEAR TREE (FILE SIZE ) (SUBLIST SIZE) MERGE MERGE
256 recs 64 recs 2.5 2 1024 64 8.5 4 1024 512 1.5 l 16384 512 16 .5 5 50000 2000 13 4.6 100 100 l 0
The figures obtai ned in the last line are correct according to the formulae. However, in practice, where the fi le size is the same as the sublist size (entire file fits in memory ), the Linear merge wi ll not transfer the sublist to a workfi le, as shown in the trace in Figure 2(B) .
Obvi ous1y , if al l the fi 1 e fits in memory , no merge is necessary, so a figure of zero means no merge, or record movement .
Thi s comparison demonstrates the efficiency of Tree merge over Linear merge but, as mentioned above, it may be affected by other factors such as track seek, so tri al and error may be the only way to determi ne which is most suited to a particular envi ronment . VOLUME 4, NO. 2 {SEPTEMBER, 1983 ) MICR0-80 PAGE 14
TO SUMMARISE ... Merging is the fi na1 process i nvo1 ved in sorting a fi 1 e of records. Its purpose is to combine sorted sub1 i sts produced by the i nterna1 sort process because the input fi 1 e is too big to fit in mai n memory at the one time.
The p 1 acement of sorted sub1 i st workfi 1 es in a restricted di sk-based system is important in order to optimi se sort time due to the effect of track seek activity. Therefore, some trade offs may be necessary to mi nimi se thi s.
Two merge a1 gori thms are Li near Merge and Tree merge. Tree merge is the more efficient in a system where track seek activity is not a limiting factor . Where it is, the choice as to which wi ll be more effi cient is governed by the parti cul ar envi ronment where the sort package is instal led.
- 00000000000 -
***** MICROBUGS *****
A1 though we make every effort to ensure accuracy in the materi a1 we pub1 ish, i nevi tab ly errors and omi ssions wi 11 occur . In thi s section, we pri nt corrections to those bugs that have been reported .
GOLF - July, 1983 Vol .3, No.l2 - page 27.
The listing publ i shed in the magazi ne contai ns a smal l error in line 2170 . It should read:
2170 IFSl The cassette version of the program al so contai ns this error. - 0000000000 - S FTWARE ***** THE TOWERS OF HANO I - (Colour} by M. Byrne ***** The 'Towers of Hanoi ' is pl ayed with a number of di sks of differi ng sizes and three pegs on which the disks may be stacked . Initial ly the di sks are arranged on one peg in order of decreasing size. The object is to transfer them {in the 1 east number of moves) to another of the pegs so they are once agai n arranged in order of decreasing size. However , you may only move one di sk at a time and it must not be pl aced on a smal ler di sk. Th is program al lows you to select the number of di sks {up to a maximum of 10 for the Hitachi Peach and 8 for the Colour Computer ) and whether you or the computer wi ll solve the problem. The mai n vari ables used are: N{3) holds the number of di sks on each peg. Pl {), P2 { ), P3{) are peg arrays. Each element holds the size of the di sk at that position. SK { ) the parameter stack. sc the source peg . DN the destination peg . AL the alternate peg . NM the move counter. SP the stack poi nter . B the base pointer for the stack elements of the previ ously invoked procedure. CT the number of disks. s the amount of del ay {for automatic operation). F the peg the di sk is moved from. T the peg the di sk is moved to. T1 , T2 used to test whether the move is legal . M is the mi nimum number of moves . TO the top di sk of the peg we are moving from. Probably the feature which wi ll cause most confusion is the use of recursion . It appears to be a not-too-well-known fact that BASIC wi ll al low recursion {on most machines anyway) . Recursion is a means whereby a procedure or subroutine may cal l itself. This involves the use of a stack {which BAS IC provi des ) for stori ng the return address and another stack {which must be set up expl icitly) if parameters are to be passed to the cal led procedure . The parameter stack is only real ly used when automatic operation is required as manual operation VOLUME 4, NO . 2 (SEPTEMBER, 1983 ) MICR0-80 PAGE 15 merely involves asking for moves and checki ng their val idity. The current top-of -stack is indicated by SP . When used by the mai n procedure, the top stack e 1 ement ho1 ds the number of the a 1tern ate peg for thi s move , top of stack - 1 ho1 ds the number of destination peg for thi s move , top of stack - 2 holds the number of the source peg for this move whi le top of stack - 3 indicates the numbers of di sks sti ll to be moved . When used by the shift procedures the top of stack contains the number of the destination peg and top of stack - 1 contains the number of the source peg . Because the parameter stack must be exp 1 i citly set up and manipul ated in BASIC, the a 1 gori thm tends to become somewhat obscured. Al so if it is the first time you have encountered recursion, BASIC is not the ideal language to learn about it. For those of you who are interested in findi ng out more, the tree-di agram for the algorithm used in thi s program is given in the book 'An Intro duction to Problem Solvi ng Using Pascal ' by Kenneth Bowl es. - 0000000000 - ***** OTHELLO - Colour Computer by S. Gi bbons ***** Othe11 o is wri tten for the 16K Tandy co 1 our computer. Othe11 o is a game of strategy for two players and is based on, and very similar to, the board game by the same name . The rules are the same as the ori ginal and are explai ned in the program. The p1 ayi ng board is made up of 64 squares ( 8 x 8) . The vert i ca1 and hori zonta1 positions are represented by numbers 1-8 shown at the top, bottom and both sides of the board. The di sks are represented by squares which are b 1 ack on one side and white on the other . (Only one side of the di sk is shown at any time). The di sks are pl aced alternately by each pl ayer starting with black . To pl ace a di sk on the board you give the hori zonta1 position then a comma f o11 owed by the verti ca1 position. The computer wi ll tel l you if you give the coordinates of an illegal position. The progressive score is constantly shown at the top right hand corner throughout the game. The score is based on the amount of di sks each pl ayer has on the board in his possession. The game wi 11 end when a11 the board has been fi 11 ed with di sks. The winner is determi ned by the colour which has the most di sks. - 0000000000 - ***** REGISTER DISPLAY PROGRAM (Peach) - by D.J. Omond ***** Thi s provi des an easy means of exami ning register contents at any time duri ng the operation of a program . It is simi lar to the facility provided by the machine-l anguage monitor but whereas that can only be initi ated from the keyboard (MON + R), the Di spl ay Program can provide regi ster content information at any poi nt in a program then can revert either to the program under test, to BASIC command level or to the machine-l anguage monitor . LOADING. A short program written in BASIC 1 oads the data 1 i sting, sets the routine into operation to fi rst initial ize the Software Interrupt vector then provide a sample di spl ay. At thi s stage, the BASIC loading program can be discarded . The location at which the operational program is stored in memory can be specified by the operator if desired during the BASIC loadi ng phase. Alternatively, the program can be stored in a "default" location at the top end of User RAM . OPERATION . The di spl ay program is initi ated by a Software Interrupt i.e. by a 3F instruction inserted in a program under test . A 1 ternati ve ly, an EXEC command inserted in a BASIC Program and directing control to the displ ay routine, provides return options as fol lows :- (a) EXEC &H6F95 returns to the program under test (b) EXEC &H6F97 returns to BASIC command mode (c) EXEC &H6F9B returns to the machine-language monitor On th e occurrence of a SWI , a11 regi sters are saved on the stack. The stack poi nter va 1 ue is VOLUME 4, NO . 2 (SEPTEMBER, 1983) MICR0-80 PAGE 16 derived (6F9F ) and placed on the stack. Use is made of various subroutines in the ROM to designate and di sp1 ay the regi ster contents e.g. 6FA7 prints 1 S 1 then 6FAC-6FB3 the SP val ue. 6FB9 refers to the regi ster headings table (used by MON ) then up to 6FCA, di splays registers CC, A, B, DP in successive loops. 6FDO to 6FEl prints the 2-byte registers X, Y, U and PC and 6FCC-E tests for completion. 6FE3- F is a stack of 11pri nt spaces 11 which is entered at vari ous level s to provi de the required number of bl anks for the screen displ ay. The last two lines 6FF3-5 restore al l regi ster val ues (equivalent to RTI ) fol lowi ng which control moves to the PC val ue stored at the time of Software Interrupt. Thi s is the means by which the return options are tied to the point of entry into the di spl ay routine. - 0000000000 - ***** DESERT - CHASE - L2/16K by A.N. Downey ***** In this game of hi gh adventure, the object is to travel a di stance, which varies between 200 and 300 mi les, across the vast Simpson Desert . Your journey is made peri 1 ous due to hazards such as : wi 1 d tribesmen , 1 ack of water, sandstorms , etc . As al l good travel lers of the desert know , you must take care of yourself and your equi pment. However, if you fi nd yoursel f in troubl e you can always hope for help - although thi s is not always forthcomi ng . The game is extremely easy to p 1 ay and is very addi ctive. Many hours have been spent at my keyboard trying to beat the odds. There is some strategy i nvo 1 ved in thi s game , however , with the number of random vari abl es included it is extremely difficult to rely upon this fact. As for the program i tse1 f: al l 1 i ne numbers are in i nterva 1 s of 10, beginning at 10 so 11 AUT011 may be used through the program. I apologi se for the lengthy graphic lines (Line N0 1S 990 - 1430 ) . However , I am sure some of you can design your own routine for these. I assure you that , a 1 though 1 engthy , they are wel l worth the work involved . The distance required to trave 1 is set up in vari able R - contai ned in Line No. 20 . Thi s may be changed to suit your requirements (make it less for a shorter di stance). I won 1t expl ain any more as it wi ll take some of the fun out of it, and the program is self prompting. So , good luck with your Desert Chase. - 0000000000 - ***** FORMATION - L2/16K (C) by Davi d Gri gg ***** An Electronic Form Creation and Data Entry System . INTRODUCTION. Entering 1 arge amounts of data can be the most tedious and frustrating part of using a personal computer . Stori ng that data on cassette tape, if you don 1 t have di sk drives , can be even more time consumi ng and annoying. If data is to be entered during program execution , then appropri ate prompts can be wri tten into the program in the form of PRINT or INPUT statements, but thi s can be fiddly and diffi cult. Data entered in thi s way can only be stored on tape using the snail 1s pace PRINT # statements, and what1s more , there is always the chance that a program error wi ll cause execution to stop, which usual ly means losing data entered duri ng execution. Rather safer is enteri ng data in the form of DATA statements in the program itself. But having to type the word 11DATA11 at the beginning of every 1 i ne can be tedi ous . Commas have to be inserted between data i terns , and it is al l too easy , wi th a 1 ong 1 i st of numeri ca 1 data i terns , to 1 ose track of how many you have entered, or which order they are in, since there are no prompts . So thi s method of data entry can be equal ly tedious . In a non-computer situation, we are al l used to fi lling in forms when information is wanted . A 1 though thi s can be wearyi ng, at 1 east we a 1 ways know what data is wanted , how much room we have to fi ll it in, and we can always go back to correct a previous entered item, if we have made a mi stake. Busi ness computer systems have offered electronic form systems for data entry for some time, whereby an e 1 ectroni c form is presented on screen so that a re1 ati vely unsophi sticated operator can enter data in the same sort of way as fi 11i ng in a form by hand, with a 11 the advantages of that method . FORMATION is a computer program for the Model 1 TRS-80 and the System 80 which gives you the same capabi lity, wi th the very val uable feature of being abl e to quickly and simply design your own e 1 ectroni c forms , then save the desi gn for future use. Data is stored in the form of DATA VOLUME 4, NO. 2 (SEPTEMBER, 1983) MICR0-80 PAGE 17 statements automatical ly appended to any existing BASIC program in memory . The data can then be stored on tape simply by using the CSAVE command in the normal manner . HOW TO USE "FORMATION" . 1. Loading the program. Turn on the computer then type SYSTEM (enter) . To the SYSTEM prompt answer FORMAT (enter }, and press the p 1 ay button on the recorder . When the prompt returns , type I (enter} , and the READY prompt wi ll appear . Now you can 1 oad any BAS IC program you wi sh to append data to. When you are ready to use FORMATION , type OPEN in command mode . The list of FORMATION opti ons should appear . 2. A Sample Form To see how FORMAT ION works, choose option 4, FILLING EXISTING FORMS . The screen wi ll fi ll up wi th a sampl e el ectronic form , for a simple mail ing list program . Look at the format of the screen . The areas marked out by under 1 i ne symbol s ( ) are 11entry fields" . A b 1 inking block cursor wi ll be present at the begi nning of the first field. Type in some appropri ate data, perhaps your own surname fit·st . Then hit ENTER (NEW LINE for the System 80 }. The b 1 ock cursor wi 11 skip to the beginning of the next entry field. The down arrow key would have the same effect (CTRL key for System 80 }. Before you enter your initials hit the up arrow key (or ESC Key) . The cursor wi ll skip back to the beginning of the previous fi e 1 d. Hit ENTER agai n to go forward to the next fie 1 d. Continue to fi 11 in appropri ate data in a 11 the fie 1 ds . If you make a mi stake, backspace in the usua1 way , or use the up arrow key (or ESC Key } to return to a previous field. Once al l the data is entered to your sati sfaction, hit CLEAR (or for the System 80 , hit shift @} . Al l the data wi ll vani sh , and the cursor wi ll be back at the beginni ng of the fi rst field. Note that if you type right to the end of a fi eld, the cursor automatical ly ski ps to the next field. Simi larly, backspacing past the begi nning of a fi eld skips you back to the start of the previ ous field. You can either continue to enter new data, or you may 1 ike to escape from thi s mode to see what has happened to your data. To do thi s, hit shift up arrow key (or shift ESC}. The list of opti ons wi ll return. Thi s time choose option 5, RETURN TO BASIC. The Ready prompt wi ll appear . Now LIST. The data you have entered wi ll be listed as one or more DATA statements beginni ng at 1 i ne 32005 , wi th commas inserted between i terns which were entered in different entry fields. If an exi sting BASIC program had been in memory , these statements wou ld have been appended at the end of thi s program . To return to FORMAT ION type OPEN (enter). 3. Creati a New Form To create your own electronic form , choose option 2, CREATE A NEW FORM . Or the exi sti ng form in memory can be modified or added to by choosing opti on l. If option 2 is chosen, the screen wi ll clear , and tne cursor wi ll appear at the top left of the screen . You may now type in any text you choose to act as prompts . The down arrow key (or CONTROL} key wi 11 drop the cursor down one 1 i ne . The up arrow key (or ESC } key wi 11 jump it up one line. The backspace key acts normal ly, though you wi ll find that the cursor is non-destructi ve. If you want to wi pe out a character , you should use the space bar . On the TRS-80, the ri ght arrow key acts as a non-destructive forward space . The ENTER (or NEW LINE} key wi 11 move the cursor to the start of the next line. Using these keys , the cursor can be quickly moved around the screen to enter text wherever you 1 ike. However , to create the vita1 entry fi e 1 ds, the underline symbo 1 must be used . This symbo 1 is accessible by hitting the @ key. An entry field begi ns wi th an underl ine symbol and continues to the end of a string of such symbo 1 s. Any break in thi s string creates a new entry field. So if you were to type " " thi s would establ ish one entry field four characters 1 ong , but typing " " creates four entry fi e 1 ds, each one character 1 ong . Entry fields can be created anywhere on the screen, and you may create up to 80 separate entry fields . It wi ll be important for you to make a written record of which entry fie 1 ds you have estab- 1 i shed , what data they wi 11 contai n, and thei r order (from left to right , top to bottom) . The reason you need to note thi s is so that your BAS IC program wi 11 be able to access the data in the right order , and wi th the right type (numerical or string as appropri ate} . Once the form is camp 1 ete to your sati sf action, type shift up arrow key (or shift ESC) to return to the option list. If your form is only for temporary usage, you can proceed to fi ll thi s form as you did wi th the sample form . However, you wi ll probably wi sh to save thi s form for future use. To do thi s, put a b 1 ank cassette in your recorder, and choose VOLUME 4, NO. 2 (SEPTEMBER, 1983} MICR0-80 PAGE 18 option 3. After you have pressed the record and p 1 ay buttons, you can save the form onto tape. Note that the entire FORMATION program, complete wi th new form, is saved in thi s way . This means that any time you wi sh to use your own form, you need only load the one SYSTEM Program . FORMATION was designed in thi s way for your convenience . NOTE : Some characters, if entered when fi lling in forms , wi ll be changed before they are inserted into the DATA statements . Thi s is because otherwi se they would act as del imiters and mess up the DATA statements. These characters are daub 1 e quotes ( 11 ) , comma (,), and the co1 on (:). t + They wi 11 be changed to the characters , , and + respectively. Your BASIC program may need to take this into account. FORMATION COMMAND SUMMARY . CREATE MODE : TRS-80 SYSTEM 80 * Move cursor up one line t ESC * Move cursor down one line + CNTRL * Move cursor forward one space + not avai lable * Move cursor back one space + * Insert underl ine symbol @ @ * Move cursor to start of new line ENTER NEW LINE * Escape from thi s mode shift t· shift ESC FILL MODE : *Cursor to start of last fi el d t ESC * Cursor to start of next fi eld + CNTRL * Move cursor forward one space not avai lable * Move cursor back one space + + * Move cursor to start of next fi eld ENTER NEW LINE * Record data, start clean form CLEAR Shift @ * Escape from thi s mode shift t shift ESC FROM BASIC: Type OPEN (enter ) to return to FORMAT ION NOTE : FORMATION makes extensive use of calls to the Microsoft Basic ROM in order to reduce the amount of memory it takes up. It is possi b 1 e that the program wi 11 not work wi th some late model TRS-8o •s wi th the revi sed ROM . Thi s program is for L2/16K machines only. Users of Leve 1 2 machines wi th more than 16K MUST respond to MEMORY SIZE wi th 32767 . This program WILL NOT work on a Di sk Basic machine. SYSTEM 80 owners who do not have a ri ght arrow key may get around the prob 1 em of ri ght di recti on cursor movement by pressing the backspace key unti 1 the cursor wraps around the screen . The desired position may then be reached as it is approached from the ri ght side of the screen . (The di stributi on di sk contai ns an offset version taki ng the user to Level 2). - 000000000 - ***** PRIORITIES - L2/16K by A.F.J. Bel l ***** This program was written for two reasons. Firstly, because of the acti vities of the Razor Gang there was a need to be ab 1 e to review the acti viti es of my hospi ta1 and put them in order of pri ority. Secondly, I wanted to get some experience in using stri ng matrices . The program enables one to specify up to 12 acti vities , and to assign a rank to the importance and to the feasi bi lity of each activity. Then the computer fi nds the product of the importance and the feasi bi lity, which can be taken as the relati ve pri ority which each activity should recei ve. One can revi ew, add or change data unti l one is sati sfi ed . One can then order the acti vities accordi ng to thei r importance, feasib ility, or priority, and printout the results. Lines 10 to 120 are housekeeping. Line 60 sets my Mi cro 1 i ne 80 Li neprinter to 10 chrs/i n and 64 chrs/l ine, sets the page length to A4 size, and sets the linenumber counter to 0. You wi ll need to change thi s to suit your type of pri nter . Lines 190 to 240 di sp 1 ay the options . The rather comp 1 i cated system in 1 i nes 220 to 2.40 enab 1 e one to use a single stroke INKEY$ system . CHR$ ( 13) in lines 250 to 300 (the instructions ) is the contra 1 character for 1 i nefeed/carri age return . Li nes 310 to 440 accept data from the keyboard , and puts the data as string va 1 ues in a stri ng matrix (two dimensional array) . Line 430 converts the stri ng val ues into numerical val ues , MICRO-SO PRODUCTS CAT 1 ·8 PR This catalogue contains a selection from the wide range of peripherals, interfaces, computers and software carried by MICR0-80 for your computer. If you don't see the item you want, contact us, we probably have it anyway! MICR0·80 has been supplying customers throughout Australia and the Pacific region by mail-order for 2112 years. Our customers findthis a simple and efficient way to do business. You may place your order by telephone or by mailing the order form from any issue of MICR0·80 magazine. Generally, it takes about one week from receipt of order until despatch. You should allow 2·3 days for your letter to. reach us and 7·10 days for the parcel to reach you, making a total turnaround time of 2112·3 weeks. WARRANTY AND SfRVICf All hardware products carry a 90 day parts and labour warranty either from the manufacturer/distributor or from MICR0·80 Pty Ltd. In many cases, warranty servicing can be arranged in your own city, otherwise goods will be repaired by our own team of technicians in our Adelaide workshops. TRADf·INS AND TERMS MICR0·80 can accept your existing equipment as a trade-in on new equipment. We can also arrange consumer mortgage financing or leasing on larger hardware purchases. Contact us for details. TKSDOS 2.3 DECODED THE CUSTOM TRS·80 B AND OTHER MYSTERIES KS AND OTHER PIYSTERifS by James farnour by Dennis Bathory Kitsz The TRSDOS operating system Ever wanted to do things to explained with a fu lly your TRS-80 that Radio Shack commented source code listing, said couldn't be done? How a description of the command about reverse video, high line interpreter and the resolution graphics, and audible IJEf'XJDjrEIM1 subroutines used by the DOS keystrokes? commands, the file Now enough? How about management system, the error turning an 8-track into a mass .------, message processor and much, storage device, making music, much more. Excellent value at controlling a synthesiser, $.39.95 (plus $1.20 p. & p.) 7m'"'Cil��. TBS88 individual reverse characters, & OiliER;',\'\'STE'RIES .." and a real·time clock just to name a few? The Custom TRS·BO and Other My steries is packed with more than 290 pages of practical information and can be yours I for only $.39.95 (plus $1.20 p. & p.) BASIC FASTfR AND BITTfR AND OTHfR MYSTERifS by Lewis Rosenfe lder Basic is not nearly as slow as 1 MACHINE LANGUAGE DISK 1/0 most programmers think. Basic and OTHER MYSTERIES faster and Better shows you by Michael Wagner IJ.4Sll' Ji.'.L."J'IER how to super charge your BASIC A.J.\TJ IlErrrER with almost .300 pages of fast, The guide to machine language functions and subroutines. disk software for TRS-80 Models You won't find any trivial ,------::::; 1 and .3 that explains what the poorly designed "check-book floppy drive system is all about, balancing" programs in this disk controller chips, read/write book - it's packed with usefu l access, head step and seek programs. commands, forced-interrupt Tutorial for the beginner, command, disk files, how instructive for the advanced, records are stored on disk, and invaluable for the creating a file, etc. You also get professionaL this book doesn't a disk formatter program, a just talk ...it shows howl Basic program to calculate passwords raster and Better is $.39.95 and much more for only $39.95 (plus $1.20 p. & p.) (plus $1.20 p. & p.) MICRO-SO PRODUCTS CAT 2 lntroducin NEW LN MODEL The new LNW Model 2 is not just a microcomputer but a complete computer package that includes excellent hardware, extensive systems software and a ra nge of applica tion software. Manufactured by LNW Research corporation, the LNW Model 2 features: HARDWARE: SYSTEMS SOFTWARE: • 4MHz Z80A microprocessor with 96K user LNWBASIC 4.0 - an extension to disk BASIC RAM. that allows full use of the LNW80s • 16K x 6 bits Graphics RAM, expandable to graphics capabilities through the 64K (four pages>. addition of powerful graphics • Printer; RS-232-C and cassette interfaces. commands such as CIRCLE, COLOR, • 12K BASIC in ROM (Level 2 compatible>. DRAW, etc. • support for single/double sided, DOSPLUS 3.4 - t h e fas t, re1· Ia ble and easy- single/double density, 5%" or 8" disk , to-use operating system that pro- drives. vides all the file control and disk • Full TRS-80 Model 1 compatibili1-u. �y. management you need for max- • Hi-res Colour APPLICATION SOFTWARE: 3. Electric Pencil - an easy-to-use word 1. LNW small Business and Professional Ac processor. counting series - including General 4 .. Microterm -an intelligent terminal pro Ledger, Accounts Receivable, Accounts gram for communications. Payable and Payroll (U.S.A. 5. Chart-Ex - allows you to transform your conventionsJ. data into pie, line or bar charts on hi 2. Electric Spreadsheet - for financial plan- res display or prin ter with bit graphics. ning and forecasting. The LNW80 Model 2 is perfect for the serious hobbyist or businessman seeking a higher performance, more reliable computer to replace his TRS-80 Model 1 without sacrificing a huge investment in software and programming experience. LNW80 Model 2 computer ...... $2,850 (complete except for disk drives and monitorJ HI-RES Green Phosphor Monitor ...... $265 Super HI-RES Hitachi RGB Monitor ...... $1 ,250 TWo Single-sided 40 Track Double Density Disk Drives ...... $825 fin cabinet with power supply and cableJ All prices include Sales Ta x and are subject to change without notice. Prices are FOB Adelaide. Add $20 road freight anywhere in Australia. All equipment carries MICR0-80's Australia-wide 90 day warranty covering parts and labour. MICR0-80 PRODUCTS CAT 3 THE WILD WESf SPACE ATTACK STRIKE FORCE This incredibly popular game craze It's up to you to keep the West Steady your nerves, keep a sharp As the primary defender of a world of now runs on your TRS-801 It's eat or beautiful with Outlaws and rene lookout, and prepare for battle to cities under deadly alien attack. your be eaten You run Scrarirnan around gade Indians on all sides.. Even the save your city. Fiendish aliens are all weaponry is the latest rapid tire train has been captured by Outlaws around, and it they destroy the city the maze. gobbling up everything in missiles, long range radar. and with all the payroll on board. Can you lose. your path Try to eat it all before nasty incendiary "star shells " Your force you clean up the Wild West? Price: $26.50 monsters devour you Excellent h1gh field can absorb only a limited number speed machine language action game Price: $26.50 of impacts A complex game of tram the Cornsott Group. With sound strategy, skill and reflexes from Melbourne House Price: $17.95 Price: $26•50 Soar swiftly over jagged landscape, Asteroids float ominously around the swooping high and low to avoid screen You must destroy the obstacles and enemy missiles attacks. asteroids before they destroy you' (Big With miles of wild terrain and tunnels asteroids break into little ones) Your to penetrate, you 're well armed with ship will respond to thrust, rotate. bombs and multiple forward missile hyperspace and lire. Watch out tor capability From Melbourne House. that saucer with the laser' Features sound. trainer mode and As reviewed in May 1981 Byte Magazine customizing program. . Price: $36.50 Price: $26.50 Your ship comes out of hyperspace As a vast panoramic moonscape under a convoy of aliens You destroy scrolls by. select one of many landing every one. But another set appears sights The more perilous the spot, the These seem more mtell1gent You more points scored ·· it you land eliminate them too Your fuel supply is safely You control LEM main engines d!mlmshmg. You must destroy two more and side thrusters One of the best sets belore you can dock The space uses of TRS-80 graphics we have ever stat1on IS now on your scanner With seen From Adventure International sound 1 With sound Price: $26.50 Price: $26.50 METEOR MISSION II GALAXY INVASION DEFENSE COMMAND As your sh1p appears on the bottom of the maze eight allen ships appear on the As you look down on your view. The invaders are back' Alone, you The sound of the klaxon is calling you' top, all traveling directly at you ' You astronauts cry out lor rescue You Invaders have been spotted warping defend the all important nuclear fuel move toward them and fire missiles But must maneuver through the asteroids toward Earth You shift right and lett canisters from the repeated attacks of the more al1ens you destroy the faster and meteors (Can you get back to the as you tire your lasers. A lew break thieving aliens. repeatedly An alien the remammg ones become If you get space station?) Fire lasers to destroy formation and fly straight at you 1 You passes your guard . snatches a the asteroids. but watch out, there place you r linger on the lire button canister and llys straight ott Quick' too good you must endure the Flag· could be an alien Flagship lurking knowing that this shot_must connect' You have one last chance to blast him sh1p.. W1th sound effects' Includes sound effects' With sound effects' from the sky' With sound and voice $26.50 ,_Price: $26.50 Price: $26.50 ·Price: $26.50 , Price: MICRO-SO PRODUCTS CAT 4 MICR0-80 now offers you the widest range possible in entertainment software. These programs are supplied on cassette for the Levei ii/16K TRS-80 Model IIIII (except as noted). They are also suitable for the System 80 but sound may not be available unless a hardware mod ification has been fitted to reverse the roles of recorders #1 and #2. DEFENCE PENETRATOR $20.95 JUNGLE BOY $2 1.50 DEFENCE PENETRATOR is based on one of the The ultimate challenge! Are your reflexes fast most popular arcade favourites of all time with enough to swing Jungle Boy from vine to vine? Can smooth graphics and sound effects. With realistic you swingthrough the jungle? Can you swim by the scrolling planetscape it's the best game yet. alligators? These are just some of the things you will fm d very challenging in Jungle Boy. BAT TLE STATION $2 1.50 The aim of the game is to defend your space station against the attack of four alien space ships. srELLARWARP $20.95 Animation with superior fighter craft brings you an MORGOTH $20.95 even greater challenge. As your computer ad Morgoth is a unique action packed adventure vances your level, the aliens become more allowing you to wander through the enchanted dangerous and the harder it is to stay alive! dominion of Morgoth and collect the lost treasures of KAZARD KALLAHAN. But Beware ! You must escape before the satanic Morgoth is aroused and seeks yea! HOPPY $2 1.50 KILLERBEETLES $2 1 .50 The aim of the game is to get your frogs across the The aim of the game is to dig traps. When a beetle busy highway without being squashed and then fa lls in you must fill it in to bury them, before they across the river by means of floating logs and can catch you. turtles. SfARCRESfA $20.95 Star Cresta takes you beyond the limits of your com INSECT FRENzy $2 1.50 puter and into the Cosmic void itself! Beware ! Iron The aim to stop the centipede from getting you, all clad concentration and lightning relfexes are re is the time keeping an eye out for the giant spider. quired to destroy the evil empress. JUNGLE RAIDERS $2 1.50 The aim of the game is to defend your four bases ALIEN CRESfA $2 1.50 from the marauding Jungle Raiders. Yo u kill all The aim is to defend your ship from numerous at the Jungle Raiders and they try to hit you with their tacks from an assortment of aliens. If you get hit spears or drag off all four of your bases. three times, it's all over. KILLER GORILLA $2 1 .50 Four completely different frames. Each one offering a different challenge, makes this one of the most RALLYRACER $20.95 complex and stimulating games ever written for a Drive through an action packed maze and try to hit TRS-80. The game keeps track of the top ten scores all the flags before Morgan the Mad motorist or along with a six character name for each score. Crazy Harry and his killer hoodlums catch you ! NOTE: As the prices of imported software may vary, these prices are valid for current stock only and prices are subject to change without notice. MICR0-80 PRODUCTS CAT 5 Storage with the The LNDoubler is easily installed into your expansion interface and provides support for both 5 �" and 8" disk drives. Completely compatible with all the major Disk Operating Systems, the LNDoubler provides technically advanced, tested and reliable double-density operation with such features as: • Analog phase lock loop data separation. as 5" or 8" drives and a switch is • Precision write precompensation. provided for drive 0. • High quality PCB will all contacts gold • Supports any mix of 5" or 8" drives, single plated. or double density, single or double sided. • Drives 1-3 may be software selected The LNDoubler will inrease the formatted storage capacity of each 40 track single-sided drive by 80% to over l80Kbytes for just over half the cost of one disk drive. With an 8 inch double sided double-density disk drive,· you can have over one Megabyte of online storage! The LNDoubler 5/8 doubler with docurnentation is available for ... $2 plus $2.00 p.&p. NOTE: A sp ecial cable is required for 8" drive operation and 8" double-density operation requires a 3.55 MHz CP U sp eed-up modification. is the state of the art in Disk Operating Systems fo r the Model 1 and Model 3 offering an order of magnitude increase in flexibility and performance over its predecessor DOSPLUS 3.4 and yet is easier to use and more friendly with a Help fa cilityexp laining the syntax of DOS commands. H1e huge manual of over 3.50 pages describes the system in detail and is sectioned and tagged so that you can find what you want more quickly Far greater flexibility is offered by the introduction of device drivers that are external to the system and that can be tailored to your needs. Some of the features offered by DOSPWS 3.5 are ... • Single and double density support with density re cognition. • Improved file control fa cilities and date stamping of files. • A keyboard driver that offers single key entry • An extensive Job Control La nguage. • Complete and detailed technical system information. • Two versions of BASIC plus a BASIC label fa cility • and much more. $160 When ordering by MAIL please specify Model 1 or Model 3 and include S 2 for freight DISK DRIVE HEADS CLEANING FIT A PERCOM DISKETTES 5" FLOPPY DATA SEPARATOR $44 & DIS TTES and eliminate CRC incl p. p. 3M Disk drives are expensive and so are Scotch Brand errors and locked-out diskettes. As with any magnetic recording device, a disk drive works • Reinforced centre hole tracks better and lasts longer if the head is • To suit soft sector format cleaned regularly. In the past, the $45 lus $2 p. & p. problem has been, how do you clean the • Rated for double density p head without pulling the mechanism When Ta ndy designed the TRS-80 apart and running the risk of damaging Box of 10 single-sided for expansion interface, they did not include delicate parts. 3M has come to our a data separator in the disk-controller rescue with SCGI'CH BRAND, non $59 incl p. & p. circuitry, despite the I.C. manufacturer:s abrasive head cleaning diskettes which recommendations to do so. The result 1s thoroughly clean the head in seconds. Box of 10 double-sided for that many disk drive owners suffer a lot The cleaning action is less abrasive than $69 incl p. & p. of Disk I/0 errors. The answer is a data an ordinary diskette and no residue is separator. This unit fits inside your left behind. Each kit contains: expansiOn mterface. It is supplied with 2 head cleaning diskettes full instructions and is a must for the 1 bottle of cleaning fluid serious disk user. 1 bottle dispenser cap MICR0-80 PRODUCTS CAT 6 The MICR0-80 interface does not interfere with the normal operation of The ultimate hi-resolution graphics yo ur Praxis 35 or ET-1 21 typewriter board fo r the TRS-80 Model 1 and which becomes a reliable, high qulaity, System 80 that provides 256 letter perfect printer. We are convinced programmable characters as well as the that you will be able to fit the interface ability to emulate a 384 x 192 dot yourself without hassles and be addressable screen. The hardware printing within the hour. Our interfaces capabilities of the PCG-80 enable you provide a Centronics compatible parallel to plot mathematical functions, display interface and are supplied with power arcs, circles, lines, waves and design supply, comprehensive fitting and display custom characters ranging instructions and user manual. The from 72 pixels to 18432 pixels. Yo u can cable to connect the interface to the mix graphics and characters anywhere computer is not included in the price. on the screen. We also offe r a fitting service in Ad elaide fo r only $35. PCG-80 to suit Model 1 only plus $ 5 p. &.. p. lnteface to suit Praxis 35 only PCG-80 to suit System 80 only plus $ 10 p. &.. p. plus $ 5 p. &.. p. Interface to suit ET-121 only plus $ 10 p. &.. p. (Note : Not suitable fo r later type japanese keyboards on TRS-80 Model 1). plus $2.00 p. &. p. plus $2.00 p. &. p. Large volume means we can buy The MICR0-80 modification features true below better and can pass the savings the-line descenders, a block cursor and symbols on to you. There are our proven, for the 4 playing-card suits. Each kit comes with prime, branded 200 nanosecond comprehensive fitting instructions and two chips, guaranteed for 1 2 months. universal lower-case driver routines on cassette A pair of DIP shunts is also to enable you to display lower case. These required to upgrade CPU memory routi nes are self-relocating, self-protecting and in the TRS-80 - these cost an will co-reside with other machine language additional $4.00. All kits come programs (the second includes keyboard complete with full, step-by-step debounce and flashing cursor). Fitting requires instructions which include labelled soldering inside the computer and should only photographs. No soldering is be carried out by an experienced hobbyist or required. You do not technician. A fitting service is available in capital have to be an experienced cities for only $20.00 and a list of installers is electronic technician to included with each kit. (Specify TRS-80 Model I install them. or System 80 when ordering.) All prices include Sales Tax and are correct at time of publication but are subject to changes without notice_ All eq uipment carries MICR0-80's Australia-wide 90-day warranty covering parts and labour MICR0-80 PRODUCTS CAT 7 T MS & T TWARE Yo u can increase your programming productivity, the execution speed and 'user friendliness' of your programs by using an enhanced Disk Operating System (DOS). To gether with the other utility software, you can get the most from your disk drives. Note: For DOSes, include $2.00 for freight. DOSPLUS 3.5 $160.00 NEWDOS 80 VERSION 2.0 $185.00 (Specify Model I or Model Ill) (Specify Model I or Model Ill) DOSPLUS 3.5 is a powerful, sophisticated DOS intended for the Newdos 80 suits the experienced user who has already used experienced user. The system can be configured to suit your require TRSDOS, understands the manual and is prepared to learn the ments, provides greatly enhanced features over 3.4 and new somewhat complicated syntax of one of the most powerful DOS's features like single-key entry, date-stamping of files, a Help file and available. With the correct hardware, Newdos 80 supports any mix more. More user friendly than 3.4, DOSPLUS 3.5 comes with a of single- or double-sided, single or double density, 5" or 8" disk very extensive stand-alone manual. drives with track counts up to 96. It provides powerful, flexible file handling in BASICincluding variable length records up to 4096 bytes. BMON by Edwin Paay $20.50 Definitely not for the beginner. The ultimate High Memory Basic Monitor L2/16-48K BMON Renumbers; Displays BASIC programs on the screen while MASTER DISK DIRECTORY $20.95 they are still loading; tells you the memory locations of the program FIND THE PROGRAM FAST !! PAYS FOR ITSELF BY RELEASING just loaded; lets you stop a load part-way through; merges two pro REDUNDANT DISK SPACE!! MASTER DIRECTORY records the grams, with automatic renumbering of the second so as to prevent directories of all your individual disks onto one directory disk. Then any clashes of line numbers; recovers your program even though it allows you examine them, find an individual file quickly, list files you did type NEW; makes one program invisible while you work alphabetically, weed out redundant files, identify disks with free on a second (saves hours of cassette time!); lists all the variables space, list files by extension, etc., etc. This program is invaluable used in the program; makes SYSTEM tapes; lets you Edit memory for the serious disk user and will pay for itself many times over. Not directly ... the list goes on and on. Cassette comes with 16K, 32K fully compatible with NEWDOS 80. and 48K versions, ready to load. Can anyone afford NOT to have BMON? THE FLOPPY DOCTOR/MEMORY DIAGNOSTIC Model Ill Disk $43.50 THE MICRO CLINIC offers two programs designed to thoroughly check out the two most trouble-prone sections of the TRS-80 - the disk system (controller and drives) and the memory arrays. Both programs are written in Z80 machine code and are supplied together on diskette for a minimum 32K, one disk system. E For Ta ndy Colour Computers with at least 16K of memory, choose from the following selection: SPACE FIGHTER $20.95 RACING DRIVER $23.50 You are out in space, armed with laser beams and your mission is Yo u drive along able to see only the road in front of you, leaving to shoot down five enemy fighters. Skill is required to keep your little time to avoid obstacles and hazards that you meet in your path. enemy in your sights to destroy them. �equires 16K Extended Col Featuring three levels of skill, colour and sound. Requires 16K Ex our BASIC. tended Colour BASIC. ESCAPE FROM MARS $20.95 A good first adventure that takes place on Mars where you have HAUNTED HOUSE $20.95 to explore the city and deal with the possibility of hostile aliens. A real adventure for the kids, with ghosts and goblins, treasures and problems. BREAKAWAY $20.95 Written in machine language for speed and features 15 levels of difficulty. TREK ADVENTURE $20.95 Yo u are in deep trouble aboard a starship abandoned by its crew. QUEST $25.50 An adventure played on a map of Alesia generated by your com puter. You must gather men and supplies by combat, exploration, PYRAMID $20.95 trading, etc. When your force is strong enough, you attack the citadel An exciting and challenging adventure where you hunt for treasure in a battle to the finish. in a pyrammid full of problems. MICR0-80 PRODUCTS CAT S I I Fe atures: • 80 cps bi-directional, logic seeking • 40, 71, 80 or 142 characters per line • Normal and italic alphanumeric, symbol and semi-graphic characters • Unidirectional bit image graphics (8 x 640 or 8 x 1280 dot/line) • Tractor and friction feed EPS compat le con ol codes I We are expanding our range of disk drives to include the new These half-height, 51/4"disk drives represent the state of the art in both technological design and mechanical construction. With the characteric high quality of manufacture expected in Japanese products, these drives feature ultra-modern electronics, servo controlled direct drive motors and exceptional physical construction that provide extremely reliable, smooth and quiet operation in both single and double density. Tw o varieties will be available shortly: 40 track double sided and 80 track double sided. Please WRITE for further information. OTHER PRINTERS AVAILABLE: EPSON RX-80 $995 Features: 100 cps, 6 character sizes, bit image and graphic modes. ITOH PROWRITER 8510 $1150 Features: 120 cps, bit graphics and proportional printing. EPSON FX-80 $1399 Features: 160 cps, 6 character sizes, proportional printing, bit graphics. All prices include Sales Tax and are correct at time of publication but are subject to change without notice . All equipment carries MICR0-80's Australia-wide 90 day warranty covering parts and labour. Add $10 road freight anywhere in Australia. VOLUME 4, NO . 2 (SEPTEMBER, 1983) MICR0-80 PAGE 19 mul ti pl ies them, converts thi s value into a string val ue, and puts it in the array . Lines 330, 390 and 420 prevent inappropri ate: data enteri ng the matrix. Line 330 a 1 so assi gns a val ue in I(N) to each row of the stri ng matri x. Thi s array is used later when orde ring the data. Li nes 450 to 570 echo the data (using lines 680 to 760) and a 11ow 1 i nes to be added or changed , and are quite strai ghtforward . Perhaps the most important part of the program is found in 1 i nes 770 to 840 which arranges the values in descending order . Vari abl e T sets the val ues to be compared in line 800 , but it is not these va 1 ues which are transposed in line 810. The va 1 ues in the I(N) array are transposed instead . And the di sp 1 ay subroutine of ·1 i nes 680 to 760 pri nts the rows of data correspondi ng to the new order of I(N) . Li nes 850 to 940 are a Screenpri nt subroutine. LN is used as a 1 i necounter si nee the 1 i nepri nter counts only one line for a ful l scan of the screen . Li nes 950 to 970 are a pagination subroutine, with the val ues set for A4 size pages . Li nes 980 to 1050 are NOT used in the usual running of the program . They are used only when deve 1 oping and testing the program to avoi d havi ng to enter data by hand . They are called by line 320 which should be del eted when the program has been debugged . - 0000000000 - **** TOWERS OF HANOI **** 300 PR I NT;J>416, "FROM PEG" ;:INPUT F COLOUR COMPUTER 310 PRI NT@430, "TO PEG " ;::I N PUT T 320 IF F< 1 OR T< 1 OR F>3 OR T>3 THEN PRINT"NO SUCH PEG" : GOTO 290 10 'THE TOWERS OF HANO I 330 IF F=T THEN PR INT"NOT ALLOWE 20 ' BY D" : GOTO 290 30 ' MICHAEL BYRNE 340 IF N 690 IF DE< >1 THEN 710 1220 FOR I=CT TO 1 STEP -1 ST PEG (3) ." :z 700 P1 =TD: X=10: GOTO 740 1230 FOR J=1 TO I 1580 PRINT"SUBJECT TO THE FOLLOW 0 710 IF DE< >2 THEN 730 1240 SOUND 10*I ,1 ING" N 720 P2 =TD: X=32 : GOTO 740 1250 SET 850 SK 880 GOSUB 810 1,C> :SET NT ":LOCATE0, 19 760 P3 =TD: X=65 \.0 CX) **** TOWERS OF HANOI **** 350 IF F< 1 OR T< 1 OR F>3 OR T>3 THENPR IN 770 P= 1 w T"NO SUCH PEG ":GOTO 780 GOSUB 1360 HITACHI PEACH 320 790 N =C THEN760 OOELSE 1170 > THEN FL IPPING THE OUTFLANK 740 IF C=5 THENSET IS BORDERE 870 IFPOINT