src/memory.c

changeset 68
58318104858b
parent 66
8ca92162fa89
child 70
5bbe76e71698
     1.1 --- a/src/memory.c	Tue Dec 28 18:59:15 2010 +0000
     1.2 +++ b/src/memory.c	Tue Dec 28 19:10:36 2010 +0000
     1.3 @@ -67,7 +67,7 @@
     1.4  		return MEM_KERNEL;
     1.5  
     1.6  	// Check page is write enabled
     1.7 -	if ((pagebits & 0x04) == 0)
     1.8 +	if (writing && ((pagebits & 0x04) == 0))
     1.9  		return MEM_PAGE_NO_WE;
    1.10  
    1.11  	// Page access allowed.
    1.12 @@ -112,14 +112,14 @@
    1.13  			case MEM_KERNEL:										\
    1.14  			case MEM_PAGE_NO_WE:									\
    1.15  				/* kernel access or page not write enabled */		\
    1.16 -				/* TODO: which regs need setting? */				\
    1.17 +				/* FIXME: which regs need setting? */				\
    1.18  				fault = true;										\
    1.19  				break;												\
    1.20  		}															\
    1.21  																	\
    1.22  		if (fault) {												\
    1.23  			if (bits >= 16)											\
    1.24 -				state.bsr0 = 0x7F00;								\
    1.25 +				state.bsr0 = 0x7C00;								\
    1.26  			else													\
    1.27  				state.bsr0 = (address & 1) ? 0x7D00 : 0x7E00;		\
    1.28  			state.bsr0 |= (address >> 16);							\
    1.29 @@ -162,14 +162,14 @@
    1.30  			case MEM_KERNEL:										\
    1.31  			case MEM_PAGE_NO_WE:									\
    1.32  				/* kernel access or page not write enabled */		\
    1.33 -				/* TODO: which regs need setting? */				\
    1.34 +				/* FIXME: which regs need setting? */				\
    1.35  				fault = true;										\
    1.36  				break;												\
    1.37  		}															\
    1.38  																	\
    1.39  		if (fault) {												\
    1.40  			if (bits >= 16)											\
    1.41 -				state.bsr0 = 0x7F00;								\
    1.42 +				state.bsr0 = 0x7C00;								\
    1.43  			else													\
    1.44  				state.bsr0 = (address & 1) ? 0x7D00 : 0x7E00;		\
    1.45  			state.bsr0 |= (address >> 16);							\