Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 beta 3/9/83; site nbs-amrf.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!umcp-cs!nbs-amrf!libes
From: libes@nbs-amrf.UUCP (Don Libes)
Newsgroups: net.micro.68k
Subject: Re: bus error, but why? (SOLVED)
Message-ID: <367@nbs-amrf.UUCP>
Date: Thu, 17-Jan-85 21:12:45 EST
Article-I.D.: nbs-amrf.367
Posted: Thu Jan 17 21:12:45 1985
Date-Received: Sat, 19-Jan-85 01:31:26 EST
Organization: National Bureau of Standards
Lines: 18

Many thanks to the people (rlgvax!jds, oakhill!cruess, vu44!jack) who
correctly clued me in that longword stores must be done on even byte
addresses on the 68010.

The reason that the C compiler generated the errant code was my own fault,
although understandable.  I was stuffing structures into an outgoing message
declared as a character buffer.  Sure enough, when I stuffed one in that had
an odd length, the next one started on an odd address boundary and my program
faulted.  My mistake was forgetting about alignment.

The reason it didn't occur to me to wonder about alignment (besides the fact
that I don't read 68000 manuals when writing C code), is that when I asked the
debugger (dbx) to see the longword at an odd address it gave me the bytes
straddling the odd address without complaint.  That was misleading, although I
suppose the author figured he was doing the programmer a favor by not
generating a bus error but simulating the long word fetch.

Don Libes	{seismo,umcp-cs}!nbs-amrf!libes