X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=cyclone68000.git;a=blobdiff_plain;f=OpAny.cpp;h=64e2bfe5213ff0b9405e9773b40bb0d29c820483;hp=9d45a0107f57f241729e7ea1641bf1947c3eeedd;hb=HEAD;hpb=52ac6b1c8f65fe2477ffc3a7fc63ca8ae9d7e59f diff --git a/OpAny.cpp b/OpAny.cpp index 9d45a01..64e2bfe 100644 --- a/OpAny.cpp +++ b/OpAny.cpp @@ -112,7 +112,7 @@ void OpEnd(int sea, int tea) } if (opend_check_interrupt) { - ot(" blt CycloneEnd\n"); + ot(" ble CycloneEnd\n"); ot(";@ CheckInterrupt:\n"); if (!opend_check_trace) ot(" ldr r1,[r7,#0x44]\n"); @@ -126,7 +126,7 @@ void OpEnd(int sea, int tea) } else { - ot(" ldrge pc,[r6,r8,asl #2] ;@ Jump to opcode handler\n"); + ot(" ldrgt pc,[r6,r8,asl #2] ;@ Jump to opcode handler\n"); ot(" b CycloneEnd\n"); } ot("\n"); @@ -159,6 +159,58 @@ int OpGetFlags(int subtract,int xbit,int specialz) return 0; } +void OpGetFlagsNZ(int rd) +{ + ot(" and r10,r%d,#0x80000000 ;@ r10=N_flag\n",rd); + ot(" orreq r10,r10,#0x40000000 ;@ get NZ, clear CV\n"); +} + +// size 0=8bit, 1=16bit +void SignExtend(int rd, int rs, int size) +{ + if (size >= 2) + { + if (rd != rs) + ot(" mov r%d,r%d\n", rd, rs); + return; + } +#if defined(HAVE_ARMv6) && (HAVE_ARMv6) + if (size == 1) + ot(" sxth r%d,r%d ;@ sign extend\n", rd, rs); + else + ot(" sxtb r%d,r%d ;@ sign extend\n", rd, rs); +#else + int shift = size ? 16 : 24; + ot(" mov r%d,r%d,asl #%d\n", rd, rs, shift); + ot(" mov r%d,r%d,asr #%d ;@ sign extend\n", rd, rd, shift); +#endif +} + +void ZeroExtend(int rd, int rs, int size) +{ + if (size >= 2) + { + if (rd != rs) + ot(" mov r%d,r%d\n", rd, rs); + return; + } +#if defined(HAVE_ARMv6) && (HAVE_ARMv6) + if (size == 1) + ot(" uxth r%d,r%d ;@ zero extend\n", rd, rs); + else +#else + if (size == 1) + { + ot(" mov r%d,r%d,lsl #16\n", rd, rs); + ot(" mov r%d,r%d,lsr #16 ;@ zero extend\n", rd, rd); + } + else +#endif + { + ot(" and r%d,r%d,#0xff ;@ zero extend\n", rd, rs); + } +} + // ----------------------------------------------------------------- int g_op;