Gee-k.net

First delves into locomotive BASIC


Created on: 17-12-2018  By Gee
I was doing a bit of reading on Sunday night and came across a scan from an amstrad magazine from February 1991.
In the scan was a "10 line" type in bit of BASIC coding. I say "10 line" because there was so many commands in each line separated by the use of ':'.
This of course made things a bit more difficult when it came time to debug the program after having copied the lot out and it didn't run. If I remember correctly, they rarely did run 1st time due to some spelling mistake, missing a dot or using ';' instead of ':'. Another reason I hate using the ':' for different actions. Just use a new line!

However, due to this program not working correctly I found a way of making debugging slightly easier. "How?" do I hear you ask? Well, the first line of any of my future BASIC programs shall start the same way from now on.
1 ON ERROR GOTO 500
500 PRINT"Error on line"ERL
510 PRINT"Error number"ERR
520 END

Obviously the 500, 510 and 520 go at the end of the program and if your code is longer than 50 lines (if you're separating them by 10 each step that is), then just change the 500 to whatever line you put the error printing in.
This error printing allows the creator of the software to see what line the error is in and what type of error it is with a corresponding number which you can then look up in the manual that you all obviously have!

I played with this code for a bit and didn't get it to work, I even asked my beloved wife to read out the scan for me to confirm I had the code correct (which she just loved doing!). I decided that there must've been something wrong with the code, I.E. it was written for the 6128 and not the 464 that I was using. Nothing to do with my newness to BASIC programming at all!
So I started messing around making my own program in BASIC just to see what I could do with no help from any books, just trial and error.
I ended up with a program that wrote this websites logo out in ascii over and over again, whilst changing the colour of the logo each time it was printed. After a while I got the borders changing colour and text going off like a strobe light, making me really glad I don't have epilepsy.

I saved all my hard work onto a tape that I was sent from a kind member of the facebook spectrum group (Don't tell him i'm using them on an amstrad!). checked that they saved ok with the CAT command, then went onto my next task.

I chose a book scan to copy from (sixty 464 programs) and started writing out what I thought was a space invaders clone. It took a good while to write out and after sorting out a few spelling mistakes, I was shocked to find that it actually worked. It's quite hard to play! I also saved this to tape as it took so long to write out that I didn't want to loose my hard work.

After this, I decided I'd go back to my own program that I wrote out and loaded it back up from the tape. I discovered that the spacing was all off in my ascii logo. So, I'm going to have a go at writing out commands to draw it to the screen instead. get it looking a bit better than using ascii characters.
Once i'm done I might even figure out how to add sound to it (I managed to figure out how to play a few notes so far). I'm not sure how to get sound to play at the same time as the screen is scrolling yet. I'll get there!