doug@edge.UUCP (Doug Pardee) (05/06/87)
> #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. The assembly language programmer who isn't too experienced on the 68000 might indeed have fallen into the same trap. Those who have spent a few months working with the little bugger are aware of the note hidden at the bottom of the page which describes the CLR instruction: Note: A memory destination is read before it is written to. And those very experienced in 68000 assembly don't use CLR much anyway; for data registers MOVEQ is faster for double-word and EOR.x is faster for word and byte. For memory operands, a simple MOVE.x #0,loc is as fast or faster for all operand sizes, addressing modes, and chips. The CLR does take more code space, though. Oh, and to clear an address register, SUBA.L An,An. How about we move any further discussion of assembly stuff to comp.lang.misc, and leave this group for C? -- Doug Pardee -- Edge Computer Corp., Scottsdale, AZ -- ...!ihnp4!mot!edge!doug