!lm12
!rm75
Simple Hires Animation...........................Mike Laumer

One thing that I have been working with in my next product (MIKE'S MAGIC MATRIX) is animation using hires graphics.  I have been developing a hires graphics editor using the FLASH! Integer BASIC Compiler.  I may not be the first one to bring a commercial product to market using the FLASH! compiler since there are at least six other programmers who are striving to beat me.

There are several methods used to achieve animation in the popular game programs.  The one presented in this program is possibly the simplest.  This program will animate an image in one place on the screen (in-place animation) from a series of frames of data.

The technique used to display the frame data on the screen is simply moving the data with 'LDA' and 'STA' instructions.  A more powerful method of animation is to use the 'EOR' instruction to merge one frame of animation into the next.  This is accomplished by using the frame data obtained by 'EOR'ing two successive frames of data.  Then using that new data to 'EOR' to the image data.  The 'EOR' istruction is very useful since it can add and delete data to and from the screen without disturbing any background that may be on the screen already.

A frame of data for the animation is written to the screen and then a delay loop entered to delay before the next data frame is written to the screen.  If the delay is smaller the animation will speed up.  If the delay is larger the animation will slow down.  The delay could be read from the game paddle.

The method I used in the routine to compute the hires graphics screen addresses is to use two tables (one for lo-byte, one for hi-byte) with 192 entries to convert the Y-coordinate into a hires address.  Otherwise, the Y-addresses would have to be computed by using a complicated formula:

    A = Y MOD 8
    B = (Y / 8) MOD 8
    C = Y / 64
    YADRS = 8192 + A*1024 + B*128 + C*40
    (add another 8192 if hires page2 adress needed)

So you see that even with an efficiently coded machine language routine to compute a screen address it will take a bit of time to perform.  It is much more effecient to simply look up the address of the first byte of the Y-row in a table.  Since the Y-coordinate never exceeds 191 (which is less than 256) the Y-register can be used easily to index the table.  The table in the program only provides the offset from the beginning of a hires page.  The program uses an 'ORA' instruction to put $20 or $40 into the hi-byte to specify hires page 1 or 2.

The data for the animations were built with MIKE'S MAGIC MATRIX and the first frame looks like this:



          (a printer dump goes here)





The data was written to a text file from within the editor and run through an Applesoft program to create an EXEC file for the S-C Macro Assembler to insert the data tables into the program.

You can make your own frames of animation by a hand process of drawing the animation dots on graph paper and reducing the data into hexadecimal data.  To do this you must take each row of dots (on or off) on the graph paper and take them 7 dots at a time.  The 7 dots must then be flipped into reverse order before converting into hex.  Here is an example of 14 pixels width:

      0 1 2 3 4 5 6 0 1 2 3 4 5 6
      ---------------------------
      . * . * * * . . * * * . * *




      . . * * * . * .  . * * . * * * .
      0 0 1 1 1 0 1 0  0 1 1 0 1 1 1 0
      ---------------  ---------------
      7 6 5 4 3 2 1 0  7 6 5 4 3 2 1 0


            $3A              $6E


As you can see the process is a pain in the neck.  If the animation has a flaw in it you have to repeat the process for every frame of data that is wrong.  That is where a hires graphics editor and animation design tool like MIKE'S MAGIC MATRIX really shines, because you can perfect your animation and test it in the editor without ever leaving.  MIKE'S MAGIC MATRIX is not yet ready for sale lacking a manual and a little more work.  I expect to have the first version ready in about two more months.  Preliminary showings to the Dallas Apple Corps indicated an enormous popularity.

Since hexadecimal strings take up a lot of listing space when they are assembled, I decided to print the tables here using just the LIST command, without the assembled object code listing.  The program part is shown in the normal assembled format.

Here is what you will see if you get it all typed correctly:

   <9 little men here>





Of course, they will all appear one after the other in the same screen position, not side-by-side.

