[{"TitleName":"Softek 'FP' Full Compiler","Publisher":"Softek International Ltd","Author":"Andrew J. Glaister, Martin Lewis","YearOfRelease":"1983","ZxDbId":"0008693","Reviews":[{"Issue":{"Name":"Crash Issue 19, Aug 1985","Price":"£0.95","ReleaseDate":"1985-07-25","Editor":"Graeme Kidd","TotalPages":132,"HasCoverTape":false,"FlannelPanel":"Publishing Executive: Roger Kean\r\nEditor: Graeme Kidd\r\nTechnical Editor: Franco Frey\r\nArt Editor: Oliver Frey\r\nProduction Designer: David Western\r\nSoftware Editor: Jeremy Spencer\r\nAdventure Editor: Derek Brewster\r\nStrategy Reviewer: Angus Ryall\r\nStaff Writer: Lloyd Mangram\r\nContributing Writers: Matthew Uffindel, Chris Passey, Robin Candy, Ben Stone, John Minson, Mark Hamer\r\nClient Liaison: John Edwards\r\nProduction Manager: Sally Newman\r\nSubscription Manager: Denise Roberts\r\nMail Order: Carol Kinsey\r\n\r\n©1985 Newsfield Limited.\r\nCrash Magazine is published monthly by Newsfield Ltd. [redacted]\r\n\r\nSubscriptions [redacted]\r\nEditorial/studio [redacted]\r\nAdvertising [redacted]\r\n\r\nColour origination by Scan Studios, [redacted]; Printed in England by Carlisle Web Offset Ltd (Member of the BPCC Group), [redacted].\r\nDistribution by COMAG, [redacted]\r\n\r\nSubscriptions: 12 issues £14.50 post included (UK Mainland); Europe: 12 issues £21.50 post included. Outside Europe by arrangement in writing.\r\n\r\nNo material may be reproduced whole or in part without written consent of the copyright holders. We cannot undertake to return any written material sent to CRASH Magazine unless accompanied by a suitably stamped addressed envelope. Unsolicited written or photo material which may be used in the magazine is paid for at our current rates. The opinions and views of correspondents are their own and not necessarily in accord with those of the publishers.\r\n\r\nMICRONET:\r\nYou can talk to CRASH via Micronet. Our MBX is 105845851\r\n\r\nCover by Oliver Frey"},"MainText":"MACHINE CODE WITHOUT TEARS\r\n\r\nThe Niche takes a first look at Basic Compilers for the Spectrum.\r\n\r\nThere's a world of difference between ZX BASIC and machine code. Programs in BASIC tend to be slow, with jerky graphics and poor sound effects. Programs in machine code run hundreds of times faster - which doesn't mean that the graphics just jerk around the screen at Warp Factor Ten. No, machine code programming permits smoother movement, '3D' perspectives, simultaneous sound, animation and so on.\r\n\r\nOf course, machine code doesn't necessarily make a game playable, and some classic games have been programmed entirely in BASIC - Mined Out, Football Manager and Velnor's Lair for instance. But if you want to write a shoot-em-up game, or a program with sophisticated graphics, you'll almost certainly find BASIC too slow.\r\n\r\nBack in the olden days of Spectrum programming, when programmers assembled code in their heads, and the back pages of the old orange manual were the first to fall out, there wasn't much alternative to learning machine code once you'd come up against the limitations of BASIC.\r\n\r\nLearning machine code was a traumatic process: before disks and microdrives (which brought their own meaning to the term random access') every programming mistake meant a crash. Teaching yourself machine code was a frustrating process as, after each mistake, it took several minutes to re-load your assembler, debugger and program source from tape in preparation for another crack at the problem.\r\n\r\nPredictably it wasn't long before someone figured out that, if the computer was so fiendishly clever, it really ought to be able to make up machine code for itself. In this article we take a look at currently available BASIC to machine code translators, or 'compilers'. Next month we hope to examine Colt and Blast, two new and aggressive-sounding BASIC compilers which are under development. In future Niches we'll blow the dust off other Spectrum languages such as Logo, Forth, C, and Pascal.\r\n\r\nMeanwhile, back at the keyboard....\r\n\r\nWHY IS BASIC SO SLOW?\r\n\r\nBASIC is slow because everything you type is carefully checked to make sure it is correct. This would be fair enough if it only happened once, when the program was entered, but the exhaustive checking continues even while a program is running.\r\n\r\nIf you write a program in BASIC to add 2 and 2 a hundred times, the computer will take as long to work out the answer the last time as it did the first 99 times. The actual adding is done fairly quickly in machine code (which is the only language the Spectrum's Z80 processor can really understand), but the overall effect is still very slow. This is partly because BASIC checks the syntax of lines over and over again, even after they have been entered (in case some stray POKE or Cosmic Ray has changed the contents of program memory?)\r\n\r\nBASIC is also hampered by the need to cope with all sorts of special cases. The routine to add numbers in the Spectrum ROM has to be able to cope with functions, arrays, numbers and variables; these can have almost any value from minus several zillion upwards. The Z80 processor can only cope with a few digits at a time; it has to do all its arithmetic in several steps, just in case. Worse still, it can't multiply and divide at all, so these operations must be performed 'longhand'.\r\n\r\nMuch of the code in the Spectrum's ROM is taken from the earlier ZX81 BASIC, which was squashed into just 8K. In order to keep the size down, parts of ZX BASIC were written using a leisurely version of the compact Forth language, rather than machine code. A new ROM for the Spectrum is planned (though not by Sinclair), but nothing has materialised yet.\r\n\r\nOne of the nice features of Spectrum BASIC is the way that it lets you type in new lines of program and scrub out old ones as you test your program. This is hell for the BASIC system, which has to keep scrabbling around in tables to keep track of shifting variables and program lines. The longer your BASIC program, the worse this gets, so that a 20K program may run at half the speed of a 2K one. In compiled BASIC, however, the position of every line and variable is fixed. This makes programs fast, but means that you have to re-compile the whole lot if you changed one line.\r\n\r\nFinally, ZX BASIC is cursed by the stupid way humans like to write things. We write 'X = 6 + 7' when the computer would be much happier with '6 + 7 = X'. It can't do anything with the name X till it finds the equals sign (meaning that a value must be stored). Similarly, the equals sign isn't really relevant till the computer knows what is to be stored. The plus sign means add two values - there's no point telling the computer about it until it has found both the numbers. ZX BASIC actually performs calculations in the second sequence (which is called Reverse polish Notation), but it has to re-order them from the first sequence every time it finds them, and that is a slow process.\r\n\r\nWHAT'S A COMPILER\r\n\r\nThe Spectrum BASIC compilers are programs which read a BASIC program and produce a machine code equivalent, The compiler and both programs have to be in memory all at once, which limits the size of compiled programs to 10-20K.\r\n\r\nCompiled code may be anything from 2 to 200 times faster than the original, depending upon the compiler you are using and the intricacy of the original program. We ran (or at least, tried to run!) the standard BASIC benchmark programs on each of the compilers. The results are shown in the Timing Table, along with the published timings for ZX BASIC.\r\n\r\nThe timings are not as fast as for pure machine code, which allows much more freedom to the programmer, but they are easily fast enough for most games programming. A number of commercial games are written in compiled BASIC (including Frank 'N' Stein, published by PSS) and look none the worse for it, although you'd be hard-put to write Knight Lore with a compiler.\r\n\r\nA few of the positions in the table contain asterisks, because the test program could not be processed by that compiler. In order to keep compiled programs fast, and reduce the complexity of the compiler, the packages all impose restrictions on what they can compile.\r\n\r\nCOMPILER CONSTRAINTS\r\n\r\nSoftek's FP compiler is the only one that can cope with decimal values, for instance - this makes it much slower than the others, but means that it is the only compiler suitable for use in business programming. But who wants to run as business on a Spectrum anyway? The other compilers restrict you to whole numbers between -32767 and 32767, although you can use values up to 65535 in POKEs and suchlike.\r\n\r\nYou can switch back and forth from normal BASIC, machine code and compiled code with USR calls and RETURN instructions, so it is possible to write programs in a mixture of languages if you need speed at one point and sophistication elsewhere.\r\n\r\nThe Softek compilers (FP and IS)are the only ones which allow you to use full BASIC string-handling; Mcoder gives you a fairly complete set of facilities to work with short strings (up to 255 characters) but Zip and the Mehmood compiler can only offer simple routines to read and write characters. You could probably write a text adventure using Mcoder or one of the Softek compilers, but you'd be much better off using The Quill.\r\n\r\nArray handling is similarly limited - none of the compilers allow arrays of more than one dimension,and the IS and Mehmood programs won't allow arrays at all, you can use long variable names with Mcoder and the Softek compilers, but the cheaper packages restrict you to 52 short variable names.\r\n\r\nThe 'core' of ZX BASIC commands - PRINT, INPUT, PLOT, DRAW, LET, GO SUB, IF, and so on - are allowed by all the compilers. The Mehmood compiler doesn't allow FOR loops, which meant that we couldn't run some of the benchmark programs.\r\n\r\nOne of the snags of real machine code is the fact that you can't 'break in' to programs. This suits software houses, who want to discourage piracy, but it is very inconvenient for programmers. The only way you can stop a machine code program is to pull out the plug and re-load it. Zip and Mcoder allow you to break into compiled programs at will, but the Softek compilers require a special command wherever you might wish to break into compiled programs, You can't break into programs produced by the Mehmood complier at all.\r\n\r\nThe Softek compilers allow you to put special instructions in REM statements. These instructions only work once a program has been compiled, which is inconvenient since you can't test such programs fully in normal BASIC - one of the big advantages of BASIC compilers over machine code is the fact that you can test your programs interactively, with all the BASIC checks and hand-holding to help you, before you compile them.\r\n\r\nSoftek's special instructions allow you to check for the Break key, enter machine code into the program, and move simple (character-sized) sprites smoothly around the screen. On the FP compiler you can also trap errors and simulate the ON GO TO statement. None of the compilers let you GO TO a calculated line number - you must always GO TO a specific number.\r\n\r\nMcoder offers some REM instructions, but these are designed for program testing. You can turn off BREAK checks, giving marginally faster code, or turn on a 'trace' facility which shows the current line as it is executed. Mcoder and Zip allow you to pass variable values back and forth between BASIC and machine code.\r\n\r\nTHE COMPILERS COMPARED\r\n\r\nSo far we've taken a broad overview, looking at the compilers together. In the following section we look closely at each of the five Spectrum compilers (there were six, but the first Spectrum BASIC compiler, SUPER C is no longer available).\r\n\r\nIS COMPILER\r\n£9.95\r\nSoftek, [redacted]\r\n\r\nThis program is very like the FP one in presentation - it shares the same instruction sheet - but it restricts itself to arithmetic using whole numbers (IS stands for Integer and String, whereas FP stood for Floating Point). This restrictions makes IS about ten times faster than its stablemate. Again, compilation is fast and you can compile several programs into different areas of memory.\r\n\r\nThe compiled code is slower than that generated by Mcoder, and quite a lot slower than Zip, but the IS compiler has the bonus of support for very simple sprites. The lack of array-handling is annoying, although not too hard to get around if you're prepared to use PEEK and POKE or string-slicing instead.\r\n\r\nZIP 1.5\r\n£5.50\r\nZIP COMPILER OFFER, [redacted]\r\n\r\nThis is yet another refugee from a computer magazine - an early version of Zip was listed (in the wrong order, mainly) by the troubleshooting goblins at Your Spectrum last year (issues 3-6). Zip is mainly written in BASIC and consequently works more slowly than Mcoder or IS, although it's not as lethargic as the Popular Computing weekly offering. Line numbers above 5000 are used by the compiler and optimiser.\r\n\r\nZip produces faster code than the other compilers, as the benchmark timings show. Like IS and Mcoder it works with whole numbers only - unlike them, it doesn't allow strings or DTA and variable names are restricted.\r\n\r\nThe documentation is better for the other compilers, consisting of twelve pages of A5 (reduced from the A4 originals), with appendices covering benchmark performance, useful subroutines and error messages. There is also a section on customising the compiler program. A demonstration game is recorded after the compiler.\r\n\r\nAs compilation takes place your program is listed on the screen, and errors are shown in context. Zip is the only compiler which detects all the errors in a program at once - this is just as well, in view of the compilation rate. Zip produces error messages in plain English, whereas the other compilers just stop at the location of the error.\r\n\r\nMCODER\r\n£8.95\r\nPSS, [redacted]\r\n\r\nMcoder has the longest history of all the Spectrum compilers. It began life in the July 1983 issue of Your Computer magazine; in those days it was a 2K program for the ZX81 called ZX-GT. Like the Softek compilers, Mcoder now occupies about 6K.\r\n\r\nThe Mcoder documentation is unimpressive: seven cassette-sized pages, in the form of a brief question and answer session and a list of commands allowed by the compiler. PSS offer a three page 'help sheet' to users who miss the significance of some of the comments in the cassette insert. The code produced is faster than that from the IS compiler, especially when it comes to string handling.\r\n\r\nMcoder looks very much like the Softek compilers (or should that be the other way around?) and performs in a similar way, with the same fast compilation and simple error indication. Mcoder and IS are very similar - Mcoder handles numeric arrays and has better debugging facilities, while IS is slightly more compatible with normal BASIC and offers simple sprites.\r\n\r\nCOMPILER\r\n£2.75\r\nA Mehmood, [redacted]\r\n\r\nThis compiler was featured in a trio of Popular Computing Weekly articles in April this year. It doesn't come with any instructions, so you'll need a copy of PopCW Volume 4 No 17, and ideally the two following issues as well. A simple demonstration game is supplied on the other side of the tape.\r\n\r\nCompiler is written in BASIC, so it works very slowly, and line numbers below 1000 are reserved for the compiler program. As soon as an error is found a message is printed and compilation stops. The messages are usually quite helpful, but the stop is annoying since you have to start again to find the next error, and this might involve a wait of several minutes.\r\n\r\nAt £2.75 this is not a bad low-cost compiler, and would probably be useful for 'spicing up' BASIC program. It is a shame that it doesn't allow for FOR... NEXT loops or even PRINTing of strings. The poor timings it achieves on the Benchmarks result from the fact that Spectrum's very slow, built-in 'division' routine is used.\r\n\r\nFP COMPILER\r\n£19.95\r\nSoftek, [redacted]\r\n\r\nThis is the most expensive compiler by a clear tenner, so it had better be good - or at least different! As the benchmark timings show, it produces fairly pedestrian code, typical 2-10 times faster than normal BASIC - but it is very flexible. You can use FP to speed up almost an ZX BASIC program that doesn't use arrays of more than one dimension, or the VAL and VALPP functions. The compiler also disallows calculations in DATA and GO TOs, but we wouldn't dream of using those, would we?\r\n\r\nThe documentation is barely adequate - a single large sheet of paper with an introduction, list of compiled statements and brief technical discussion.\r\n\r\nThe FP compiler displays the current line being processed as it works. When an error is found the compiler stops and shows the line containing the problem, with a question mark to show where the problem was found. You can't go on to detect subsequent errors, but this doesn't matter much since the compiler is very fast. You can compile several programs into different areas of memory by using CLEAR between on compilation and the next.\r\n\r\nFP is a well-written program, but it is expensive and may not be useful to many Spectrum users, since it doesn't offer a dramatic speed increase over well-written BASIC. We'll look at it again next month, when we examine BLAST, a new compiler designed to process 'off the shelf' programs.\r\n\r\nNone of these compilers really offer 'instant translation' for your BASIC. With the possible exception of Softek's FP you really have to write your program with compilation in mind - it is hard work to convert existing BASIC to suit any of the compilers. Also, there are some things which are hard to do without the flexibility of real machine code. That said, the packages all produce working code pretty effortlessly, and you can be reasonably confident that compiled programs will work first time - unlike hand-coded ones!\r\n\r\nNext month, PR companies willing, we should be able to report on two new compilers - Colt, from HiSoft, which is a development of Mcoder, and Oxford Computer Systems' Blast, which promises to compile absolutely any ZX BASIC program, without alteration. At the moment we're having a bit of trouble wheedling copies out of the manufacturers - they both seem to be holding back until they've had a chance to dismantle their competitor's product! We'll compile more information next Niche....","ReviewerComments":[],"OverallSummary":"","Page":"86,87,88","Denied":false,"Award":"Not Awarded","Reviewers":[],"ScreenshotText":[],"BlurbText":[{"Text":"BENCHMARK TESTS _ COMPARING THE COMPILERS\r\n\r\nEight standard BenchMark programs were used in the comparison; timings for the execution of each benchmark program are given in seconds, with the speedup ratios achieved by each of the compilers printed on a grey background.\r\n\r\nZX BASIC\r\nBM1: 4.9\r\nBM2: 9.0\r\nBM3: 21.9\r\nBM4: 20.7\r\nBM5: 25.2\r\nBM6: 62.8\r\nBM7: 90.0\r\nBM8: 25.0\r\n\r\nMEHMOOD\r\nBM1: * (0x)\r\nBM2: 0.065 (138x)\r\nBM3: 9.0 (2.4x)\r\nBM4: 4.2 (4.9x)\r\nBM5: 4.2 (6.0x)\r\nBM6: * (0x)\r\nBM7: * (0x)\r\nBM8: * (0x)\r\n\r\nSOFTEK FP\r\nBM1: 1.75 (2.8x)\r\nBM2: 2.1 (4.3x)\r\nBM3: 8.7 (2.5x)\r\nBM4: 9.4 (2.2x)\r\nBM5: 9.4 (2.7x)\r\nBM6: 19.7 (3.2x)\r\nBM7: 24.0 (3.8x)\r\nBM8: 22.5 (1.1x)\r\n\r\nSOFTEK IS\r\nBM1: 0.058 (84x)\r\nBM2: 0.076 (118x)\r\nBM3: 0.57 (38x)\r\nBM4: 0.98 (21x)\r\nBM5: 0.99 (25x)\r\nBM6: 1.32 (48x)\r\nBM7: * (0x)\r\nBM8: * (0x)\r\n\r\nMCODER2\r\nBM1: 0.043 (113x)\r\nBM2: 0.097 (93x)\r\nBM3: 0.62 (35x)\r\nBM4: 0.90 (23x)\r\nBM5: 0.92 (27x)\r\nBM6: 1.17 (54x)\r\nBM7: 1.47 (61x)\r\nBM8: * (0x)\r\n\r\nZIP 1.5\r\nBM1: 0.031 (158x)\r\nBM2: 0.064 (141x)\r\nBM3: 0.194 (113x)\r\nBM4: 0.108 (192x)\r\nBM5: 0.115 (219x)\r\nBM6: 0.29 (235x)\r\nBM7: 0.46 (191x)\r\nBM8: * (0x)"}],"TranscriptBy":"Chris Bourne","ReviewScores":null,"CompilationReviewScores":[]},{"Issue":{"Name":"Your Spectrum Issue 1, Jan 1984","Price":"£0.95","ReleaseDate":"1983-12-15","Editor":"Bruce Sawford","TotalPages":98,"HasCoverTape":false,"FlannelPanel":"Editor: Bruce Sawford\r\nContributing Editor: Roger Munford\r\nTechnical Editor: Ron Smith\r\nEditorial Consultant: Andrew Pennell\r\nSoftware Consultant: Gavin Monk\r\nProduction Editor: Derek Cohen\r\nContributors: Guy Kewney, Phil Manchester, Toni Baker, Steve Mann, Stephen Adams, John McNulty, Mark Anson, Maggie Burton, Alan Jowett, Dr John Nunn, Jonathan How\r\nArt Editor: Jimmy Egerton\r\nGroup Advertisement Manager: Jeff Raggett\r\nAdvertisement Executives: Norman Setra, Arthur Medley\r\nTypesetters: Bunch Typesetting\r\nProduction Manager: Sonia Hunt\r\nGroup Art Director: Perry Neville\r\nPublisher: Stephen England\r\nDistribution Manager: Colin James\r\nPublished by Sportscene Specialist Press Ltd, [redacted] Company registered in England. Telephone (all departments): [redacted]\r\nReproduction: Graphic Ideas, London\r\nPrinters: Chase Web Offset [redacted]\r\nDistribution: Seymour Press [redacted]\r\n\r\nAll material in Your Spectrum ©1983 Felden productions, and may not be reproduced in whole or in part without the written consent of the publishers. Your Spectrum is a bi-monthly publication and the second issue will be available during the first week of February 1984.\r\n\r\nThanks to Pilot Software City ([redacted]) for the loan of countless pieces\r\nof software, and without whom the miraculous would have been totally impossible."},"MainText":"COURTING COMPILERS\r\n\r\nGO-FASTER!\r\n\r\nFLIRTING WITH FORTH\r\n\r\nOnce the initial association with Sinclair Basic has run its course, Spectrum owners soon come to realise its limitations - especially with regard to speed of operation. Steve Mann checks out alternative routes - in particular the 'FP'and 'IS' compilers from Softek, and the Abersoft Forth package.\r\n\r\nAll Spectrum owners will have noticed that their implementation of, say, Missile Command just doesn't have the speed or the smooth, pixel-by-pixel movement that a true arcade game devotee has come to expect from a program. In fact, Basic is just about okay if the display is kept simple - PRINT AT is actually, relatively, quite fast if the number of objects that need to be moved is kept small - but once the number of moving objects reaches four or five, the movement slows down dramatically.\r\n\r\nSinclair's highly individualistic - some might say bloody-minded - method of laying out the display file ensures that direct POKEs to the screen are more trouble than they're worth, so something different is needed. Another drawback is that anything that is moved a character square at a time is going to look jerky when compared with the single pixel steps achieved in professional programs.\r\n\r\nWHICH WAY OUT\r\n\r\nA recent innovation is the idea of a 'games design' package; Melbourne House has just marketed one of these, as has Quicksilva. But these are necessarily limited - the Quicksilva package, for example, while allowing the designer a fair amount of freedom in manipulation of sprites, insists that the resultant game is of one of four types, described as Space Invader, Asteroids, Scramble or Berserk. If you want a completely new format then, tough, you're out on your own, buster.\r\n\r\nPundits will pontificate patronisingly... \"Where's the problem?\" they'll ask, \"machine code will deal with all that and more\" - but no one likes a smart-arse, and machine code has a reputation for sending beginners gibbering and whimpering back to the comfort of Basic. It's not that it's amazingly difficult - in fact, in some ways it's extremely simple - but it's not an easy subject to learn from books and early attempts at understanding often prove so off-putting that the whole idea gets quietly shelved in the 'forget it' tray.\r\n\r\nThere has to be an easier way, and there is - in fact there are several. One way out is to learn Forth - definitely the year's most fashionable language for home computer users - and later on in this article we'll be taking a look at the Abersoft Forth compiler for the Spectrum. Another alternative is to use compiled Basic instead of the built-in interpreted version and, as Softek has released new versions of its Basic compiler, it seems only right and proper to give these the once-over.\r\n\r\nSo, introductory waffle over, it's time now to move towards the highly laud- able aim of making life easy for the user. Let's get down to some specifics...\r\n\r\nTHE COMPILER ROUTE\r\n\r\nInteger and Floating Point From Softek\r\n\r\nPurists may look down on Basic compilers as being something of an easy way out, but then who wants to make things difficult? The principle behind a Basic compiler is perfectly straightforward - just type in your Basic program (or load it from tape or Microdrive), hit a couple of keys and, presto, the 707 has become a space shuttle - at least that's the theory.\r\n\r\nOf course, nothing is actually that simple. The manual for the Softek compilers claims that compiled programs will run 'up to' 200 times faster (in some circumstances even 500 faster is possible), but the important point to note is that 'up to' is apostrophised (if there is such a word). In practice you will find that the compiled code is rarely that efficient and your programs are unlikely to be any more than 10 times faster. But let's not be ungrateful, a speed increase of 1000 percent is certainly not to be sneezed at!\r\n\r\nThe other point to note is that there is a trade-off of speed against ease of use - the Softek 'FP' floating-point compiler offers many more features to the user; it will handle almost all Basic commands and functions, including strings and arrays (single dimension only) and a full range of 'real' numbers. The 'IS' integer compiler has many more restrictions on its use - no arrays, fewer commands and integer numbers only, in the range - 32767 to 32767 (some functions will store a number in the range 0 to 65536 - for example, PEEK, POKE and USR). Floating point numbers are stored in five bytes, whereas integers take up two only - so the IS compiler produces much quicker code than does the FP version; in some cases operation can be speeded up by using the INT function, but generally the FP compiler will run two to ten times faster and in all but optimum conditions the speed increase will be at the lower end of this range.\r\n\r\nIn most instances, the 'IS' model is perfectly satisfactory, despite its more limited range of facilities, and the speed factor more than makes up for the extra care that is needed to ensure that the Basic is compilable. The lack of floating point maths need not necessarily be a drawback - integer numbers are often quite sufficient and, indeed, most Forth implementations will not handle floating point numbers anyway.\r\n\r\nAs a demonstration of the comparative speeds of interpreted and compiled Basic, let's examine a very simple program that plots every point on the screen (Figure 1). A couple of FOR/NEXT loops do the job quite adequately and, as can be seen from the timings, the 'IS' compiled version is fastest by many orders of magnitude. In the segment of this review that looks at Abersoft Forth, I have included a Forth version of this routine and a timing for further comparison.\r\n\r\nMINUS MASTER KEY\r\n\r\nBoth Softek compilers use the same memory addresses, and both take up approximately 6K of RAM. I had hoped to incorporate Softek's Master Key program, which defines the SPACE key as a further SHIFT and which then uses this in conjunction with the numeric keys to give user-definable function keys. Unfortunately Master Key, which worked a treat on my earlier Spectrum model, is another fine program that has fallen by the wayside now that Sinclair has started mucking about with the ULA (see Front Lines, Sinclairwatch). Your author's much-loved Issue 2 Spectrum gave up the ghost a few weeks ago and despite having now got a replacement - also categorised as an Issue 2 - affections for the new model are already strained by the number of programs that now fail to work. Sinclair Research may claim that it's all the fault of software manufacturers who have jumped to conclusions about specifications, but one program that resolutely refuses to run on my new machine is Sinclair's own IQ Test! Anyway, Master Key would have been a boon when used in conjunction with the compiler. It would have enabled Basic programs to be compiled at a single keypress, thus obviating the need to remember the somewhat clumsy RAND USR command needed both to compile and then to run programs. I just hope that Softek produces a revised version for later Issue 2 and Issue 3 machines.\r\n\r\nAnyway, even without Master Key, Softek's compilers work well enough. The compiler is first loaded and the user is asked if RAMTOP is okay at 40000 (48K version). RAMTOP may be moved to allow many different short routines to be linked together. After typing in the Basic, all that is needed is to key in RAND USR 59300. The compiler makes two passes through the program, printing on-screen the start and end addresses and detailing any errors. Compilation stops at any mistake and the offending line may be pulled down and edited in usual Basic fashion. Once any errors have been dealt with, all that's needed is to make a note of the start address and use this in another RAND USR call to RUN the program. The Basic program remains in memory if desired, so both interpreted and compiled Basic programs may be run.\r\n\r\nInitially, all but the simplest programs will probably refuse to compile when using the 'IS' version - but it's not too difficult to rewrite the offending sections to allow for the limitations (arrays will obviously take some thought - one solution is to POKE the required information into spare memory for later retrieval). Only skimpy, provisional documentation was available to work with while writing this review, but Softek assures us that full manuals will be available very shortly. The 'FP' compiler is much less finicky, although it did seem impossible to use a third parameter in a DRAW statement, despite the manual's claims to the contrary.\r\n\r\nOne particularly nice feature is the use of special REM statements to give commands and facilities not normally available in Sinclair Basic. These include such features as ON ERROR GOTO; ON n GOTO, where n must be a single-letter variable: and, most useful of all, REM S a,x,y which plots the character whose ASCII code is at PLOT position x,y. This REM statement allows some very smooth pixel-by-pixel movement (sec Figure 2) and can be used with user-defined graphics to produce mini-sprites.\r\n\r\nThere were some slight problems with graphics when using the compilers - the Union Jack program from the Sinclair manual, for example, gained some extraneous black blobs when compiled - but there was certainly nothing that could not be put right after a little thought. Hopefully the final version of the manual will go into a little more detail than the preliminary effort - but even with just this, both Softek compilers proved easy to use and gave some impressive results.\r\n\r\nIt's also nice to see that Softek has dropped its demand for royalty payments on programs that are produced with its compilers - all the company now asks is that the use of a compiler is acknowledged on packages and advertising.\r\n\r\nThe 'FP' Compiler costs £19.95, the 'IS' Compiler £9.95 and both together the price is £24.95. You can get them from Softek, [redacted].\r\n\r\n\r\nSHIFT INTO FORTH\r\n\r\nAbersoft helps trash Basic speed limits.\r\n\r\nThe Forth language was originally developed by Charles Moore in the 1960s as a language for controlling radio telescopes. Since then it's been used for a wide variety of applications, including arcade video games. Unlike Basic, which is usually ROM-based, Forth is generally supplied on disk and, with its sudden surge in popularity over the past year or so. now on cassette too.\r\n\r\nThe newcomer to the language will notice two major differences between Forth and Basic Forth uses Reverse Polish Notation (ie. Basic's PRINT 2+2 is replaced by 2 2 + . ), and makes great use of the stack for virtually every operation.\r\n\r\nThere are now many versions of Forth available for the Spectrum - Abersoft's implementation is basically fig-FORTH (the modishly lower case 'fig' referring to the Forth Interest Group) with extensions to handle the machine-specific graphics and sound commands. Forth was originally designed for use on disk-based systems, and the Abersoft version emulates disk operation by setting aside an 11K chunk of memory and using this as a 'pretend' disk. Although 11K does not sound like an incredible amount of memory, the compactness of Forth allows some very complex programs to be developed.\r\n\r\nThe version looked at here has no provision for Microdrives, but it would be relatively simple to implement these, giving in effect a true (although slow) disk-based system. The 11 K of 'RAMdisk' is organised into pages of 1K, each containing 16 lines of 64 characters. This is hardly ideal for the Spectrum's 32-character display but is a Forth standard and, in fact, gives rise to no real problems in use.\r\n\r\nHOW IT OPERATES\r\n\r\nFor those who are totally unfamiliar with the language, it should be said that Forth is used by defining words, using the basic building-blocks of the standard words in the dictionary. Each new word is treated as a new dictionary entry, and further words may be defined by using these. Thus, eventually, a complex program may be defined and run by the typing of a single word.\r\n\r\nThe stack assumes paramount importance, being used for almost every operation - even to the extent of passing values from word to word and doing the same job as a Basic variable. It is in fact a surprisingly easy language to gel to grips with, once the user has grasped Reverse Polish. Words may be defined direct from the keyboard - in which case the definitions go straight into the dictionary; or by using the editor - in which case they are not compiled immediately but wait until the blocks of text from the editor are LOADed.\r\n\r\nFor most of the machine-specific extensions, Abersoft has stuck to the familiar Basic names, but Reverse Polish means that parameters go before, rather than after, the keyword the Basic PLOT x,y becomes, for example, x y PLOT (note the absence of a comma). In some cases the familiar words have a slightly different meaning - the Basic DRAW, which uses relative coordinates (DRAW 50,50 would mean draw to a point 50 pixels horizontally and 50 pixels vertically away from the last plotted position) is replaced by absolute co-ordinates, with 50 50 DRAW meaning draw a line from the last point plotted to the screen coordinates 50,50. The CIRCLE routine in ROM could be called from Forth. The Basic BEEPcommand is omitted completely, which is a pity. However, the facility exists to insert machine code routines and so the CIRCLE becomes the Forth BLEEP, used in the format nl n2 BLEEP to produce a tone of duration n1 and pitch n2. User-defined graphics are fully supported, and the manual contains a routine to define any character by using the word UDG.\r\n\r\nIn addition to the Spectrum graphics and sound extensions, Abersoft Forth supports the Pascal-like CASE structure for handling multiple decisions, and the word FREE which - surprise, surprise! - tells you how many bytes remain free for use.\r\n\r\nThe Abersoft documentation makes no claims about the use of Forth, instead concentrating on the Spectrum-specific extensions and giving a glossary - with a few omissions - of the words in the dictionary. Unfortunately the glossary contains some misprints, but as the novice user will need a proper Forth instruction book, these should not be too troublesome. It's a good idea to supplement the Abersoft manual, and whatever book is decided on for teaching purposes, with the fig-Forth installation documentation; this costs a fiver and is well worth shelling-out for (the contact address is given at the end of this article).\r\n\r\nAll in all, then, Abersoft Forth is highly recommended for the beginner who wishes to learn more about this fascinating language. With an increase in speed of up to 5000 percent over Basic, Forth provides a good alternative to machine code for fast-running programs and speedy graphics and its use in arcade machines testifies to its success as a language for the programming of all-action games. It's impossible to give more than a rough idea of the language's capabilities in this short article - but hopefully, at least, your curiosity will provoke you into investigating Forth on your Spectrum.\r\n\r\nAbersoft Forth costs £14.95 and is available from Abersoft, [redacted].","ReviewerComments":[],"OverallSummary":"","Page":"21,22,25","Denied":false,"Award":"Not Awarded","Reviewers":[{"Name":"Steve Mann","Score":"","ScoreSuffix":""}],"ScreenshotText":[],"BlurbText":[{"Text":"\"I agree it's quite remarkable that we can run the whole of BL on a Sinclair Spectrum - but do we really need 17,340 people to operate it?\""},{"Text":"Figure 1. Basic program to plot each point onscreen. Basic takes 6min 03 sees. 'FP' compiler takes 1min 40secs. 'IS' compiler takes 10secs.\r\n\r\n10 FOR A = 0 TO 175\r\n20 FOR B = 0 TO 255\r\n30 PLOT B,A\r\n40 NEXT B\r\n50 NEXT A\r\n\r\nFigure 2. 'Mini-sprites' on the 'FP' compiler.\r\n\r\n10 FOR A = 1 TO 128\r\n2 0 LET B = (255 - A)\r\n3 0\r\nREM S, 87, A, A\r\n40 REM S, 88, B, A\r\n50 REM B\r\n60 BEEP 1/50, 1\r\n70 NEXT A\r\n\r\nFigure 3 'FP' screen dump — this saves the screen above RAMTOP and then downloads the screen. Line 10 is to put the design on-screen (anything will do).\r\n\r\n10 CIRCLE\r\n1 2 8 . 8 8 . 5 0\r\n20 LET A = 16384\r\n30 LET X = 46000\r\n40 LET K = PEEK A\r\n50 POKE X, K\r\n60 IF A > 22528 THEN GOTO 80\r\n70 LET A = A + 1: LET X = X + 1: GOTO 40\r\n80 CLS: PAUSE 100\r\n90 LET A = 16384 : LET X = 46000\r\n100 LET K = PEEK X\r\n110 POKE A, K\r\n120 LET A = A + 1: LET X = X + 1\r\n130 IF A > 22527 THEN STOP\r\n140 GOTO 100\r\n\r\nFigure 4. This program plots each point on-screen in Forth — it takes just 20secs.\r\n\r\n: TEST\r\n 176 0 DO\r\n 256 0 DO\r\n I J PLOT\r\n LOOP LOOP;\r\n\r\nFigure 5. Using dictionary words to draw a pattern on-screen\r\n\r\n: DEMO\r\n 251 0 DO\r\n 125 0 PLOT I 90 DRAW\r\n 125 175 PLOT I 90 DRAW\r\n 15 +LOOP;\r\n\r\nFigure 6 Using the previous example of Figure 5 to define a new word, the pattern then runs through all the INK colours.\r\n\r\n: DEMO 1\r\n 7 0 DO\r\n I INK CLS DEMO\r\n 5000 0 DO LOOP\r\n LOOP:"},{"Text":"GOOD READING\r\n\r\nThe Complete Forth - Alan Winfield (Sigma Technical Press).\r\n\r\nDiscover Forth - Thom Hogan\r\n\r\nForth Programming - Leo Scanlon\r\n\r\nForth installation documentation is available from Forth Interest Group UK, [redacted]."}],"TranscriptBy":"Chris Bourne","ReviewScores":null,"CompilationReviewScores":[]},{"Issue":{"Name":"Crash Issue 5, Jun 1984","Price":"£0.75","ReleaseDate":"1984-05-24","Editor":"Roger Kean","TotalPages":126,"HasCoverTape":false,"FlannelPanel":"Editor: Roger Kean\r\nConsultant Editor: Franco Frey\r\nProduction Designer: David Western\r\nArt Editor: Oliver Frey\r\nClient Liaison: John Edwards\r\nStaff Writer: Lloyd Mangram\r\nContributing Writers: Matthew Uffindel, Chris Passey\r\nSubscription Manager: Denise Roberts\r\n\r\nTelephone numbers\r\nEditorial/office [redacted]\r\nAdvertising [redacted]\r\nHot Line [redacted]\r\n\r\n©1984 Newsfield Ltd.\r\nCrash Micro is published monthly by Newsfield Ltd. [redacted]\r\n\r\nNo material may be reproduced in whole or in part without written consent from the copyright holders.\r\n\r\nPhotosetting by SIOS [redacted]\r\nColour origination by Scan Studio, [redacted]\r\nPrinted in England by Carlisle Web Offset Ltd, [redacted].\r\nDistribution by Comag, [redacted]\r\n\r\nSubscriptions: 12 issues £9.00 UK Mainland (post free)\r\nEurope: 12 issues £15 (post free).\r\n\r\nWe cannot undertake to return any written or photographic material sent to CRASH MICRO unless accompanied by a stamped addressed envelope.\r\n\r\nCover by Oliver Frey"},"MainText":"SOFTEK 'IS' AND 'FP' COMPILERS\r\n\r\nThese are compilers for the 16K and 48K Spectrum - the 'IS' being an integer compiler, and the 'FP' a full floating point compiler. As these are similar in many ways, they will both be covered in this one review.\r\n\r\nEach of the compilers contains 16K and 48K versions on the same tape and comes in a large video case. They are supplied with a short but informative instruction leaflet. While the packaging looks very game-like, any more than a cursory glance will show that they are in fact very comprehensive and useful utility programs.\r\n\r\nTo load the compiler you simply type LOAD \"\". The program loads in two parts, a BASIC loader then the compiler itself. When fully loaded you will be asked whether RAMTOP at 40000 is OK, and given the option to change this if necessary - your BASIC will be compiled immediately above RAMTOP.\r\n\r\nOnce RAMTOP is set, you are told that you can NEW and BASIC loader.\r\n\r\nWhen the compiler is loaded, you can type in your BASIC program, or load it from tape or microdrive in the usual way. As you may expect, the 'FP' version will handle more of the BASIC than the 'IS', and your BASIC program will have to be written bearing in mind the list of allowed commands. Both compilers are quite comprehensive, in the string handling, for instance, strings are totally flexible and can be any length. String slicing is allowed as are LEN, STR$ CODE CHR$ INKEY$ SCREEN$ \"+\" (for concatenation). Strings can be compared as in BASIC, this is far more powerful than the string handling in the MCODER compiler. When compiling BASIC programs from magazines and so on then obviously some modification is usually needed, but both compilers handle most BASIC commands and it is usually quite easy to make the required changes to programs.\r\n\r\nWhen your BASIC is loaded and ready to be compiled you simply type RAND USR 59300 (26600 for 16K).\r\n\r\nVarious messages appear as the compiler passes twice through your BASIC - these are:\r\n\r\n1. START ADDRESS. This is always one byte above RAMTOP.\r\n\r\n2. END ADDRESS.\r\n\r\n3. VARIABLES END. This message appears when your program contains string or arrays. These are stored immediately after your compiled BASIC.\r\n\r\n4. FIRST PASS/SECOND PASS.\r\n\r\n5. ERROR/NO ERRORS.\r\n\r\nAfter a successful compilation the message 'NO ERRORS' appears. If the compiler finds an error then the 'ERROR' message will appear, compilation will stop and the offending line is displayed with a question mark after the error. If this occurs then pressing EDIT will bring down the erroneous line for correction.\r\n\r\nIf compilation is successful your program can be run using RAND USR START ADDRESS (given in 1. above).\r\n\r\nError reports use standard Sinclair error codes.\r\n\r\nYour BASIC program remains in memory after compilation. This allows modifications to be made if the machine code does not run as planned.\r\n\r\nIf all is well your compiled program can be saved as CODE in the normal way. Note, however, that the compiler must be saved along with the compiled code as it contains several runtime routines needed for efficient programs. As with the MCODER compiler, programs can be stacked in memory and used as subroutines; this is done by carefully setting and resetting RAMTOP.\r\n\r\nSPECIAL FEATURES\r\n\r\nREM statements are used in both SOFTEK compilers to obtain facilities not available from BASIC. These include:\r\n\r\n'IS' Version\r\nREM B - Checks to see if BREAK is pressed\r\nREM S,a,x,y, - PRINTS a character (ASCII code 'a') on to the screen at PLOT poisition x, y.\r\n\r\n'FP' Version\r\nREM O,a,n,n - This simulates the BASIC function ON a GOTO n,n...\r\nREM E,n - If an error occurs jump to line n.\r\n\r\nIN USE\r\n\r\nBoth compilers proved very easy to use and the speed improvements is immediately noticeable. There seemed to be some problem when trying to use READ and DATA statements within a program loop - the program in question worked under BASIC but gave an OUT OF DATA message when compiled. Also if a variable was assigned within a FOR-NEXT loop an OUT OF MEMORY error was sometimes encountered during compilation. This seemed to be intermittent and if it did occur, using CLEAR cured it. These minor irritations aside, both compilers worked OK.\r\n\r\nAPPLICATIONS\r\n\r\nBoth compilers take up about 6K of RAM. The FP compiler is obviously capable of more accurate results in scientific and technical applications but also, as it uses time consuming (accurate) floating point notation, it is slower than the 'IS' version. The 'IS' compiler is more suitable for such things as games.\r\n\r\nSOFTEK claim in their advertisement, 'Superfast games involving hi-res graphics and movement are now possible even if you are only knowledgeable in BASIC.' This is to some extent true, but the hi-res movement (using REM S) ranges from not particularly fast to downright slow. It is just not fast enough for fast-moving games. Both compilers would be ideal for use alongside other machine code subroutines with, for example, an interupt driven sprite-moving routine. This would obviously need some knowledge of machine code, so it wouldn't be quite lair to say that compilers are the complete alternative.\r\n\r\nCONCLUSIONS\r\n\r\nAt £9.95 for the 'IS' compiler, and £19.95 for the 'FP' version these programs represent excellent value for money. If you are looking for a compiler these two are probably the best on the market at the moment. The 'IS' compiler is far superior to the MCODER from PSS, with the added bonus of (slow) mini-sprite graphics. Please note the copyright notice on the compilers, however - that the use of SOFTEK'S compiler must be clearly acknowledged on packaging, advertisements and on the initial screen title display if it is used for creation of commercial software.","ReviewerComments":[],"OverallSummary":"","Page":"107","Denied":false,"Award":"Not Awarded","Reviewers":[{"Name":"Steven Wetherill","Score":"","ScoreSuffix":""}],"ScreenshotText":[],"BlurbText":[],"TranscriptBy":"Chris Bourne","ReviewScores":null,"CompilationReviewScores":[]}]}]