Hi guys,
as promised, an explanation about how the scroll routine works:
Current screen array:The Atom screen in CLEAR3 colour mode has 128 x 96 pixels. Because a byte has 4 coloured pixels, you can define a tile of 4 x 8 coloured pixels. The complete screen can be stored in a 32 x 12 byte array. This array is called scr_current or the current screen array.
I use bit 7 of a byte in the array to mark the tile as changed. This means that we can use 128 tiles which can all be marked as changed.
The main loop reads the current screen array and plots the tiles which are changed. Then it clears bit 7 of the changed tile and stores the byte in the array.
Animation pipes:The idea is that every tile nr has an animation jump address. Because you can define 128 tiles, 128 animation jump addresses are stored in a table. One extra animation address is defined for no animation. Eg. to rotate 8 tiles after each other, you have to define animation routine1:
Animation1:
- Increment tile nr
- If tile nr=48 then tile nr=40
- Mark tile as changed, bit7=1
- Store tile nr in scr_current array
If you want tile nr 40 to rotate, change animation jump address40 into the address of routine Animation1. Every loop tilenr 40 is incremented and if the tile nr=48 then it will become 40.
This is how the pipes are scrolling. Because a byte has 4 coloured pixels, you have to design 4 pre-shifted tiles to become a pixel scroll.
Score digits:Displaying the score works like this:
- Executing all animations
- Backup part of the current screen array (where the digits are positioned)
- Copy the number tiles into the current screen array and mark them as changed
- Update screen
- Restore part of the current screen array
That's why the digits are displayed without flickering.
Phase4:
https://www.youtube.com/watch?v=Kt4FACMY6IE- Score routine added
- Score digits added
Greetings
Kees