Gee-k.net

Making BASIC more complicated


Created on: 18-10-2019  By Gee
My previous post was about me learning how to make a program in BASIC, and it worked!
There was a little bit of complicated math (for my brain), but it wasn't exactly an awe inspiring program. So I decided I would make it a bit better. Make it so that you can use it over and over just by using the arrow keys to select your day, month, year and it would automatically update the day of the week on the fly.
So that's exactly what I've done. So technically I've actually made my 1st ever real Amstrad program. wooo!
Anyway, back to the point.
I started by making my layout, placing the "Day Month Year" labels where I wanted them and then then placing the arrows above and below them. Then I put some placeholder date text in to see how it all looked.
Once that was done it was just a case of changing the numbers into variables and making the arrows change whenever the correlating buttons were pressed.
The difficult part was, after I had the program working, cutting down the code as I had made it quite bloated and used some duplicate and triplicate code where I could have used a bunch of variables instead. It was easier at the time to just make the duplicate code.
However, once it WAS running right, I added a couple of functions such as pressing R for a random date and pressing E to exit the program. I also cut the code down quite a but, going from 171 lines of BASIC to 109 or there abouts. I can't remember exactly now.
The duplicated code got cut out and made into Variables. I also cut down a couple of other bits that didn't need to be there. So the code runs a little quicker now.
Next thing for me to do is to remake the whole program, this time in z80 assembly language. I'll then be able to port it to the spectrum too if I really wanted to by editing the code ever so slightly. AND if I'm clever about the way I write the code, I'll be able to make the assembler do the work of choosing which system it's compiling for.
So, keep your eyes pealed for a much faster version of the program coming to this website.
I just need to find the newer version of the program I made in BASIC so I can share it on here too..