HISOFT PASCAL - VERSION 1.4
31. Remaining 1982
Part 1
FILE type is undefined.
The RECORD type cannot have variants.
Procedures and functions as parameters are under-
acceptable. The compiler takes approximately 12
To memory and 4K takes runtimes. They can
the following control co-
yes:
ENTER - enter a line;
DELETE - deleting a character;
EDIT - return to the editor;
CS+8 - move to the next position
bulation;
CS+5 - delete the entire line;
CHR(16) - screen/printer switch.
After loading HPCT, the screen will appear
question:
TOP of RAM?
You must enter either an integer decimalnumber (<=65536) or immediately press ENTER.
If a number is entered, it is used
as the last address of RAM+1, in
otherwise the vertex RAM is calculated
automatically. Installed at this address
the compiler stack is changed (i.e. you can re-
reserve RAM for any purpose;
RAMTOP<65536). The ZX-SPECTRUM top RAM
is the starting address for the UDG. Pos-
After pressing ENTER HP4T will set the following
question:
TOP of RAM for "T"?
In response, you can enter either decimal
number, or use a previously determined
divided value TOP of RAM. What you
enter will be used as a stack when
executing object code after command
"T" editor. After this HPHT you
will ask:
Table size?
What you enter will be considered
vary as the amount of memory used
under the symbol table. If you immediately press
ENTER, then table size: = available RAM/16
(usually this is more than enough)
but). If you enter the symbol E before a number,
then the built-in editor will become unavailable
nom. This procedure is useful when using
using an external editor
Part 2
Compilation and launch
The compiler generates a listing like:
xxxx nnnn source text of the string.
where xxxx is the address of the beginning of the code, generate
constructed by this line, nnnn is the number of the construction
ki.
If the string length is more than 8O characters,
the compiler inserts a newline character
ka". Listing can be printed on
printer using the $P option. For adaptation
To set up the listing output, you need to
press CS+SPACE (BREAK). If after this
press EDIT - return to the editor, when
pressing any other key - continued
tion of the output. If during compilation I find
wife errors, then the corresponding
messages and listing listings are available
stops. If you enter
symbol E - the system goes to editing
to indicate the displayed line if you enter
P, - to edit the previous line.
Part 1.Syntax and semantics
1.1 Identifiers.
The allowed length of the identifier is not more than
more than 1O characters. There are small and
big letters.
1.2, 1.3. UNSIGNED INTEGER, UNSIGNED
NUMBER
Integers have an absolute value of not more
more than 32767. Numbers with higher value
are treated as REAL. Mantissa REAL
has a length of 23 bits (i.e. 7 significant
numbers). Results of operations with REAL -
intimates; those. 2.OOOO2 - 2 <>
OOOOO2. Maximum number of REAL type
equal to 3.4E38, minimum - 5.9E-39. For
increasing accuracy should be avoided
there are zeros; so O.OOO123456 represents-
less accurate than 1.23456E-4 ( O - then -
the same number, and there can be no more than 7).
Hex representation of the number is allowed when
RAM address designation: #O3, #FF.
1.4 UNSIGNED CONSTANT
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ooooooooo consnant identifier ooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
oohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ooooooooo unsigned number ooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ooooooo NIL ooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ooooooooo character ooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Note that lines cannot contain
more than 255 characters. The string type is
is ARRAY [1..N] OF CHAR, where N is the target
loye O-255 inclusive. Literal
strings must not contain the EOL character
(CHR(13)) - otherwise the system
generates *ERROR* 68. The null character is
lyzed not as '', but as CHR(O).
1.5. CONSTANT
Use of controls is allowed
display codes as constants:
CONST bs=CHR(1O);
сг=CHR(13);
1.6. SIMPLE TOUR
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
oooooooooo ture identifier oooooooooo
oohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ooooooooo identifier ooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
oooooooh.. oooooooooooo
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Type defined as (identifier,
identifier,....) can have no more than
255 elements.
1.7. TURE
The reserved word PACKED is allowed
Timo, but ignored because the arrays are already
packed.
1.7.1 ARRAYs & SETs
The basic SET type can have up to 256
elements. Arrays of arrays are allowed,
arrays of sets, records with fields like
many, etc. HPCT uses e-
the vivalence of names, and not types, follows
specifically:
TURE
tabela=ARRAY [1..1OO] OF INTEGER;
tabelb=ARRAY [1..1OO] OF INTEGER;
the tabela variable cannot be assigned
military value of the tabelb variable because
they are of different type.
TURE
tabel=ARRAY [1..1OO] OF INTEGER;
VAR
tabela, tabelb: tabel;
in this case the variables tabela and ta-
belb have the same type, i.e. assigned
Setting tabela=tabelb will not cause an error.
1.7.2. POINTERs
There are some restrictions on the use
use of signs:
a) pointers to non-objects are not allowed
manifest type. This does not apply to cons-
instructions like:
TURE
item=RECORD
value:INTEGER;
next:eitem
END;
linK=eitem;b) a pointer to a pointer is not allowed
tel;
c) pointers of the same type are considered equal
vivalent, i.e.:
VAR
first:linK;
current:item;
d) the NIL constant is defined.
1.7.4. RECORDs
The WITH keyword is allowed for
more compact access to fields for
pussy.
1.7.5. FIELD LIST
1.9. VARIABLE
If the variable is declared as ARRAY
[1..1O] OF ARRAY [1..1O] OF INTEGER, then
to access element (1,1) of this mass
siva can be used: a[1][1] or
a[1,1].
1.1O. FACTOR
1.11. TERM
The lower bound of sets is always equal to
O, and the size of the set is always equal to the maximum
the maximum size of the base type. T.o.
SET OF CHAR always takes 32 bytes
(255 elements are possible per bit per element
ment), SET OF O..1O is equivalent to SET OF
O..255.
1.12. SIMPLE EXPRESSION
1.13. EXPRESSION
1.14. PARAMETER LIST
1.15. STATEMENT
CASE operator; A null CASE list is not
allowed, i.e. CASE OF END generates
error *ERROR*13. The ELSE statement is executed
Yes, if the selector (list of expressions)
not found in constant list. If you use
The END delimiter is used and the selector is not
detected, then control is transferred to
operator after END.FOR operator; Control variable
FOR operator cannot be structured
variable or parameter.
GOTO statement; Transition via GOTO is possible
wives only within the same block where
the GOTO statement is used and on the same
level. The label must be declared in
the same block where it is used. Met-
ka can contain from 1 to 4 digits. Ope-
GOTO cannot be used for
exiting FOR ... DO loops, procedures
or functions.
1.16. BLOCK
Using procedures and functions before
their definition
Procedures and functions can be used
called before their definition:
PROCEDURE a(y:t); FORWARD;
PROCEDURE in(x:t);
BEGIN
...
a(p);
...
END;
PROCEDURE a;
BEGIN
...v(r)
...
END.
Part 2.
Predefined IDs
12.1. Constants
MAXINT - maximum integer 32767.
TRUE, FALSE - Boolean constants.
12.2 Types
INTEGER
REAL
CHAR
BOOLEAN
12.3 Procedures and functions
12.3.1 I/O routines
2.3.1.1 WRITE (e) - output 8-bit
expression values to the screen or printer.
CHR(8) - (CTRL H) return cursoron
step back (BACKSPACE);
CHR(12)- (CTRL L) clear screen or
new printer page;
CHR(13)- (CTRL M) carriage return and
new line;
CHR(16)-(CTRL P) output switch
screen/printer;
WRITE (р1,р2,...,рп) is equivalent to:
BOOLEAN
12.3 Procedures and functions
12.3.1 I/O routines
2.3.1.1 WRITE (e) - output 8-bit
expression values to the screen or printer.
CHR(8) - (CTRL H) returns the cursor to
step back (BACKSPACE);
CHR(12)- (CTRL L) clear screen or
new printer page;
CHR(13)- (CTRL M) carriage return and
new line;
CHR(16)-(CTRL P) output switch
screen/printer;
WRITE (р1,р2,...,рп) is equivalent to:
BEGIN WRITE (р1); WRITE(p2);... ;
WRITE(rp) END;
The parameters p1, p2,..., pn can have
one of the following formats:
(e) or (e:m) or (e:m:n) or (e:m:H);
where e, m, n are expressions; H - symbolic
constant.
Let's consider 5 cases:
1) does not have type INTEGER: used
format (e) or (e:m): value of expression
It is converted to the character string type
followed by spaces. String length
can be increased (with leading pro-
white) when using the parameter m,
defining the total number of characters, which
which must be withdrawn;
2) it is of type INTEGER and is used
format(e:m:H); in this case e outputs -
in hexadecimal format. If m=1
or m=2, then the value is displayed ( e MOD
16^m ) no more than m characters long. If
m=3 or m=4, then the full value is displayed
expression e with a length of no more than 4 characters
fishing If m>4, then insert before the number
There are spaces. Example
WRITE (1O25:m:H);
if m=1, then 1 is output
m=2, O1
m=3, OCHO1m=4, OCHO1
m=5, OCHO1.
3) it is of type REAL, format (e), (e:m)
or (e:m:n); the value of e is converted to
a string of characters representing
number of type REAL. Form of presentation of op-
n is divided. If n is missing, then
the number is displayed in "scientific" form, i.e.
with mantissa and exponent. Minimum
the length of the "scientific" representation is 8
symbols, if the value m<8, then always
the full length of 12 characters will be displayed
fishing (if the number is negative).
WRITE (-1.23E1O:m);
if m=7, then it will be output
-1.23OOOE+1O
m=8 -1.2E+1O
m=9 -1.23E+1O
m=1O -1.23OE+1O
m=11 -1.23OOE+1O
m=12 -1.23OOOE+1O
m=13 -1.23OOOE+1O
If the format (e:n:m) is used, then
the number e will be output with a fixed
point, and n will determine the number of outputs
no decimal places. If n=O, then
the number e will be printed as an integer.
If e is significantly more than determined
format, then it is displayed in "scientific"form.
WRITE(1E2:6:2) 1OO.O
WRITE(1E2:8:2) 1OO.OO
WRITE(23.455:6:1) 23.5
WRITE(23.455:4:2) 2.34SSOE+O1
WRITE(23.455:4:O) 23
4) is not of type CHAR or string; withdraw-
lasts either one character or m characters
with leading spaces if necessary
we go.
5) it is of type BOOLEAN.
2.3.1.2. WRITELN
WRITELN gives a new line, which is equivalent to
tape WRITE(CHR(13)).
WRITELN (р1,р2,...,рп); equivalent to:
BEGIN WRITE(р1,р2,...,рп); WRITELN
END;
2.3.1.3. PAGE
The PAGE procedure is equivalent to WRI-
TE(CHR(12)), i.e. cleaning the screen or
new printer page.2.3.1.4. READ
READ - input data from the keyboard. Enter
carried out through a buffer, which is
initially contains only the EOL character.
The buffer is accessed via
a one-character text box.
If the text box points to
EOL marker, then before the end of the operation
input, a new line will be entered into the buffer
from the keyboard.
Consider the READ(V) procedure when di-
personal types V:
1) V is of type CHAR:
In this case, READ(V) simply reads
character from the input buffer and assigns it
V. If the text window in the buffer is installed
is assigned to the EOL marker (character CHR(13)), then
the EOLN function will return the value
TRUE and will be read from the keyboard
new line of text. When you re-
completing the read procedure, text window
will be set to the beginning of a new construction
ki.
Note that EOLN=TRUE at the beginning of the program
frames. This means that if the variable
in the first READ is of type CHAR, then the proc-
fool READ will return the value CHR(13) with
subsequent entry of a new line from the key
auras; subsequent execution of READ type
CHAR will return the first character of this
new line.
2)Vis of type string: By the READ procedure
lines can be read with a length determined
divided previously by type string or before
EOLN=TRUE. If the EOLN flag is set
until all characters in the line have been entered,
the number of which is determined by the type
string, then the string will be padded to
full length in CHR(O) characters. Please pay
Please note the note to point 1).
3) V is of type INTEGER: Maximum
number that can be entered in this
case, equals 32767.
2.3.1.5. READLN
READLN (v1, v2, ... , vn); equivalent
BEGIN READ(v1, v2, ... , vn); READLN END
READLN simply reads the new buffer from
keyboards. Thus, after performing RE-
ADLN EOLN becomes FALSE if
the next line is not empty.
READLN can be used to pro-
start an empty line at the beginning of execution
object code. This is useful if you
want to read a character of type CHAR at the beginning
le programs, but not necessarily if you
enter a character of type integer or real or
character from the following line.
12.3.2. Functionsinput.
2.3.2.1. EOLN
The EOLN function is a Boolean function
and returns TRUE if the following
The common input character is EOL-sym-
ox Otherwise EOLN=FALSE.
2.3.2.2. INCH
Keyboard scanning function. If
none of the keys is pressed, then the function
returns CHR(O), otherwise
case - a character of type CHAR, corresponding to
indicating the code of the key pressed.
12.3.3 Conversion functions
2.3.3.1. TRUNC(X): TRUNC(-1.5) = -1;
TRUNC(1.9) = 1.
2.3.3.2. ROUND(X): ROUND(-6.5) = -6;
ROUND(11.7) = 12;
ROUND(-6.51)= -7; ROUND(23.5) = 24.
2.3.3.3. ENTIER(X): X must be of type
integer or real.
The function returns the largest integer
number that is less than or equal to X for
any X. ENTIER(-6.5) = -7; ENTI-
ER(11.7) = 11.2.3.3.4. ORD(X).
2.3.3.5. CHR(X).
12.3.4. Arithmetic functions.
ABS(X) = eXe;
SQR(X) = X*X, result of the same type,
as X;
SQRT(X) = X, the result is always of type
al;
FRAC(X) = X-ENTIER(X), FRAC(1.5) =
O.5, FRAC(-12.56) = O.44;
SIN(X) = result of type real, X in ra-
dianas;
COS(X);
TAN(X);
ARCTAN(X);
EXP(X) = e^X, where e=2.71828;
LN(X).
12.3.5. Other functions.
NEW(p);
MARK(v1); store heap state in
variable v1;
RELEASE(v1); clear the heap from the address
ca indicated by variable v1, and up to
end;
INLINE (c1, c2, c3 ...), cn - Hexnumbers like #XX;
USER(V) subroutine call at address
V. For address designation, greater than #7FFF
(32767) it is necessary to use negative
telial values: #COOO = (-16384).
The subroutine must end with the command
doy RET.
HALT program stop with message issuing
tion: "Halt at PC= xxxx", where xxxx -
Nex address 3U in which HALT is located.
ROKE(X,U), X - memory address of type IN-
TEGER, V - expression of any type. PO-
KE(#bOOO, "A") - write to cell #bOOO
#41. ROKE(-16384, 3.6E) - place OO
OB 8O 7O at #COOO.
TOUT(name, start, size) - record re-
money on the tape. First parameter Name
must be of type ARRAY [1..8] OF CHAR.
Size byte of data is output to tape on-
starting from address Start (both parameters are of type
INTEGER) You can use real Hex
quantities.
TIN(name, start) - input from tape (see.
TOUT). TIN can be used to enter
texts into a CHAR array.
OUT(р,с) - value of parameter р type
INTEGER is loaded into the BC register, sim-
a free parameter with is loaded into the register
A, the OUT (C) command is executed, A pro-
processor Z8O.
12.3.6. Other featuresRANDOM - pseudo-random generation
numbers O-255. The function is ineffective;
more forest-like in some cases using
call self-written subroutines;
SUCC(X);
PRED(X);
ODD(X);
ADDR(V) - V parameter of any type, re-
The result is the address of variable V
RACK(X, T) X is of type INTEGER - address
memory, the second argument is the type of the result -
ta. If in 3U, starting with #SOOO it is written:
5O 61 73 63 61 6C, then:
WRITE RACK(#SOOO, ARRAY [1..6] OF
CHAR) will print Pascal
RACK(#SOOO, CHAR) P
RACK(#SOOO, INTEGER) 24912
REEK(#SOOO, REAL) 2.46227E+29
SIZE(V) - returns the amount of memory in
bytes occupied by variable V.
INP(p) = IN A, (C) of Z8O.
Part 3.
Comments and compilation options.
3.2 Compilation options
Option L (according todefault L+) Control
listing
L+ print of entire listing
L - prints only lines containing
errors
Option O (default O+)
Overflow control. All operations with
numbers like real and * and / with numbers in-
tegers are always checked for
overflow.
O+ control operations + and -
over integer numbers
O - do not check
Option C (default C+) Control
keyboard when executing object co-
yes. Pressing EDIT returns to the system.
topic with a message from the HALT command.
C - no control.
Option S (default S+)
S+ stack overflow control when
calling procedures and functions. In case of re-
When the stack is full, the following message is displayed: "Out
of RAM at PC = xxxx".
Option A (default A+) Control
array boundaries. In case of an error it displays -
message: "Index too high" or "In-
dex ltd low".
Option I (default I-)
Whenperforming comparison operations >,
<, >=, <= over 16-bit integers
lami if the arguments are divisible by a number
>MAXINT=32767, then an overflow occurs
tion. In this case, the result of the comparison becomes
seems unfaithful. For a correct comparison
To obtain such values, it is necessary to use
Use option I+. A similar situation can
can also occur with real numbers when
trying to divide by 3.4E.
Option P (used without + and -) Pe-
The printer/screen switch is similar
CTRL P on IBM PC.
Option F The name of this option must be followed by
followed by an 8-character name separated by a space
file (if the name is < 8 characters, its additional
are represented by spaces). In this case, the original text
programs from the specified file inserts-
after the line containing the F option.
(See 4T version 1.5)
Part 4.
Built-in editor
The editor commands look like:
C N1,N2,S1,S2 ;
C - the command being executed,
N1,N2 - numbers from 1 to 32767,
S1,S2 - lines up to2O characters.
The editor stores parameter values,
used in previous commands,
so in some cases the parameters can be
lower. If the lengths of strings S1 and S2 are
exceed 2O characters, then the extra characters
are ignored. Parameters below
in ( ) , there must be mandatory
but.
Command: I n,m Auto-numbering mode
lines, exit the mode - CS+1 (EDIT).
Command: L n,m Print text using
input file from line n to line m
portions that can be changed
command 'K'. When you press EDIT - exit to
editor.
Command: K n Set output portion
by command L. n - number of lines in the portion.
Command: D (n,m) Delete lines starting
from n to m.
Command: M n, m Forwarding a string with no.
of measure n into the line with number m. In this case
line number n is erased, and the contents
my string m is replaced with the contents
lines n.
Command: N (n,m) Text renumbering
first file:the first line gets a number
n, numbering step m.
Command: F n,m,f,s In the source file
a search is performed between strings n and m
text f. Upon its discovery, found
line is displayed on the screen and the system
switches to Edit mode. After this, use
Using the Edit mode commands, you can
continue searching for text f or replace find-
transferred text f to text s and further
continue searching. Note that lines f and s
can be determined previously by other co-
Mandami.
Command: E n Enable editing mode
editing Edit.
Subcommands:
space - increase text indication -
body by +1,
DELETE - decreasing text indication -
body by -1,
CS+8 - tab,
ENTER - end editing with saving
acceptance of the changes made,
Q - exit from editing. String
remains unchanged
R - reload edit buffer
nia, i.e. deleting all changes and re-
careful line editing,
L - print the rest of the line (for
text index) and re-editing
tiring,K - deleting a character at the pointer position
body,
Z - remove all characters from position
index inclusive and until the end of the line
ki,
F - search for the next line containing
the text f, defined earlier in the F command,
S - replacement with previously defined text
s text f and automatic execution
subcommands "F", i.e. search for next
line containing f.
It should be noted that in this version
This subcommand "S" must be executed
immediately after the "F" command or
subcommands "F" or "S",
I - insert a character at the current position
pointer. The mode is saved until pressed
ENTER keys. Acceptable use
DELETE and CS+8 (delete and tab),
X - set the text pointer to
end of line.
Commands for exchanging with a tape recorder
Command: P n, m, s write lines to tape
nth source text named s,
Command: G,,s n read file from tape
named s. if some text is already
exists in memory, thenentered from tape
the text is joined to the existing one and the whole
the file is numbered in increments of 1. To interrupt
To change the input, you can use BREAK.
Compilation and launch
Command: C n compile from line n,
Command: R execution previously compiled
tared object code stored in
buffer,
Command: T n broadcast command. Is-
running text is compiled starting from
lines n and, in case of successful compilation,
tions, the system displays the question “OK?”. When
in response "Y" the object code produced
during compilation, sent to the end
runtimes (breaking the compiler in the process),
and then runtimes and object code are output
are placed on a tape with a name defined
previously as parameter f. After this-
th file f can be loaded into memory using
using the LOAD"" command.
Other commands
Command: Output in Basic,
Command: O n,m transformation of the original
th text prepared in a different re-
HPHT dactor, in the format adopted in HI-
SOFT HPHT,
Command: S,,d change delimiterparameters on d. Space as a
no divisor is allowed.
APPENDIX 1. Error messages
1. The number is too large.
2. ";" was expected.
3. Undeclared identifier.
4. An identifier was expected.
5. Use in constant declarations
not ":=", but "=".
6. "=" was expected.
7. An expression cannot begin with this
identifier.
8. Expected ":=".
9. ")" was expected.
1O. Wrong type.
11. "." was expected.
12. Expected factor.
13. A constant was expected.
14. This identifier is not a constant.
15. "THEN" was expected.
16. "DO" was expected.
17. "TO" or "DOWNTO" was expected.
18. "(" was expected.
19. This type of expression cannot be inferred.
2O. "OF" was expected.
21. "," was expected.
22. Expected ":".
23. "PROGRAM" was expected.
24. The variable was expected because para-
meter isvariable parameter.
25. "BEGIN" was expected.
26. A change was expected in the READ call -
Naya.
27. You cannot compare the expressions of this
type.
28. Must be of type INTEGER or REAL.
29. It is impossible to consider this type of transfer
money.
3O. This identifier is not
pom.
31. An exponent was expected in the number real.
32. A scalar expression was expected (not
numeric).
33. An empty line is not allowed (use
call cis(O) ).
34. "[" was expected.
35. "]" was expected.
36. The array index must have a
lar type.
37. ".." was expected.
38. Expected "]" or "," in declaration
ARRAY.
39. The lower limit is greater than the upper.
4O. The set is too large (more
255 elements).
41. The result of a function should be
type identifier.
42. In the set, "," or "]" was expected.
43. The set expected ".." or ","
or "]".
44. The parameter type must be identified
type qualifier.
45. An empty set cannotbe
the first factor in the operator.
46. A scalar quantity was expected,
including real.
47. A scalar quantity was expected, artificial
Any real.
48. Sets are incompatible.
49. "<" or ">" cannot be used-
for comparing sets.
5O. Expected "FORWARD", "LABEL",
"CONST", "VAR", "TURE" or "BEGIN".
51. Nekh number was expected.
52. ROCE cannot be applied to multiple
to you.
53. The array is too large (>64K).
54. In the definition of "RECORD" expected
"END" or ";".
55. Field ID expected.
56. After "WITH" a variable was expected.
57. The variable in "WITH" must have
type "RECORD".
58. Field ID was not associated with
operator "WITH".
59. After "LABEL" an integer was expected without
sign.
6O. After "GOTO" an integer was expected without
sign.
61. Mark at the wrong level.
62. Undeclared mark.
63. The parameter "SIZE" must be
belt
64. For pointers can use-
This is just an equality check.
67. Output onlyparameter for the price
ly with two ":" has the form e:m:H.
68. String cannot contain character
EOL.
Appendix 3. Presentation of data in
3U.
13.1. Data presentation
13.1.1. Whole
Integers take up 2 bytes in memory.
1 -- #OOO1
256 -- #O1OO
-256 -- #FFOO
For operations with integers, the re-
hyster HL.
13.1.2. Character, Boolean and others
scalar. They occupy 1 byte in memory.
TRUE has the value 1 and FALSE has the value O.
For operations with these types, use
register A.
13.1.3. REAL.
Reals are stored in the form of mantis-
sa-order in 4 bytes. For operations on
real numbers are used re-
hysters DE and HL. D - for storage order-
ka, E,H,L - for storing the mantissa, star-
The lowest digit of register H is for storingnumber sign. T.o.:
2 = O1OOOOOO OOOOOOOO OOOOOOOO
OOOOOOO1 = #4O #OO #OO #O1
1 = O1OOOOOO OOOOOOOO OOOOOOOO
OOOOOOOO = #4O #OO #OO #OO
-12.5 = 111OO1OO OOOOOOOO OOOOOOOO
OOOOOO11 = #E4 #OO #OO #O3
O.1 = O11OO11O O11OO11O O11OO11O
111111OO = #66 #66 #66 #FC
H L E D
13.1.4. Records and arrays.
Records take up space in memory,
equal to the sum of their components. Arrays of under-
N*S bytes are written, where N is the size of the mass
siva, S - number of bytes occupied by one
element.
13.1.5. Multitudes.
Sets are stored as bits
strings and, if the base type has N elements
cops, then the number of bytes occupied is equal to:
(N-1) DIV (8+1), i.e. SET OF CHAR
met 256-1 DIV 8+1 = 32 bytes. SET OF
(BLUE, GREEN, YELLOW) - 3-1 DIV 8+1 = 1
byte.
13.1.6. Pointers.
Pointers occupy 2 bytes of memory, so
holding the address of the variable (low byte
first).13.2. Storing Variables in Runtimes
13.2.1 Global variables are stored
starting from the top of the runtimes stack
down, i.e. if the stack starts with #BOOO
and the global variables are:
VAR i:INTEGER;
sn:CHAR;
x:REAL;
then i will be located in AFFE-AFFF,
sn AFFD,
x AFF9-AFFC.
Local variables. There is no access to them
pa through the stack. Instead at the beginning
each indoor unit installs -
register IX so that (IX-4) is indicated
went to the beginning of the block of local variables.
Thus, if:
PROCEDURE test;
VAR i,j:INTEGER;
then i will be in IX-4-2 and
IX-4-1, i.e. in IX-6, IX-5,
j IX-8 and IX-7.
13.2.3. Parameters and return values
valuesValue parameters are treated as lo-
cal variables and, like these variables,
nye, occupy the highest memory addresses. Od-
however, unlike variables, in (IX+2)
the low address is fixed, not the top one
areas. If:
PROCEDURE test (i:REAL; j:INTEGER);
then j (located first) will be on-
walk to IX+2 and IX+3,
and i from IX+4 to IX+7.
Variable parameters are considered
as well as value parameters, since
the only difference is that the first takes 2
bytes of memory storing the addresses of these transfers
money.
If:
PROCEDURE test (i:INTEGER; VAR x:REAL);
then the link to x is placed in IX+2 and
IX+3 (these cells contain the address of the variables -
no x), and i - in IX+4, IX+5.
Return values are placed above
the first parameter.
FUNCTION test (i:INTEGER):REAL;
i will be located in IX+2 , IX+3, and cells
from IX+4 to IX+7 are reserved forrise-
growing value.
Implementation of HISOFT PASCAL 4T at 48K
ZX-SPECTRUM.
Single characters cannot be used
<=, <>, >=, but only combinations of <, > and
=.
Management is carried out only temporarily
variable attributes familiarity through
standard control codes (WRITE(CHR
(17), WRITE(CHR(4) - green "paper");
permanent attributes cannot be changed.
Together with the object code, it is always auto-
The bootloader is automatically written. If
You used the "T" command to write
object code and runtimes to tape, then
to put the code into operation it is enough to
fill LOAD "" .
After finishing the code, you can
restart by entering GOTO 7.
If you exited Pascal by command
"B", to return to the editor, enter GO-
TO 9 ("warm" start with preservation of use
running text) or GOTO 12 ("cold"
start with initialization).
To set the INK color, use
CHR(15).
PRODUCT APPLICATION NOTE PS1.1
Sound andZX-SPECTRUM graphics in Pascal
4T
1. Sound (see MPACK package for HP8O).
Example: FAN(262,O.5) ; FAN(O,1) -
generation of average C within O.5
sec., then pause for 1 sec.
2. Graphics (see MPACK package).
3. Output via system ROM.
There are situations when it is useful
output through the system point
input RST #1O. For example, when using
control code PRINT AT, for which
which must be followed by 8-bit values
X and Y. However, using the WRITE statement
Certain values cannot be displayed
(for example, code 8 corresponds to BACKSPA-
CE (DELETE)). For this purpose it is advisable
use the procedure SPOUT (C:CHAR).
Using a graphics package
TURTLE
Packet by command G,,TURTLE attach-
applies to any program (note, however,
that for normal operation the package must
be provided with a PROGRAM header and
VAR declaration, TURE, CONST and LABEL
it is not necessary to declare. In addition,
the program should not contain pre-
specifically declared procedures and functions.).
Information about the "turtle" is stored in the global
score variables.Global Variables
HEADING
Used to store corner
values of the direction in which at a given
moment the “turtle” is oriented. Accept
calculates REAL values in degrees and can
be set to O by the TURTLE procedure.
The O value corresponds to East.
XCOR, YCOR
They store the current coordinates (X,Y) through
plows." They have the REAL type and are initially equal to
we are 127 and 87 respectively.
PENSTATUS
Has type INTEGER. Used for
storing the state of the "pen"; O - "feather"
lowered, 1 - raised.
Procedures
INK (C:INTEGER), C = O - 8;
PAPER (C:INTEGER), C = O - 8;
COPY - copying the screen to the printer;
PENDOWN (C:INTEGER) - translation "through-
plows" into a state in which it
movement will leave a trail of color C.
PENUP is the reverse procedure of PENDOWN.
(Both procedures set the variable
PENSTATUS)SETHD (A:REAL) - assigns a parameter
type REAL of the global variable HEADING,
i.e. sets the direction of movement.
O-East, 9O-North, 18O-West, 27O-South.
That is counterclockwise.
SETXY (X,У:REAL) - Sets absolute
"turtle" position.
FWD (L:REAL) - Moves the "turtle" forward
ed by L units in the direction determined
set by the HEADING variable.
BACK (L:REAL) - Moves the "turtle" to -
rear by L units (reverse of FWD).
TURN (A:REAL) - Rotate the head "through-
groins" by A degrees. The increase in A corresponds
corresponds to a counterclockwise turn
ki.
VECTOR (A,L:REAL) - Shifts position
"turtles" by L units in direction A.
After moving the head remains in
A-direction.
RIGHT (A:REAL)
LEFT (A:REAL) - Rotate the head "through-
groins" to the right/left by A degrees.
ARCR (R:REAL, A:INTEGER) - "Turtle"
goes along an arc of a circle of size R, length
on the arc is defined in A. "Turtle" goes
clockwise. Usually R = up to O.5.
TURTLE - Initialization of global transfers
belt
Example programNote that the TURTLE package is placed
starting from line 1O and ending
line 135O.
1. Circles
1 PROGRAM CIRCLES;
2 VAR I:INTEGER;
136O BEGIN
137O TURTLE;
138O FOR I:=1 TO 9 DO
139O BEGIN
1ХOO ARCR (O.5.36O);
141O RIGHT (4O)
142O END
143O END.
2. Spirals
1 PROGRAM SPIRALS ;
2 VAR
136O PROCEDURE SPIRALS (L,A:REAL);
137O BEGIN
138O FWD(L);
139O RIGHT(A);
1ХOO SPIRALS(L+1,A)
141O END;
142O BEGIN
143O TURTLE;
144O SPIRALS (9.95) or (9.9O) or (9,
121)...Errors in TURTLE
Line 57O USER(#EAC) should be
menena:
INLINE (#FD, #21, #3A, #5C, #FD, #SV,
1, #CE, #CD, #AC, #E, #FD, #SV, 1, #8,
#F3);
Pascal 4T Version 5 (from April 1, 1983
g.)
1. Functions can return values
POINTER(pointers);
2. Fixed a bug in NEW;
3. New editor; V command added
without arguments, which produces values
separator, line range, Find and Substi-
tit lines;
4 Option $F ("Include") has been implemented.
If you want to use it, then use
current text that is supposed
"pump", should be output to
tape using the W command. W works
similar to command P, except that
It is clear that according to W the information is not displayed in
HPHT format and recording starts immediately
after finishing the command. Text,
written by W, command G,, read
it is impossible.
Example:W 5O,12O,PLOT - record of the PLOT procedure.
To enable PLOT:
1OO END;
11O
12O ($F PLOT) - “turning on” the procedure
plot;
13O
14O PROCEDURE MORE; - the remaining part
programs.
Call procedure SPOUT (C:CHAR).
Using a graphics package
TURTLE
W 5O,12O,PLOT - record of the PLOT procedure.
To enable PLOT:
1OO END;
11O
12O ($F PLOT) - “turning on” the procedure
plot;
13O
14O PROCEDURE MORE; - the remaining part
programs.
Call procedure SPOUT (C:CHAR).
Usagegraphics package
TURTLE
Packet by command G,,TURTLE attach-
applies to any program (note, however,
that for normal operation the package must
be equipped with PROGRAM
Share your thoughts about the article