From: notaz Date: Wed, 9 Apr 2008 20:30:57 +0000 (+0000) Subject: bugfixes for Cyclone r9 change X-Git-Tag: v1.85~514 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8527dc450a96f7a292b7f302e8e55147628b6042;p=picodrive.git bugfixes for Cyclone r9 change git-svn-id: file:///home/notaz/opt/svn/PicoDrive@418 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/cpu/Cyclone/OpBranch.cpp b/cpu/Cyclone/OpBranch.cpp index 0a2b3ecb..ce5ae70a 100644 --- a/cpu/Cyclone/OpBranch.cpp +++ b/cpu/Cyclone/OpBranch.cpp @@ -47,7 +47,7 @@ static void PopSr(int high) OpRegToFlags(high); } -// Pop PC - assumes r11=Memory Base - trashes r0-r3 +// Pop PC - trashes r0-r3 static void PopPc() { ot(";@ Pop PC:\n"); @@ -55,7 +55,8 @@ static void PopPc() ot(" add r1,r0,#4 ;@ Postincrement A7\n"); ot(" str r1,[r7,#0x3c] ;@ Save A7\n"); MemHandler(0,2); - ot(" add r0,r0,r11 ;@ Memory Base+PC\n"); + ot(" ldr r1,[r7,#0x60] ;@ Get Memory base\n"); + ot(" add r0,r0,r1 ;@ Memory Base+PC\n"); ot("\n"); CheckPc(); #if EMULATE_ADDRESS_ERRORS_JUMP @@ -175,7 +176,6 @@ int Op4E70(int op) case 3: // rte OpStart(op,0x10,0,0,1); Cycles=20; PopSr(1); - ot(" ldr r11,[r7,#0x60] ;@ Get Memory base\n"); PopPc(); ot(" ldr r1,[r7,#0x44] ;@ reload SR high\n"); SuperChange(op,1); @@ -195,7 +195,6 @@ int Op4E70(int op) case 5: // rts OpStart(op,0x10); Cycles=16; - ot(" ldr r11,[r7,#0x60] ;@ Get Memory base\n"); PopPc(); #if EMULATE_ADDRESS_ERRORS_JUMP ot(" tst r4,#1 ;@ address error?\n"); @@ -217,7 +216,6 @@ int Op4E70(int op) case 7: // rtr OpStart(op,0x10); Cycles=20; PopSr(0); - ot(" ldr r11,[r7,#0x60] ;@ Get Memory base\n"); PopPc(); #if EMULATE_ADDRESS_ERRORS_JUMP ot(" tst r4,#1 ;@ address error?\n"); diff --git a/cpu/Cyclone/OpLogic.cpp b/cpu/Cyclone/OpLogic.cpp index d32d34e7..912d94bf 100644 --- a/cpu/Cyclone/OpLogic.cpp +++ b/cpu/Cyclone/OpLogic.cpp @@ -40,7 +40,7 @@ int OpBtstReg(int op) EaCalcReadNoSE((type>0)?8:-1,0,tea,size,0x003f); - if (tea>=0x11) + if (tea>=0x10) ot(" and r11,r11,#7 ;@ mem - do mod 8\n"); // size always 0 else ot(" and r11,r11,#31 ;@ reg - do mod 32\n"); // size always 2 ot("\n"); @@ -94,7 +94,7 @@ int OpBtstImm(int op) EaCalcReadNoSE(-1,0,sea,0,0); ot(" mov r11,#1\n"); ot(" bic r10,r10,#0x40000000 ;@ Blank Z flag\n"); - if (tea>=0x11) + if (tea>=0x10) ot(" and r0,r0,#7 ;@ mem - do mod 8\n"); // size always 0 else ot(" and r0,r0,#0x1F ;@ reg - do mod 32\n"); // size always 2 ot(" mov r11,r11,lsl r0 ;@ Make bit mask\n"); diff --git a/cpu/Cyclone/OpMove.cpp b/cpu/Cyclone/OpMove.cpp index ac2abea8..be91b18a 100644 --- a/cpu/Cyclone/OpMove.cpp +++ b/cpu/Cyclone/OpMove.cpp @@ -376,23 +376,20 @@ int OpMovem(int op) OpStart(op,ea,0,1); + ot(" ldrh r11,[r4],#2 ;@ r11=register mask\n"); + ot("\n"); + ot(";@ Get the address into r6:\n"); + EaCalc(6,0x003f,cea,size); + #if !MEMHANDLERS_NEED_PREV_PC // must save PC, need a spare register ot(" str r4,[r7,#0x40] ;@ Save PC\n"); #endif -#if !MEMHANDLERS_NEED_CYCLES - ot(" str r5,[r7,#0x5c] ;@ Save Cycles\n"); -#endif - ot(" ldrh r11,[r4],#2 ;@ r11=register mask\n"); ot(";@ r4=Register Index*4:\n"); if (decr) ot(" mov r4,#0x40 ;@ order reversed for -(An)\n"); else ot(" mov r4,#-4\n"); - ot("\n"); - ot(";@ Get the address into r6:\n"); - EaCalc(6,0x003f,cea,size); - ot("\n"); ot(" tst r11,r11\n"); // sanity check ot(" beq NoRegs%.4x\n",op);