Previous 199869 Revisions Next

r19650 Tuesday 18th December, 2012 at 10:42:24 UTC by O. Galibert
mcs96: Add norml and the missing div variants [O. Galibert]
[src/emu/cpu/mcs96]i8x9x.c i8x9x.h mcs96ops.lst

trunk/src/emu/cpu/mcs96/i8x9x.c
r19649r19650
157157      break;
158158   case 0x0f:
159159      logerror("%s: io port 1 %02x (%04x)\n", tag(), data, PPC);
160      io->write_word(P1*2, data);
160161      break;
161162   case 0x10:
162163      logerror("%s: io port 2 %02x (%04x)\n", tag(), data, PPC);
164      io->write_word(P2*2, data);
163165      break;
164166   case 0x11:
165167      logerror("%s: sp con %02x (%04x)\n", tag(), data, PPC);
r19649r19650
237239      logerror("%s: read timer2 h (%04x)\n", tag(), PPC);
238240      return timer_value(2, get_cycle()) >> 8;
239241   case 0x0e:
240      logerror("%s: read io port 0 (%04x)\n", tag(), PPC);
241      return 0x00;
242      static int last = -1;
243      if(io->read_word(P0*2) != last) {
244         last = io->read_word(P0*2);
245         logerror("%s: read p0 %02x\n", tag(), io->read_word(P0*2));
246      }
247      return io->read_word(P0*2);
242248   case 0x0f:
243      logerror("%s: read io port 1 (%04x)\n", tag(), PPC);
244      return 0x00;
249      return io->read_word(P1*2);
245250   case 0x10:
246      logerror("%s: read io port 2 (%04x)\n", tag(), PPC);
247      return 0x00;
251      return io->read_word(P2*2);
248252   case 0x11: {
249253      UINT8 res = sp_stat;
250254      sp_stat &= 0x80;
trunk/src/emu/cpu/mcs96/i8x9x.h
r19649r19650
4646public:
4747   enum {
4848      A0, A1, A2, A3, A4, A5, A6, A7,
49      SERIAL
49      SERIAL,
50      P0, P1, P2
5051   };
5152
5253   i8x9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
trunk/src/emu/cpu/mcs96/mcs96ops.lst
r19649r19650
305305   next(OP1 ? 7+OP1 : 8);
306306
3073070f    norml direct_2
308   OP2 &= 0xfc;
309   TMP = reg_r16(OP2);
310   TMP |= reg_r16(OP2+2) << 16;
311   for(OP3 = 0; OP3 < 31 && INT32(TMP) >= 0; OP3++);
312   PSW &= ~(F_Z|F_N|F_C);
313   if(!TMP)
314      PSW |= F_Z;
315   reg_w8(OP1, OP3);
316   reg_w16(OP2, TMP);
317   reg_w16(OP2+2, TMP >> 16);
318   next(11+OP3);
308319
30932011    clrb  direct_1
310321   reg_w8(OP1, 0x00);
r19649r19650
10081019   post_indexed 6 7 // +5 when external
10091020
101010218c    divu  direct_2
1022   OP2 &= 0xfc;
1023   PSW &= ~F_V;
1024   OP1 = reg_r16(OP1);
1025   if(OP1) {
1026      TMP = reg_r16(OP2);
1027      TMP |= reg_r16(OP2+2);
1028      UINT32 TMP2 = TMP / OP1;
1029      if(TMP2 > 65535)
1030         PSW |= F_V|F_VT;
1031      TMP = TMP % OP1;
1032      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1033      reg_w16(OP2, TMP);
1034      reg_w16(OP2+2, TMP >> 16);
1035   }
1036   next(25);
10111037
101210388d    divu  immed_2w
1039   OP2 &= 0xfc;
1040   PSW &= ~F_V;
1041   if(OP1) {
1042      TMP = reg_r16(OP2);
1043      TMP |= reg_r16(OP2+2);
1044      UINT32 TMP2 = TMP / OP1;
1045      if(TMP2 > 65535)
1046         PSW |= F_V|F_VT;
1047      TMP = TMP % OP1;
1048      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1049      reg_w16(OP2, TMP);
1050      reg_w16(OP2+2, TMP >> 16);
1051   }
1052   next(26);
10131053
101410548e    divu  indirect_2
1055   OP2 &= 0xfc;
1056   PSW &= ~F_V;
1057   UINT32 d = any_r16(OP1);
1058   if(d) {
1059      TMP = reg_r16(OP2);
1060      TMP |= reg_r16(OP2+2);
1061      UINT32 TMP2 = TMP / d;
1062      if(TMP2 > 65535)
1063         PSW |= F_V|F_VT;
1064      TMP = TMP % d;
1065      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1066      reg_w16(OP2, TMP);
1067      reg_w16(OP2+2, TMP >> 16);
1068   }
1069   post_indirect 2 28 29 // +4 when external
10151070
101610718f    divu  indexed_2
1072   OP2 &= 0xfc;
1073   PSW &= ~F_V;
1074   UINT32 d = any_r16(OP1);
1075   if(d) {
1076      TMP = reg_r16(OP2);
1077      TMP |= reg_r16(OP2+2);
1078      UINT32 TMP2 = TMP / d;
1079      if(TMP2 > 65535)
1080         PSW |= F_V|F_VT;
1081      TMP = TMP % d;
1082      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1083      reg_w16(OP2, TMP);
1084      reg_w16(OP2+2, TMP >> 16);
1085   }
1086   post_indexed 28 29 // +4 when external
10171087
10181088fe8c  div   direct_2
1089   OP2 &= 0xfc;
1090   PSW &= ~F_V;
1091   OP1 = reg_r16(OP1);
1092   if(OP1) {
1093      TMP = reg_r16(OP2);
1094      TMP |= reg_r16(OP2+2);
1095      INT32 TMP2 = INT32(TMP) / INT16(OP1);
1096      if(TMP2 > 32767 || TMP2 < -32768)
1097         PSW |= F_V|F_VT;
1098      TMP = TMP % INT16(OP1);
1099      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1100      reg_w16(OP2, TMP);
1101      reg_w16(OP2+2, TMP >> 16);
1102   }
1103   next(30);
10191104
10201105fe8d  div   immed_2w
1106   OP2 &= 0xfc;
1107   PSW &= ~F_V;
1108   if(OP1) {
1109      TMP = reg_r16(OP2);
1110      TMP |= reg_r16(OP2+2);
1111      INT32 TMP2 = INT32(TMP) / INT16(OP1);
1112      if(TMP2 > 32767 || TMP2 < -32768)
1113         PSW |= F_V|F_VT;
1114      TMP = TMP % INT16(OP1);
1115      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1116      reg_w16(OP2, TMP);
1117      reg_w16(OP2+2, TMP >> 16);
1118   }
1119   next(30);
10211120
10221121fe8e  div   indirect_2
1122   OP2 &= 0xfc;
1123   PSW &= ~F_V;
1124   INT32 d = INT16(any_r16(OP1));
1125   if(d) {
1126      TMP = reg_r16(OP2);
1127      TMP |= reg_r16(OP2+2);
1128      INT32 TMP2 = INT32(TMP) / d;
1129      if(TMP2 > 32767 || TMP2 < -32768)
1130         PSW |= F_V|F_VT;
1131      TMP = TMP % d;
1132      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1133      reg_w16(OP2, TMP);
1134      reg_w16(OP2+2, TMP >> 16);
1135   }
1136   post_indirect 2 32 33  // +4 when external
10231137
10241138fe8f  div   indexed_2
1139   OP2 &= 0xfc;
1140   PSW &= ~F_V;
1141   INT32 d = INT16(any_r16(OP1));
1142   if(d) {
1143      TMP = reg_r16(OP2);
1144      TMP |= reg_r16(OP2+2);
1145      INT32 TMP2 = INT32(TMP) / d;
1146      if(TMP2 > 32767 || TMP2 < -32768)
1147         PSW |= F_V|F_VT;
1148      TMP = TMP % d;
1149      TMP = (TMP2 & 0xffff) | ((TMP & 0xffff) << 16);
1150      reg_w16(OP2, TMP);
1151      reg_w16(OP2+2, TMP >> 16);
1152   }
1153   post_indexed 32 33  // +4 when external
10251154
1026115590    orb   direct_2
10271156   TMP = reg_r8(OP1);
r19649r19650
11791308   next(21);
11801309
11811310fe9e  divb  indirect_2
1311   PSW &= ~F_V;
1312   INT32 d = INT8(any_r8(OP1));
1313   if(d) {
1314      TMP = reg_r16(OP2);
1315      UINT32 TMP2 = INT16(TMP) / d;
1316      if(INT16(TMP2) > 127 || INT16(TMP2) < -128)
1317         PSW |= F_V|F_VT;
1318      TMP = INT16(TMP) % d;
1319      TMP = (TMP2 & 0xff) | ((TMP & 0xff) << 8);
1320      reg_w16(OP2, TMP);
1321   }
1322   post_indirect 1 24 25 // +4 when external
11821323
11831324fe9f  divb  indexed_2
1325   PSW &= ~F_V;
1326   INT32 d = INT8(any_r8(OP1));
1327   if(d) {
1328      TMP = reg_r16(OP2);
1329      UINT32 TMP2 = INT16(TMP) / d;
1330      if(INT16(TMP2) > 127 || INT16(TMP2) < -128)
1331         PSW |= F_V|F_VT;
1332      TMP = INT16(TMP) % d;
1333      TMP = (TMP2 & 0xff) | ((TMP & 0xff) << 8);
1334      reg_w16(OP2, TMP);
1335   }
1336   post_indexed 1 24 25 // +4 when external
11841337
11851338a0    ld    direct_2
11861339   reg_w16(OP2, reg_r16(OP1));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team