Previous 199869 Revisions Next

r18559 Tuesday 16th October, 2012 at 19:32:39 UTC by Wilbert Pol
tlcs900.c: Implemented the 4-byte prefetch queue.  [Wilbert Pol]
[src/emu/cpu/tlcs900]900tbl.c tlcs900.c

trunk/src/emu/cpu/tlcs900/900tbl.c
r18558r18559
15901590   cpustate->xssp.d -= 4;
15911591   WRMEML( cpustate->xssp.d, cpustate->pc.d );
15921592   cpustate->pc.d = cpustate->imm1.d;
1593   cpustate->prefetch_clear = true;
15931594}
15941595
15951596
r18558r18559
16011602      WRMEML( cpustate->xssp.d, cpustate->pc.d );
16021603      cpustate->pc.d = cpustate->ea2.d;
16031604      cpustate->cycles += 6;
1605      cpustate->prefetch_clear = true;
16041606   }
16051607}
16061608
r18558r18559
16101612   cpustate->xssp.d -= 4;
16111613   WRMEML( cpustate->xssp.d, cpustate->pc.d );
16121614   cpustate->pc.d = cpustate->ea1.d;
1615   cpustate->prefetch_clear = true;
16131616}
16141617
16151618
r18558r18559
17431746   {
17441747      cpustate->pc.d -= 2;
17451748      cpustate->cycles += 4;
1749      cpustate->prefetch_clear = true;
17461750   }
17471751}
17481752
r18558r18559
17681772   {
17691773      cpustate->pc.d -= 2;
17701774      cpustate->cycles += 4;
1775      cpustate->prefetch_clear = true;
17711776   }
17721777}
17731778
r18558r18559
17931798   {
17941799      cpustate->pc.d -= 2;
17951800      cpustate->cycles += 4;
1801      cpustate->prefetch_clear = true;
17961802   }
17971803}
17981804
r18558r18559
18181824   {
18191825      cpustate->pc.d -= 2;
18201826      cpustate->cycles += 4;
1827      cpustate->prefetch_clear = true;
18211828   }
18221829}
18231830
r18558r18559
20302037   {
20312038      cpustate->pc.d = cpustate->ea2.d;
20322039      cpustate->cycles += 4;
2040      cpustate->prefetch_clear = true;
20332041   }
20342042}
20352043
r18558r18559
20412049   {
20422050      cpustate->pc.d = cpustate->ea2.d;
20432051      cpustate->cycles += 4;
2052      cpustate->prefetch_clear = true;
20442053   }
20452054}
20462055
r18558r18559
21742183static void _JPI(tlcs900_state *cpustate)
21752184{
21762185   cpustate->pc.d = cpustate->imm1.d;
2186   cpustate->prefetch_clear = true;
21772187}
21782188
21792189
r18558r18559
21832193   {
21842194      cpustate->pc.d = cpustate->ea2.d;
21852195      cpustate->cycles += 4;
2196      cpustate->prefetch_clear = true;
21862197   }
21872198}
21882199
r18558r18559
21932204   {
21942205      cpustate->pc.d = cpustate->ea2.d;
21952206      cpustate->cycles += 4;
2207      cpustate->prefetch_clear = true;
21962208   }
21972209}
21982210
r18558r18559
22032215   {
22042216      cpustate->pc.d = cpustate->ea2.d;
22052217      cpustate->cycles += 4;
2218      cpustate->prefetch_clear = true;
22062219   }
22072220}
22082221
r18558r18559
23992412      cpustate->sr.b.l |= FLAG_VF;
24002413      cpustate->pc.d -= 2;
24012414      cpustate->cycles += 4;
2415      cpustate->prefetch_clear = true;
24022416   }
24032417}
24042418
r18558r18559
24172431      cpustate->sr.b.l |= FLAG_VF;
24182432      cpustate->pc.d -= 2;
24192433      cpustate->cycles += 4;
2434      cpustate->prefetch_clear = true;
24202435   }
24212436}
24222437
r18558r18559
24742489      cpustate->sr.b.l |= FLAG_VF;
24752490      cpustate->pc.d -= 2;
24762491      cpustate->cycles += 4;
2492      cpustate->prefetch_clear = true;
24772493   }
24782494}
24792495
r18558r18559
24922508      cpustate->sr.b.l |= FLAG_VF;
24932509      cpustate->pc.d -= 2;
24942510      cpustate->cycles += 4;
2511      cpustate->prefetch_clear = true;
24952512   }
24962513}
24972514
r18558r18559
25162533{
25172534   UINT8   a, b;
25182535
2519   RDOP();
2520   a = RDOP();
2521   RDOP();
2522   b = RDOP();
2523   RDOP();
2536   RDOP( cpustate );
2537   a = RDOP( cpustate );
2538   RDOP( cpustate );
2539   b = RDOP( cpustate );
2540   RDOP( cpustate );
25242541   WRMEM( a, b );
25252542}
25262543
r18558r18559
29752992{
29762993   cpustate->pc.d = RDMEML( cpustate->xssp.d );
29772994   cpustate->xssp.d += 4;
2995   cpustate->prefetch_clear = true;
29782996}
29792997
29802998
r18558r18559
29853003      cpustate->pc.d = RDMEML( cpustate->xssp.d );
29863004      cpustate->xssp.d += 4;
29873005      cpustate->cycles += 6;
3006      cpustate->prefetch_clear = true;
29883007   }
29893008}
29903009
r18558r18559
29933012{
29943013   cpustate->pc.d = RDMEML( cpustate->xssp.d );
29953014   cpustate->xssp.d += 4 + cpustate->imm1.sw.l;
3015   cpustate->prefetch_clear = true;
29963016}
29973017
29983018
r18558r18559
30043024   cpustate->xssp.d += 4;
30053025   cpustate->regbank = cpustate->sr.b.h & 0x03;
30063026   cpustate->check_irqs = 1;
3027   cpustate->prefetch_clear = true;
30073028}
30083029
30093030
r18558r18559
36833704   cpustate->xssp.d -= 2;
36843705   WRMEMW( cpustate->xssp.d, cpustate->sr.w.l );
36853706   cpustate->pc.d = RDMEML( 0x00ffff00 + 4 * cpustate->imm1.b.l );
3707   cpustate->prefetch_clear = true;
36863708}
36873709
36883710
r18558r18559
38873909      cpustate->p1_reg32 = get_reg32_current( cpustate, cpustate->op );
38883910      break;
38893911   case _CR8:
3890      cpustate->imm1.d = RDOP();
3912      cpustate->imm1.d = RDOP( cpustate );
38913913      switch( cpustate->imm1.d )
38923914      {
38933915      case 0x22:
r18558r18559
39083930      }
39093931      break;
39103932   case _CR16:
3911      cpustate->imm1.d = RDOP();
3933      cpustate->imm1.d = RDOP( cpustate );
39123934      switch( cpustate->imm1.d )
39133935      {
39143936      case 0x20:
r18558r18559
39293951      }
39303952      break;
39313953   case _CR32:
3932      cpustate->imm1.d = RDOP();
3954      cpustate->imm1.d = RDOP( cpustate );
39333955      switch( cpustate->imm1.d )
39343956      {
39353957      case 0x00:
r18558r18559
39623984      }
39633985      break;
39643986   case _D8:
3965      cpustate->ea1.d = RDOP();
3987      cpustate->ea1.d = RDOP( cpustate );
39663988      cpustate->ea1.d = cpustate->pc.d + cpustate->ea1.sb.l;
39673989      break;
39683990   case _D16:
3969      cpustate->ea1.d = RDOP();
3970      cpustate->ea1.b.h = RDOP();
3991      cpustate->ea1.d = RDOP( cpustate );
3992      cpustate->ea1.b.h = RDOP( cpustate );
39713993      cpustate->ea1.d = cpustate->pc.d + cpustate->ea1.sw.l;
39723994      break;
39733995   case _I3:
39743996      cpustate->imm1.d = cpustate->op & 0x07;
39753997      break;
39763998   case _I8:
3977      cpustate->imm1.d = RDOP();
3999      cpustate->imm1.d = RDOP( cpustate );
39784000      break;
39794001   case _I16:
3980      cpustate->imm1.d = RDOP();
3981      cpustate->imm1.b.h = RDOP();
4002      cpustate->imm1.d = RDOP( cpustate );
4003      cpustate->imm1.b.h = RDOP( cpustate );
39824004      break;
39834005   case _I24:
3984      cpustate->imm1.d = RDOP();
3985      cpustate->imm1.b.h = RDOP();
3986      cpustate->imm1.b.h2 = RDOP();
4006      cpustate->imm1.d = RDOP( cpustate );
4007      cpustate->imm1.b.h = RDOP( cpustate );
4008      cpustate->imm1.b.h2 = RDOP( cpustate );
39874009      break;
39884010   case _I32:
3989      cpustate->imm1.d = RDOP();
3990      cpustate->imm1.b.h = RDOP();
3991      cpustate->imm1.b.h2 = RDOP();
3992      cpustate->imm1.b.h3 = RDOP();
4011      cpustate->imm1.d = RDOP( cpustate );
4012      cpustate->imm1.b.h = RDOP( cpustate );
4013      cpustate->imm1.b.h2 = RDOP( cpustate );
4014      cpustate->imm1.b.h3 = RDOP( cpustate );
39934015      break;
39944016   case _M:
39954017      cpustate->ea1.d = cpustate->ea2.d;
39964018      break;
39974019   case _M8:
3998      cpustate->ea1.d = RDOP();
4020      cpustate->ea1.d = RDOP( cpustate );
39994021      break;
40004022   case _M16:
4001      cpustate->ea1.d = RDOP();
4002      cpustate->ea1.b.h = RDOP();
4023      cpustate->ea1.d = RDOP( cpustate );
4024      cpustate->ea1.b.h = RDOP( cpustate );
40034025      break;
40044026   case _R:
40054027      cpustate->p1_reg8 = cpustate->p2_reg8;
r18558r18559
40294051      cpustate->p2_reg32 = get_reg32_current( cpustate, cpustate->op );
40304052      break;
40314053   case _CR8:
4032      cpustate->imm1.d = RDOP();
4054      cpustate->imm1.d = RDOP( cpustate );
40334055      switch( cpustate->imm1.d )
40344056      {
40354057      case 0x22:
r18558r18559
40504072      }
40514073      break;
40524074   case _CR16:
4053      cpustate->imm1.d = RDOP();
4075      cpustate->imm1.d = RDOP( cpustate );
40544076      switch( cpustate->imm1.d )
40554077      {
40564078      case 0x20:
r18558r18559
40714093      }
40724094      break;
40734095   case _CR32:
4074      cpustate->imm1.d = RDOP();
4096      cpustate->imm1.d = RDOP( cpustate );
40754097      switch( cpustate->imm1.d )
40764098      {
40774099      case 0x00:
r18558r18559
41044126      }
41054127      break;
41064128   case _D8:
4107      cpustate->ea2.d = RDOP();
4129      cpustate->ea2.d = RDOP( cpustate );
41084130      cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sb.l;
41094131      break;
41104132   case _D16:
4111      cpustate->ea2.d = RDOP();
4112      cpustate->ea2.b.h = RDOP();
4133      cpustate->ea2.d = RDOP( cpustate );
4134      cpustate->ea2.b.h = RDOP( cpustate );
41134135      cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sw.l;
41144136      break;
41154137   case _I3:
41164138      cpustate->imm2.d = cpustate->op & 0x07;
41174139      break;
41184140   case _I8:
4119      cpustate->imm2.d = RDOP();
4141      cpustate->imm2.d = RDOP( cpustate );
41204142      break;
41214143   case _I16:
4122      cpustate->imm2.d = RDOP();
4123      cpustate->imm2.b.h = RDOP();
4144      cpustate->imm2.d = RDOP( cpustate );
4145      cpustate->imm2.b.h = RDOP( cpustate );
41244146      break;
41254147   case _I32:
4126      cpustate->imm2.d = RDOP();
4127      cpustate->imm2.b.h = RDOP();
4128      cpustate->imm2.b.h2 = RDOP();
4129      cpustate->imm2.b.h3 = RDOP();
4148      cpustate->imm2.d = RDOP( cpustate );
4149      cpustate->imm2.b.h = RDOP( cpustate );
4150      cpustate->imm2.b.h2 = RDOP( cpustate );
4151      cpustate->imm2.b.h3 = RDOP( cpustate );
41304152      break;
41314153   case _M8:
4132      cpustate->ea2.d = RDOP();
4154      cpustate->ea2.d = RDOP( cpustate );
41334155      break;
41344156   case _M16:
4135      cpustate->ea2.d = RDOP();
4136      cpustate->ea2.b.h = RDOP();
4157      cpustate->ea2.d = RDOP( cpustate );
4158      cpustate->ea2.b.h = RDOP( cpustate );
41374159      break;
41384160   }
41394161}
r18558r18559
53255347   cpustate->p2_reg32 = get_reg32_current( cpustate, cpustate->op );
53265348
53275349   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5328   cpustate->op = RDOP();
5350   cpustate->op = RDOP( cpustate );
53295351   inst = &mnemonic_80[cpustate->op];
53305352   prepare_operands( cpustate, inst );
53315353   inst->opfunc( cpustate );
r18558r18559
53435365   cpustate->p2_reg32 = get_reg32_current( cpustate, cpustate->op );
53445366
53455367   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5346   cpustate->op = RDOP();
5368   cpustate->op = RDOP( cpustate );
53475369   cpustate->ea2.d += (INT8)cpustate->op;
53485370   cpustate->cycles += 2;
5349   cpustate->op = RDOP();
5371   cpustate->op = RDOP( cpustate );
53505372   inst = &mnemonic_80[cpustate->op];
53515373   prepare_operands( cpustate, inst );
53525374   inst->opfunc( cpustate );
r18558r18559
53645386   cpustate->p2_reg32 = get_reg32_current( cpustate, cpustate->op );
53655387
53665388   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5367   cpustate->op = RDOP();
5389   cpustate->op = RDOP( cpustate );
53685390   inst = &mnemonic_90[cpustate->op];
53695391   prepare_operands( cpustate, inst );
53705392   inst->opfunc( cpustate );
r18558r18559
53785400   const tlcs900inst *inst;
53795401
53805402   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5381   cpustate->op = RDOP();
5403   cpustate->op = RDOP( cpustate );
53825404   cpustate->ea2.d += (INT8)cpustate->op;
53835405   cpustate->cycles += 2;
5384   cpustate->op = RDOP();
5406   cpustate->op = RDOP( cpustate );
53855407   inst = &mnemonic_98[cpustate->op];
53865408   prepare_operands( cpustate, inst );
53875409   inst->opfunc( cpustate );
r18558r18559
53955417   const tlcs900inst *inst;
53965418
53975419   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5398   cpustate->op = RDOP();
5420   cpustate->op = RDOP( cpustate );
53995421   inst = &mnemonic_a0[cpustate->op];
54005422   prepare_operands( cpustate, inst );
54015423   inst->opfunc( cpustate );
r18558r18559
54095431   const tlcs900inst *inst;
54105432
54115433   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5412   cpustate->op = RDOP();
5434   cpustate->op = RDOP( cpustate );
54135435   cpustate->ea2.d += (INT8)cpustate->op;
54145436   cpustate->cycles += 2;
5415   cpustate->op = RDOP();
5437   cpustate->op = RDOP( cpustate );
54165438   inst = &mnemonic_a0[cpustate->op];
54175439   prepare_operands( cpustate, inst );
54185440   inst->opfunc( cpustate );
r18558r18559
54265448   const tlcs900inst *inst;
54275449
54285450   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5429   cpustate->op = RDOP();
5451   cpustate->op = RDOP( cpustate );
54305452   inst = &mnemonic_b0[cpustate->op];
54315453   prepare_operands( cpustate, inst );
54325454   inst->opfunc( cpustate );
r18558r18559
54405462   const tlcs900inst *inst;
54415463
54425464   cpustate->ea2.d = *get_reg32_current( cpustate, cpustate->op );
5443   cpustate->op = RDOP();
5465   cpustate->op = RDOP( cpustate );
54445466   cpustate->ea2.d += (INT8)cpustate->op;
54455467   cpustate->cycles += 2;
5446   cpustate->op = RDOP();
5468   cpustate->op = RDOP( cpustate );
54475469   inst = &mnemonic_b8[cpustate->op];
54485470   prepare_operands( cpustate, inst );
54495471   inst->opfunc( cpustate );
r18558r18559
54605482   switch ( cpustate->op & 0x07 )
54615483   {
54625484   case 0x00:   /* (n) */
5463      cpustate->ea2.d = RDOP();
5485      cpustate->ea2.d = RDOP( cpustate );
54645486      cpustate->cycles += 2;
54655487      break;
54665488
54675489   case 0x01:   /* (nn) */
5468      cpustate->ea2.d = RDOP();
5469      cpustate->ea2.b.h = RDOP();
5490      cpustate->ea2.d = RDOP( cpustate );
5491      cpustate->ea2.b.h = RDOP( cpustate );
54705492      cpustate->cycles += 2;
54715493      break;
54725494
54735495   case 0x02:   /* (nnn) */
5474      cpustate->ea2.d = RDOP();
5475      cpustate->ea2.b.h = RDOP();
5476      cpustate->ea2.b.h2 = RDOP();
5496      cpustate->ea2.d = RDOP( cpustate );
5497      cpustate->ea2.b.h = RDOP( cpustate );
5498      cpustate->ea2.b.h2 = RDOP( cpustate );
54775499      cpustate->cycles += 3;
54785500      break;
54795501
54805502   case 0x03:
5481      cpustate->op = RDOP();
5503      cpustate->op = RDOP( cpustate );
54825504      switch ( cpustate->op & 0x03 )
54835505      {
54845506      /* (xrr) */
r18558r18559
54895511
54905512      /* (xrr+d16) */
54915513      case 0x01:
5492         cpustate->ea2.b.l = RDOP();
5493         cpustate->ea2.b.h = RDOP();
5514         cpustate->ea2.b.l = RDOP( cpustate );
5515         cpustate->ea2.b.h = RDOP( cpustate );
54945516         cpustate->ea2.d = *get_reg32( cpustate, cpustate->op ) + cpustate->ea2.sw.l;
54955517         cpustate->cycles += 5;
54965518         break;
r18558r18559
55045526         {
55055527         /* (xrr+r8) */
55065528         case 0x03:
5507            cpustate->op = RDOP();
5529            cpustate->op = RDOP( cpustate );
55085530            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5509            cpustate->op = RDOP();
5531            cpustate->op = RDOP( cpustate );
55105532            cpustate->ea2.d += (INT8) *get_reg8( cpustate, cpustate->op );
55115533            cpustate->cycles += 8;
55125534            break;
55135535
55145536         /* (xrr+r16) */
55155537         case 0x07:
5516            cpustate->op = RDOP();
5538            cpustate->op = RDOP( cpustate );
55175539            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5518            cpustate->op = RDOP();
5540            cpustate->op = RDOP( cpustate );
55195541            cpustate->ea2.d += (INT16) *get_reg16( cpustate, cpustate->op );
55205542            cpustate->cycles += 8;
55215543            break;
55225544
55235545         /* (pc+d16) */
55245546         case 0x13:
5525            cpustate->ea2.b.l = RDOP();
5526            cpustate->ea2.b.h = RDOP();
5547            cpustate->ea2.b.l = RDOP( cpustate );
5548            cpustate->ea2.b.h = RDOP( cpustate );
55275549            cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sw.l;
55285550            cpustate->cycles += 5;
55295551            break;
r18558r18559
55325554      break;
55335555
55345556   case 0x04:   /* (-xrr) */
5535      cpustate->op = RDOP();
5557      cpustate->op = RDOP( cpustate );
55365558      reg = get_reg32( cpustate, cpustate->op );
55375559      *reg -= ( 1 << ( cpustate->op & 0x03 ) );
55385560      cpustate->ea2.d = *reg;
r18558r18559
55405562      break;
55415563
55425564   case 0x05:   /* (xrr+) */
5543      cpustate->op = RDOP();
5565      cpustate->op = RDOP( cpustate );
55445566      reg = get_reg32( cpustate, cpustate->op );
55455567      cpustate->ea2.d = *reg;
55465568      *reg += ( 1 << ( cpustate->op & 0x03 ) );
55475569      cpustate->cycles += 3;
55485570      break;
55495571   }
5550   cpustate->op = RDOP();
5572   cpustate->op = RDOP( cpustate );
55515573   inst = &mnemonic_c0[cpustate->op];
55525574   prepare_operands( cpustate, inst );
55535575   inst->opfunc( cpustate );
r18558r18559
55675589   }
55685590   else
55695591   {
5570      cpustate->op = RDOP();
5592      cpustate->op = RDOP( cpustate );
55715593      cpustate->p2_reg8 = get_reg8( cpustate, cpustate->op );
55725594      /* For MUL and DIV operations */
55735595      cpustate->p2_reg16 = get_reg16( cpustate, cpustate->op );
55745596   }
5575   cpustate->op = RDOP();
5597   cpustate->op = RDOP( cpustate );
55765598   inst = &mnemonic_c8[cpustate->op];
55775599   prepare_operands( cpustate, inst );
55785600   inst->opfunc( cpustate );
r18558r18559
55895611   switch ( cpustate->op & 0x07 )
55905612   {
55915613   case 0x00:   /* (n) */
5592      cpustate->ea2.d = RDOP();
5614      cpustate->ea2.d = RDOP( cpustate );
55935615      cpustate->cycles += 2;
55945616      break;
55955617
55965618   case 0x01:   /* (nn) */
5597      cpustate->ea2.d = RDOP();
5598      cpustate->ea2.b.h = RDOP();
5619      cpustate->ea2.d = RDOP( cpustate );
5620      cpustate->ea2.b.h = RDOP( cpustate );
55995621      cpustate->cycles += 2;
56005622      break;
56015623
56025624   case 0x02:   /* (nnn) */
5603      cpustate->ea2.d = RDOP();
5604      cpustate->ea2.b.h = RDOP();
5605      cpustate->ea2.b.h2 = RDOP();
5625      cpustate->ea2.d = RDOP( cpustate );
5626      cpustate->ea2.b.h = RDOP( cpustate );
5627      cpustate->ea2.b.h2 = RDOP( cpustate );
56065628      cpustate->cycles += 3;
56075629      break;
56085630
56095631   case 0x03:
5610      cpustate->op = RDOP();
5632      cpustate->op = RDOP( cpustate );
56115633      switch ( cpustate->op & 0x03 )
56125634      {
56135635      /* (xrr) */
r18558r18559
56185640
56195641      /* (xrr+d16) */
56205642      case 0x01:
5621         cpustate->ea2.b.l = RDOP();
5622         cpustate->ea2.b.h = RDOP();
5643         cpustate->ea2.b.l = RDOP( cpustate );
5644         cpustate->ea2.b.h = RDOP( cpustate );
56235645         cpustate->ea2.d = *get_reg32( cpustate, cpustate->op ) + cpustate->ea2.sw.l;
56245646         cpustate->cycles += 5;
56255647         break;
r18558r18559
56335655         {
56345656         /* (xrr+r8) */
56355657         case 0x03:
5636            cpustate->op = RDOP();
5658            cpustate->op = RDOP( cpustate );
56375659            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5638            cpustate->op = RDOP();
5660            cpustate->op = RDOP( cpustate );
56395661            cpustate->ea2.d += (INT8) *get_reg8( cpustate, cpustate->op );
56405662            cpustate->cycles += 8;
56415663            break;
56425664
56435665         /* (xrr+r16) */
56445666         case 0x07:
5645            cpustate->op = RDOP();
5667            cpustate->op = RDOP( cpustate );
56465668            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5647            cpustate->op = RDOP();
5669            cpustate->op = RDOP( cpustate );
56485670            cpustate->ea2.d += (INT16) *get_reg16( cpustate, cpustate->op );
56495671            cpustate->cycles += 8;
56505672            break;
56515673
56525674         /* (pc+d16) */
56535675         case 0x13:
5654            cpustate->ea2.b.l = RDOP();
5655            cpustate->ea2.b.h = RDOP();
5676            cpustate->ea2.b.l = RDOP( cpustate );
5677            cpustate->ea2.b.h = RDOP( cpustate );
56565678            cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sw.l;
56575679            cpustate->cycles += 5;
56585680            break;
r18558r18559
56615683      break;
56625684
56635685   case 0x04:   /* (-xrr) */
5664      cpustate->op = RDOP();
5686      cpustate->op = RDOP( cpustate );
56655687      reg = get_reg32( cpustate, cpustate->op );
56665688      *reg -= ( 1 << ( cpustate->op & 0x03 ) );
56675689      cpustate->ea2.d = *reg;
r18558r18559
56695691      break;
56705692
56715693   case 0x05:   /* (xrr+) */
5672      cpustate->op = RDOP();
5694      cpustate->op = RDOP( cpustate );
56735695      reg = get_reg32( cpustate, cpustate->op );
56745696      cpustate->ea2.d = *reg;
56755697      *reg += ( 1 << ( cpustate->op & 0x03 ) );
56765698      cpustate->cycles += 3;
56775699      break;
56785700   }
5679   cpustate->op = RDOP();
5701   cpustate->op = RDOP( cpustate );
56805702   inst = &mnemonic_d0[cpustate->op];
56815703   prepare_operands( cpustate, inst );
56825704   inst->opfunc( cpustate );
r18558r18559
56955717   }
56965718   else
56975719   {
5698      cpustate->op = RDOP();
5720      cpustate->op = RDOP( cpustate );
56995721      cpustate->p2_reg16 = get_reg16( cpustate, cpustate->op );
57005722      cpustate->p2_reg32 = get_reg32( cpustate, cpustate->op );
57015723   }
5702   cpustate->op = RDOP();
5724   cpustate->op = RDOP( cpustate );
57035725   inst = &mnemonic_d8[cpustate->op];
57045726   prepare_operands( cpustate, inst );
57055727   inst->opfunc( cpustate );
r18558r18559
57165738   switch ( cpustate->op & 0x07 )
57175739   {
57185740   case 0x00:   /* (n) */
5719      cpustate->ea2.d = RDOP();
5741      cpustate->ea2.d = RDOP( cpustate );
57205742      cpustate->cycles += 2;
57215743      break;
57225744
57235745   case 0x01:   /* (nn) */
5724      cpustate->ea2.d = RDOP();
5725      cpustate->ea2.b.h = RDOP();
5746      cpustate->ea2.d = RDOP( cpustate );
5747      cpustate->ea2.b.h = RDOP( cpustate );
57265748      cpustate->cycles += 2;
57275749      break;
57285750
57295751   case 0x02:   /* (nnn) */
5730      cpustate->ea2.d = RDOP();
5731      cpustate->ea2.b.h = RDOP();
5732      cpustate->ea2.b.h2 = RDOP();
5752      cpustate->ea2.d = RDOP( cpustate );
5753      cpustate->ea2.b.h = RDOP( cpustate );
5754      cpustate->ea2.b.h2 = RDOP( cpustate );
57335755      cpustate->cycles += 3;
57345756      break;
57355757
57365758   case 0x03:
5737      cpustate->op = RDOP();
5759      cpustate->op = RDOP( cpustate );
57385760      switch ( cpustate->op & 0x03 )
57395761      {
57405762      /* (xrr) */
r18558r18559
57455767
57465768      /* (xrr+d16) */
57475769      case 0x01:
5748         cpustate->ea2.b.l = RDOP();
5749         cpustate->ea2.b.h = RDOP();
5770         cpustate->ea2.b.l = RDOP( cpustate );
5771         cpustate->ea2.b.h = RDOP( cpustate );
57505772         cpustate->ea2.d = *get_reg32( cpustate, cpustate->op ) + cpustate->ea2.sw.l;
57515773         cpustate->cycles += 5;
57525774         break;
r18558r18559
57605782         {
57615783         /* (xrr+r8) */
57625784         case 0x03:
5763            cpustate->op = RDOP();
5785            cpustate->op = RDOP( cpustate );
57645786            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5765            cpustate->op = RDOP();
5787            cpustate->op = RDOP( cpustate );
57665788            cpustate->ea2.d += (INT8) *get_reg8( cpustate, cpustate->op );
57675789            cpustate->cycles += 8;
57685790            break;
57695791
57705792         /* (xrr+r16) */
57715793         case 0x07:
5772            cpustate->op = RDOP();
5794            cpustate->op = RDOP( cpustate );
57735795            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5774            cpustate->op = RDOP();
5796            cpustate->op = RDOP( cpustate );
57755797            cpustate->ea2.d += (INT16) *get_reg16( cpustate, cpustate->op );
57765798            cpustate->cycles += 8;
57775799            break;
57785800
57795801         /* (pc+d16) */
57805802         case 0x13:
5781            cpustate->ea2.b.l = RDOP();
5782            cpustate->ea2.b.h = RDOP();
5803            cpustate->ea2.b.l = RDOP( cpustate );
5804            cpustate->ea2.b.h = RDOP( cpustate );
57835805            cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sw.l;
57845806            cpustate->cycles += 5;
57855807            break;
r18558r18559
57885810      break;
57895811
57905812   case 0x04:   /* (-xrr) */
5791      cpustate->op = RDOP();
5813      cpustate->op = RDOP( cpustate );
57925814      reg = get_reg32( cpustate, cpustate->op );
57935815      *reg -= ( 1 << ( cpustate->op & 0x03 ) );
57945816      cpustate->ea2.d = *reg;
r18558r18559
57965818      break;
57975819
57985820   case 0x05:   /* (xrr+) */
5799      cpustate->op = RDOP();
5821      cpustate->op = RDOP( cpustate );
58005822      reg = get_reg32( cpustate, cpustate->op );
58015823      cpustate->ea2.d = *reg;
58025824      *reg += ( 1 << ( cpustate->op & 0x03 ) );
58035825      cpustate->cycles += 3;
58045826      break;
58055827   }
5806   cpustate->op = RDOP();
5828   cpustate->op = RDOP( cpustate );
58075829   inst = &mnemonic_e0[cpustate->op];
58085830   prepare_operands( cpustate, inst );
58095831   inst->opfunc( cpustate );
r18558r18559
58215843   }
58225844   else
58235845   {
5824      cpustate->op = RDOP();
5846      cpustate->op = RDOP( cpustate );
58255847      cpustate->p2_reg32 = get_reg32( cpustate, cpustate->op );
58265848   }
5827   cpustate->op = RDOP();
5849   cpustate->op = RDOP( cpustate );
58285850   inst = &mnemonic_e8[cpustate->op];
58295851   prepare_operands( cpustate, inst );
58305852   inst->opfunc( cpustate );
r18558r18559
58415863   switch ( cpustate->op & 0x07 )
58425864   {
58435865   case 0x00:   /* (n) */
5844      cpustate->ea2.d = RDOP();
5866      cpustate->ea2.d = RDOP( cpustate );
58455867      cpustate->cycles += 2;
58465868      break;
58475869
58485870   case 0x01:   /* (nn) */
5849      cpustate->ea2.d = RDOP();
5850      cpustate->ea2.b.h = RDOP();
5871      cpustate->ea2.d = RDOP( cpustate );
5872      cpustate->ea2.b.h = RDOP( cpustate );
58515873      cpustate->cycles += 2;
58525874      break;
58535875
58545876   case 0x02:   /* (nnn) */
5855      cpustate->ea2.d = RDOP();
5856      cpustate->ea2.b.h = RDOP();
5857      cpustate->ea2.b.h2 = RDOP();
5877      cpustate->ea2.d = RDOP( cpustate );
5878      cpustate->ea2.b.h = RDOP( cpustate );
5879      cpustate->ea2.b.h2 = RDOP( cpustate );
58585880      cpustate->cycles += 3;
58595881      break;
58605882
58615883   case 0x03:
5862      cpustate->op = RDOP();
5884      cpustate->op = RDOP( cpustate );
58635885      switch ( cpustate->op & 0x03 )
58645886      {
58655887      /* (xrr) */
r18558r18559
58705892
58715893      /* (xrr+d16) */
58725894      case 0x01:
5873         cpustate->ea2.b.l = RDOP();
5874         cpustate->ea2.b.h = RDOP();
5895         cpustate->ea2.b.l = RDOP( cpustate );
5896         cpustate->ea2.b.h = RDOP( cpustate );
58755897         cpustate->ea2.d = *get_reg32( cpustate, cpustate->op ) + cpustate->ea2.sw.l;
58765898         cpustate->cycles += 5;
58775899         break;
r18558r18559
58855907         {
58865908         /* (xrr+r8) */
58875909         case 0x03:
5888            cpustate->op = RDOP();
5910            cpustate->op = RDOP( cpustate );
58895911            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5890            cpustate->op = RDOP();
5912            cpustate->op = RDOP( cpustate );
58915913            cpustate->ea2.d += (INT8) *get_reg8( cpustate, cpustate->op );
58925914            cpustate->cycles += 8;
58935915            break;
58945916
58955917         /* (xrr+r16) */
58965918         case 0x07:
5897            cpustate->op = RDOP();
5919            cpustate->op = RDOP( cpustate );
58985920            cpustate->ea2.d = *get_reg32( cpustate, cpustate->op );
5899            cpustate->op = RDOP();
5921            cpustate->op = RDOP( cpustate );
59005922            cpustate->ea2.d += (INT16) *get_reg16( cpustate, cpustate->op );
59015923            cpustate->cycles += 8;
59025924            break;
59035925
59045926         /* (pc+d16) */
59055927         case 0x13:
5906            cpustate->ea2.b.l = RDOP();
5907            cpustate->ea2.b.h = RDOP();
5928            cpustate->ea2.b.l = RDOP( cpustate );
5929            cpustate->ea2.b.h = RDOP( cpustate );
59085930            cpustate->ea2.d = cpustate->pc.d + cpustate->ea2.sw.l;
59095931            cpustate->cycles += 5;
59105932            break;
r18558r18559
59135935      break;
59145936
59155937   case 0x04:   /* (-xrr) */
5916      cpustate->op = RDOP();
5938      cpustate->op = RDOP( cpustate );
59175939      reg = get_reg32( cpustate, cpustate->op );
59185940      *reg -= ( 1 << ( cpustate->op & 0x03 ) );
59195941      cpustate->ea2.d = *reg;
r18558r18559
59215943      break;
59225944
59235945   case 0x05:   /* (xrr+) */
5924      cpustate->op = RDOP();
5946      cpustate->op = RDOP( cpustate );
59255947      reg = get_reg32( cpustate, cpustate->op );
59265948      cpustate->ea2.d = *reg;
59275949      *reg += ( 1 << ( cpustate->op & 0x03 ) );
r18558r18559
59295951      break;
59305952   }
59315953
5932   cpustate->op = RDOP();
5954   cpustate->op = RDOP( cpustate );
59335955   inst = &mnemonic_f0[cpustate->op];
59345956   prepare_operands( cpustate, inst );
59355957   inst->opfunc( cpustate );
trunk/src/emu/cpu/tlcs900/tlcs900.c
r18558r18559
5353   UINT8   tff1;
5454   UINT8   tff3;
5555   int      timer_change[4];
56   bool   prefetch_clear;
57   UINT8   prefetch_index;
58   UINT8   prefetch[4];
5659
5760   /* Current state of input levels */
5861   int      level[TLCS900_NUM_INPUTS];
r18558r18559
199202
200203#define RDMEM(addr)         cpustate->program->read_byte( addr )
201204#define WRMEM(addr,data)   cpustate->program->write_byte( addr, data )
202#define RDOP()            RDMEM( cpustate->pc.d ); cpustate->pc.d++
203205#define RDMEMW(addr)         ( RDMEM(addr) | ( RDMEM(addr+1) << 8 ) )
204206#define RDMEML(addr)         ( RDMEMW(addr) | ( RDMEMW(addr+2) << 16 ) )
205207#define WRMEMW(addr,data)      { UINT16 dw = data; WRMEM(addr,dw & 0xff); WRMEM(addr+1,(dw >> 8 )); }
206208#define WRMEML(addr,data)      { UINT32 dl = data; WRMEMW(addr,dl); WRMEMW(addr+2,(dl >> 16)); }
207209
208210
211INLINE UINT8 RDOP( tlcs900_state *cpustate )
212{
213   UINT8 data;
214
215   if ( cpustate->prefetch_clear )
216   {
217      for ( int i = 0; i < 4; i++ )
218      {
219         cpustate->prefetch[ i ] = RDMEM( cpustate->pc.d + i );
220      }
221      cpustate->prefetch_index = 0;
222      cpustate->prefetch_clear = false;
223   }
224   else
225   {
226      cpustate->prefetch[ cpustate->prefetch_index ] = RDMEM( cpustate->pc.d + 3 );
227      cpustate->prefetch_index = ( cpustate->prefetch_index + 1 ) & 0x03;
228   }
229   data = cpustate->prefetch[ cpustate->prefetch_index ];
230   cpustate->pc.d++;
231   return data;
232}
233
234
209235INLINE tlcs900_state *get_safe_token( device_t *device )
210236{
211237   assert( device != NULL );
r18558r18559
256282   device->save_item( NAME(cpustate->check_irqs) );
257283   device->save_item( NAME(cpustate->ad_cycles_left) );
258284   device->save_item( NAME(cpustate->nmi_state) );
285   device->save_item( NAME(cpustate->prefetch_clear) );
286   device->save_item( NAME(cpustate->prefetch_index) );
287   device->save_item( NAME(cpustate->prefetch) );
259288}
260289
261290
r18558r18559
345374   {
346375      cpustate->level[i] = CLEAR_LINE;
347376   }
377   cpustate->prefetch_clear = true;
348378}
349379
350380
r18558r18559
551581      WRMEMW( cpustate->xssp.d, cpustate->sr.w.l );
552582      cpustate->pc.d = RDMEML( 0xffff00 + 0x20 );
553583      cpustate->cycles += 18;
584      cpustate->prefetch_clear = true;
554585
555586      cpustate->halted = 0;
556587
r18558r18559
601632
602633      cpustate->pc.d = RDMEML( 0xffff00 + vector );
603634      cpustate->cycles += 18;
635      cpustate->prefetch_clear = true;
604636
605637      cpustate->halted = 0;
606638
r18558r18559
882914      }
883915      else
884916      {
885         cpustate->op = RDOP();
917         cpustate->op = RDOP( cpustate );
886918         inst = &mnemonic[cpustate->op];
887919         prepare_operands( cpustate, inst );
888920
r18558r18559
16141646      WRMEMW( cpustate->xssp.d, cpustate->sr.w.l );
16151647      cpustate->pc.d = RDMEML( 0xffff00 + 0x20 );
16161648      cpustate->cycles += 18;
1649      cpustate->prefetch_clear = true;
16171650
16181651      cpustate->halted = 0;
16191652
r18558r18559
16641697
16651698      cpustate->pc.d = RDMEML( 0xffff00 + vector );
16661699      cpustate->cycles += 18;
1700      cpustate->prefetch_clear = true;
16671701
16681702      cpustate->halted = 0;
16691703
r18558r18559
19361970      }
19371971      else
19381972      {
1939         cpustate->op = RDOP();
1973         cpustate->op = RDOP( cpustate );
19401974         inst = &mnemonic[cpustate->op];
19411975         prepare_operands( cpustate, inst );
19421976

Previous 199869 Revisions Next


© 1997-2024 The MAME Team