[comp.lang.c] 68000 CLR read/modify/write

dyer@atari.UUCP (Landon Dyer) (05/02/87)

> 	I recently implemented a 68000 OS in C.  The amount of assembly
> coding was insignificant.  One interesting anecdote:
> 
> 	#define	DSK_SEL	*(char *)0xf12345  /* WRITE but dont READ */
> 		DSK_SEL = 0;
> 
> caused a parity error and had to be replaced with
> 		temp = 0; DSK_SEL = temp;
> 
> The code generated was CLR.B and MOV.B respectively.  Can anyone
> elucidate?  Notice that here the assembly language programmer might
> well have fallen into the same trap as the C compiler.

On a vanilla 68000, the CLR instruction does a read before writing the
zero.  If the memory has parity checking that needs to be initialized
by writing a value to memory before doing any reads (like the IBM-PC)
then CLR is NOT what you want to use.

The read/modify/write behavior was fixed on the 68010 -- another
reason why I've heard the 68010 called a "finished" 68000....

NB: Don't write any 68000 BITBLT code using CLR.
-- 
-Landon Dyer, Atari Corp.	    {sun,lll-lcc,imagen}!atari!dyer

The views expressed here do not not		You're a mean one, Mr. Grinch,
necessarily reflect those of Atari Corp.	 There're segments in your soul