Soft - description of the Pascal programming language for the ZX Spectrum from Hisoft.

Spectrum Expert #02
 For those who do not like assembly language, we publish
descriptions of two undeservedly forgotten
Spectrum of programming languages - Pass-
Kalya and Si. At the first moment it may
hope that these languages will remain so
unclaimed due to inadequate
superiorities of the Spectrum versions.          
 Imperfection - yes, it's bad, though
even such simple versions give good
a great opportunity for prompt writing
various programs, for example, computing
laziness, calculations, as well as operational
tests of complex algorithms that
then it will be possible to more easily re-
lyse in assembler, etc. Pascal,
in our opinion, you can get it everywhere, and
here is an unbroken, efficient C, yes -
not easy everywhere, so we included it in
application.                             
                                        
(c) D. Rudovsky.             
                              
    Language compilers Pascal andC      
          for ZX-SPECTRUM.              
                                        
 In Russia, only Pass compilers are used.
Kalya and Xi company Hisoft,  released yet
in 83-84.  As a result, no one
compilers do not support 128K, but
the interface and editor are almost identical
are typical to each other and to the assembler GENS, 
launched by the same company. Differences observed
are given only in places specific to
basic languages.                         
                                        
 Well, let's start in order: Pascal.         
 We will talk about the most common
version Hisoft Pascal HP4D.              
 As always, we start with the download. After
launching the BASIC loader and loading co-
new block, the screen will display
inscription:                                
 TOP OF RAM?                            
 By typing a number here, you will set the top
the new limit of memory available to the compiler
ru.  If you immediately press , then the top
The new limit will be set equal to
user symbol area
(UDG).                                  
 Next the following will appear on the screen:              
 TOP OF RAM FOR 'T'? Here you need to enter the upper limit
memory for your program (similar to
CLEAR in BASIC). The last request was
when starting the editor it will be:           
 TABLE SIZE?                            
The number entered here will set the size
label tables, i.e. the amount of memory that
This one will be allocated by the compiler for in-
formations about the names used in the program
frame. The default value is taken
equal to 1/16 of free memory.           
 Before moving on to the description of the re-
daktor and compiler, I must say
so many words about memory allocation.     
 The compiler takes 12K, the editor -  
about 2K, plus space is allocated under the tab-
face marks according to the meaning,
given at the beginning.  The compiler is located
comes from the address 24600, therefore, to
program and object code remains about
21K, however, we must take into account that the object is
The code dumped to disk does not match
gives with object code running from
compiler.                            
                                        
 Editor.                              
                                        
 A signal that the editor is ready to work
both, is the symbol ">" and the cursor behind
him. As in the standard Spectrum-Basie-
ke, in HP each line has its own number,
although, unlike BASIC, it is impossible here
operate with line numbers in the program
meh.  General rules for typing strings in programs
framework are identical to the rules for dialing programs
frames in standard BASIC.  For pro-
viewing and editing are used
the following commands:                      
 I[n][,m]  - auto-numbering of lines.   After
after entering this command, the initial
number n (by default n=10 ), and after
pressing   appears  n+m,  then
n+2*m etc. To exit the set, press
.                                 
 D[n,m]  - deleting a group of lines.  Delete-
lines are included from numbern to numbermincluded
carefully.                               
                                        
 М[n,m] -moving line n  into line
kum.                                   
 N[n,m] - renumbering of lines.  This co-
manda is applied when it arises
need to insert a line.          
                                        
Example:                                 
                                        
 1 PROGRAM DEMO;                        
 2 VAR I,S : INTEGER;                   
 3 BEGIN                                
 4 FOR I:=1 TO 30 DO                    
 5 S:=S+1; WRITELN(I);                  
 6 END;                                 
 7 WRITELN(S)                           
 8 END.                                 
                                        
 We need to insert BEGIN between the lines 
4 and 5.  Use the command N10,10      
                                        
 We get:                              
 10 PROGRAM DEMO;                       
 20 VAR I,S : INTEGER;                  
 30 BEGIN                               
 40 FOR I:=1 TO 30 DO                   
 50 S:=S+1; WRITELN(I);                 
 60 END;                                
 70 WRITELN(S)                          
 80 END.                                
                                        
 Now we can safely insert a new one
line numbered, say, 45.      
                                        
 Now let's move on to the language itself.  dawn
The following words are reserved:            
                                        
AND                                    
 ARRAY                                  
 BEGIN                                  
 CASE                                   
 CONST                                  
 DIV                                    
 DO                                     
 DOWNTO                                 
 ELSE                                   
 END                                    
 FORWARD                                
 FUNCTION                               
 GOTO                                   
 IF                                     
 INLABEL                                  
 MOD                                    
NIL                                    
 NOT                                    
 OF                                     
 OR                                     
 PACKED                                 
 PROCEDURE                              
 PROGRAM                                
 RECORD                                 
 REPEAT                                 
 SET                                    
 THEN                                   
 TO                                     
 TURE                                   
 UNTIL                                  
 VAR                                    
 WHILE                                  
 WITH                                   
                                        
 Hisoft Pascal  allows the use
following data types:                 
┌--------┬---------------------------┐  
│  Type   Interval  
├--------┼---------------------------┤  
│boolean │ True, False │  
│ char │ 0 - 255 │  
│integer │ -32768 - 32767 │  
│ real │ -9.99999e38 - 9.99999e38 │  
│string │ character string │  
│ word │ ????             │  
│ │ │  
│record │ ------------ │  
└--------┴--------------------------┘  
                                        
 Standard Pascal procedures:         
                                        
WRITE                                  
 WRITELN                                
 READ                                   
 READLN                                 
 PAGE                                   
 HALT                                   
 USER                                   
 ROKE                                   
 INLINE                                 
OUT                                    
 NEW                                    
 MARK                                   
 RELEASE                                
 TIN                                    
 TOUT                                   
                                        
 Functions:                                        
 ABS                                    
 SQR                                    
 ODD                                    
 RANDOM                                 
 ORD                                    
 SUCC                                   
 PRED                                   
 INCH                                   
 EQLN                                   
 РЕЕК                                   
 CHR                                    
 SQRT                                   
 ENTER                                  
 ROUND                                  
 TRUNC                                  
 FRAC                                   
 SIN                                    
 COS                                    
 TAN                                    
 ARCTAN                                 
 EXP                                    
 LN                                     
 ADDR                                   
 SIZE                                   
 INP                                    
                                        
 Комментарии к  некоторым  процедурам  и
функциям:                               
                                        
 INLINE- allows you to insert machine
codes into the text of a Pascal program, with
this at the time of program execution re-
hysteres are not saved and location
code entered by the command INLINE, not op-
sparsely. The above means that it is not
it is recommended to enter it inline
subroutines that have absolute jumps
codes or subroutine calls in the main field
no program.                          
                                        
 INCH  - analogue of the BASIC function inkey$,  
however, unlike it, it waits for pressing
per key.                             
                                        
 SIZE - this function returns the size
variable specified as para-
meters.                                  
                                        
 As you can see from the list above,
a set of built-in procedures and functions
extremely limited and unlikely to satisfy
demanding user. Fortunately,
along with the compiler were released and
several libraries for it. Unfortunately,
I couldn't find the disk version
compiler with these libraries.       
                                        
 A few words are neededtell about mistakes
compilation.  The error code is indicated when
output of the compilation listing under the place,
that caused the error or immediately after it.  Here
list of compile-time errors:       
                                        
 1. Missing "."                     
 2. Missing parameter                
 3. Constant missing               
 4. This identifier is not con- 
    stantoy                             
 5. "THEN" is missing                  
 6. Missing "DO"                    
 7. Missing "TO" or "DOWNTO"       
 8. Missing ")"                     
 9. This type cannot be inferred         
 20. Missing "OF"                   
 21. Missing ","                    
 22. Missing ":"                    
 23. Missing "PROGRAM"              
 24. There is no parameter variable    
 25. Missing "BEGIN"                
 26. The variable is missing from the call for
     reading                             
 27. I can’t compare the values of this type
     pa                                 
 28. Must be integer or real
     type                                
 29. It is impossible to enter a variable for this
     type                               
 30. This identifier is not a type
     pom                                
 31. There is no exponent in real
     number                          
 32. No scalar value     
 33. The null row is not defined       
 34. Missing "("                    
 35. Missing ")"                    
 36.The array index is not a scalar
     noi magnitude                      
 37. Missing ".."                   
 38. ")" is missing from the array description
     or ","                            
 39. The lower border is larger than the upper      
 40. Installation too large          
 41. The result type does not match the object
     manifest type of the function             
 42. The definition is missing ".." or  
     ")"                                
 43. The definition is missing "..",    
     ",", ")"                         
 44. The identifier type must match
     with parameter type                  
 45. The zero setting should not be
     the first condition in the uncertain   
     definition                        
 46. Missing scalar(including
     valid) value           
 47. There is no scalar (except for the actual
     nominative) meaning                
 48. Settings are incompatible             
 49. "AND" should not be used when
     comparison of installations                
 50. Missing "FORWARD", "LABEL",
     "CONST", "VAR", "TURE", or "BEGIN"
 51. There is no hexadecimal format
mat                                
 52. No installation              
 53. The array is too large             
 54. Not included in the entry definition
    "END" or ";"                       
 55. Missing identifier field    
 56. Missing variable after "WITH"
 57. The variable in "WITH" must have
     type "RECORD"                       
 58. The identifier field is the same as the op-
 dividing the procedure                   
 59. There is no number after "LABEL"    
     lines                             
 60. There is no number after "GOTO"     
     lines                             
 61. Wrong label                    
 62. Label not defined                
 63. The parameter must be a variable    
 64. Pointers can only be compared  
 65. Formatted output is possible     
     only for integers                   
 66. The string is not a character string
 67. Parameter for "NEW", "MARK", "RELE-
     ASE" must be a pointer type    
 68. The address parameter must be re-  
     mine                             
                                        
 In conclusion, as a summary, I would like to say,
that, despite obvious shortcomings,
Pascal compiler is quite suitable for
writingdata processing programs and
solving problems of computational mathematics.
                                        
                                        
                                        

Share your thoughts about the article