Skip navigation

GAL: GAL Assembly Language – Exercises

To get some experience at writing assembly language programs, try coding some of the following exercises. Try your hand before looking at the code provided.

It is assumed that you have read the manual, and have toyed with at least some of the sample programs.

Remember if you need to determine the number for a letter or symbol, you can use text2numbers (opens in a new tab).

Note that the solutions given are only one way to solve the problem. If yours produces the correct result then it is just as good – and maybe better!

1. Sum a set of numbers

Write a program to read a series of numbers and print the total.

Show me the code

Display and run (opens in a new tab)

2. Largest of 3 numbers

Write a program to read three numbers and print the largest.

Show me the code

Display and run (opens in a new tab)

3. Hello world

Write a program to print the message Hello, world!

Show me the code

Display and run (opens in a new tab)

4. Check character is numeric

Write a program to read a character and test whether or not it is numeric. Print Y if it is, or N if not.

Show me the code

Display and run (opens in a new tab)

5. Odd or even

Write a program to read a number and print whether it is odd or even.

Show me the code

Display and run (opens in a new tab)

6. Fibonacci numbers

Write a program to read a number N, and calculate and print the first N numbers in the Fibonacci sequence. The first two Fibonacci numbers are 0 and 1; after that the next number is obtained by taking the last two numbers and adding them together.

Show me the code

Display and run (opens in a new tab)

7. Sum the digits

Write a program to read a number and sum all its digits. Print the result. Hint: there is a trick to this one, and you will most likely need modified code from exercise 4.

Show me the code

Display and run (opens in a new tab)