EUG Screen Documentation

By Gus Donnachaidh

Originally published in EUG #22

Your noble editor was behind the opening screen to this issue and budding BASIC programmer that I am, I have written this article to assist those unschooled in some of the commands used within it.

Starting with the SOUND command, I began by altering the pitch parameter of the SOUND with a FOR NEXT loop and the READ statement. The variable I used with A% and the variables that it is given are in the DATA statements. Initially these played a short scale and used eight notes.

Each DATA statement is read into the program with the statement READ A%. To make the program cycle through each DATA value, the FOR NEXT loop is used in the line FOR B%=90 TO 220 STEP 10.

I put in the command RESTORE to tell the program which line number the DATA values could be found at as, with the text, there would be more than one set of DATA lines. B% cycles in increments of 10.

Finally I put in the NEXT command but added B% again because there is more than one FOR NEXT loop and I wanted to make sure the loop didn't respond to the wrong NEXT.

The program will cycle eight times and read a value for A%, insert it into the SOUND command and play this as a note.

The text routine isn't too different. First is a FOR NEXT loop, this time using E%, and it counts in increments of 10 too, thus cycling eleven times. A RESTORE statement is also needed.

The words I used were the first that came into my head and look quite visually interesting. This is the point of the opening screen, yes?

Back to the music, the first thing to do was make sure text and music were called up at the same time. I did this by treating the text as a subroutine, called with GOSUB <line no>. A subroutine isn't as flexible as a procedure, of course but they work a little bit faster (I think!)!

The command RETURN ends a subroutine.

The whole program had then to be made to continuously cycle, to print text, scroll up screen and print more text. I solved this with the line IF B%<170 GOSUB <first line> ELSE GOTO 10 <i.e. restart>.

This meant that the GOSUB was not called on the final cycle of the music's FOR NEXT loop and as such was not reset.

Another problem is that BBC BASIC won't nest more than ten FOR NEXT loops at a time. I solved this by simply adding ON ERROR RUN - unbelievably bad programming practice though.

The command *FX 220 27 changes the function of the ESCAPE key and assigns it to the SPACE instead. Therefore you need the ON ERROR statement that reassigns ESCAPE to its normal value and CHAINs the EUG menu.

I decided to put in a familiar tune and eventually hit upon "No Place Like Home". What do you mean, it doesn't sound like it?! Why it sounds the way it does I don't know but I felt it was alright so I left it.

ENVELOPEs can be a bit tricky and I had to look in an old copy of Electron User (1984) for a "Sounds Exciting" to complete the masterpiece.

Having read all about this now, can you really claim it was complicated? Of course not. Hence I shall expect a flood of disks with offerings for future EUG opening screens along with that article/letter/problem/program you have been meaning to send for so long but couldn't find the time.

Gus Donnachaidh, EUG #22