[net.micro.amiga] 6502 and the 68000, hardwired code vs library calls.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (03/14/86)

	I must concur that a 68000 running at 7Mhz is about an order of
magnitude faster than a 6502.  However, you don't get a performance
increase of that much through the OS due to several very good reasons:

	
Programs written for the C64 (for instance), are usually written in
assembly (6502), and access the graphics chips/screen directly.

Programs written on the Amiga usually use the supplied Graphics
library to do various things.  Assuming you aren't using Layers,
you still have a large amount of overhead to do even the simplest
of operations.  Consider:

	* Time it takes to go through the library call table
	* Time it takes to check various rastport parameters and
	* Time it takes to calculate line/bit positions

I wrote a program to move 256 'dots' on the C64.  Each dot had it's own 
velocity and direction (angle 0-255).  MY 'WritePixel' routine took about
40 uS (~20 uS if the y-corr was the same).  That was on a 1 Mhz 6510  (same
machine language as a 6502)

A similar operation in 68000, going directly to the graphics screen (no
windows, you have the entire screen to yourself), would take about 4 uS.
It would involve mucho memory.. being completely table driven.  (By the way,
thats about 250Kpix/sec, and the code would be short enough that it could be
inline rather than a call, and this is NOT using any gfx support chips).

A similar operation using the graphics support library and 'WritePixel'
would take at least 100 uS, probably more, due to overhead.

A similar operation (say a line this time), using the blitter, and assuming
you have full control of it would depend on the line length, but for long
lines be extremely fast per pixel.  The overhead would be (and this is a
guess), about 40uS to do calculations and write the stuff directly to the
blitter registers

A similar operation using 'Draw' would take at least 100 uS, probably more,
due to overhead (e.g. the rastport).

MY DOTS program, re-written for the Amiga and using the WritePixel call
is about 1/3 as fast.  Don't expect to get performance by being lazy!!!!

---
The above is an excellent example of 'hardwired' code VS 'portable' code.
The hardwired code will invariably be much faster than the portable code.


So, you wonder why EA takes over the entire machine?   I rest my case.


					-Matt