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

Em breve - Comming soon


BASIC Apascalado Para o ZX81

Pascalated BASIC For the ZX81

Enquanto não chega o livro, 
click aqui para comprar a versão para o ZX Spectrum:
 BASIC Apascalado Para o ZX Spectrum 
			
  While the book is not available, 
  Click here to buy the version for the ZX Spectrum:
   Pascalated BASIC 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