Previous 15994 Revisions Next

r15915 Thursday 16th August, 2012 at 01:49:50 UTC by Angelo Salese
Added ANDNBSU and ORBSU, used by 3D Tetris
[src/emu/cpu/v810]v810.c

src/emu/cpu/v810/v810.c
r15914r15915
946946}
947947
948948/* TODO: clocks */
949static void opMOVBSU(v810_state *cpustate,UINT32 op)
949static UINT32 opBSU(v810_state *cpustate,UINT32 op)
950950{
951   UINT32 srcoff,dstoff,src,dst,size;
952   UINT32 tmp;
951   if(!(op & 8))
952      fatalerror("V810: unknown BSU opcode %04x",op);
953953
954//   printf("BDST %08x BSRC %08x SIZE %08x DST %08x SRC %08x\n",cpustate->R26,cpustate->R27,cpustate->R28,cpustate->R29,cpustate->R30);
954   {
955      UINT32 srcbit,dstbit,src,dst,size;
956      UINT32 dsttmp,tmp;
957      UINT8 srctmp;
955958
956   dstoff = cpustate->R26;
957   srcoff = cpustate->R27;
958   size =  cpustate->R28;
959   dst = cpustate->R29 & ~3;
960   src = cpustate->R30 & ~3;
959//      printf("BDST %08x BSRC %08x SIZE %08x DST %08x SRC %08x\n",cpustate->R26,cpustate->R27,cpustate->R28,cpustate->R29,cpustate->R30);
961960
962   tmp = R_W(cpustate,src);
963   W_W(cpustate,dst,tmp);
961      dstbit = cpustate->R26;
962      srcbit = cpustate->R27;
963      size =  cpustate->R28;
964      dst = cpustate->R29 & ~3;
965      src = cpustate->R30 & ~3;
964966
965   srcoff++;
966   dstoff++;
967      switch(op & 0xf)
968      {
969         case 0x8: // ORBSU
970            srctmp = (R_W(cpustate,src) >> srcbit) & 1;
971            dsttmp = R_W(cpustate,dst);
967972
968   srcoff&=0x1f;
969   dstoff&=0x1f;
973            tmp = dsttmp | (srctmp << dstbit);
970974
971   if(srcoff == 0)
972      src+=4;
975            W_W(cpustate,dst,tmp);
976            break;
977         case 0xb: // MOVBSU
978            srctmp = (R_W(cpustate,src) >> srcbit) & 1;
979            dsttmp = (R_W(cpustate,dst) & ~(1 << dstbit));
973980
974   if(dstoff == 0)
975      dst+=4;
981            tmp = (srctmp << dstbit) | dsttmp;
976982
977   size --;
983            W_W(cpustate,dst,tmp);
984            break;
985         case 0xd: // ANDNBSU
986            srctmp = (R_W(cpustate,src) >> srcbit) & 1;
987            dsttmp = R_W(cpustate,dst);
978988
979   cpustate->R26 = dstoff;
980   cpustate->R27 = srcoff;
981   cpustate->R28 = size;
982   cpustate->R29 = dst;
983   cpustate->R30 = src;
989            tmp = dsttmp & (~(srctmp << dstbit));
984990
985   if(size != 0)
986      cpustate->PC-=2;
987}
991            W_W(cpustate,dst,tmp);
992            break;
993         default: fatalerror("V810: unemulated BSU opcode %04x\n",op);
994      }
988995
989static UINT32 opBSU(v810_state *cpustate,UINT32 op)
990{
991   if(!(op & 8))
992      fatalerror("V810: unknown BSU opcode %04x",op);
996      srcbit++;
997      dstbit++;
993998
994   switch(op & 0xf)
995   {
996      case 0xb: opMOVBSU(cpustate,op); break;
997      default: fatalerror("V810: unemulated BSU opcode %04x\n",op);
999      srcbit&=0x1f;
1000      dstbit&=0x1f;
1001
1002      if(srcbit == 0)
1003         src+=4;
1004
1005      if(dstbit == 0)
1006         dst+=4;
1007
1008      size --;
1009
1010      cpustate->R26 = dstbit;
1011      cpustate->R27 = srcbit;
1012      cpustate->R28 = size;
1013      cpustate->R29 = dst;
1014      cpustate->R30 = src;
1015
1016      if(size != 0)
1017         cpustate->PC-=2;
9981018   }
9991019
10001020   return clkIF+1; //TODO: correct?

Previous 15994 Revisions Next


© 1998-2018 The MESS Team