80-Bus News

  

May–June 1983, Volume 2, Issue 3











Page 55 of 59











55

Both manuals dive formal definitions of the syntax of the Pascal the compilers will’ accert. Hisoft use these syntax diagrams with one way arrows to show vou what can go wheres while Compas have done a very careful Job of writing out a full Backus Naur definition of the landuade. In case vou are not familiar with BNF, it tends to look like thist-

(program) £22 (rrogram heacling> <black> . Cprodram heading) i:= (empty) | PROGRAM <file and so on and so on...

I’find syntax diagrams a million times easier ta ready even though they are not as rleasincg to the mathematical minds and I believe they are a better wav of doing things. You may disagrees if vou are fond of mathematical formalism for its own saker rather than where it is useful. Both comeilers come complete with exame le programs. The ones Hisoft dive vou are printed in the manualry so vou have to tyre them in for vourselfs if vou want to use them. One of thems which is surprosec to be able to read a CP/M disc directory into memorv:r doean’t work with my CP/M: although I am told it dees with others. Comeas’s examrles are already on the discs so all vou have to do is compile them and run them. Thev are very nice examples, too. One of them is a calculator erodram: which makes your expensive Nascom Cor similar] werk Just like a £5 pocket calculator. Another is a tuite useful address and telerhone number file handling prodram, and there is alse one that can do hex dumes of files from disc.

The precision of real number calculations is not the same in both systems. Hiseft gives veu seven significant fissures, while Comreas gives vou eleven. Of course, if vou need even more erecise fisures than that, you can Program your way round the restriction with either compilery as I mentioned in a Previous article. Thev both use two bytes to store an intesersy which dives vou the usual “32748 to 32767 range of values. Compas doesn’t tell vou if an integer variable has overflowed, whereas Hisoft does, unless vou set a comeiler orticn to omit overflow checks. This would make the eregram run fasters but I usually forget to do ity and I have no complaints about the seeed Hiseft programs run at! With Compas, vou have to set a compiler cetion if vou want to use recursion. I used to think using recursion was .iust showing off, until I needed it once or twice.

Compas has a data tyre that is net used in standard Pascalr or Hisoft for that matters and it is the string. Nermaliv,s in FPascals ene uses arrays of characters, and writes routines to manirulate them. It can be deanery although I never finished the set of routines I was working on a while aga. The lack of strings in Pascal is a real downer. Compas strings are very much like BASIC strings, although the way it cheers strings up Ceauivalent to left$» right$, and mid$J] uses a notation like that of the reculiar BASIC in the Sinclair ZX61. Still» it is theres and strings can be cut up, concatenated and senerally

messed around as much as You like.

Extensions to Pascal.

Both comeilers dive vou direct access to the contents of memory, Compas dees it by means. of what they call “the memory array", which behaves much like an ordinary Pascal array, whose contents are the 780’. address space. Hisoft have addect the words FEEK and FPOKE to the landuades but these are net the single byte orerations users of non structured BASIC know and love. If vou poke an address with a data tyre that takes more than one byter all the bytes of the source item are poked into successive memory, locations. In other words» POKEC EFGQA+’Heaclind’ > would put the werd “Heading on the tor line of the

screen. This is very useful!

The Z8@ ports can also be accessed using either compiler. Hisoft have the reserved words IN and OUT, while Comeas uses another of its srecial arrays

which is referred to as the Fort array.


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 55 of 59