ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/gencpu.c
(Generate patch)

Comparing BasiliskII/src/uae_cpu/gencpu.c (file contents):
Revision 1.2 by cebix, 1999-10-21T13:19:27Z vs.
Revision 1.13 by gbeauche, 2001-03-20T17:35:46Z

# Line 59 | Line 59 | static void read_counts (void)
59      if (file) {
60          fscanf (file, "Total: %lu\n", &total);
61          while (fscanf (file, "%lx: %lu %s\n", &opcode, &count, name) == 3) {
62 <            opcode_next_clev[nr] = 3;
62 >            opcode_next_clev[nr] = 4;
63              opcode_last_postfix[nr] = -1;
64              opcode_map[nr++] = opcode;
65              counts[opcode] = count;
# Line 72 | Line 72 | static void read_counts (void)
72          if (table68k[opcode].handler == -1 && table68k[opcode].mnemo != i_ILLG
73              && counts[opcode] == 0)
74          {
75 <            opcode_next_clev[nr] = 3;
75 >            opcode_next_clev[nr] = 4;
76              opcode_last_postfix[nr] = -1;
77              opcode_map[nr++] = opcode;
78              counts[opcode] = count;
# Line 221 | Line 221 | static void sync_m68k_pc (void)
221   }
222  
223   /* getv == 1: fetch data; getv != 0: check for odd address. If movem != 0,
224 < * the calling routine handles Apdi and Aipi modes. */
224 > * the calling routine handles Apdi and Aipi modes.
225 > * gb-- movem == 2 means the same thing but for a MOVE16 instruction */
226   static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem)
227   {
228      start_brace ();
# Line 232 | Line 233 | static void genamode (amodes mode, char
233          if (getv == 1)
234              switch (size) {
235               case sz_byte:
236 < #ifdef AMIGA
236 > #if defined(AMIGA) && !defined(WARPUP)
237                  /* sam: I don't know why gcc.2.7.2.1 produces a code worse */
238                  /* if it is not done like that: */
239                  printf ("\tuae_s8 %s = ((uae_u8*)&m68k_dreg(regs, %s))[3];\n", name, reg);
# Line 241 | Line 242 | static void genamode (amodes mode, char
242   #endif
243                  break;
244               case sz_word:
245 < #ifdef AMIGA
245 > #if defined(AMIGA) && !defined(WARPUP)
246                  printf ("\tuae_s16 %s = ((uae_s16*)&m68k_dreg(regs, %s))[1];\n", name, reg);
247   #else
248                  printf ("\tuae_s16 %s = m68k_dreg(regs, %s);\n", name, reg);
# Line 1517 | Line 1518 | static void gen_opcode (unsigned long in
1518              printf ("\tif ((format & 0xF000) == 0x0000) { break; }\n");
1519              printf ("\telse if ((format & 0xF000) == 0x1000) { ; }\n");
1520              printf ("\telse if ((format & 0xF000) == 0x2000) { m68k_areg(regs, 7) += 4; break; }\n");
1521 +            printf ("\telse if ((format & 0xF000) == 0x3000) { m68k_areg(regs, 7) += 4; break; }\n");
1522 +            printf ("\telse if ((format & 0xF000) == 0x7000) { m68k_areg(regs, 7) += 52; break; }\n");
1523              printf ("\telse if ((format & 0xF000) == 0x8000) { m68k_areg(regs, 7) += 50; break; }\n");
1524              printf ("\telse if ((format & 0xF000) == 0x9000) { m68k_areg(regs, 7) += 12; break; }\n");
1525              printf ("\telse if ((format & 0xF000) == 0xa000) { m68k_areg(regs, 7) += 24; break; }\n");
# Line 1533 | Line 1536 | static void gen_opcode (unsigned long in
1536          m68k_pc_offset = 0;
1537          break;
1538       case i_RTD:
1536        printf ("\tcompiler_flush_jsr_stack();\n");
1539          genamode (Aipi, "7", sz_long, "pc", 1, 0);
1540          genamode (curi->smode, "srcreg", curi->size, "offs", 1, 0);
1541          printf ("\tm68k_areg(regs, 7) += offs;\n");
# Line 1567 | Line 1569 | static void gen_opcode (unsigned long in
1569          need_endlabel = 1;
1570          break;
1571       case i_RTR:
1570        printf ("\tcompiler_flush_jsr_stack();\n");
1572          printf ("\tMakeSR();\n");
1573          genamode (Aipi, "7", sz_word, "sr", 1, 0);
1574          genamode (Aipi, "7", sz_long, "pc", 1, 0);
# Line 2442 | Line 2443 | static void gen_opcode (unsigned long in
2443          swap_opcode ();
2444          printf ("\tfrestore_opp(opcode);\n");
2445          break;
2446 +     case i_CINVL:
2447 +     case i_CINVP:
2448 +     case i_CINVA:
2449 +     case i_CPUSHL:
2450 +     case i_CPUSHP:
2451 +     case i_CPUSHA:
2452 +        break;
2453 +     case i_MOVE16:
2454 +        if ((opcode & 0xfff8) == 0xf620) {
2455 +                /* MOVE16 (Ax)+,(Ay)+ */
2456 +                printf ("\tuaecptr mems = m68k_areg(regs, srcreg) & ~15, memd;\n");
2457 +                printf ("\tdstreg = (%s >> 12) & 7;\n", gen_nextiword());
2458 +                printf ("\tmemd = m68k_areg(regs, dstreg) & ~15;\n");
2459 +                printf ("\tput_long(memd, get_long(mems));\n");
2460 +                printf ("\tput_long(memd+4, get_long(mems+4));\n");
2461 +                printf ("\tput_long(memd+8, get_long(mems+8));\n");
2462 +                printf ("\tput_long(memd+12, get_long(mems+12));\n");
2463 +                printf ("\tif (srcreg != dstreg)\n");
2464 +                printf ("\tm68k_areg(regs, srcreg) += 16;\n");
2465 +                printf ("\tm68k_areg(regs, dstreg) += 16;\n");
2466 +        }
2467 +        else {
2468 +                /* Other variants */
2469 +                genamode (curi->smode, "srcreg", curi->size, "mems", 0, 2);
2470 +                genamode (curi->dmode, "dstreg", curi->size, "memd", 0, 2);
2471 +                printf ("\tmemsa &= ~15;\n");
2472 +                printf ("\tmemda &= ~15;\n");
2473 +                printf ("\tput_long(memda, get_long(memsa));\n");
2474 +                printf ("\tput_long(memda+4, get_long(memsa+4));\n");
2475 +                printf ("\tput_long(memda+8, get_long(memsa+8));\n");
2476 +                printf ("\tput_long(memda+12, get_long(memsa+12));\n");
2477 +                if ((opcode & 0xfff8) == 0xf600)
2478 +                printf ("\tm68k_areg(regs, srcreg) += 16;\n");
2479 +                else if ((opcode & 0xfff8) == 0xf608)
2480 +                printf ("\tm68k_areg(regs, dstreg) += 16;\n");
2481 +        }
2482 +        break;
2483       case i_MMUOP:
2484          genamode (curi->smode, "srcreg", curi->size, "extra", 1, 0);
2485          sync_m68k_pc ();
# Line 2463 | Line 2501 | static void generate_includes (FILE * f)
2501      fprintf (f, "#include \"memory.h\"\n");
2502      fprintf (f, "#include \"readcpu.h\"\n");
2503      fprintf (f, "#include \"newcpu.h\"\n");
2466    fprintf (f, "#include \"compiler.h\"\n");
2504      fprintf (f, "#include \"cputbl.h\"\n");
2505   }
2506  
# Line 2494 | Line 2531 | static void generate_one_opcode (int rp)
2531      }
2532      fprintf (stblfile, "{ op_%lx_%d, 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
2533      fprintf (headerfile, "extern cpuop_func op_%lx_%d;\n", opcode, postfix);
2534 < /*      fprintf (headerfile, "extern unsigned long REGPARAM2 op_%lx_%d(uae_u32);\n", opcode, postfix); */
2498 <    printf ("unsigned long REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
2534 >    printf ("void REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
2535  
2536      switch (table68k[opcode].stype) {
2537       case 0: smsk = 7; break;
# Line 2504 | Line 2540 | static void generate_one_opcode (int rp)
2540       case 3: smsk = 7; break;
2541       case 4: smsk = 7; break;
2542       case 5: smsk = 63; break;
2543 +         case 7: smsk = 3; break;
2544       default: abort ();
2545      }
2546      dmsk = 7;
# Line 2609 | Line 2646 | static void generate_one_opcode (int rp)
2646      gen_opcode (opcode);
2647      if (need_endlabel)
2648          printf ("%s: ;\n", endlabelstr);
2612    printf ("return %d;\n", insn_n_cycles);
2649      printf ("}\n");
2650      opcode_next_clev[rp] = next_cpu_level;
2651      opcode_last_postfix[rp] = postfix;
# Line 2621 | Line 2657 | static void generate_func (void)
2657  
2658      using_prefetch = 0;
2659      using_exception_3 = 0;
2660 <    for (i = 0; i < 5; i++) {
2661 <        cpu_level = 3 - i;
2662 <        if (i == 4) {
2660 > #if !USE_PREFETCH_BUFFER
2661 >        /* gb-- No need for a prefetch buffer, nor exception 3 handling */
2662 >        /* Anyway, Basilisk2 does not use the op_smalltbl_5 table... */
2663 >    for (i = 0; i <= 4; i++) {
2664 > #else
2665 >    for (i = 0; i < 6; i++) {
2666 > #endif
2667 >        cpu_level = 4 - i;
2668 >        if (i == 5) {
2669              cpu_level = 0;
2670              using_prefetch = 1;
2671              using_exception_3 = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines