fix state/status transposition, add GENCON.PIE handling

Fri, 03 Dec 2010 00:12:53 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Fri, 03 Dec 2010 00:12:53 +0000
changeset 44
f928be115194
parent 43
4d59e4ceef52
child 45
caa916e038e5

fix state/status transposition, add GENCON.PIE handling

src/memory.c file | annotate | diff | revisions
src/state.h file | annotate | diff | revisions
     1.1 --- a/src/memory.c	Fri Dec 03 00:04:01 2010 +0000
     1.2 +++ b/src/memory.c	Fri Dec 03 00:12:53 2010 +0000
     1.3 @@ -98,12 +98,12 @@
     1.4  				break;												\
     1.5  			case MEM_PAGEFAULT:										\
     1.6  				/* Page fault */									\
     1.7 -				state.genstat = 0x8BFF | (status.pie ? 0x0400 : 0);	\
     1.8 +				state.genstat = 0x8BFF | (state.pie ? 0x0400 : 0);	\
     1.9  				fault = true;										\
    1.10  				break;												\
    1.11  			case MEM_UIE:											\
    1.12  				/* User access to memory above 4MB */				\
    1.13 -				state.genstat = 0x9AFF | (status.pie ? 0x0400 : 0);	\
    1.14 +				state.genstat = 0x9AFF | (state.pie ? 0x0400 : 0);	\
    1.15  				fault = true;										\
    1.16  				break;												\
    1.17  			case MEM_KERNEL:										\
    1.18 @@ -145,12 +145,12 @@
    1.19  				break;												\
    1.20  			case MEM_PAGEFAULT:										\
    1.21  				/* Page fault */									\
    1.22 -				state.genstat = 0xCBFF | (status.pie ? 0x0400 : 0);	\
    1.23 +				state.genstat = 0xCBFF | (state.pie ? 0x0400 : 0);	\
    1.24  				fault = true;										\
    1.25  				break;												\
    1.26  			case MEM_UIE:											\
    1.27  				/* User access to memory above 4MB */				\
    1.28 -				state.genstat = 0xDAFF | (status.pie ? 0x0400 : 0);	\
    1.29 +				state.genstat = 0xDAFF | (state.pie ? 0x0400 : 0);	\
    1.30  				fault = true;										\
    1.31  				break;												\
    1.32  			case MEM_KERNEL:										\
    1.33 @@ -317,20 +317,16 @@
    1.34  					case 0x040000:		// [ef][4c]xxxx ==> General Control Register
    1.35  						switch (address & 0x077000) {
    1.36  							case 0x040000:		// [ef][4c][08]xxx ==> EE
    1.37 -								break;
    1.38 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
    1.39 -								break;
    1.40 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
    1.41  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
    1.42 -								break;
    1.43  							case 0x043000:		// [ef][4c][3B]xxx ==> ROMLMAP
    1.44 +							case 0x044000:		// [ef][4c][4C]xxx ==> L1 MODEM
    1.45 +							case 0x045000:		// [ef][4c][5D]xxx ==> L2 MODEM
    1.46 +							case 0x046000:		// [ef][4c][6E]xxx ==> D/N CONNECT
    1.47 +								// All write-only registers... TODO: bus error?
    1.48 +								handled = true;
    1.49  								break;
    1.50 -							case 0x044000:		// [ef][4c][4C]xxx ==> L1 MODEM
    1.51 -								break;
    1.52 -							case 0x045000:		// [ef][4c][5D]xxx ==> L2 MODEM
    1.53 -								break;
    1.54 -							case 0x046000:		// [ef][4c][6E]xxx ==> D/N CONNECT
    1.55 -								break;
    1.56 -							case 0x047000:		// [ef][4c][7F]xxx ==> Whole screen reverse video
    1.57 +							case 0x047000:		// [ef][4c][7F]xxx ==> Whole screen reverse video [FIXME: not in TRM]
    1.58  								break;
    1.59  						}
    1.60  						break;
    1.61 @@ -482,18 +478,14 @@
    1.62  					case 0x040000:		// [ef][4c]xxxx ==> General Control Register
    1.63  						switch (address & 0x077000) {
    1.64  							case 0x040000:		// [ef][4c][08]xxx ==> EE
    1.65 -								break;
    1.66 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
    1.67 -								break;
    1.68 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
    1.69  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
    1.70 -								break;
    1.71  							case 0x043000:		// [ef][4c][3B]xxx ==> ROMLMAP
    1.72 -								break;
    1.73  							case 0x044000:		// [ef][4c][4C]xxx ==> L1 MODEM
    1.74 -								break;
    1.75  							case 0x045000:		// [ef][4c][5D]xxx ==> L2 MODEM
    1.76 -								break;
    1.77  							case 0x046000:		// [ef][4c][6E]xxx ==> D/N CONNECT
    1.78 +								// All write-only registers... TODO: bus error?
    1.79 +								handled = true;
    1.80  								break;
    1.81  							case 0x047000:		// [ef][4c][7F]xxx ==> Whole screen reverse video
    1.82  								break;
    1.83 @@ -656,18 +648,14 @@
    1.84  					case 0x040000:		// [ef][4c]xxxx ==> General Control Register
    1.85  						switch (address & 0x077000) {
    1.86  							case 0x040000:		// [ef][4c][08]xxx ==> EE
    1.87 -								break;
    1.88 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
    1.89 -								break;
    1.90 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
    1.91  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
    1.92 -								break;
    1.93  							case 0x043000:		// [ef][4c][3B]xxx ==> ROMLMAP
    1.94 -								break;
    1.95  							case 0x044000:		// [ef][4c][4C]xxx ==> L1 MODEM
    1.96 -								break;
    1.97  							case 0x045000:		// [ef][4c][5D]xxx ==> L2 MODEM
    1.98 -								break;
    1.99  							case 0x046000:		// [ef][4c][6E]xxx ==> D/N CONNECT
   1.100 +								// All write-only registers... TODO: bus error?
   1.101 +								handled = true;
   1.102  								break;
   1.103  							case 0x047000:		// [ef][4c][7F]xxx ==> Whole screen reverse video
   1.104  								break;
   1.105 @@ -820,12 +808,15 @@
   1.106  						switch (address & 0x077000) {
   1.107  							case 0x040000:		// [ef][4c][08]xxx ==> EE
   1.108  								break;
   1.109 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
   1.110 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
   1.111 +								state.pie = ((value & 0x8000) == 0x8000);
   1.112 +								handled = true;
   1.113  								break;
   1.114  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
   1.115  								break;
   1.116  							case 0x043000:		// [ef][4c][3B]xxx ==> ROMLMAP
   1.117  								state.romlmap = ((value & 0x8000) == 0x8000);
   1.118 +								handled = true;
   1.119  								break;
   1.120  							case 0x044000:		// [ef][4c][4C]xxx ==> L1 MODEM
   1.121  								break;
   1.122 @@ -982,7 +973,9 @@
   1.123  						switch (address & 0x077000) {
   1.124  							case 0x040000:		// [ef][4c][08]xxx ==> EE
   1.125  								break;
   1.126 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
   1.127 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
   1.128 +								state.pie = ((value & 0x8000) == 0x8000);
   1.129 +								handled = true;
   1.130  								break;
   1.131  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
   1.132  								break;
   1.133 @@ -1145,7 +1138,10 @@
   1.134  						switch (address & 0x077000) {
   1.135  							case 0x040000:		// [ef][4c][08]xxx ==> EE
   1.136  								break;
   1.137 -							case 0x041000:		// [ef][4c][19]xxx ==> P1E
   1.138 +							case 0x041000:		// [ef][4c][19]xxx ==> PIE
   1.139 +								if ((address & 1) == 0)
   1.140 +									state.pie = ((value & 0x80) == 0x80);
   1.141 +								handled = true;
   1.142  								break;
   1.143  							case 0x042000:		// [ef][4c][2A]xxx ==> BP
   1.144  								break;
     2.1 --- a/src/state.h	Fri Dec 03 00:04:01 2010 +0000
     2.2 +++ b/src/state.h	Fri Dec 03 00:12:53 2010 +0000
     2.3 @@ -36,6 +36,8 @@
     2.4  	/// GENCON.ROMLMAP -- false ORs the address with 0x800000, forcing the
     2.5  	/// 68010 to access ROM instead of RAM when booting. TRM page 2-36.
     2.6  	bool		romlmap;
     2.7 +	/// GENCON.PIE -- Parity Error Check Enable
     2.8 +	bool		pie;
     2.9  } S_state;
    2.10  
    2.11  // Global emulator state. Yes, I know global variables are evil, please don't