The ATARI ST can only move about 32Kb of data during one frame (20ms in 50Hz), so in order to make anything twist, distort or change form the data must be pre-calculated in most of the cases. But then you often run into memory problems, 512 kilobyte of memory is sometimes making you feel like inside a shoebox.
The first bit distorted Y scroller I saw was made by FLEXIBLE FRONT and used a fixed offset in the sin table, It .was also a ROXL scroller so all CPU was used.
I’m going to explain my code that performs an Y bit distortion of a 2D matrix containing a scroller. (the routine is used in m-demo 3 and KEFF demo).
First of all you need a sin table that is preferable 512, 1024, 2048…. bytes long since the wraparound will be easier to handle then. Then we need to take a 8 by 8 pixel block and Y distort using the sin table. The upper part of the 8 by 8 block is now representing all the upper edges of the character and the lower part is representing the lower parts. the blocks in-between is not distorted since that is just a waist of CPU power. Look at the figure below (it is the 2D matrix) and you will see what I mean.
Some of the characters contains a lot of vertical edges so we need to add a function that’s finding the vertical edges in the matrix and applying the correct distorted block (upper, lower or no distortion).
I guess you don’t even know what I’m talking about… So here it is, in raw MC68000:
megabend5.zip