My intentions are to start at the beginning of the manual and continue until it is finished. If anyone feels as though I am violating any copyrights, email me and we can discuss it.
Preface |
Introduction |
Editor and Compiler Instructions |
Sample Programs |
Programming Techniques |
Appendix A - Compiler, Assembler and Run-time Error Messages |
Appendix B - Quick Guide to Kyan Pascal |
Appendix C - Specifications |
The first chapter, EDITOR AND COMPILER INSTRUCTIONS, explains how to enter, edit, and compile a PASCAL program. This material must be read prior to actual programming.
Readers with no previous experience with PASCAL should read the chapters in order. It is recommended that the example programs be entered, compiled, and run. It is not essential that every line be duplicated from these programs. In fact, rewriting the example programs not only is instructive but also can improve them.
Programmers who are already familiar with PASCAL need only read the sections on topics they wish to review. Appendix B provides a quick review of PASCAL vocabulary.
The two principal aims of PASCAL are "..to make available a language suitable to teach programming as a systematic discipline based on certain fundamental concepts clearly and naturally reflected by the language.." and to "develop implementations of this language which are both reliable and efficient on presently available computers" (Jensen and Wirth, "Pascal User Manual and Report").
PASCAL has become a widely used language for both elementary and advanced programming. Its popularity derives from the clarity of programs written in it and the efficiency with which it can be implemented within the computer.
Kyan PASCAL is especially efficient in this regard, because the run time code and the compiler itself are written in assembly language, the language of the microprocessor integrated circuit. Unlike some other compiled languages, Kyan PASCAL includes the necessary tools for advanced programmers who wish to include assembly language routines in their PASCAL programs.
PASCAL is a self-documenting and self-structuring language. Top-down programming and modulization are natural outgrowths of its features. These features include, among others, user-defined functions and procedures of which modules are built.
Separation of the declaration section from the program body also enforces good programming technique. All the information on constants, types of variables, and names of variables and constants appears in a single section rather than being spread throughout the program.
Kyan PASCAL provides features that help the programmer to find the syntax errors that account for over 90% of the errors in programming. Over 30 error messages for syntax are in the compiler. These not only tell the programmer what types of errors were made but also on which lines the errors occurred.
Kyan PASCAL does not stop looking for errors or lose synchronization when an error is found. Instead, although some compilation halts, error detection continues and all the errors are displayed at one time.
One final reason for using PASCAL is its portability. PASCAL, one of today's most popular languages, is implemented on nearly every computer on the market. Kyan PASCAL is compatible with standard PASCAL. Programs and program modules written in Kyan PASCAL (using standard procedures and functions) will run on a multitude of computers: a programmer can develop software on a home computer, transport it to many other machines, and run the programs immediately.
KYAN PASCAL VERSION 1.0 COPYRIGHT 1985 BY KYAN SOFTWARE 1850 UNION STREET, SUITE 183 SAN FRANCISCO, CA 94123 >If you have an Apple ][, to transfer the editor program from the disk to memory, type ED:
>EDfollowed by <RETURN>. Striking the <RETURN> key tells the computer that you have completed your command.
If you have an Atari, to transfer the editor program from disk to memory, type D1:ED:
>D1:EDfollwed by <RETURN>. All commands that require disk access on the Atari, must have the prefic "D1:--" which stands for disk drive #1. If you have more than one disk drive, this prefix can change to D2, D3, etc.
The prompt symbol (>) is a signal from the program, in this case from Kyan PASCAL, that the computer is waiting for your command. Unless instructed otherwise, you should always press <RETURN> when entering commands into the computer.
Your Apple [Atari] computer will search for the editor and load it. When loading is completed the following message will be displayed:
PATHNAME? [FILE NAME? if computer is an Atari]
PATHNAME? TRIAL [FILE NAME? D1:TRIAL if you computer is an Atari]Because the program trial is new the editor will prompt:
FILE NOT FOUND, PRESS ANY KEYWhen you press any key the screen will become blank. Notice that there is no prompt. All entries that you make will become part of your program file (TRIAL) just as you see them on the screen.
Enter a string of six X:
XXXXXXFollow the instructions in the next section to save TRIAL.
If you wish to save TRIAL (the exapmle program above) type <ESC> S. This is one of the three ways to end editing:
<ESC> S (Save and Resume) <ESC> Q (Quit without Save) <ESC> X (Save and Exit)If you typed <ESC> S you saved the program you were editing and have returned to the editor so that you could add more lines.
If you type <ESC> Q none of the changes or entries you did were saved. You just quit and left the file in the state it was before you started editing.
If you typed <ESC> X the prompt (>) reappeared because you saved your changes, left the editor to edit a different program (or to compile).
Remember before creating or saving programs, you should make backup copies of your Kyan PASCAL disk.
If you own an Atari, you can re-enter the editor by typing "!" and <RETURN> after the prompt.
PASCAL names, i.e., names of variables, types, etc., in a PASCAL program are not the same as ProDOS pathnames or DOS 2.5 file names!
To change the name of the file you are working with, type <ESC> P and the computer will prompt:
PATHNAME: [FILE NAME: if your computer is an Atari]Enter the new name, e.g. "Account", of the file followed by a carriage return and <ESC>:
PATHNAME: Account <RETURN> <ESC> FILE NAME: D1:Account <RETURN> <ESC> [Atari Version]It should be noted that the new file name will be entered immediately after <RETURN>, whether or not the final <ESC> is typed. The final <ESC> causes the computer to leave the special functions mode.
All cursor movement commands are a combination of the [CNTL] key (Note: ^ is a shorthand notation for [CNTL] so [CNTL]-S is the same as ^S) and another key. The combinations are:
^S move the cursor back 1 space (left) ^D move the cursor forward 1 space (right) ^E move the cursor back 1 line (up) ^X move the cursor forward 1 line (down) ^A move the cursor back 1 word (left) ^F move the cursor forward 1 word (right) ^R move the cursor back 20 lines (up) ^C move the cursor forward 20 lines (down) ^T move the cursor to the top of the file ^V move the cursor to the bottom of the fileMany Apple and Atari computers have cursor (arrow) keys. You may also use these to move the cursor right of left one space and up or down one line.
If you hold the cursor keys pressed down the cursor movement will be repeated until you release the keys.
^G delete the letter coincident to the cursor ^Q delete the letter to the left of the cursor ^Y delete the line in which the cursor is positionedThe delete key <DEL>, if present, accomplishes the same task as ^Q.
Sometimes you may wish to find a certain string within a program. Or you may wish tp replace a string with another string:
<ESC> enter the special editor function A set "A" (designate the string to be found) B set "B" (designate the replacement string) C change "A" string to "B" string ^W search from cursor forward to end of file ^Z search from cursor back to beginning of fileTo find the occurrence of any string enter <ESC> A and the editor will prompt:
A:Next enter the string to be found. For example, if "look out" is to be found, enter "look out" followed by a carriage return:
A:look out <RETURN>The final two steps are to leave the special editor functions mode by typing the <ESC> key and then typing ^W or ^Z. The cursor will go to the first occurrence of "look out" ahead of the present cursor position. To find the second occurrence, enter ^Z again. This process can be repeated until all occurrences of "look out" have been found.
Maximum string size is 40 characters.
To substitute a new string for any string both the old ("A") string and the new ("B") string must be designated. Use the "A" and "B" commands listed above. The "A" string consists of the words or lines the way they are before the substitution. The "B" string consists of the new words or lines that will take their place.
When both strings have been set, type the "C" command. The editor will prompt:
CHANGE ALL STRINGS OR SOME (A/S/Q)?Choose "S" to0 have the editor stop at each possible string and question whether or not to make that substitution.
Choose "A" to replace all strings in the file. Choose "Q" to quit without making any substitutions.
Substitutions always start at the top of the file and continue to the end.
To replace the string "first" with the string "#1" everywhere in the file follow these steps:
1. Type: | <ESC> A | |
2. Prompt appears: | A: | |
3. Type: | first <RETURN> | |
4. Type: | B | |
5. Prompt appears: | B: | |
6. Type: | #1 <RETURN> | |
7. Type: | C | |
8. Prompt appears: | CHANGE ALL STRINGS OR SOME (A/S/Q)? | |
9. Type: | A |
<ESC> GWhen the editor will prompts "LINE NUMBER" enter the number of the line which you wish to change. For example, if the compiler indicates that you have an error in line 3, enter 3 after the prompt:
LINE NUMBER: 3 <RETURN>Remember, if you add or delete lines before the one you are searching for, then the line number of that line will be increased or decreased, accordingly.
PATHNAME OF FILE TO INSERT (BLANK TO QUIT) FILE NAME OF FILE TO INSERT (BLANK TO QUIT) [Atari Version]If you enter the pathname [or file name] of an existing file it will be inserted into the file you are editing. Atari users, remember to include the disk prefix.
List of Editor Commands
(Note: ^ is equivalent to CONTROL Key) ED enter the editor program ^S move the cursor back 1 space (left) ^D move the cursor forward 1 space (right) ^E move the cursor back 1 line (up) ^X move the cursor forward 1 line (down) ^A move the cursor back 1 word (left) ^F move the cursor forward 1 word (right) ^R move the cursor back 20 lines (up) ^C move the cursor forward 20 lines (down) ^V move the cursor to the bottom of the file ^T move the cursor to the top of the file ^Q delete the letter to the left of the cursor ^G delete the letter or keystroke coincident to the cursor ^Y delete the line in which the cursor is positioned ^W find string backward direction ^Z find string forward direction ^O mark/cut block ^P paste/block ^N type "[" (left bracket) - Apple ][ only <SHIFT>M type "]" (right bracket) - Apple ][ only Special Editor Functions Mode: <ESC> enter/leave special functions mode S remain in editing with save Q exit from editing without save X exit from editing with save A designate string to be found B designate replacement string C set search/replace options I include file P set pathname [or filename if you have an Atari] G go to line H get help menuList of Compiler/Assembler Commands
PC Enter the compiler and assembler programs Assembler/Compiler Options - Apple ][: -O Omit object code -L Generate assembly language listing -Sn Send error listing to slot #n Assembler/Compiler Options - Atari: -O Omit object code -E Send error listing to screen only -EP Send error listing to screen and printer -L Send assembly listing to screen only -LP Send assembly listing to screen and printerOther Commands
^<RESET> Stops program during run time -- Apple ][ Only <BREAK> Stops program during run time -- Atari Only
Assembler Error Messages
Run-Time Error Messages