Unlike my OS4.x programming tutorials in C I will start with the basics for Amos Professional. This, and further, tutorials are aimed at the absolute beginners. People that really want to start programming but want to start with something easy (cue Amos!) and need a lot of guidance. Once you master Amos you can move on to something else. Why Amos? Is it not a dead language? Absolutely not! I am actually using it to create a new disk magazine for the classic Amiga’s. What makes Amos so great is that it will allow you to learn programming the easy way and get better along the way. No 100 lines of code to open a screen but just one line only in Amos. It takes away the difficult part so you you won’t be scared away and stick around. Are you still with me? Good! Let’s get started….

As a programmer you should put comments in your code to describe what it is doing. You might know what it does when you write the code but several months later you might not. Also if someone else is reading your code they can understand what is going on. Many times I had discovered how to fix something and not provide comments only to discover at a later stage that I had no clue what it was actually doing. There are two ways of providing comments in your code:

Rem This next line of code will make me rich!

‘ This next line of code will make me rich!

As you can see we can use “Rem” in front of our comments or the apostrophe ‘.

Now I am going to show you an example that will address a lot of points in one time. Don’t worry if you looked at it and don’t understand a thing.

x=0
While X<11
Inc X
Print X
Wend
Print “We left the loop!”

Our first example!

The run our example we can press F1 or select “Run” from the “Project” menu in Amos Professional.

What does example does is print the numbers 0 till 10 on the screen and once it has reached 11 it will print “We left the loop!”.

The first line “x=0” will set x to 0. We call X a variable. A variable means that it’s value can change. This will make sense in short moment when we discuss the rest of the example. Just to complete it you need to know that the name of a variable has to begin with a letter and cannot begin with a number. What is also not allowed is that the name starts with letters that make up one of the Amos Professional commands. I will show you….

FRIDAY=1

The above is allowed.

1FRIDAY= 1

The above is not allowed since it starts with a number.

FRIDAYPRINT=1

The above is allowed.

PRINTFRIDAY=1

The above is not allowed since the first part makes up the Amos Professional command “PRINT”.

Next we reach the “While – Wend” part. While – Wend will repeat a group of instructions till a certain condition is true. For example While – Wend will instruct your wife to go shopping till the wallet is empty. In our example While – Wend will print the value of X till X has reached the value 11. The instruction “While X<11” is taking care of this. The part “X<11” means till the value of X is less (<) than 11. The command “Inc X” in our While – Wend statement will increase the value of X each time with one. Remember I said earlier on that the value of a variable can change? In our example the value of our variable X will change. The command “Print X” will print the value of X. Once X has reached the value 11 our program will leave the While – Wend statement and execute our last part in which it will print “We left the loop!”.

So what do you think? Easy to understand? Please let me know if it is not clear or you have questions left. That’s all for now. Next time we will go a bit deeper but still maintain that level of easiness.

Advertisements