[comp.sys.amiga] MFM coding/protection.

DXB132@psuvm.psu.edu (11/29/90)

In article <1990Nov28.163130.29457@batcomputer.tn.cornell.edu>,
riley@batcomputer.tn.cornell.edu (Daniel S. Riley) says:

>this with one the CIA timers would take about 6 more lines of
>assembly.  Commodore will even tell you how to do it--read Bryce's
>article "Amiga Low-Level Disk Access" in AmigaMail volume 1, page
>VIII-9.  Using timing loops in floppy access code is just pure

As an aside, for those of you too lazy to use the CIA (which IS really the
best way), there are some other approaches. Here's one:

 movea.l #$bfe001,a0
 move.w #MagicWorstCase,d0
.. move.b (a0),(a0)
 dbra d0,..
 rts

Because the CIAs are accessed at the same max rate (.7Mhz or similar) you can
calculate a worst case count value that will provide a minimum delay even with
an infinitely fast CPU. However this should really only be used if code space
is tight (like when you're patching someone's code that doesn't work with your
machine!!!!!!!!!!!!!!! )  Get the feeling that I do that quite a bit? :-)

This is NOT meant as a flame of the author of the code, however. I myself
wrote code like that a few years ago (and worse!). And for a program that's
for your own personal use, it's perfectly fine.

-- Dan Babcock

csg019@cck.cov.ac.uk (-~=Zaphod=~-) (12/05/90)

In article <1990Nov28.163130.29457@batcomputer.tn.cornell.edu> riley@batcomputer.tn.cornell.edu (Daniel S. Riley) writes:
>[ warning...flames ahead ]
>
>In article <1990Nov27.113820.28055@cck.cov.ac.uk> csg019@cck.cov.ac.uk (Z*A*P*H*O*D) writes:
>[...]
>>step_wait	=	3000		Delay for track movement
>
>and
>
>>stepper_delay
>>	move.w	#step_wait,d1
>>wait
>>	dbra	d1,wait
>
>and
>
>>motor_delay
>>	move.w	#$b000,d0
>>md
>>	dbra	d0,md
>>	rts
>
>A game programmer fer sure...
>
>Let me guess:  for high performance games on the Amiga, your players
>demand that floppy disk access be finely tuned for the 68000--if it
>didn't have timing loops, then it just wouldn't be worth playing.
>
>*sigh*
>
>This is the sort of mindless coding that leads to programs that break
>on accelerated Amigas for *no* defensible reason whatsoever.  Timing
>this with one the CIA timers would take about 6 more lines of
>assembly.  Commodore will even tell you how to do it--read Bryce's
>article "Amiga Low-Level Disk Access" in AmigaMail volume 1, page
>VIII-9.  Using timing loops in floppy access code is just pure
>laziness on the part of programmers who can't seem to understand that
>the Amiga is not a C-64.  Don't copy this code--get the AmigaMail
>article and learn to do it right.
>
>A rare flame from the keyboard of
>
Thank you for your constructive critisism. I know this code is DIRTY and
could be modified to work no problems (using you either your method, or
a quicker trip to the $dff006 register, taking in to account a PAL or NTSC
system.)

Please don't try to tell me how to code, i've been at 68k for 4 years now
and i know my weaknesess better than anyone else. It was meant as a demo
to give info on decoding and disk layout, NOT to be taken as 100% perfect.


-- 
*********///  O O **A member of S.H.I.T. (Super High Intelegence Team)**///***
*       ///    u    Fight, defeat and kill organized laming.           ///   *
*  \\\ ///    ---  Zaphod of Intuition  csg019@uk.ac.cov.cck ok?  \\\ ///    *
****\\X//**********************************************************\\X//******