• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Retro Game Coders

Retro Game Coders

Retro computer/console game + dev community

  • About
    • Retro Computer Collection
    • Contact
  • Blog
  • Retro Resources
    • Retro Gaming Timeline
    • Online Retro IDE
    • Retro Pixel Art Editor
    • Dungeon Loom Map Editor
    • 6502 Programmer’s Reference
    • Emulators
      • Acorn Electron
      • Amstrad CPC Emulator
      • Online BBC Micro Emulator
      • Commodore PET Emulator
      • Browser C64 Emulator
      • DOSBox/DOS PC emulator
      • Tandy CoCo/Dragon
    • Best Retro YouTube Channels
    • New Retro Books
    • Raspberry Pi Amiga Emulation
    • MiSTer FPGA Tutorial
    • BMC64 C64 Pi
  • Community

Home » Retro Game Coders Blog » Programming

Programming the Amiga with AMOS BASIC: Animation & Scrolling with AMAL

There is one last popular option for scrolling the screen and covering it gives us an opportunity to introduce the special AMOS animation language, AMAL …

▶ Try this lesson in your browser

Run the AMAL animation and scrolling example in our in-browser Amiga and AMOS IDE. Hit Run to see AMAL drive the scroll without blocking the main loop:

Open amal-scrolling.bas in the IDE →

Amiga AMOS Basic Programming Tutorials:
  1. Installing AMOS
  2. Loading images and configuring AMOS screens
  3. “Dual Playfield”
  4. Bobs and Sprites
  5. Maps and Scrolling
  6. Better Tile Scrolling
  7. AMOS AMAL Animation Programming
  8. Playable Shoot-Em-Up Game

Join Retro Game Coders Community
Join the Retro Game Coders Community

AMOS AMAL

AMAL is an animation language embedded in the main AMOS language.

The idea is that you can code the animations for various elements, and have that taken care off automatically in the background while you take care of other things your program needs to do.

First you assign an animation channel.

You can control the animation of sprites, bobs, rainbows, and even a screen:

' Set up an AMAL channel
' This sets the channel 1 to control
' the Screen 0 Offset
Channel 1 To Screen Offset 0

' Sets up channel 2 to Bob 1
Channel 2 To Bob 1

Next you assign the AMAL code to that channel. The code is provided as a string, and can be abbreviated (eg. A or Anim)

As mentioned, the main use of AMAL is animation and movement, which is implemented like this:

' Anim or A provides a sequence of animation frames 
'  - times to repeat (0 means forever)
'  - image number 
'  - delay (in 50th/sec)
A1$="Anim 0,(1,20)(2,20)(3,20)(4,20)(3,20)(2,20)"
A2$="Label:"
A3$="Move 80,0,50;Move -80,0,50;"
A4$="Jump Label"
A$=A1$+A2$+A3$+A4$
Amal 2,A$

Label or L: is a label so we can loop back to this point

J or Jump means jump to label, like a goto

M or Move moves the assigned object in pixels, horizontal and/or vertical. In our example we are going to move the screen 100 pixels horizontal, 0 vertical, and do it over 8 frames:

Amal 1,"L:M 100,0,8;J L;"

Once you have code assigned to a channel, you can start and stop the AMAL and animations with on or off:

Amal On 
Anim On 

You can now follow the tutorials and edit the code right in your web browser with the Online Retro IDE

– No downloads, configuration, etc necessary, and it is free!

Animating a Space Invader

Here is a simple example of moving and animating a bob.

The invader moves left and right 80 pixels while doing a basic 4 frame of animation dance.

Screen Open 0,320,200,32,Lowres
Flash Off : Curs Off : Hide 
Paper 0
Pen 4
Cls 

Load "invaders2.abk"
Get Bob Palette 
Cls 

Bob 1,100,100,1
Channel 2 To Bob 1

' AMAL code to animate and move our invader
A1$="Anim 0,(1,20)(2,20)(3,20)(4,20)(3,20)(2,20)"
A2$="Label:"
A3$="Move 80,0,50;Move -80,0,50;"
A4$="Jump Label"
A$=A1$+A2$+A3$+A4$
Amal 2,A$
Anim On 
Amal On 

Wait Key 

AMAL Scroller Code

The following code will scroll the screen left and right at various speeds, while bouncing some space invaders.

I will leave combining the sprite animation with the scrolling as an exercise for the reader!

Rem ************************************** 
Rem  
Rem   AMAL scrolling demo
Rem
Rem   by Maker Hacks 
Rem
Rem   2020 
Rem
Rem ***************************************

' Fresh screen
Screen Open 0,320,200,32,Lowres
Flash Off : Curs Off : Hide 
Paper 0
Pen 4
Cls 

' Set up our variables
Dim X(10)
Dim Y(10)
Dim XDIRECTION(10)
Dim YDIRECTION(10)

' Randomize the space invaders
' Start positions and directions
For B=0 To 9
   X(B)=Rnd(320)
   Y(B)=Rnd(200)
   XDIRECTION(B)=Rnd(16)-16
   If XDIRECTION(B)=0 Then XDIRECTION(B)=-8
   YDIRECTION(B)=-XDIRECTION(B)
Next B

' Get our invader graphic
Load "invader.abk"
Get Bob Palette 
Cls 

' Put some background text up
Locate 0,2
For X=1 To 60
   Print "Hello World! ";
Next X

' Using double buffer and auto back
' should automatically make things less flickery
Double Buffer 
Autoback 0

' This is our AMAL code
' Moves ? pixels in ? frames then loops
Channel 1 To Screen Offset 0
Amal 1,"L:M 100,0,8;M 100,0,16;M 100,0,32;M -100,0,32;M -100,0,16;M -100,0,8;J L;"
Amal On 

' Keep bouncing until a key is pressed
While Inkey$=""
   For B=0 To 9
      Bob B,X(B),Y(B),1

      If X(B)<=0 Then XDIRECTION(B)=-XDIRECTION(B)
      If X(B)>=320-32 Then XDIRECTION(B)=-XDIRECTION(B)
      If Y(B)<=0 Then YDIRECTION(B)=-YDIRECTION(B)
      If Y(B)>=200-32 Then YDIRECTION(B)=-YDIRECTION(B)
      X(B)=X(B)+XDIRECTION(B)
      Y(B)=Y(B)+YDIRECTION(B)

   Next B

   ' wait for vertical blank
   Wait Vbl 
Wend 


Category: ProgrammingTag: amos, basic programming, Commodore Amiga
Previous Post:Programming the Amiga with AMOS BASIC: Better Tile Scrolling
Next Post:Programming the Amiga with AMOS BASIC: A Playable “Shoot ’em up” Game

Retro Game Coders

Retro computer/console game + dev programming community by Chris Garrett

  • Bluesky
  • Threads
  • Facebook
  • Instagram
  • YouTube
  • Mastodon

Maker Hacks ・ D6Combat・chrisg.com

© Copyright 2026 Chris Garrett

Privacy ﹒ Terms of Service

Return to top