KYAN PASCAL
True Pascal for Atari, at last
Reviewed by RAY COLE
Finally there is a Pascal for the Atari that doesn't require two disk drives and a computer science degree! If you're looking for a fast version of Standard Pascal for your single drive Atari, Kyan Pascal is the language for you.
Pascal was developed by Professor Niklaus Wirth of Switzerland in the late '60s. Designed as a learning language, Pascal emphasizes structured programming which promotes good programming technique. It has become the first language taught to new students of engineering and computer science.
Those not familiar with Pascal will find it is similar to the ACTION! or C languages. The object code is compiled from text source code. Kyan pascal includes an editor for source code, as well as the compiler and some extension files.
There are two Pascal "dialects." One was designed for microcomputers at the University of California, San Diego and is accordingly called UCSD Pascal. The other is Standard Pascal. Kyan is Standard Pascal with a few additions and extensions.
FEATURES
Kyan Pascal supports all of the features that make Pascal great-- global and local procedures, pointers for linked lists and binary trees, two-dimensional arrays, arrays of records, variant records, recursion, etc., etc.
In short, it has all the features you would expect from any Standard Pascal on any other computer. And Kyan Software has done Pascal for the Atari at only $69.95!
COMPILER
The Kyan Pascal compiler is reasonably fast and effective. Unlike UCSD Pascal, Kyan Pascal text files are compiled directly into assembly language. The compiler, in addition to locating errors, produces a complete assembly language listing which you can send to the screen and/or the printer. But unfortunately, there is no way to save this listing to disk for fine tuning.
The assembly language listing is next assembled to produce the object code file which can be run from DOS without Kyan Pascal. (Though you will need to append the library files or at least put them on the same disk.)
The resulting object file has a very rapid run-time. Ten iterations of the Eratosthenes Prime Number Sieve (see "First ST Performance Test," Antic, October 1985) ran in about 120 seconds with the screen on. With the screen off, the same program ran in just 80 seconds.
Compare this to the eight and a half minutes it took UCSD Pascal on the Apple IIe, or the eight minutes and 55 seconds it took Atari BASIC to complete the task.
The biggest drawback of the compiler is the 35 seconds it takes to load. If you have a 130XE, you can put the compiler in the RAMdisk and save yourself the half-minute load time. But even at 35 seconds, the resulting speedy object code is well worth the wait!
EDITOR
The Kyan Pascal editor commands are hardly mnemonic and do not take advantage of the familiar Atari screen editor. However, programmers familiar with Wordstar or Turbo Pascal will be right at home. Also, you quickly adjust to the lack of mnemonics because the layout is fairly logical.
Deletions may take getting used to. [SHIFT] [DELETE] wipes out a single character the way you would expect [CONTROL] [DELETE] to work. To delete a line, you have to use [CONTROL] [Y].
A "search and replace" feature is included in the editor, but unfortunately there is no "copy block" command. Also, the tab key does nothing at all, and there is no substitute!
In a language like Pascal, where everything is indented, that tab key is sorely missed. If you do any complicated loop nesting, you'll find yourself hitting the space bar about five to ten times before each line. Because the compiler requires only that the source file be DOS compatible, you might be better advised to use a text editor you're more comfortable with.
ASSEMBLER
Kyan Pascal contains an assembler which can be used to embed machine language routines in the middle of any procedure, function, or main program body. It is also possible--though somewhat cumbersome--to pass information between the ML routines and the Pascal programs, procedures, and functions.
OPERATING SYSTEM
Ideally, an operating system should be so easy to use that you don't notice it exists at all. But Kyan Pascal's operating system is far from ideal.
To load the program compiler, the manual says: Type PC. Actually, you must type D:PC. When the editor prompts you for the name of the file you want to edit, do you type CONSTRUC? No, you have to type D:CONSTRUC.
Every time you access a file from the disk, you must remember to include the device. This is not only silly, it's aggravating. When the compiler asks for the name of the file to compile, you'd better remember to put that D: before the filename, or you'll nave to reload the compiler!
There are other inconveniences. You cannot get a disk directory without going to DOS. And if you try to reload the editor after running a program that uses graphics, the computer locks up. Hopefully these glitches will be smoothed out in later releases.
DATA TYPES
Kyan Pascal allows the use of both capitals and lowercase letters for naming variables or writing the program itself. It does not, however, permit underscores. Thus, Variable Name is okay, but Variable_Name is not.
Most of the important data types for variables are supported, including integer, real, char, and Boolean. In addition, Kyan Pascal allows user-defined subrange and enumerated types.
The type, double precision is not a required part of any Pascal and is left out of Kyan Pascal. It is not needed anyway, since this implementation yields an amazing 13 digits of accuracy with regular type real variables!
UCSD Pascal programmers may at first lament the loss of the predefined data type string, since the only way to simulate string variables in Kyan Pascal is by setting up an array of characters. However, a small library of string routines comes with the language and can be included in your programs.
One problem with Kyan strings is the relational operators, "<" and ">" These work only on the first letter of each of the compared strings. For example, suppose Word = 'ANTIC' and FirstWord='ATARI', then the line:
If Word < FirstWord then
FirstWord = Word;
will not set FirstWord equal to ANTIC as we would like. This tends to make sorting tasks a bit more difficult than they should be.
Assignment statements are a little inconvenient too, since all of the character array elements must be filled. For example, given the following declarations:
Type String: array[1..15] of char;
Var Magazine: String;
the assignmenf statement Magazine:= 'Antic' will not work. You must use Magazine:='Antic 'so that there are exactly 15 characters between the quotes. A readln adds the trailing blanks automatically, and you can truncate them in a writeln by including the function LENGTH in your program and using the length as a field specification. Thus:
writeln(Magazine :
LENGTH(Magazine));
will print out all characters up to but not including the first blank. I had to call the company to find this out, though. It's not explained anywhere in the manual.
DOCUMENTATION:
Documentation is, unfortunately, pretty poor. The spiral-bound instruction manual contains many errors, not all of which are typos. And the most serious are those of omission, such as the above-mentioned LENGTH function.
I also disagree with the included sample programs which, I feel, set bad examples for programmers new to Pascal. The programs don't make use of procedures as much as they should, the commenting is weak, and the indenting format is inconsistent.
Of course, the manual does not claim to be a Pascal instruction book and users unfamiliar with the Ianguage should definitely purchase a separate book (I recommend PASCAL: An Introduction To The Art And Science Of Programming by Waiter J. Savitch. Benjamin/Cummings Publishing Company, Inc., 1984.)
EXTENSIONS
Kyan Pascal includes a few extensions to the standard. The ASSIGN procedure permits a crude sort of PEEK and POKE, and PRON and PROFF will redirect writeln output to the printer instead of the screen.
With the command "#i", you can include procedures from one program into another. With the command "#a" you can insert an assembly language routine. Provisions have been made to allow chaining programs together and passing variable values between chained programs.
GRAPHICS BONUS
Version 1.1 contains a library of graphics routines for the Atari. There are six files which simulate the BASIC commands GRAPHICS, PLOT, DRAWTO, SETCOLOR, POSITION, and LOCATE.
Though the language is fast, it's not quite fast enough to produce arcade quality games. But if you've been writing your games in BASIC you'll find Kyan Pascal to be significantly faster--and easier to use.
Unfortunately, there are no dedicated commands for Player- Missile graphics and no equivalent to the BASIC SOUND statement. And you'll have to write assembly language routines to create these functions in Pascal.
BOTTOM LINE
Kyan Pascal is exactly what it claims to be--a good, solid, fast version of Standard Pascal. And there lies the disappointment. With just a few additions, it could have been so much more.
Its deficiencies lie mostly in the lack of extensions to the Standard. In general, Kyan Pascal is territic as long as you don't particularly care about writing programs that make use of features that are unique to the Atari.
Nevertheless, Kyan Pascal plus a good book makes a painless way to introduce yourself to Pascal programming. If you are taking a class in Pascal and want to do some work at home, Kyan Pascal is a must. If you use Pascal at the office and want to write programs at home on your Atari, again, Kyan Pascal is the package for you.
Nearly everything that BASIC does without assembly language can be done faster and more easily with Kyan Pascal. At this price, its worth looking into.
This package is available from Kyan Software, 1850 Union Street, #183, San Francisco, CA 94123, (415) 775-2923, on 64K disk, (XL/XE models only) for $69.95.
(Note: At this writing, Kyan Pascal was only available for XE and XL counputers. According to the manucfactures the 400/800 version will be available within two to three months. If you own an older machine be sure and contact Kyan before ordering.--ANTlC ED)
Ray Cole is a junior at UCSD majoring in Engineering. He's heen programming in Pascal on his Atari as well as on minicomputers--for over two years. Ray teaches introductory Pascal classes on Apple computers.