BACH TO BASIC
Robin Nixon introduces a simple music tutor
BACH TO BASIC is a simple tonic sol fah tutor in which the computer plays a tune and the pupil plays it back, aided by a graph of notes.
Tunes are entered by pressing the number keys 1 to 8 - 1 for doh, 2 for ray and so on.
The program is designed so that a pupil can start off at a very simple level and subsequently move up through intermediate to advanced levels.
A running score is kept to give the pupil an idea of how well he or she is doing.
Several options are available including four levels of difficulty, three different speeds and an option to turn screen output off - to make the pupil work by ear.
If you wish to add to the music data place the new data from line 1150 onwards, using 1 for doh, 2 for ray and so on.
Having done that you re-dimension A%(40,8) in line 270 so that the 40 is replaced by the total number of music data lines. Then replace the 40 in m%=RND(40) in line 560 with the total number of tunes in your new version.
Variables | |
LD% | Level of difficulty |
SP% | Speed or tempo of music |
GB% | Set to 2 if the display is disabled |
T% | The pupil's input or note to be played |
NC% | Score |
L% | Temporary score |
A%(40,8) | Data for 40 tunes |
B%(8) | Pitch of each of the eight notes |
Program Structure |
|
210-240 | Downloader |
270-280 | Initialise |
290-340 | Main play loop |
750-1140 | Data for 40 tunes |
Procedures |
|
instructions | Displays the instructions |
select | Selects the various options |
question | Plays a random tune |
bar | Draws a bar of the graph |
sound | Plays a note from a tune |
double, double1 | Display double height text |
EASTER EGG CHASE
Peter Rabbit is a greedy guts! He's no longer content with going into gardens to steal lettuce. Now he's trying to find a hidden Easter Egg.
He plans to find the egg and take it to his house - but he has an awkward little problem.
A group of invisible elves keep stealing and hiding the egg whenever Peter finds it. If only he could remember where the elves were standing, he could find a way to avoid them.
The elves are not all bad though. When Peter sets off to find the egg they tell him whether to travel north, east, south or west to find it.
Your job is to guide Peter to the egg and then to the house at the top of the screen.
It requires some luck, but strategy and memory, as well as an understanding of compass bearings, are also needed.
In fact, the game, apart from being fun, is a good way of learning the four points of the compass and the use of coordinates.
To enable a three colour Peter to be drawn, he is poken directly on to the screen.
If you've followed the series on machine code graphics in Electron User you'll understand how such characters can be created, but you may be surprised to hear that it can be done within a Basic program.
The data for Peter is read from line 440 and the character is printed at line 370. Despite the fact that all the instructions are in Basic, the character moves fairly smoothly from one location to the next.
The program itself is straightfoward. Procedures have been given popular names which tell their purpose, with the main program occupying lines 40 to 220 and the procedures being defined after that.
Main Variables | |
X% | Peter's address |
oldx% | Peter's old address |
pos% | Square that Peter occupies |
help%() | The elves' squares |
loc%() | Addresses for Peter relative to X% |
char%() | Data for Peter |
what% | Data for Egg |
egg% | Location of the egg |
INVASION FORCE
Frantic arcade action by Stephen Martin
The evil Zyzaxon empire has developed a new super breed of high speed assault craft.
Aptly codenamed the Invasion Force, their mission is to penetrate the Earth's defences. Once through, stage two of their attack wave can start.
Your job is to stop them reaching the second stage of their attack plan. You are the sole survivor of the stage one defence. Can you survive wave after wave of relentlessly advancing aliens? Play on and see...
Variables | |
HI% | Stores high score |
LEV% | Stores the level achieved |
L% | Lives left |
Procedures |
|
message | Prints force destroyed and wipes screen |
assemble | Assembles the machine code |
msk | Scrolls message across the screen |
tune | Plays spacey tunes |
landed | Prints force has landed and wipes screen |
setscreen | Prints level and lives and wipes screen |
newhigh | New high score? |