AMAL: Movement That Runs Itself
You've moved a bob by hand, frame by frame. AMAL lets you describe a movement once and hand it to AMOS to run on its own — in the background, fifty times a second, while your program gets on with everything else. It's the Amiga's secret weapon for smooth motion.
So far, every pixel of movement has cost you a line in the frame loop: read, add, draw, wait. That's fine for one bob, but a game has dozens of things moving — and writing the motion of every one into the loop gets crowded fast. AMOS has a better way. AMAL — the AMOS Animation Language — lets you write a little movement program once, hand it to AMOS, and let it run the motion for you, automatically, in the background. Your bob keeps moving even when your main program is busy doing something else entirely. It's one of the things that made AMOS feel like magic.
What you'll see by the end
The bob is sliding from one side of the screen to the other and back, forever. But look at the program: the main loop does nothing — no Add, no position to update. AMAL is running the whole movement behind the scenes.
The whole program
Hide
Screen Open 0,320,200,16,Lowres
Colour 0,$111
Colour 1,$F40
Colour 2,$FD0
Cls 0
Ink 1
Bar 0,0 To 23,23
Ink 2
Bar 6,6 To 17,17
Get Bob 1,0,0 To 24,24
Cls 0
Bob 1,40,90,1
Channel 1 To Bob 1
Amal 1,"Loop: M 220,0,75 ; M -220,0,75 ; Jump Loop"
Amal On
Do
Wait Vbl
Loop
The bob is made the usual way. The new idea is three lines that set up an automatic movement, and then a main loop that, remarkably, does no moving at all.
Attach a channel to the bob
Channel 1 To Bob 1
AMAL runs its movements through channels — think of a channel as a little motor you can bolt onto something and let it drive. This line connects channel 1 to bob 1, so anything channel 1 does happens to that bob.
Describe the movement
Amal 1,"Loop: M 220,0,75 ; M -220,0,75 ; Jump Loop"
Amal hands channel 1 a movement, written as a short string in AMAL's own little language. Read the string left to right:
Loop:is a label — a name marking this spot, so you can come back to it.M 220,0,75is a move: shift 220 pixels across, 0 down, smoothly over 75 steps. That's the bob gliding to the right.M -220,0,75moves it back — 220 pixels the other way, over 75 steps.Jump Loopjumps back to theLoop:label, so the whole thing starts again — right, left, right, left, forever.
The semicolons separate one AMAL instruction from the next. It's a tiny program in its own right, living inside that string.
Switch it on
Amal On
This turns the AMAL system on. From this moment, AMOS runs channel 1's movement automatically, fifty times a second, tied to the screen refresh — without your program lifting a finger.
The loop that does nothing
Do
Wait Vbl
Loop
Here's the striking part. The main loop just waits — there's no movement code in it at all. The bob glides back and forth regardless, because AMAL is driving it in the background. In a real game this is where your other work would go — checking scores, spawning enemies — while AMAL quietly handles the motion you've handed off.
Why hand movement off
Doing it yourself, in the loop, is fine for a thing or two. But picture twenty drifting clouds, a scrolling starfield, a patrolling guard: writing every one's motion into the frame loop buries your game logic under bookkeeping. Hand those repeating, predictable movements to AMAL, and your loop stays about the game — what's happening, who hit whom, what the player did — while AMOS keeps everything gliding. That division of labour is a big part of how AMOS games punched above their weight.
Type it and run it
Type the program in and press F1. The bob slides back and forth on its own. Press Esc or reset to stop. (If the bob doesn't move, the most likely cause is a typo in the AMAL string — see below.)
Try this: change the path
Change the move to M 0,150,75 (and the return to M 0,-150,75). Now the bob glides down and back up instead of side to side — M takes an across amount, then a down amount, so swapping the numbers swaps the direction. Try M 220,150,75 for a diagonal.
Try this: change the speed
Change the 75 in both moves to 150. The bob now takes 150 steps to cross instead of 75, so it glides slower — more steps over the same distance means smaller, gentler movements. Fewer steps, faster and choppier; more steps, slower and smoother.
If it doesn't work
- The bob doesn't move (or the screen looks wrong). The AMAL string is fussy about its punctuation. Check the semicolons between instructions, the colon after the label (
Loop:), and thatJumpnames the same label exactly. - AMOS complains about
ChannelorAmal. The order matters: place the bob withBobfirst, thenChannel … To Bob …, thenAmal, thenAmal On. The channel has to have a bob to drive. - It moves once and stops. The
Jump Loopis what makes it repeat. Without it, AMAL runs the moves once and sits still.
What you've learnt
AMAL hands movement to AMOS to run on its own. A Channel ties an AMAL program to a bob; Amal gives it a movement written in AMAL's little language — M across,down,steps to glide, a label and Jump to repeat; and Amal On sets it running in the background, fifty times a second, while your main loop gets on with the game. Handing off repeating motion this way is how an AMOS game keeps dozens of things moving without drowning its own logic.
What's next
Things are moving — by your hand and by AMAL. The last piece of a game is consequence: what happens when two of them touch. Next — Bumping Into Things — you'll detect when one bob collides with another, the test that sits under every catch, hit, and pickup in every game there is.