Pascalated BASIC to ZX81 Converter

(No line numbers, no GOTOs)


Tutorial By Example

Example Title Edit Download Run online
0 Factorials
1 Guess Number
2 LASER (slow)
2 LASER (fast)
3 Multiplication Table
4 Cannonball
5 15
6 Joker
7 The Towers of Hanoi
8 Find Zero
9 The Lost Comic Book
10 River Crossing
11 2D Graph (slow)
11 2D Graph (fast)
12 Fair Shares
13 Memory
14 Hangman
15 Worm


Pascalated BASIC
BASIC Apascalado

Structured BASIC
BASIC Estruturado

LINE STEP =

History

1958 - Appears ALGOL 58, the first structured programming language.
1970 - Appears Pascal - the most famous structured language.
1976 - Appears SBASIC (Dartmouth Structured BASIC) - the first attempt to create a structured BASIC.
1983 - Structured programming became widely known with Turbo Pascal 3 from Borland.
1984 - Appears the Sinclair QL with structured BASIC.
1985 - Appears QuickBASIC (later QBASIC), the first structured BASIC without line numbers.
1987 - Appears Pascalated BASIC (for the ZX Spectrum) in MicroSe7e journal (Portugal).


Instructions

Usage of Pascalated editor
Simple write or paste your program on the left side text area.
When you're done copy the program on the right side text area to an emulator (example: EightyOne).
Usage of EightyOne emulator
To run the program, first select the structured text (CTRL-A), copy (CTRL-C) and paste it (CTRL-V) on a file with extension BAS. Then click on the "Open Tape File" icon, select the file and click "Open".
To save the tap, click the "Save Tape File" icon and choose a filename with extension "P" or "TZX".
Pascalated sintax
Do not try to use GOTOs
Each program is a set of routines.
Each routine starts with "DEFPROC RoutineName" and ends with "ENDPROC".
The first routine must begin with "PROGRAM ProgramName" and ends with an "END" instead of "ENDPROC".
Reserved words of Pascalated BASIC
PROGRAM and END comes from Pascal programming language.
REPEAT, UNTIL and WHILE comes from Pascal.
DEFPROC, ENDPROC and PROC comes from NextBASIC of ZX Spectrum Next.
IF-BEGIN-ELSEIF-ENDIF comes from various languages.
More info
Read the Pascal to BASIC translations below.
Study the starting program at the beginning of this page.
Modify the program at the beginning of this page and write a new program.
Study the tutorial programs at the beginning of this page.

Sintax

	
	

Pascal

Pascalated BASIC

ZX81 BASIC

Note


REPEAT 
  ...
UNTIL condition; 			
		

REPEAT variable
  ...
UNTIL condition			
		

FOR i = 0 TO 0.5 STEP 0
  ...
  LET i = condition
NEXT i   			
		

Variable name must have only 1 char.
Be careful: the variable cannot be used 
by another loop at the same time.
		

WHILE condition DO 
BEGIN 
  ...
END			
		

WHILE condition DO variable
  ...
ENDWHILE 			
		

FOR i = NOT ( condition ) TO 0.5 STEP 0
  ...
  LET i = NOT ( condition )
NEXT i   			
		

Variable name must have only 1 char.
Be careful: the variable cannot be used 
by another loop at the same time.
          

IF condition1 THEN
  BEGIN 
  ...
  END			
ELSE IF condition2 THEN
  BEGIN 
  ...
  END			
ELSE
  BEGIN 
  ...
  END			
		

IF condition1 BEGIN variable
  ...
ELSEIF condition2 
  ...
ELSE
  ...
ENDIF 			
		

LET i = condition1 
FOR i = i TO 0.5 STEP -1 
  ...
NEXT i 

LET i = (i<0)*-1 + (i=0)*( condition2 ) 
FOR i=i TO 0.5 STEP -2
  ...
NEXT i 

LET i = (i=0) 
FOR i = i TO 0.5 STEP -2 
  ...
NEXT i
		

Variable name must have only 1 char.
Be careful: the variable cannot be used 
by another loop at the same time.
      
		

routine_name(arg)
		

LET ARG = X
PROC ROUTINE NAME
		

LET arg1 = arg
GOSUB ROUTINE NAME
		

Procedure call
		

PROCEDURE routine_name
BEGIN
  ...
END
		

DEFPROC ROUTINE NAME 
  ...
ENDPROC
		

REM ROUTINE NAME		
  ...
RETURN
		

Procedure declaration
		

t := routine_name(arg)
		

LET ARG = X
PROC ROUTINE NAME
LET T = RESULT
		

LET ARG = X
GOSUB ROUTINE NAME
LET T = RESULT
		

Function call
		

FUNCTION routine_name (arg:REAL) :REAL;
BEGIN
  ...
END;  
		

DEFPROC ROUTINE NAME		
LET U = ARG
...
LET RESULT = V
ENDPROC
		

REM ROUTINE NAME		
LET U = ARG
...
LET RESULT = V
RETURN 
		

Function declaration
		

total_apples := 0
		

LET TOTALAPPLES = 0
LET TOTAL APPLES = 0
		

LET TOTALAPPLES = 0
LET TOTAL APPLES = 0

Remember that a string array and a simple string variable 
cannot have the same name - unlike the case for numbers.
On variable names, you can use spaces - they are ignored.
Warning: On variable names, dont use spaces when the first 
word is a reserved word because emulators usually get confused.
		
If you run out of computer memory then ask the administrator to add the option to remove comments from the program.

Compre o livro - Buy the book


BASIC Apascalado Para o ZX81

Pascalated BASIC For the ZX81

São 150 páginas com artigos e listagens 
dos 15 programas deste tutorial -
incluindo alguns dos jogos clássicos da história dos videogames. 
    
É um verdadeiro curso de programação 
que pode ser aproveitado para programar em qualquer linguagem 
e também recordar o potencial do ZX81.
    
Clique no preço para comprar via PayPal
ou faça a sua encomenda enviando uma mensagem 
para o email info@ArcaLusitana.org
    
    
  BASIC Apascalado
Para o ZX81
Pascalated BASIC
For the ZX81
Portugal e ilhas Euro 12,50 Euro 13,50
Estrangeiro Euro 17,50 Euro 19,25
There are 150 pages with articles and listings
of the 15 programs of this tutorial -
including some of the classic games from video game history.
    
It's a real programming course
that can be used to program in any language
and also recall the potential of the ZX81.
    
Click on the price to buy via PayPal
or place your order by sending a message
to the email info@ArcaLusitana.org
    
    
  Pascalated BASIC
For the ZX81
Outside Portugal Euro 19,25
Click aqui para comprar outros livros:
BASIC Apascalado Para o ZX81
BASIC Apascalado Para o ZX Spectrum
BASIC Apascalado - Compilado Para o ZX Spectrum
Click here to buy other books:
Pascalated BASIC For the ZX81
Pascalated BASIC For the ZX Spectrum
Pascalated BASIC - Compiled For the ZX Spectrum


Pascalated BASIC for the ZX Spectrum (c) 1987, 2021 by ZarSoft
Pascalated BASIC for the ZX81 (c) 2024 by ZarSoft
Email: info@ArcaLusitana.org