2022 Pascalated BASIC Contest
(ZX Spectrum)






Introduction

Win a ZX-UNO (ZX Spectrum clone) with just a few lines of a BASIC program!

The Planeta Sinclair blog and the Arca Lusitana archive present: 2022 Pascalated BASIC Contest.

If you paid attention to the release of ZX Spectrum Next in 2017, you might know that NextBASIC allows programming without GOTOs with the new commands:

Not everyone can have a ZX Spectrum Next...
But everyone can pretend they're programming in the ZX Spectrum Next!

This is the challenge of this contest:
Programming in BASIC without using GOTOs!


A bit of History



Rules

The prize
The first prize is a ZX-UNO offered by the Arca Lusitana archive. Other prizes will be announced soon.
The ZX-UNO is a modern clone of Spectrum (and others) (custom taxes may be applied for winners outside European Union).
Deadline
The deadline is September 30, 2022.
The program
You can compete in 2 categories:
     Category A - Games
     Category B - Others (educational, utilities, etc.)
However, programs that contain the command GO TO (or RUN) will not be admitted to the competition.
Human language
The program can only have 2 languages: Portuguese and/or English (both on the screen and in the listing).
Program submission
The program must be sent to the email: concurso@ArcaLusitana.org
Many programs
You can send as many programs as you would like.
You can send as many versions as you want within the deadline. The last version will be the one that will enter the contest.
Speed
The contestant has the right to request for the program to be evaluated in a certain emulator at a certain speed higher than normal speed.
Copyright
You can retain the rights to the program but the Planeta Sinclair blog and the Arca Lusitana archive will have the right to place copies on the internet.
If the program has an anti-piracy security system, an unlocked version must also be provided (for evaluation purposes only).
Jury
The jury is made up of (in alphabetical order): André Leão (blog Planeta Sinclair), Zé Oliveira (site Arca Lusitana), João Ramos (museu LOAD ""), Mário Viegas (blog Planeta Sinclair), Filipe Veiga (blog Planeta Sinclair).
Programs will be evaluated according to the following criteria:
     Category A - Games - Aesthetics (screen), easy to play (keys), entertainment capacity and program structuring.
     Category B - Others - Usefulness and structuring of the program.
The jury may change the deadline and/or the number of prizes if the quantity and/or quality of the work so requires.
Jury members cannot compete.

Competition program requirements

BASIC only
You cannot use assembly.
The programming has to be structured (Structured BASIC)
The program cannot use the GO TO command (neither RUN because RUN = CLEAR : GO TO).
The program must use subroutines (GO SUB, RETURN) (GO SUB cannot be used as GO TO).
Each subroutine cannot have more than 100 lines.
The RETURN command can only be used on the last line of a subroutine.
The program cannot invoke line numbers in GO SUB and RESTORE - variables with routine addresses must be used. In the case of RESTORE, an address modifier can also be used - Example: RESTORE RoutineData+N.
The following files must be sent:
Structured BASIC listing (without GOTOs),
Pascalated BASIC listing and
Snapshot (TAP, TZX, SNA, Z80).
Pascalated BASIC Editor/Converter
A Pascalated editor/converter is available in the Arca Lusitana repository.

How to write the program

The Pascalated BASIC editor
You can access an editor/converter here: Pascalated BASIC converter.
Just type or paste your program in the left area..
The editor accepts either a Structured BASIC program or a Pascalated BASIC program.
When you finish writing the program, copy the text from the right area to the BASinC emulator.
If you change the program in BASinC and you want to use the Pascalated BASIC editor again then you can copy the text to the left area and the editor will convert the text back to Pascalated BASIC.
The BAsinC emulator
To run the program, select the BASIC Structured text (CTRL-A), copy the text to the clipboard (CTRL-C) and paste the text (CTRL-V) into the BASinC emulator.
To copy the text from the BASinC emulator to the Pascalated BASIC editor, use Edit/Copy_Listing and paste the text into the Pascalated BASIC editor.
In BASinC, to export BASIC text to a file you have to save it with a BAS extension (click SAVE and type a name with a BAS extension).
In BASinC, to export a snapshop use File/Export_Tap with TAP extension or SAVE with SNA or Z80 extension.
Structured BASIC Syntax
Do not use GOTOs.
Each program is a set of routines.
Each routine starts with ":REM RoutineName".
Each routine ends with "RETURN" - don't insert extra RETURNs in the routine body.
The first routine must end with "STOP" instead of "RETURN".
In the Pascalated BASIC editor, reserved words must be written in capital letters.
Pascalated BASIC Syntax
Do not use GOTOs.
Each program is a set of routines.
Each routine starts with "DEFPROC RoutineName" and ends with "ENDPROC".
The first routine should start with "PROGRAM ProgramName" and end with "END" instead of "ENDPROC".
In the Pascalated BASIC editor, reserved words must be written in capital letters.
Each Pascalated BASIC reserved word must be written on a separate line (at the beginning).
Pascalated BASIC reserved words
PROGRAM and END come from the Pascal language.
REPEAT, UNTIL and WHILE come from Pascal and NextBASIC from ZX Spectrum Next.
DEFPROC, ENDPROC and PROC come from ZX Spectrum Next's NextBASIC.
IF-BEGIN-ELSEIF-ELSE-ENDIF come from several languages.
In SQL there is IF c BEGIN - END.
In Fortran there is IF c THEN - ELSE IF c2 - ELSE - END IF.
More information
Study the program in the Pascalated Editor page. Modify the program to teste the converter.
Study the Pascalated BASIC conversions below.
ZX Spectrum BASIC runs faster on the first lines! Places the routines that need to be faster at the beginning of the program.
The editor/converter is not detecting all syntax errors. Report any problem you encounter.
Contact email concurso@ArcaLusita.org.

Pascalated BASIC sintax

	
	

Pascal

Pascalated BASIC

Structured BASIC
for the ZX Spectrum

Note


REPEAT 
  ...
UNTIL condition; 			
		

REPEAT variable
  ...
UNTIL condition; 			
		

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

REPEAT	
(the variable name can have only 1 character)
(warning: the variable cannot be used at the same time on another cycle)		
		

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

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
		

Routine call
		

PROCEDURE routine_name
BEGIN
  ...
END
		

DEFPROC RoutineName
  ...
ENDPROC
		

: REM RoutineName
  ...
RETURN
		

Routine declaration
		

t := routine_name(arg)
		

LET arg1 = arg
GO SUB NomeDaRotina
LET t = result
		

LET arg1 = arg
GO SUB RoutineName
LET t = result
		

routine 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 
		

routine função declaration
		

oranges_total := 0
		

LET OrangesTotal = 0
		

LET OrangesTotal = 0
		

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

oranges_total := 0
		

LET oranges total = 0
		

LET oranges total = 0
		

You can use spaces (they are ignored)
Warning: The BASinC emulador remove the spaces.
(Only numeric variables can have more than 1 caracter.)
		

Participants of the 2022 Pascalated BASIC Contest



Pascalated BASIC (c) 1987, 2021 by ZarSoft