Animation: Trig Demo

By Richard Dimond

Originally published in EUG #21

Animated Wonders

These are five samples of animation originally published in Acorn User (Dec 1992) to demonstrate the compression routines which I gave in my article in EUG #18. As published, the programs would not run with PAGE greater than &1100 (as HIMEM needs to be lowered to between &1700 and &1F00). I have now modified the programs so that they download to &E00.

Each program builds up a series of screens which are then compressed and SAVEd in the sequence above HIMEM. They are then expanded and displayed to give the animation.

Changes Made For Electron

The programs needed changes since the M/code must be *LOADed before the program is downloaded. I have also provided a Quick Demo Menu. The compressed screen files are SAVEd in the files DAT1,... and when these are LOADed, the demo will run. This saves the time taken for the data to be built up which can be up to half an hour or more! Numbers 3 and 4 are the quickest. With some of the demos, the data runs into the screen area and only the lower part of the screen is used for the demo.

To see the animation as quickly as possible, select the 'Quick Anims Menu' before choosing it. If you have PAGE at &E00, you can press a key at any time after it starts to return to the menu. If the program has to download, you need to press CTRL-BREAK to set up again.

Program Notes

I have used two integer variables as flags, M% to indicate whether PAGE greater than &1100 and D% for the Quick Demo mode.

If PAGE is lower than &1100 then M% is FALSE and the programs run normally with the M/code LOADing at line 140, and if D% is TRUE the programs skip the procedures for building up and displaying the screens to LOAD the data files, line 1020 and then run the demo.

With PAGE greater than &1100, the programs jump to line 2000. M% is now TRUE and the M/code is LOADed at line 2020. If D% is FALSE then the program goes to line 2080 and then downloads and runs as normally with the screens building up.

With PAGE at &1D00, the data files need to be LOADed to &2A00 and then downloaded to their correct address after the BASIC program has been downloaded. This proved to be rather tricky as they all now ran into the screen area.

The Mode must be set initially and not after downloading (line 60). HIMEM must be first set as high as possible and a text window set above this to prevent the files being corrupted.

The downloading is done by a short M/code routine added to the compression routines at &9EE. The addresses for this are set at line 2050 and the routine CALLed at line 75 after downloading.

A further point is that the memory must be cleared on pressing CTRL-BREAK as I found that, on selecting another demo after a CTRL-BREAK, the demo was misplaced. I have included the *FX200,3 call at line 2010 to clear memory so that the demos are correctly shown.

Richard Dimond, EUG #21