On 16 Apr 2012, at 16:28, Simon Owen wrote:
> On 16 Apr 2012, at 16:13, Andrew Collier wrote:
>> It still amuses me that the biggest side-effect of my contributions to
>> the Sam scene was to necessitate accuracy in the emulators :)
> 
> Getting the textured scroller right in part 2 of MNEMOdemo1 was definitely a 
> grail moment, where everything had to be right.  Even now, if you build 
> SimCoupe on the Mac and use Clang rather than gcc the scroller is wrong!  
> I've not put any effort into tracking that down yet, but it's almost 
> certainly a compiler issue (gcc and MSVC are fine).

I was intrigued by this, so I had a look:

CPU.cpp: 84
#define PORT_ACCESS(a)  { (g_dwCycleCounter += 4) += ((a) >= BASE_ASIC_PORT) 
?abPortContention[g_dwCycleCounter&7] : 0; }

I don't have a copy of K&R to hand, but I reckon this is ambiguous (i.e. the 
value of g_dwCycleCounter&7 depends on the whether this is evaluated before or 
after the += 4. Honestly I'm a bit surprised that the left hand side is an 
lvalue at all...). Substituting a clearly non-ambiguous version cleans up the 
problems, so I've checked in the change.

Andrew

Reply via email to