Radio Shack TRS-80 Micro Computer System Tiny Pascal software User's Manual
पीडीएफ
दस्तावेज़
विज्ञापन
विज्ञापन
To
Contents
NOT J
EA
VATS Pm A
PASEA Instructions ...............
6 / Using the 32K Tiny jy |
~~ 7/Error Codes ............. PY
= 8/ Useful Calls and Addresses PT
TENE BLOCKADE PRES
e (US ET ERE АА АААААНИИИ
LJ
-
-
Г.
Pa
LJ
LJ
Ll
Li
Е В / Sample Programs ... EEE
C / Syntax Diagrams. . м $ TES
Customer a TEO
[3
Вася
rete NI
5 1 1 / fy. of the System ETT
Radio SI Tiny Pascal í isa cassette- based system for creating, editing,
REIL executing Pascal programs. Tiny Pascali isa subset ofthe
standard Pascal bu |
This manual summarizes Tiny Pascal И explains how to use и, on the e e
Level II TRS- 80. С
Эка са hal Ч
С
A i. ЙЕ В (PEE 4 ar JUN 4 FEF DE SI
- E Cy Y PS
CUSTOM MANUFACTURED IN THE USA BY RADIO SHACK EA DIVISION OF TANDY CORPORATION
<A,
1/ Overview of the System
Tiny Pascal is a complete, self-contained operating system for creating, compiling,
running, saving and loading Pascal programs for the TRS-80. Once you have loaded
Tiny Pascal, you can use all the ‘ ‘subsystems’:
Monitor: Provides run-time support, checks for errors, and provides the
necessary utilities to save and load programs to and from cassette tape.
Compiler: Compiles your PASCAL source program into P-code, ready to be
executed. The compiler also checks for syntax errors.
Editor: Lets you create or modify Tiny Pascal source programs.
All three sub-systems are loaded simultaneously, and are always present in RAM,
unless you choose to overwrite portions to free memory space.
The minimal system requirements are: LEVEL 11, 16 K RAM. You will need at
least 32K to examine the Compiler source. (See Chapter 6.)
Overview of this Manual
Chapters 2 through 4 of this manual discuss in detail the three sub-systems, what
they do, and how to use them. Chapter 5 deals with the specific aspects, limitations
and enhancements to Tiny Pascal. Then follows a chapter on Getting Started to help
you get through the first time you bring Tiny Pascal up. Finally, you will find the
error codes, syntax diagrams, listings of sample programs. and other useful
information.
2/ The Monitor
All operations make at least some use of the Monitor, so we will begin our
description of the Tiny Pascal system with it. The Monitor provides run-time
support to the entire system, as well as providing you with a means of
saving/loading your source programs and P-code (compiled) programs via cassette
tape. From the Monitor you also give the command to compile a program. or to run
that program once it has been compiled. You also invoke the Editor from the
Monitor.
Monitor Commands à vriwes 19
E Edit old source file or create a new one.
C Compile source program into P-code, ready to be executed.
P-code 1s stored after source in RAM. |
C/-P Compile source, but do NOT generute P-code (useful for checking
a for syntax errors)
C/-S _ Compile source, and overwrite the source program with P-code
(used when you have very large programs). You will have to
reload or retype the source program if you want to edit it later.
R Run the compiled program.
R-C Run the compiled program and overwrite the Editor and the
| | Compiler. You will have to reload the Pascal system if you want to
editor compile a program later.
LS filename Load source program from cassette.
LP filename Load P-code program from cassette.
WS filename Save source program to cassette.
WP filename Save P-code program to cassette.
Note that you may choose to overwrite sections of the Tiny Pascal system if you
need the space for a large program. However, you must remember that the
overwritten sections are gone and you must re-load the entire system if you are to
use them again.
A file name can be at most six characters long. When loading a program, either in
source or P-code format, the file name must be entered exactly as it was saved on
tape. That is, when loading the Tiny Pascal system or when reloading a program
which you have saved, you must be sure to use the correct and complete name.
If you accidently type in the wrong file name when requesting a load, the Tiny
Pascal system may never return control to the keyboard and you will have to reset
and reload the entire system again. Also, there is no way to find out the names of
files on tape, so you must remember exactly what you called the file when you
recorded it.
3/ The Editor
The Editor provided with your Tiny Pascal package enables you to create and
modify source programs.
The Pascal Editor is line oriented, but, unlike BASIC, does not use line numbers
since they are not used in the Pascal language. The maximum number of lines of
text that you can have is 600, and the maximum line length is 130 characters.
All Editor commands are single characters: some may have numeric arguments
following them, or a character string. In our discussion of the Editor. xx refers to
integer numbers (1-999), and string refers to a string. Each command ends with a
carriage return (ENTER) on your TRS-80 keyboard). Invalid commands are flagged
with the message "ILLEGAL".
The line pointer always points to the line most recently displayed, modified or
inserted. After a Delete command, the line pointer is moved up one line. When you
first load the Tiny Pascal system, a sample program is loaded in, too. Thus. when
you type “LE to enter edit mode, a file is already there. You will see a **>"". This is
the prompt from the editor that lets you know that it is waiting for a command (not
text). The commands are listed below. _
To erase a source program, use the “D* command. After a D*”, the editor will
automatically put you into Insert mode and wait for text.
Editor Commands
Note: ‘*’ means entirely or ‘all the way”:
y у
ENTER A carriage return on an empty line will exit from Insert mode
P Prints the current line 24 le reee
Pxx Prints xx lines starting from current line
P* Prints entire file
U Moves up one line
Uxx Moves up.xx lines
U" Moves up to top or first line of file
#5»
Editor commands. continued
N Moves line pointer to next line (down)
Мхх Moves line pointer down xx lines
N* Moves line pointer to last line of file
D Deletes current line
Dxx Deletes xx lines starting at current line
D* Deletes entire file. This will automatically put you into Insert
mode and wait for text.
| Enters Insert mode. Begins inserting lines after current line
pointer. À *?" is displayed to prompt you. Press (ENTER) at the
beginning of a line to exit from Insert mode.
Rstring Replaces the current line by String
X Extends line. The current line is displayed and the cursor is
positioned to the end of the line, allowing characters to be
appended. Press (ENTER) to save changes and return to
ra pty,
HN ig
the Editor.
S Displays Status: Number of lines, file location, position of line
pointer. |
Q Quits and returns to the Tiny Pascal Monitor :
a
The Editor also recognizes two special keys: the back arrow @ for backspace,
and the rightarrow € for tab, which is three spaces. These two keys may be
used at any time forediting a command or input file. @ over a tab moves the
- cursor three spaces back on the display and erases the tab.
To illustrate: If you want to enter a program, you would type ‘’E’ from the
Monitor, then you would type ‘1’ for Insert. You then can enter text. To stop.
entering text, you press (ENTER) on an empty line,
If a “MEMORY FULL” error occurs while editing or inserting, the source file is too
big. You may be able to pack in the program by eliminating extra spaces and tabs.
You should experiment with the editor for awhile to make sure that you completely
understand its operation.
ARR RS sr men
oR SA TARA
4/ The Compiler
A compiler is a program that translates the statements of a high-level language into
an equivalent program of machine-readable form. Tiny Pascal translates the
high-level source program into an intermediate file called P-code. The P-code is
then interpreted, using the run-time Monitor for support. The result is a program
which executes at least four times faster, and up to eight times faster than BASIC!
Tiny Pascal is a subset of standard Pascal. The syntax is essentially identical to the
full language. Syntax diagrams have been included in Appendix C for those who
are just now learning the language.
This manual is not an instructional text on Pascal programming, but rather an
explanation of the limits and special features of Tiny Pascal. However, we will
review some essential points in the next section.
For those who need a more thorough introduction, we recommend the following:
Programming in Pascal; Grogono. Addison-Wesley, 1978
Pascal: User Manual and Report; Jensen and Wirth. Springer-Verlag, 1974
A Primer on Pascal; Conway. Gries. and Zimmerman. Winthrop Publishers. 1976
Pascal, An Introduction to Methodical Programming; W. Findlay and D.A. Watt,
Computer Science Press, 1978 |
Compiler Specifics
Note: See the Index for a complete list of Pascal keywords .
|. Maximum number of procedure or function parameters is 15; maximum
number of procedure nests is seven levels; the symbol table is restricted te 75
entries (200 for big version).
2. ‘“:="" is used for assignment and ‘“ =‘ is used for equality. They are not
interchangeable!
3. “J” 1s used to separate statements, not to end statements. Thus the last“; in
. ER че Cea
Te EEE RA - Pet tar
a compound statement: =
rampe
BEGIN statement °
statement;
IF exp THEN exp ELSE exp;
statement;
END .
is not necessary. (It is, however, allowed since a Pascal statement can be a null.)
Note also the absence of “*;”* before an ELSE or an END in a CASE statement.
EA ALLENDE ARI ES iris 1e ue ee ae 8e 0
4. Expressions may be either arithmetic or logical (Boolean). Thus, the following
are legal:
A:=B>C;
IFA+B THEN...
Note: The Boolean operator OR has the same precedence as the arithmetic
operators ‘“ +’ and ‘“— ’’. AND has the same precedence as *** "and Div, etc.
[tis important to remember that OR and AND have precedence over =" <"",
etc., thus the need for brackets at times as shown below:
IF (A < 10) AND (A > 5) THEN...
The statement:
IF A < 10 AND (A > 5) THEN...
Would be parsed (analyzed) as:
IF À < (10 AND (A > 5)) THEN...
Thus producing an unintended result.
There are some context-sensitive rules and meanings that cannot be inferred from
the syntax diagrams, and may be particular to this implementation:
5.
6.
For the TRS-80, “(and'**)” are used instead of “| and)”.
Identifier names must start with a letter and may be followed with letters or
digits, but only the first four characters are significant. However, reserved
words must be typed in full.
. Identifiers must be declared before used. Identifiers can be declared twice,
but only the last one is used. Formal parameters of a procedure need not (and
should not) be declared again inside the procedure.
. Parameters are passed to procedures or functions by value, 1.e. a copy of the
value of the parameter as defined before the call.
. The scope rules for identifiers are the same ones used by any block-structure
language. The scope of a variable 1s the procedure that contains it. An inner
procedure can use a variable defined in an outer procedure.
10. The only data types Tiny Pascal supports are integers and one-dimensional
integer arrays. The integers are 16-bit signed. The arrays start at 0. Arrays are
not checked for subscript-oyt-of-range at runtime.
PRS HITT i PERRY i oY TERA EAT ЛЬ
ae ME frm Es a io a | 4
11. Built-in functions:
Function Meaning
ADIVB Truncated Integer division: 27 DIV5 = 5
A MOD B À — (ADIVB)'B:27 MOD5 = 2
ASHLB Binary | eft Shift A by B:27 SHL 5 = 54 TY SEL 2 =
ASHRB Sr y... Right Shit A by B:27 SHR 2 = 13 . WISE =
The built-in array MEM can be used to read to (if it appears in the left side of an
assignment) or from (if it appears in an expression) a specified memory
location, such as:
A:= MEM (24467) +3; (* READ FROM MEMORY")
MEM (T):= 0; (WRITETO MEMORY*)
A second form of the MEM function is MEMW. This enables a two-byte word to
be read to or from memory using the same convention as for MEM. Note: The
low order byte comes first. in accordance with INTEL convention.
12
ue
Hex constants are prefixed by “%”',e.g., %2A00 —
13. Strings are enclosed by ET quotes! ). по! double e quotes € Ш Whena stn ng
j value of the first character of the string. When a a string g appears in nthe WRITE
- statement, the entire string w ould be output. For example:
X:= "ABCD
X would equal 65 (ASCII VA
14. TheREAD and WRITE statements are character-oriented, not linc-oriented.
More than one character can be input or output with a single statement.
Decimal. TT or hex numbers can be read in from the keyboard by a “4”
(decimal) ог "" (hex) after the variable in the READ statement. Similarly. a a
decimal integer can be printed on the output device by following the
expression with the appropriate * 4” or '%' for hex.
READ (A,B,C, 1#,J%)
This would READ three characters, a decimal number, and a hex number.
A:= 65
WRITE (HELLO?B',A, Y, Ax, 'B', A%)
would print:
HELLO? A 65 0041
Note: “Y represents a blank space. Itis used only where necessary for illustration.
BE ке
=== I5. Since the READ is character-oriented, it is neccessary to terminate an integer
input by a non-integer character (such as (ENTER) or SPACEBAR)). Toinputa_
hex number, four digits must be typed.
16. To write on a new line, it is necessary to output the ASCII code for carrlage 5
return/line-feed to the output device. That is, you must manually insert a
carriage return/line feed. For the TRS-80 this can be accomplished by outputting
the carriage return alone. (The TRS-80 software does the rest.) For example:
WRITE (THISIS A TEST’, 13)
+”
Note: 131s an ASCII “carriage return”.
17. Anexpression in the IF, WHILE, and REPEAT statements is said to fulfill the
condition if the least significant bit is one. This is equivalent to testing whether
the expression is odd. Thus after:
IFXTHENA:= 1ELSEA:= 100
A would have the value of one if X is odd, and 100 if X is even.
18. The relational operators (* =", =>", etc.) always produce a value of
zero or one. Thus after:
A:= Х = 5;
A equals one if X equals five; otherwise A equals zero.
19. Comments are opened by COR and closed by ***)”.
Ay
20. Here is a list of built-in functions and procedures:
ABS(exp) Returns the absolute value of exp
CALL (exp) A user-defined machine language subroutine where exp
is an address to the routine.
Subroutines must conform to the following:
I). Save all registers upon entry.
2). Restore all registers before exiting.
3). Return from the subroutine in the following fashion:
INC DE
INC DE
RET
INKEY Inputs from the keyboard, used like this: A : =
A ont Туан
INKEY
Inputs port exp, used like this: A = INP(exp)
a
Turpin peek ov —
Move a block of memory of bytes from address a
to address b.
Outputs ato porta,
Plots ‘graphics to screen ‚using the x X-y v coordinates.
la 1s odd then plot is set’, if aiseven then plot is
e
EJE DE
ВНЕ) FE Pa
“reset”
POINT(x,y) Just like BASIC: Returns one if the point is set, zero if
not set.
SQR(exp) Returns square root of exp.
21. The screen control characters are the same as TRS-80 BASIC. For example,
use WRIT E (28,31) to clear the screen.
5/ Starting Instructions €
10
5
"In this section, we will go step-by-step from loading the tape the first time, to ( L 5) 7
running your first program. Side One of your tape comes with three sample
programs: the first is loaded with the system, the second is HILBER and the third is
BLOCK. Side Two contains the big 32/48K compiler and source to Tiny Pascal,
PAS32K and COMPS1 respectively.
Start-Up
1. Turn on your machine. When asked for MEMORY SIZE. respond by pressing
ENTER).
2. Type ‘‘SYSTEM’’ (ENTER), to reach system level, You will see KV TO
ta
=>
3. Make sure that your Tiny Pascal tape is at the start, and type PASCAL. then
(ENTER) and put the recorder in the Play mode.
4. The tape will begin to load, and the asterisk will blink every four seconds. The
entire load will take about three minutes. — /22 5727
2 ta wi di
UA
“7” CENTER) a
TINY PASCAL vr
where X is the version and Y the release number.
6. Atthis point you have successfully loaded the entire Tiny Pascal operating
system, and can proceed to the next section below. If you did not get this far try
loading the tape again. Try various volume settings.
AE
LF
Creating a Program
|. From the Monitor, type E”. This will place you in the Editor. You will see a set
of statistics on the current file. A sample program is loaded with Tiny Pascal. If
this is your very first try, then skip ahead to step 5, otherwise proceed.
2. Todelete the sample program whichis always loaded with the system, you
simply use the editor command: "p+" Remember, 'D*' will delete all lines and
put you in the Insert mode.
3. Atthis point you may enter a program.
4. Once your program is entered, you may exit the Insert mode by pressing CENTER)
at the start of a line. This puts you back in the Editor command mode.
>. Toreturn to the Monitor, to compile, etc., you press (©) for “Quit”.
Compiling, Running, Saving/Loading a
Program
1. Normally, to compile a source program, you press ( € ) (ENTER) from the
Monitor. This creates P-code. If you have any syntax errors, they will show up
here. If you have syntax errors, the error list in Chapter 7 will tell you what they
are. You should then go back and edit the existing source file to correct the
syntax errors before re-compiling.
Note: Other options for compilation are discussed on the next page and on page 2.
to
. Once you have successfully compiled the program, you may run it from the
Monitor by typing: R (ENTER) from the Monitor.
3. Tosave the program, or the P-code, you may use the appropriate Monitor
commands. That is, WS filename” to save the source file (program text), or
“WP filename’ to save the P-code file. Or, at this point, you could start a new
program, or load a previously stored program from tape.
4. Remember, you must re-compile a program if you make a change in it!
5. Toload a previously stored program, you would use either the ‘LS filename" to
load the source (text) file, or the LP filename" to load the P-code (object code)
file. If you forget and accidentally try to load an object file as a source file, or
vice versa, errors will result and youmay have to reload the Tiny Pascal system.
11
Ta 7 Zi E ae? - wh ты 13 rid WE SN
Ra LIE я
Special Notes
The (BREAK) key causes a pause in program execution; press any other key to
resume. If you press (BREAK) twice in a row, you will terminate the run, and return
to the Tiny Pascal monitor. a
Once a program has been compiled, only the P-code (that is the compiled program)
need be loaded for execution. In other words, it is not necessary to compile before
each execution if you have saved the P-code on tape.
If an error "1001" occurs during compilation, there is not enough memory. You
should try using "C/-S". Be sure to save the source first!
When a "MEMORY FULL" error occurs while running the program, either cut down
your array size or try using the "R/-C” option. Be sure to save the source first!
We know that you will enjoy using Tiny Pascal, and recommend that you play with
it a while just to get the hang of it and to become familiar with all its features.
12
6/ Using the 32
On Side Two of your tape is an expanded Tiny Pascal compiler. That is, it can
handle larger programs. You will need at least 32K RAM to use it. It is exactly the
same as the 16K version, except that it will use all the memory that you have in your
machine.
To use 1t, simply follow the directions in Chapter 5, for starting Tiny Pascal, except
substitute ?PAS32K” for “PASCAL”. The source to the compiler is immediately after
"PAS32K" on Side Two. ltis called: "COMPS 1”. To load this file simply type: "LS
COMPS1”. You can then examine the source to the compiler. You do not need to do
this to run the 32K version; it is for your interest only. You can use it to study the
design and exact implementation of Tiny Pascal. The source to Tiny Pascal is
written in Tiny Pascal and should provide hours of enjoyment.
Note: Programs are not interchangeable between the two compilers. That is, a
program created using the 32/48K compiler cannot be used with the normal
compiler, and vice-versa.
13
7/ Error Codes
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
14
© о мо HAWN =
Error In Simple Type
Identifier Expected
“Program” Expected
“)" Expected
“: Expected
llegal Symbol
Error In Parameter List
“Of” Expected
“(" Expected
Error in Type
: “(Expected
“)" Expected
: EndExpected
: “;" Expected
: Integer Expected
; “=" Expected
: “Begin” Expected
: Error In Declaration Part
: Error in Field-List
: “Expected
: “*” Expected
Error In Constant
“: =" Expected
“Then” Expected
“Until” Expected
“Do” Expected
“To’/“Downto” Expected
“If” Expected
“File” Expected
Error In Factor
Error In Variable
Identifier Declared Twice
Low Bound Exceeds High Bound
Identifier Is Not Of Appr. Class
Identifier Not Declared
Sign Not Allowed
Number Expected
Incompatible Subrange Types
File Not Allowed Here
Type Must Not Be Real
Tagfield Type Must Be Scalar
# №
111
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
Incompatible With Tagfield Type
Index Type Must Not Be Real
Index Type Must Be Scalar
Base Type Must Not Be Real
Base Type Must Be Scalar
Error In Type Of Standard Procedure Parameter
Unsatisfied Forward Reference
Forward Reference Type Identifier in Variable Declaration
Forward Declared; Repetition Not Allowed
Function Result Type Must Be Scalar
File Value Parameter Not Allowed
Forward Declared Function, Repetition Not Allowed
Missing Result Type In Function Declaration
F-Format For Real Only
Error In Type Of Standard Function Parameter
Number Of Parameters Does Not Agree With Declaration
lllegal Parameter Substitution
Result Type Of Parameter Function Does Not Agree With Declaration
Type Conflict Of Operands
Expression Is Not Of Set Type
Tests On Equality Allowed Only
Strict Inclusion Not Allowed
File Comparision Not Allowed
legal Type Of Operand
Type Of Operand Must Be Boolean
Set Element Type Must Be Scalar
Set Element Types Not Compatible
Type Of Variable Is Not Array
Index Type Is Not Compatible With Declaration
Type Of Variable Is Not Record
Type Of Variable Must Be File Or Pointer
lllegal Parameter Substitution
legal Type Of Loop Control Variable
Illegal Type Of Expression
Type Conflict
Assignment Of Files Not Allowed
Label Type Incompatible With Selecting Expression
Subrange Bounds Must Be Scalar
Index Type Must Not Be Integer
Assignment To Standard Function Is Not Allowed
Assignment To Formal Function Is Not Allowed
No Such Field In This Record
Type Error In Read
Actual Parameter Must Be A Variable
Control Variable Must Be Neither Formal Nor Non-Local
Multidefined Case Label
Too Many Cases In Case Statement
Missing Corresponding Variant Declaration
15
159: Real Or String Tagfields Not Allowed
160: Previous Declaration Was Not Forward
161: Again Forward Declared
162. Parameter Size Must Be Constant
163: Missing Variant In Declaration
~~ 164: Substitution of standard Proc/Func Not Allowed
165: Multidefined Label
166: Multideclared Label
167: Undeclared Label
168: Undefined Label
169: Error In Base Set
170: Value Parameter Expected
171: Standard File Was Redeclared
172: Undeclared External File
173: (Not Relevant)
174: Pascal Procedure Or Function Expected
175: Missing Input File
176: Missing Output File
201: Error In Real Constant: Digit Expected
202: String Constant Must Not Exceed Source Line
203: Integer Constant Exceeds Range
204: (Not Relevant)
250: Too Many Nested Scopes Of Identifiers
251: Too Many Nested Procedures And/Or Functions
252: Too Many Forward References Or Procedure Entries
253: Procedure Too Long
254: Too Many Long Constants in This Procedure
255: Too Many Errors In This Source Line
256: Too Many External References
257: Too Many Externals
258: Too Many Local Files
259: Expression Too Complicated
300: Division By Zero
301: No Case Provided For This Value
302: Index Expression Out Of Bounds
303: Value To Be Assigned Is Out Of Bounds
304: Element Expression Out Of Range
398: Implementation Restriction
399: Variable Dimension Arrays Not Implemented
1000: ‘ Missing
1001: Out Of Memory
8/ Useful Calls and Addresses
HEX
ADDRESS
4180
4182
4184
4186
4188
418A
4186
418E
4190
4192
4194
4196
4198
419A
41A0
41A2
41A4
FUNCTION
Starting address of user source program
Ending address of user source program
Start of P-Code
End of P-Code
Address of editor
Address of compiler
Start address of user source program (again)
Address of runtime stack
Ending address of runtime stack
End of memory address (7FFF for 16K)
Monitor entry point
Address of program currently executing
Complement of contents of 418E
Overflow message flag — default 0
Call address: console in (waits for key press)
Call address: console out
Call address: Inkey (input from keyboard, does not wait
for key press, i.e. returns at once.)
17
a E ET Bi icmp iii
má fig + U а . e a
© ir rpm memes e a ee
La SS AP bi -
9/ The Rules to BLOCKADE
The sample program BLOCKADE (called BLOCK) is loaded with the Tiny Pascal
system. The rules are the same as the amusement hall versions. Each player tries to
a box in the other.
The game accepts commands from two players simultaneous! y. Each player moves
his/her man using the keys illustrated below:
Left-Side Player Right-Side Player
(W)— up (0) — up
let — (А) (D)— right ей — (К) (3) — right
(X)— down (.)— down
The speed is user selected between one and ten, with one being the fastest and ten
the slowest. Three to four is about right for be ginners.
AE
Se
16K Version
Appendix A/ Memory Maps
4060
4100
4180
41A0
41E0
473A
498E
5BCO
62A0
6ABO
EBDO
7FFF
Reserved Ram For
Interpreter & Monitor
Entry Points Table
System Control Block
1/0 Routines
Interpreter;
Runtime Routines
Monitor
User Memory For
Source & P-Code
(4.5) |
Runtime Stack For
Editor or Compiler
(1.75)
Editor P-Code
Compiler Table
Compiler P-Code
Assumed end of memory
32K/48K Version
4060
4100
4180
41A0
41E0
473A
4990
5690
SEAO
5FCO
73F0
Reserved Ram For
Interpreter & Monitor
Entry Points Table
System Control Block
1/0 Routines
Interpreter:
Runtime Routines
Monitor
Runtime Stack For
Editor or Compiler
(3.25)
Editor P-Code
Compiler Table
Compiler P-Code
User Memory For
Source & P-Code
el MACIZA EA
E —]]]]] "¿A
19
Appendix B / Sample Programs
CA SAMPLE TINY PASCAL PROGRAM BY H. YUEN #2
VAR HE, Ya. X.Y. Ks FL INTEGER:
BEGIN
Xe: =1<066; YE:=15066: F:=11;
REFEAT »%:=56: Y: =76: MHEITECL1S, 28, 317:
FOR K:=1 TC 16686 DO BEGIN
4;
Asie DIV 45 Vi =¥-X DIV S
FLOT Cx SHE &. T SHR . 15 END:
AA =40+40 DIV Fi Ya:
F:=F+F DIV 6
UNTIL F276; WKITE<SZE. 21, “THE SHOW IS QYER”?
END.
verve DIV Fa
Lage
- Ш NEPLOT HILEERT CURVES OF ORDERS 1 To Aa)
- CONST Aza: HATE:
VAR Is Hi AC. кб. Те LY INTEGER:
PROC MOVE:
VAR I. J: INTEGER:
FUNC MINCA, ED;
EEGIN IF ASE THEN MIN:=E ELSE MIN:=A END:
FUNC MARTA, ED:
EEGIN IF AE THEN MAX:=B ELSE MAX: =f END;
BEGIM FOR Ic:=MINCS. UT TO MAS. LO DO
FOR J:=MINCY Y? TO MAS. YY DBO
FLOT<I, J, 4°:
MIS v.=y
END;
PROC POTYEF, To;
BEGIM IF IZ THEN
CASE TYF OF
1: BEGIN Fs, I-19: Mi=X-Hi MOVE:
Pai, I-17: УМЕН: MOE;
Pi. I-17: S:ES+H: MOVE:
Pus. I-17 END:
EEGIM FOZ, 1-12; Y: =y+H: MOVE:
Foz, I-12 x:=x+H: MOVE:
Foz: I-12 МЕН: MIE:
Fe 2 END:
X FEGIN AlL5ATH: MUES
:5'+Hi MOVE:
Le
ed fo BT fo хор
1-1.
2. 1
Foxe I-10
pa 1-12; H:=#-H; МОМЕ:
1-12 END
4 BEGIN Fri. I-139: Yı=Y-Hi MOVE:
Fody I-10 m:=k-H: MOVE:
Fa I-10: Wi=Y+Hi MOVE:
I-i
à ENC
Er
END:
EEGIN +MAIHES
HRITECIó, ZE, Z1, 1%. HILBERT CURYES ">;
I:=6: H:=H6: ®8:=H DIY 2: Ya: =;
FEFERT I:=I+1:;: H:2H DIV 3
SMA =XE+H DIV 2: Ya: == 8+H DIN 2
ERECT = 0320 Y: 216: U=4: М; =;
Fol, Io
UNTIL I=N
END.
21
- CRELOCKRDE. BY KM CHUNG, 4-26 To)
; YAR I. J. SFEED. ABORT. BELME INTEGER:
SCORE. MARE. MOVE. CURSOR: ARRAY 1) OF INTEGER:
PROC FECORE:
EEGIM HRITECSCORE CAN;
MEMWOHSARAZAY =NEFFE: CSET CURSOR
WRITE SCOREC1O8) END:
PROC BLINK:
VAR T. KE. DELAY: INTEGER:
BEGIN T:=CURSORC I ~MOVECT
FOR K:=1 TO za DO EESTI
FOR DELAY:=1 TC 166 Co;
IF MEMWCT »=BLHE THEN MEMMCT) =MARE CT
ELSE MEMMC Ty =BLMNE
EM
END:
BEGIN WRITEC SFEEDC1-163 “0;
READCSFEEDH): SFEED: =SPEEDw#16;
MARECOS |= €" +4 SHL В: MARKCL)Y (= 0 +73" SHL &
ELNE:=" “+ “SHL E;
SCORE (GG :=£; SCORE (15: =6;
REFERT WRITEC1S. 20.315: C4+TURN OFF CURSOR, CLEAR SCEEEN+ ;
FOR I:=3 TO 117 Do BEGIN É
PLOTCI, 4.15: FLOTCI, 45,1% END;
FOR I:=1 TO 45 DO BEGIN
FLOTCS, 1.15; FLOTCL8, I, 13;
FLÜTC1L1E, 1.49; PLOT(147, 1.15 END:
CORSCR ES: =SICQG+Ed+4+12;
CURSOR CAD
.
LE met fe? Toy
зн;
HH
MOVE LES i =54: MOVECL) =—5d;
I:=1; ABORT:26: FSCORE:
FEFEAT UNTIL INEETYCIÓ: C+HIT KEY TO START:5
FEFEAT I:=1-1:
FOR J:=1 T0 SPEED DO
CASE INEEY OF
HS MOVE CAS: =-64: MOVE CES - =Ed;
“DS MOVE CES =2; ASC MOVE CES =-2;
OSI MOVE R1 TN =-64: 7 :MOYEC4) :=d:
MOVE C10 =7; "KO MOVE CL =D
CURZORCID (=CURSOR CI J +MOVE CT 3;
IF MEMMCCURSOR:IS)=ELNK THEN MEMWCCURSOR CT >» =MARK CT 2
ELSE BEGIN SCORE€(1-I>:=SCOFE©1—1>+{4;
ABORT :=1; ELIME END
UNTIL ABORT
UNTIL SCORECi-1>>=16
END.
22
VARIABLE (==) EXPRESSION |
PROCEDURE IN A
\_ PROCEDURE aq ©
— BEGIN | —>STATEMEN В END
EXPRESSION (THEN STATEMENT (ELSE) STATEM ENTE - A
N—(case)—| EXPRESSION |— (OF) CONSTANT (+) ETATEMEN STATEMENT
JD
WH (WHILE) | EXPRESSION | STATEMENT : A
(REP TE [STATEMENT en | EXPRESSION | В,
o
(For) —IDEnTIFER-— (1) EXPRESSION | CZ ON | TEMENT | 4
Ш Ш VO Comnro
DO и
EXPRESSION [ \ >
5)
»
(EM (с) | EXPRESSION | (63) EXPRESSION | J
23
PROGRAM
——e|BLOCK (+)
BLOCK
{Na
я NN
— (Cas)
INTEGER )-
TE
- О-
(овен ее OM
N— | -
STATEMENT (END) ——
BEGIN
FACTOR
MA
\ + |CONSTANT| 7
[VARIABLE A
A
FUNCTION )
| FUNCTION
(Ne
—— (7 — | FACTOR | НК A
к
—O9— O — Es —O >
——e SIMPLE EXPRESSION -
| А
SIMPLE EXPRESSION
OT =
Co
[sim PLE EXPRESSION
©
TERM In
TERM a
FACTOR} x x x x y y .
FACTOR 7 | | |
VARIABLE
: * ~[10enTiFIER] -
0
CONSTANT
`` —[ipenTiFiER} и +
— [nece] A
—-| STRING | A
Ea) —
IDENTIFIER
————| LETTER)
25
INTEGER
e | ) ÓN .
*(') [ «(CHARACTER) ) +\) .
HEXINTEGER
26
о ВР.
Ta
">
/
डाउनलोड
बस एक दोस्ताना अनुस्मारक. आप दस्तावेज़ को यहीं देख सकते हैं. लेकिन सबसे महत्वपूर्ण बात यह है कि हमारे AI ने इसे पहले ही पढ़ लिया है. यह जटिल चीजों को सरल शब्दों में समझा सकता है, किसी भी भाषा में आपके सवालों के जवाब दे सकता है, और सबसे लंबे या सबसे जटिल दस्तावेजों को भी जल्दी से नेविगेट करने में आपकी मदद कर सकता है.
विज्ञापन