Step25: Programming basis

I guess an important step is to get the basis of the programmation. You need to undersant the overall logic behind an algorithm then how to setup in assembly.

Algorithm

Like in a video game, demos are real time. That means everything you see on screen is computed. Some data are pre-computed, that means already computed before the demo run. If demo is running on a 50Hz screen, that means in a second 50 pictures need to be compute (50 FPS) (On NTSC, this is 60FPS). 50 FPS means 20ms for computing one picture (or « frame »). This is really short. So when building your program, you need to create an architreture than never block your execution. Also the most you can parallilized computing, the better it is. If you run out of time for building a picture, you can consider using 2 frames (or more), the go down to 25FPS or below. The best demos are running at full speed, that means 50FPS.

For french speakers, I’ve written a full method for practising C and C++ with simple exercice based on the « frame » principle.

It is called "NGCK" : http://www.dk-games.com/NGCK.html

This is some exercice I give to my students when I’m teaching them basis of programmation in video game. You’ll find the same structure as in demo : On initialisation function, and « update » function for doing computing and a display function. The last one sholuld never block or be too long.

Assembly

Once you’ve understand the concept of real time in a program, you will need to write code in assembly to run it on small computer like Amiga. I’ve also programmed on small platform in C, like game boy advance console. The console is a bit more powerful than an amiga so using compiled C is still fast. On Amiga, we do not have enough power to run something else than assembly for having full speed (but check the article talking about Amos or Blitz Basic, these langage are also great and fast).

68000 Assembly is a smart langage in my point of view. (I think it is clearer than 8 bits assembly langages). There are not much commands, and you can learn them quite easily. What you need to understand is that assembly commands are small bricks and using lot of them you can build bigger things like lego assembly.

In  68000 assembly, you manipulate data of 3 size : Byte, Word, and long, respectively 8, 16 and 32 bits. These values can be used as signed or unsigned values. In face you can do what you want with them (for example you can use a 16bits value and define that 4 bits are the integer part and 8 bits are the « floating » part, so you can use them as fixed float values).

For learning more, you can read this tutorial: MarkeyJester’s Motorola 68000 Beginner’s Tutorial

I often go there to find some infos about instructions.

Cool demos of that time

From Dexion X-Mas Conference 1990

Phenomena – Animotion (Amiga Demo, 1990)

Rebels – Total Triple Trouble – Amiga Intro

Megademo 2 (Budbrain, 1990, Amiga ECS)

The first part is a refererence to ‘The Madonna Demo’ from Crionics Megademo

 

Step24 Step26