X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FEa.cpp;h=4be33e134eabfe23aedee5f2fba4018c04d2500b;hb=e5503e2f4fe1c7ccc46c493a1596fb0e416f678e;hp=8b103c93bd0a1e830bcbb0a483646e131015c25c;hpb=85a36a57a816ac643ee5f982d774532a0ca4d58b;p=picodrive.git diff --git a/cpu/Cyclone/Ea.cpp b/cpu/Cyclone/Ea.cpp index 8b103c9..4be33e1 100644 --- a/cpu/Cyclone/Ea.cpp +++ b/cpu/Cyclone/Ea.cpp @@ -1,6 +1,8 @@ #include "app.h" +int earead_check_addrerr = 1, eawrite_check_addrerr = 0; + // some ops use non-standard cycle counts for EAs, so are listed here. // all constants borrowed from the MUSASHI core by Karl Stenerud. @@ -98,11 +100,12 @@ static int EaCalcReg(int r,int ea,int mask,int forceor,int shift,int noshift=0) for (i=mask|0x8000; (i&1)==0; i>>=1) low++; // Find out how high up the EA mask is mask&=0xf<=8) needor=1; // Need to OR to access A0-7 - - if (((mask&g_op)>>low)&8) needor=0; // Ah - no we don't actually need to or, since the bit is high in r8 - - if (forceor) needor=1; // Special case for 0x30-0x38 EAs ;) + if (ea>=8) + { + needor=1; // Need to OR to access A0-7 + if ((g_op>>low)&8) { needor=0; mask|=8<=0x3a && ea<=0x3b) MemHandler(2,size,a); // Fetch - else MemHandler(0,size,a); // Read + if (ea>=0x3a && ea<=0x3b) MemHandler(2,size,a,earead_check_addrerr); // Fetch + else MemHandler(0,size,a,earead_check_addrerr); // Read + + // defaults to 1, as most things begins with a read + earead_check_addrerr=1; if (sign_extend) { @@ -461,7 +467,11 @@ int EaWrite(int a,int v,int ea,int size,int mask,int top,int sign_extend_ea) if (shift) ot(" mov r1,r%d,asr #%d\n",v,shift); else if (v!=1) ot(" mov r1,r%d\n",v); - MemHandler(1,size,a); // Call write handler + MemHandler(1,size,a,eawrite_check_addrerr); // Call write handler + + // not check by default, because most cases are rmw and + // address was already checked before reading + eawrite_check_addrerr = 0; ot("\n"); return 0; }