Fix read-after-write logic experimental_memory_mapper_v2

Fri, 12 Apr 2013 12:34:32 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 12 Apr 2013 12:34:32 +0100
branch
experimental_memory_mapper_v2
changeset 140
1e4c45b144c4
parent 135
159f937af10d
child 141
8460d432606f

Fix read-after-write logic

In some cases (notably reading from a page after having written to it), the
mapper may change the pagestate from "accessed and written" ("dirty"; PS0,PS1)
to "accessed but not written" (clean; PS1,!PS0). This should never, ever, EVER
happen. Once a page is dirty, it remains so until the 68k clears the DIRTY
bit.

Once again, this wonderful bit of logic was missing from the TRM.

src/memory.c file | annotate | diff | revisions
     1.1 --- a/src/memory.c	Wed Mar 13 01:10:34 2013 +0000
     1.2 +++ b/src/memory.c	Fri Apr 12 12:34:32 2013 +0100
     1.3 @@ -94,7 +94,8 @@
     1.4  	} else {
     1.5  		// No L7 interrupt
     1.6  		if ((write && !(MAP_PAGEBITS(addr) & PAGE_BIT_PS1) &&  (MAP_PAGEBITS(addr) & PAGE_BIT_PS0)) ||
     1.7 -			(write &&  (MAP_PAGEBITS(addr) & PAGE_BIT_PS1) && !(MAP_PAGEBITS(addr) & PAGE_BIT_PS0)))
     1.8 +			(write &&  (MAP_PAGEBITS(addr) & PAGE_BIT_PS1) && !(MAP_PAGEBITS(addr) & PAGE_BIT_PS0)) ||
     1.9 +			(          (MAP_PAGEBITS(addr) & PAGE_BIT_PS1) &&  (MAP_PAGEBITS(addr) & PAGE_BIT_PS0)))  /* NOTE -- Once again, this case was missing from the PAL equations in the TRM... */
    1.10  		{
    1.11  			// No L7 interrupt, PS[1:0] = 0b01, write
    1.12  			// No L7 interrupt, PS[1:0] = 0b10, write