X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cpu%2FCyclone%2FMain.cpp;h=5647fb1d3accc1a6e756856f1bef87983a46aa97;hb=2270612aa7ee7d04549e95c2ab4d72f6aa67fa8d;hp=fce0c3d4e1331f6d14515a37f26ff2cea8ccfc6d;hpb=b637c56aadc5b854ca28a8a111cf07324bc0e2ad;p=picodrive.git diff --git a/cpu/Cyclone/Main.cpp b/cpu/Cyclone/Main.cpp index fce0c3d..5647fb1 100644 --- a/cpu/Cyclone/Main.cpp +++ b/cpu/Cyclone/Main.cpp @@ -102,9 +102,10 @@ static void PrintException(int ints) ot("no_sp_swap%i%s\n",ints,ms?"":":"); ot(" ldr r10,[r7,#0x60] ;@ Get Memory base\n"); - ot(" mov r1,r4,lsl #8\n"); - ot(" sub r1,r1,r10,lsl #8 ;@ r1 = Old PC\n"); - ot(" mov r1,r1,asr #8 ;@ push sign extended\n"); +// ot(" mov r1,r4,lsl #8\n"); +// ot(" sub r1,r1,r10,lsl #8 ;@ r1 = Old PC\n"); +// ot(" mov r1,r1,asr #8 ;@ push sign extended\n"); + ot(" sub r1,r4,r10 ;@ r1 = Old PC\n"); OpPush32(); OpPushSr(1); ot(" mov r0,r11\n"); @@ -277,6 +278,7 @@ static void PrintFramework() ot(" bx lr\n"); ot("\n"); #endif + // 68k: XNZVC, ARM: NZCV if (ms) ot("CycloneSetSr\n"); else ot("CycloneSetSr:\n"); ot(" mov r2,r1,lsr #8\n"); @@ -291,8 +293,8 @@ static void PrintFramework() ot(" str r3,[r0,#0x3C]\n"); ot(" str r2,[r0,#0x48]\n"); ot("setsr_noswap%s\n",ms?"":":"); - ot(" mov r2,r1,lsr #3\n"); - ot(" strb r2,[r0,#0x45] ;@ the X flag\n"); + ot(" mov r2,r1,lsl #25\n"); + ot(" str r2,[r0,#0x4c] ;@ the X flag\n"); ot(" bic r2,r1,#0xf3\n"); ot(" tst r1,#1\n"); ot(" orrne r2,r2,#2\n"); @@ -310,8 +312,8 @@ static void PrintFramework() ot(" orrne r2,r2,#2\n"); ot(" tst r1,#2\n"); ot(" orrne r2,r2,#1\n"); - ot(" ldrb r1,[r0,#0x45] ;@ the X flag\n"); - ot(" tst r1,#2\n"); + ot(" ldr r1,[r0,#0x4c] ;@ the X flag\n"); + ot(" tst r1,#0x20000000\n"); ot(" orrne r2,r2,#0x10\n"); ot(" ldrb r1,[r0,#0x44] ;@ the SR high\n"); ot(" orr r0,r2,r1,lsl #8\n"); @@ -418,8 +420,12 @@ int MemHandler(int type,int size,int addrreg) addrreg=0; #endif if (addrreg != 0) + { + ot(" add lr,pc,#4\n"); // helps to prevent interlocks ot(" mov r0,r%i\n", addrreg); - ot(" mov lr,pc\n"); + } + else + ot(" mov lr,pc\n"); ot(" ldr pc,[r7,#0x%x] ;@ Call ",func); // Document what we are calling: @@ -473,6 +479,7 @@ static void PrintOpcodes() ot(" mov r0,#0x10\n"); ot(" bl Exception\n"); #endif + ot("\n"); Cycles=34; OpEnd(); @@ -499,6 +506,7 @@ static void PrintOpcodes() ot(" mov r0,#0x28\n"); ot(" bl Exception\n"); #endif + ot("\n"); Cycles=4; OpEnd(); @@ -524,6 +532,7 @@ static void PrintOpcodes() ot(" mov r0,#0x2c\n"); ot(" bl Exception\n"); #endif + ot("\n"); Cycles=4; OpEnd(); @@ -626,12 +635,11 @@ static void PrintJumpTable() } if(ip&1) ott("0x%.4x", 0, "\n",0,ip++,1); if(ip&7) fseek(AsmFile, -1, SEEK_CUR); // remove last comma - ot("\n"); if(ip&7) { for(i = 8-(ip&7); i > 0; i--) ot(",0x0000"); - ot("\n"); } + ot("\n"); if(ms) { for(i = (0x2000-ip/2)/8+1; i > 0; i--) ot(" dcd 0,0,0,0,0,0,0,0\n"); @@ -679,7 +687,7 @@ static int CycloneMake() ot("\n;@ Dave's Cyclone 68000 Emulator v%x.%.3x - Assembler Output\n\n",CycloneVer>>12,CycloneVer&0xfff); ot(";@ (c) Copyright 2003 Dave, All rights reserved.\n"); - ot(";@ some code (c) Copyright 2005-2006 notaz, All rights reserved.\n"); + ot(";@ some code (c) Copyright 2005-2007 notaz, All rights reserved.\n"); ot(";@ Cyclone 68000 is free for non-commercial use.\n\n"); ot(";@ For commercial use, separate licencing terms must be obtained.\n\n");