X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=cpu%2FCyclone%2FOpAny.cpp;h=a50114acefe90e6602e9dc021f0f854d548e9866;hb=8527dc450a96f7a292b7f302e8e55147628b6042;hp=cbdf5bb23b1f4cbe0c01403c6eb42445da3b1e90;hpb=ee5e024ce624b4a5e5efc38e5d7c6a040a48a8b0;p=picodrive.git diff --git a/cpu/Cyclone/OpAny.cpp b/cpu/Cyclone/OpAny.cpp index cbdf5bb..a50114a 100644 --- a/cpu/Cyclone/OpAny.cpp +++ b/cpu/Cyclone/OpAny.cpp @@ -1,9 +1,11 @@ #include "app.h" +int opend_op_changes_cycles, opend_check_interrupt, opend_check_trace; + static unsigned char OpData[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -static unsigned short CPU_CALL OpRead16(unsigned int a) +static unsigned short OpRead16(unsigned int a) { return (unsigned short)( (OpData[a&15]<<8) | OpData[(a+1)&15] ); } @@ -62,15 +64,17 @@ void OpStart(int op, int sea, int tea, int op_changes_cycles, int supervisor_che if (last_op_count!=arm_op_count) ot("\n"); pc_dirty = 1; + opend_op_changes_cycles = opend_check_interrupt = opend_check_trace = 0; } -void OpEnd(int sea, int tea, int op_changes_cycles, int check_interrupt) +void OpEnd(int sea, int tea) { int did_fetch=0; + opend_check_trace = opend_check_trace && EMULATE_TRACE; #if MEMHANDLERS_CHANGE_CYCLES if ((sea >= 0x10 && sea != 0x3c) || (tea >= 0x10 && tea != 0x3c)) { - if (op_changes_cycles) + if (opend_op_changes_cycles) { ot(" ldr r0,[r7,#0x5c] ;@ Load Cycles\n"); ot(" ldrh r8,[r4],#2 ;@ Fetch next opcode\n"); @@ -85,12 +89,22 @@ void OpEnd(int sea, int tea, int op_changes_cycles, int check_interrupt) #endif if (!did_fetch) ot(" ldrh r8,[r4],#2 ;@ Fetch next opcode\n"); + if (opend_check_trace) + ot(" ldr r1,[r7,#0x44]\n"); ot(" subs r5,r5,#%d ;@ Subtract cycles\n",Cycles); - if (check_interrupt) + if (opend_check_trace) + { + ot(";@ CheckTrace:\n"); + ot(" tst r1,#0x80\n"); + ot(" bne CycloneDoTraceWithChecks\n"); + ot(" cmp r5,#0\n"); + } + if (opend_check_interrupt) { ot(" blt CycloneEnd\n"); ot(";@ CheckInterrupt:\n"); - ot(" ldr r1,[r7,#0x44] ;@ Get SR high T_S__III and irq level\n"); + if (!opend_check_trace) + ot(" ldr r1,[r7,#0x44]\n"); ot(" movs r0,r1,lsr #24 ;@ Get IRQ level\n"); // same as ldrb r0,[r7,#0x47] ot(" ldreq pc,[r6,r8,asl #2] ;@ Jump to next opcode handler\n"); ot(" cmp r0,#6 ;@ irq>6 ?\n"); @@ -119,17 +133,17 @@ int OpBase(int op,int size,int sepa) // Get flags, trashes r2 int OpGetFlags(int subtract,int xbit,int specialz) { - if (specialz) ot(" orr r2,r9,#0xb0000000 ;@ for old Z\n"); + if (specialz) ot(" orr r2,r10,#0xb0000000 ;@ for old Z\n"); - ot(" mrs r9,cpsr ;@ r9=flags\n"); + ot(" mrs r10,cpsr ;@ r10=flags\n"); - if (specialz) ot(" andeq r9,r9,r2 ;@ fix Z\n"); + if (specialz) ot(" andeq r10,r10,r2 ;@ fix Z\n"); - if (subtract) ot(" eor r9,r9,#0x20000000 ;@ Invert carry\n"); + if (subtract) ot(" eor r10,r10,#0x20000000 ;@ Invert carry\n"); if (xbit) { - ot(" str r9,[r7,#0x4c] ;@ Save X bit\n"); + ot(" str r10,[r7,#0x4c] ;@ Save X bit\n"); } return 0; }