Path: utzoo!attcan!uunet!portal!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: Re: ASSEMBLY MOVE/CLEAR/SET/COMPARE ROUTINES (was Clearing memory chain)
Message-ID: <1119@atari.UUCP>
Date: 16 Aug 88 19:13:25 GMT
References: <8808160343.AA10248@cory.Berkeley.EDU>
Reply-To: apratt@atari.UUCP (Allan Pratt)
Organization: Atari (US) Corporation, Sunnyvale, California
Lines: 32


dillon@cory.berkeley.edu says something about clearing memory being fast
when using movem and lots of registers.  He is right, but on a 4-meg
machine it still takes appreciable time.  It takes almost a second,
which is a long time if you do it a lot for short utilities loaded off
hard disk:

	At 4 clocks per longword to do the memory access, it takes
	4*3.5MB = 13,107,200 clocks, or ~0.82 seconds at 16MHz to
	clear 3.5MB, not counting instruction fetching and looping
	overhead.  This also doesn't count the fact that video
	memory cycles are interleaved with processor memory cycles;
	I don't know what that impact will be. 

The clearing code in the 11/20 ROMs (pre-Mega ROMs) is stupid and
slow, which is why it takes appreciable time to clear 1 Meg.  The
Mega ROMs fixed this, but clearing 3.5 Meg still takes a long time,
and future machines may possibly have up to 10 Meg -- clearing
9.5 Meg will not be pleasant:

	It would take 38,273,024 clocks (~2.4 sec) to clear
	9.5MB at 16MHz, but fortunately any machine with that
	much memory will probably run faster than 16MHz.

These numbers are back-of-the-napkin computations, and I may have
some major flaw in my arithmetic, but .82 seconds sounds right to me.

You can speed up memory clearing on a Mega 4 by installing a 2MB RAMdisk...

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt