<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 25 Jun 1993 07:28:24 +1200
From   : David Andrew Sainty <David.Sainty@...>
Subject: Unrolling loops & fast routines

   Date: Thu, 24 Jun 93 09:54:47 BST
   From: matthew@... (Matthew Sweet)

   Mik,

   The only way to get the routine as fast as the above is to use it to
   copy from and to page aligned buffers. The easiest way to guarantee
   that you can do this is to DIM more memory than you need, and use
   another variable as your base:

   DIM BufferSpace% &4ff
   BufferStart%=(BufferSpace%+&ff) AND &100

Of course, we all knew Matthew really meant AND &FF00 here... :-)

   This code fragment is 30 bytes long, and contains no absolute jumps,
   therefore you should be able to assemble it starting at BufferSpace%,
   and relocate it to BufferStart%+&400 if BufferStart%-BufferSpace% < 30.

Hmmm, nice little way around the basic thing.....

However, I wonder if the super-fast transfer is really required at all?
Making it transfer from an arbitrary address will be perhaps 400 cycles
slower on average, but that's NOT very long! (especially if the bulk of
your code is in basic...)

If you have multiple screens and are DIMing lots of screen buffers,
allocating an extra 256 bytes each time is going to get expensive!

Note also that the mode 7 screen is only 40x25 bytes, which is 24 bytes
less than 1k. Not only can you dim less than 1k per screen, but you
can also transfer less and gain speed that way (Note that this is a
little messy, you need two loops transferring 3 pages concurrently, and
the 4th page in a 2nd loop).

Dave.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>