Pascalated BASIC to ZX81 Converter

(No line numbers, no GOTOs)


Tutorial By Example

Example Title Edit Download Run online
1 Factorials
2 Guess Number
3 LASER
4 Multiplication Table
5 Cannonball
6 15
7 The Towers of Hanoi
8 Find Zero
9 River Crossing
10 2D Graph
11 Fair Shares
12 Memory
13 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
		

		

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.
You can use spaces - they are ignored.
Warning: You cannot use spaces when the first word is a reserved word 
or already exist one variable name with that word.
		

Compre o livro para o ZX Spectrum - Buy the book for the ZX Spectrum


BASIC Apascalado Para o ZX Spectrum

Pascalated BASIC For the ZX Spectrum

Eis o livro do "Concurso BASIC Apascalado 2022!

O hardware do ZX Spectrum foi rejuvenescido com o 
ZX Spectrum Next e, agora é a altura para renovar 
o software do ZX Spectrum com a linguagem BASIC Apascalado.

São 200 páginas a cores com artigos e listagens 
dos 30 programas do "Tutorial do Concurso" 
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 ZX Spectrum.

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 ZX Spectrum
Pascalated BASIC
For the ZX Spectrum
Portugal e ilhas Euro 19,50 Euro 19,75
Estrangeiro Euro 24,50 Euro 24,75
Here is the book of the "2022 Pascalated BASIC Contest"!

The ZX Spectrum's hardware has been rejuvenated with the
ZX Spectrum Next and now is the time to renew
the ZX Spectrum software with the Pascaled BASIC language.

There are 200 color pages with articles and listings
of the 30 programs of the contest 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 ZX Spectrum.

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 ZX Spectrum
Outside Portugal Euro 24,75

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