The following article was printed in December 1989 of the magazine „8000 PLUS".
(Followed by a correction in January 1990)
A firework on the PCW1

FIREWORX

By Richard Cox
This is one of the programs which was screaming, "Run me!" when it came out of the envelope. It also came with a note to "switch all the lights off and turn the PCWs brightness up full." So we did. It's only by dint of the fact that we got hungry that we're not still watching the display now. It really is very impressive indeed.
The less fun loving of our readers should skip this listing as all it does is to produce a quite spectacular fireworks display on the screen of the PCW. The display can either be controlled from the keyboard using the numeric keypad or you can sit back and watch the built-in demonstration.
To add some zing for the hard core programmers amongst you, there is also the possibility of adding your own data lines. This will enable you to create even bigger and better displays. The data statements within lines 50-130 are the demonstration and can be customised. They consist of an encoded series of keypresses with delays in between. Each keypress is represented by a shift state (n,N, for normal or S,s for shifted) followed by the key number in decimal form. N01 is unshifted [EOL]. A delay time, consisting of a decimal integer must follow each keypress. Missing out this time assumes a gap of 65,536 (about 90 minutes).This confuses the display. Two codes do not fit the pattern; Q which terminates the current CALL FIREWORX! (the exclamation mark is mandatory) and K which stops the display and enters keyboard mode. Lines 150-170 demonstrate these. Neither Q nor K require a delay time.
The core of the program lies in lines 200-570 which hold the machine code subroutine Fireworx!. They also hold the routine to load Fireworx!
To control your own display you will need to use the numeric keypad as follows:
Oooooooo! Ahhhhhh! Wow! and erm.....bang! Light up the sky with Basic fireworx!
KeyKey no
Position on screen 
[RELAY] 01
bottom left 
[ENTER]78
bottom right 
[2]07
middle 
[EOL]13
top left 
[5]14
top middle 
[WORD/CHAR]05
top right 
When [SHIFT] is pressed, a large firework is set off. The space bar has a special function: each firework is a collection of moving dots of which there is a finite number. After about eight normal sized fireworks you run out of dots. Pressing the space bar reclaims some of them for recycling. Pressing the space bar and [SHIFT] instantly reclaims all of the dots.
Due to lack of space, we can't go into the program in greater detail. Suffice it to say that it should provide hours of enjoyment both from a programming and a sensory level. Thanks to Richard Cox for the excellent idea, execution and documentation.
This is the demonstration display which can be edited or completely replaced at your whim.
Thi5 section puts you into keyboard mode and allows you to create your own on screen displays.
Line 210 contains a version check which looks to see which version of Basic your machine uses. 9512s use v1.39 while the 8000 series use v1.29. Line 250 acts on this by selecting the correct line of code to be loaded at the end.
The dreaded DATA. As Richard Cox says 'Just think beautiful moving pictures.

FIREWORX WHICH DIDN'T

As many of you will have noticed, last month's Fireworx program was more like "DAMPSQUIB.BAS".
Our fault entirely, and like Guy Fawkes, we have suffered suitably appalling punishment. The problem
arose in line 260 which ended rather abruptly. The line should be as follows:

READ x$:WHILE x$<>"*":POKE a,VAL("&H"+x$):a=a+1:READ x$:WEND:RETURN
Many apologies to Richard Cox annd to everyone who
spent time tearing their hair out.
[The corrected BASIC listing and the assembler listing]

1. The program Fireworx requires BASIC version v1.29 (8000 series) or v1.39 (9512 series). On all other versions this program does NOT work.

I found the appropriate locations for version 1.47 so that the program should run under this version.

Line 210 reads among others:
210 ... v1.39=PEEK(&H151)=&H33
The address &H151 points to a character within the version message:
Mallard-80  BASIC with Jetsam   Version 1.29
                                          ^   &H32
Mallard-80  BASIC with Jetsam   Version 1.39
                                          ^   &H33
Mallard-80  BASIC with Jetsam   Version 1.47
                                          ^   &H34
The original program sets the value of variable v1.39 to -1 in case of version 1.39. Otherwise it will be set to 0. In line 250 the decision will be made which code to select — either line 560 or 570. I appended lines 251 and 252 as well requesting versions 1.29 and 1.47. If none of them is found program breaks with an error message.
[The adapted BASIC listing]

HTML customization by Werner Cirsovius
January 2015
© 8000 PLUS