Pascalated BASIC to ZX Spectrum Converter

(No line numbers required)


Tutorial By Example

Lesson Date Title Edit Download
the 3 files
Run online
1 2022-02-25 Guess the Number
2 2022-03-04 Laser
3 2022-03-11 Multiplication Table
4 2022-03-18 Cannonball (Bala)
5 2022-03-25 The Hunter
6 2022-04-01 4 In a Line
7 2022-04-08 Pong
8 2022-04-15 Eagle 1 (Lander)
9 2022-04-22 15
10 2022-04-29 3D Graph z=F(xy)
11 2022-05-06 Hangman
12 2022-05-13 Asteroids Patrol
13 2022-05-20 The PI Obsession
14 2022-05-27 The Towers of Hanoi
15 2022-06-03 Space Invader
16 2022-06-10 Find Zero
17 2022-06-17 River Crossing
18 2022-06-24 Joker
19 2022-07-01 2D Graph
20 2022-07-08 Fair Shares
21 2022-07-15 Maze Walls
22 2022-07-22 Klotski (big square)
23 2022-07-29 Torpedo
24 2022-08-05 The Lost Comic Book
25 2022-08-12 Worm
26 2022-08-19 Memory (hidden cards)
27 2022-08-26 Dogfight David
28 2022-09-02 The Towering Inferno
29 2022-09-09 The Blue Diamond
30 2022-09-16 TIM's Castle
2022-09-30 [Contest Deadline] Download all 30 files
Click here to access the
2022 Pascalated BASIC Contest


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.
1981 - Appears the BBC Micro - with one of the first 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).
2017 - Pascalated BASIC became a reality (33 years later) with NextBASIC from ZX Spectrum Next.


Instructions

Usage of Pascalated editor
Simple write or paste your program on the left side text area.
The editor accepts either a ZX Spectrum structured program or a Pascalated version.
When you're done copy the program on the right side text area to an emulator (try BASinC).
If you make changes to the Structured BASIC program then you can paste it on the left text area and it will be converted back to Pascalated BASIC.
Usage of BASinC emulator
To run the program, select the BASIC Structured text (CTRL-A), copy (CTRL-C) and paste (CTRL-V) on BASinC emulator.
To copy a program from BASinC to Pascalated editor, use Edit/Copy_Listing and paste the text on the Pascalated editor.
On BASinC, to export BASIC text you must save with BAS extension (click SAVE and choose extension BAS).
On BASinC, to export snapshop use File/Export_Tap or SAVE with extension BAS,SNA,Z80.
Structured BASIC sintax (ZX Spectrum)
Do not use GOTOs
Each program is a set of routines.
Each routine starts with ": REM RoutineName".
Each routine ends with "RETURN".
The first routine must end with a "STOP" instead of a "RETURN".
Reserved words must be on upper case.
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 must be on upper case.
Each Pascalated command must be on a separately line (at the beginning of the line). This also applied to the command FOR-NEXT.
Reserved words of Pascalated BASIC
PROGRAM and END comes from Pascal programming language.
REPEAT, UNTIL and WHILE comes from Pascal and NextBASIC of ZX Spectrum Next.
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

ZX Spectrum BASIC

Note


REPEAT 
  ...
UNTIL condition; 			
		

REPEAT variable
  ...
UNTIL condition			
		

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

REPEAT	
(variable 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   			
		

WHILE
(BEGIN is not needed)			
		

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 : REM IF-BEGIN
FOR i = i TO 0.5 STEP -1 : REM IF-BEGIN
  ...
NEXT i : REM ENDIF
LET i = (i<0)*-1 + (i=0)*( condition2 ) : REM ELSEIF
FOR i=i TO 0.5 STEP -2 : REM ELSEIF
  ...
NEXT i : REM ENDIF
LET i = (i=0) : REM ELSE
FOR i = i TO 0.5 STEP -2 : REM ELSE
  ...
NEXT i : REM ENDIF
		

IF ... BEGIN ... END
(sometimes ':' is not enough)			
		

routine_name(arg)
		

LET arg1 = arg
PROC RoutineName
		

LET arg1 = arg
GO SUB RoutineName
		

procedure call
		

PROCEDURE routine_name
BEGIN
  ...
END
		

DEFPROC RoutineName 
  ...
ENDPROC
		

: REM RoutineName		
  ...
RETURN
		

procedure declaration
		

t := routine_name(arg)
		

LET arg1 = arg
PROC RoutineName
LET t = result
		

LET arg1 = arg
GO SUB RoutineName
LET t = result
		

function call
		

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

DEFPROC RoutineName		
LET v = arg1
...
LET result = v
ENDPROC
		

: REM RoutineName		
LET v = arg1
...
LET result = v
RETURN 
		

function declaration
		

total_apples := 0
		

LET TotalApples = 0
		

LET TotalApples = 0
		

java notation
(Remember that a string array and a simple string variable 
cannot have the same name - unlike the case for numbers)
		

total_apples := 0
		

LET total apples = 0
		

LET total apples = 0
		

you can use spaces (they are ignored)
but the BASinC emulator removes the spaces
(only numeric variables can have more than 1 char)
		
Each Pascalated command must be on a separately line. 
The command FOR-NEXT also must be at the beginning of the line.
  FOR i=1 TO 10 
    PRINT i 
  NEXT i
		
If you want to make an exception, start de line with an ":"
  : FOR i=1 TO 10 : PRINT i : NEXT i
		

Compre o livro - Buy the book


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
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

	

Programas de demonstração escritos em BASIC Apascalado em 1987

1 BASIC Apascalado 1 (factorial iterativo) (MicroSe7e 56) (1987) [Zarsoft].z80 2 (duas versões semelhantes) BASIC Apascalado 2 - Recursividade (factorial optimizado (memória)) (MicroSe7e 60) (1987) [Zarsoft].z80 BASIC Apascalado 2 - Recursividade (factorial rápido) (MicroSe7e 60) (1987) [Zarsoft].z80 3 BASIC Apascalado 3 - Recursividade sem stack (factorial) (MicroSe7e 61) (1988) [Zarsoft].z80 4 (2 versões semelhantes) BASIC Apascalado 4 - Recursividade (Torres de Hanoi) (versão1) (MicroSe7e 62) (1988) [Zarsoft].z80 BASIC Apascalado 4 - Recursividade (Torres de Hanoi) (versão2) (MicroSe7e 62) (1988) [Zarsoft].z80 8 BASIC Apascalado 8 - Automato (avaliar número) (MicroSe7e 66) (1988) [Zarsoft].z80 9 BASIC Apascalado 9 - A Vitória do Spectrum Next (2021) [ZarSoft].z80

Pascalated BASIC (c) 1987, 2021 by ZarSoft
Email: info@ArcaLusitana.org