NOTE: What follws is the Kyan Pascal Manual for the Atari and Apple 8-bit computers. There isn't much right now, however, I will add sections as my time allows. If you wish to copy this file, please feel free to do so. Be aware that it will be periodically updated. My suggestion is to set a bookmark to this page if you find it important.

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.


KYAN PASCAL - A PROGRAMMING LANGUAGE

Table of Contents

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

Preface

PASCAL, A Programming Language provides beginning programmers with a step-by-step introduction to PASCAL, and advanced programmers with a convenient reference to the language.

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.


Table of Contents

Introduction

The history of Pascal goes back to the late 1960s, when Niklaus Wirth, a professor of computer science, decided that a new approach -- a new language -- was needed for teaching programming. Wirth introduced PASCAL as a formal language in 1971.

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.


Previous Section | Table of Contents

Editor and Compiler Instructions

Kyan PASCAL consists of two programs: the editor program (ED) and the compiler/assembler program (PC). When your Appletm [Ataritm] is booted (to boot the Atari, push the <Option> key during power-up) with a Kyan PASCAL disk in the drive the following will be displayed:
            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:
            >ED
followed 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:ED
follwed 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]

Creating a File, an Example

Suppose the name of your program is TRIAL enter:
            PATHNAME? TRIAL

            [FILE NAME? D1:TRIAL if your computer is an Atari]
Because the program trial is new the editor will prompt:
            FILE NOT FOUND, PRESS ANY KEY
When 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:

            XXXXXX
Follow the instructions in the next section to save TRIAL.

End of Editing

The first step in editing is to press the <ESC> key. This will put you in a mode in which you can use the "special editor functions." A help menu wull be displayed. To leave this mode and resume normal editing press the <ESC> key again.

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.

Files, Pathnames and File Names

Programs such as the TRIAL program above are stored in separate files. Each program added to the disk must have its own path or file name. An Apple pathname consists of 64 or fewer letters and/or characters. An Atari file name consists of D1: followed by an 8 character name followed by a 3 character extension (e.g., D1:XXXXXXXX.YYY). Spaces are not permitted within either pathnames or file names.

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.

Cursor Movement

Kyan PASCAL includes an easily learned, full-screen, insert mode editor. Anywhere you move the cursor, a letter, a number, a space, or even a new line break may be added. This greatly facilitates editing your program.

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 file
Many 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.

Delete Commands

To delete a letter, word or line use the following commands:
^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 positioned
The delete key <DEL>, if present, accomplishes the same task as ^Q.

Find String and Change String (Search and Replace)

string is a combination of characters (letters, numbers, and symbols) and spaces. A string may be a certain word or a group of words.

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 file
To 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

Edit at Line - N

To edit a specific line use the command:
         <ESC> G
When 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.

Including a File

If you wish to include one file in another use the <ESC> I command. When you enter <ESC> I the editor will prompt"
         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.

Block Move Commands

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 menu

List 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 printer

Other Commands

^<RESET> Stops program during run time -- Apple ][ Only <BREAK> Stops program during run time -- Atari Only

Previous Section | Table of Contents

Appendix A - Compiler, Assembler, and Run-Time Error Messages

Compiler Error Messages
  1.  syntax error
  2.  unexpected end of input
  3.  array dimension expected
  4.  to or downto expected
  5.  type specification expected
  6.  ordinal type expected
  7.  := expected
  8.  : expected
  9.  , expected
  10.  ; or end expected
  11.  compiler directive expected
  12.  do expected
  13.  end expected
  14.  = expected
  15.  identifier expected
  16.  [ expected
  17.  constant expected
  18.  ( expected
  19.  of expected
  20.  type identifier expected
  21.  . expected
  22.  program expected
  23.  ] expected
  24.  ) expected
  25.  ; expected
  26.  .. expected
  27.  then expected
  28.  unsigned integer expected
  29.  file name expected
  30.  can't open file
  31.  illegal file name
  32.  ; or until expected
  33.  missing end statement(s)
  34.  extraneous end statements(s)
  35.  ; or case expected

Assembler Error Messages

  1.  A addressing mode error
  2.  L label required with EQU
  3.  M multiply defined symbol
  4.  U undefined expression
  5.  O unrecognized opcode
  6.  S syntax error
  7.  J branch address is out of range

Run-Time Error Messages

  1.  bad subscript
  2.  too many active files (Maximum is 5 files)
  3.  file not active
  4.  set element out of range
  5.  heap overflow
  6.  bad ln(arguement)
  7.  bad exp(arguement)
  8.  read past eof (End of File)
  9.  out of memory
  10.  arithmetic overflow