Previous 199869 Revisions Next

r26273 Monday 18th November, 2013 at 21:05:23 UTC by O. Galibert
mcs96: Misc. fixes [O. Galibert]
[src/emu/cpu/mcs96]mcs96.c mcs96.h mcs96ops.lst

trunk/src/emu/cpu/mcs96/mcs96.c
r26272r26273
141141void mcs96_device::execute_set_input(int inputnum, int state)
142142{
143143   switch(inputnum) {
144   case EXINT_LINE:
145      if(state)
146         pending_irq |= 0x80;
147      else
148         pending_irq &= 0x7f;
149      check_irq();
150      break;
144151   }
145152}
146153
r26272r26273
293300      flags |= 3;
294301      break;
295302
303   case DASM_immed_or_reg_2b:
304      if(oprom[1] >= 0x10)
305         sprintf(buffer, " %s, %s", regname(oprom[2]).cstr(), regname(oprom[1]).cstr());
306      else
307         sprintf(buffer, " %s, #%02x", regname(oprom[2]).cstr(), oprom[1]);
308      flags |= 3;
309      break;
310
296311   case DASM_immed_3b:
297312      sprintf(buffer, " %s, %s, #%02x", regname(oprom[3]).cstr(), regname(oprom[2]).cstr(), oprom[1]);
298313      flags |= 4;
r26272r26273
366381               sprintf(buffer, " %02x", delta);
367382         } else {
368383            if(delta < 0)
369               sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]-1).cstr());
384               sprintf(buffer, " -%02x[%s]", -delta, regname(oprom[1]).cstr());
370385            else
371               sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]-1).cstr());
386               sprintf(buffer, " %02x[%s]", delta, regname(oprom[1]).cstr());
372387         }
373388         flags |= 3;
374389      }
r26272r26273
392407               sprintf(buffer, " %s, %02x", regname(oprom[3]).cstr(), delta);
393408         } else {
394409            if(delta < 0)
395               sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).cstr(), -delta, regname(oprom[1]-1).cstr());
410               sprintf(buffer, " %s, -%02x[%s]", regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr());
396411            else
397               sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).cstr(), delta, regname(oprom[1]-1).cstr());
412               sprintf(buffer, " %s, %02x[%s]", regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr());
398413         }
399414         flags |= 4;
400415      }
r26272r26273
418433               sprintf(buffer, " %s, %s, %02x", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta);
419434         } else {
420435            if(delta < 0)
421               sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), -delta, regname(oprom[1]-1).cstr());
436               sprintf(buffer, " %s, %s, -%02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), -delta, regname(oprom[1]).cstr());
422437            else
423               sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta, regname(oprom[1]-1).cstr());
438               sprintf(buffer, " %s, %s, %02x[%s]", regname(oprom[4]).cstr(), regname(oprom[3]).cstr(), delta, regname(oprom[1]).cstr());
424439         }
425440         flags |= 5;
426441      }
trunk/src/emu/cpu/mcs96/mcs96ops.lst
r26272r26273
22   if(irq_requested) {
33      int level;
44      for(level = 7; level >= 0 && !(PSW & pending_irq & (1<<level)); level--);
5      pending_irq &= ~(1<<level);
5      if(level != 7)
6         pending_irq &= ~(1<<level);
67      OP1 = level;
78      TMP = reg_r16(0x18);
89      TMP -= 2;
r26272r26273
7374   OP1 = read_pc();
7475   OP2 = read_pc();
7576
77eadr  immed_or_reg_2b
78   OP1 = read_pc();
79   OP2 = read_pc();
80
7681eadr  immed_3b
7782   OP1 = read_pc();
7883   OP2 = read_pc();
r26272r26273
199204   reg_w16(OP1, do_add(TMP, 1));
200205   next(4);
201206
20208    shr   immed_2b
203   OP1 &= 0x1f;
20708    shr   immed_or_reg_2b
208   if(OP1 >= 0x10) {
209      OP1 = reg_r8(OP1) & 0x1f;
210   }
204211   TMP = reg_r16(OP2);
205212   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
206213   if(OP1 >= 2 && (TMP & (0xffff >> (OP1 <= 16 ? 17-OP1 : 0))))
r26272r26273
215222   reg_w16(OP2, TMP);
216223   next(OP1 ? 7+OP1 : 8);
217224
21809    shl   immed_2b
219   OP1 &= 0x1f;
22509    shl   immed_or_reg_2b
226   if(OP1 >= 0x10) {
227      OP1 = reg_r8(OP1) & 0x1f;
228   }
220229   TMP = reg_r16(OP2);
221230   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
222231   if(OP1 >= 2 && (TMP & (0xffff << (OP1 <= 16 ? 17-OP1 : 0))))
r26272r26273
231240   reg_w16(OP2, TMP);
232241   next(OP1 ? 7+OP1 : 8);
233242
2340a    shra  immed_2b
235   OP1 &= 0x1f;
2430a    shra  immed_or_reg_2b
244   if(OP1 >= 0x10) {
245      OP1 = reg_r8(OP1) & 0x1f;
246   }
236247   TMP = reg_r16(OP2);
237248   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
238249   if(OP1 >= 2 && (TMP & (0xffff >> (OP1 <= 16 ? 17-OP1 : 0))))
r26272r26273
247258   reg_w16(OP2, TMP);
248259   next(OP1 ? 7+OP1 : 8);
249260
2500c    shrl  immed_2b
251   OP1 &= 0x1f;
2610c    shrl  immed_or_reg_2b
262   if(OP1 >= 0x10) {
263      OP1 = reg_r8(OP1) & 0x1f;
264   }
252265   OP2 &= 0xfc;
253266   TMP = reg_r16(OP2);
254267   TMP |= reg_r16(OP2+2) << 16;
r26272r26273
266279   reg_w16(OP2+2, TMP >> 16);
267280   next(OP1 ? 7+OP1 : 8);
268281
2690d    shll  immed_2b
270   OP1 &= 0x1f;
2820d    shll  immed_or_reg_2b
283   if(OP1 >= 0x10) {
284      OP1 = reg_r8(OP1) & 0x1f;
285   }
271286   OP2 &= 0xfc;
272287   TMP = reg_r16(OP2);
273288   TMP |= reg_r16(OP2+2) << 16;
r26272r26273
285300   reg_w16(OP2+2, TMP >> 16);
286301   next(OP1 ? 7+OP1 : 8);
287302
2880e    shral immed_2b
289   OP1 &= 0x1f;
3030e    shral immed_or_reg_2b
304   if(OP1 >= 0x10) {
305      OP1 = reg_r8(OP1) & 0x1f;
306   }
290307   OP2 &= 0xfc;
291308   TMP = reg_r16(OP2);
292309   TMP |= reg_r16(OP2+2) << 16;
r26272r26273
351368   reg_w8(OP1, do_addb(TMP, 1));
352369   next(4);
353370
35418    shrb  immed_2b
355   OP1 &= 0x1f;
37118    shrb  immed_or_reg_2b
372   if(OP1 >= 0x10) {
373      OP1 = reg_r8(OP1) & 0x1f;
374   }
356375   TMP = reg_r8(OP2);
357376   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
358377   if(OP1 >= 2 && (TMP & (0xff >> (OP1 <= 8 ? 9-OP1 : 0))))
r26272r26273
367386   reg_w8(OP2, TMP);
368387   next(OP1 ? 7+OP1 : 8);
369388
37019    shlb  immed_2b
371   OP1 &= 0x1f;
38919    shlb  immed_or_reg_2b
390   if(OP1 >= 0x10) {
391      OP1 = reg_r8(OP1) & 0x1f;
392   }
372393   TMP = reg_r8(OP2);
373394   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
374395   if(OP1 >= 2 && (TMP & (0xff << (OP1 <= 8 ? 9-OP1 : 0))))
r26272r26273
383404   reg_w8(OP2, TMP);
384405   next(OP1 ? 7+OP1 : 8);
385406
3861a    shrab immed_2b
387   OP1 &= 0x1f;
4071a    shrab immed_or_reg_2b
408   if(OP1 >= 0x10) {
409      OP1 = reg_r8(OP1) & 0x1f;
410   }
388411   TMP = reg_r8(OP2);
389412   PSW &= ~(F_Z|F_N|F_C|F_V|F_ST);
390413   if(OP1 >= 2 && (TMP & (0xff >> (OP1 <= 8 ? 9-OP1 : 0))))
r26272r26273
16031626   }
16041627
16051628d1    jnh   rel8
1606   if((PSW & (F_Z|F_N)) != F_C) {
1629   if((PSW & (F_C|F_N)) != F_C) {
16071630      PC += OP1;
16081631      next(8);
16091632   } else {
r26272r26273
16691692   }
16701693
16711694d9    jh    rel8
1672   if((PSW & (F_Z|F_N)) == F_C) {
1695   if((PSW & (F_C|F_N)) == F_C) {
16731696      PC += OP1;
16741697      next(8);
16751698   } else {
trunk/src/emu/cpu/mcs96/mcs96.h
r26272r26273
4242
4343class mcs96_device : public cpu_device {
4444public:
45   enum {
46      EXINT_LINE = 1
47   };
48
4549   mcs96_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int data_width, const char *shortname, const char *source);
4650
4751   UINT64 get_cycle();
r26272r26273
6973   };
7074
7175   enum {
72      DASM_none,          /* No parameters */
73      DASM_nop_2,         /* One ignored parameter byte */
74      DASM_rel8,          /* Relative, 8 bits */
75      DASM_rel11,         /* Relative, 11 bits */
76      DASM_rel16,         /* Relative, 16 bits */
77      DASM_rrel8,         /* Register + relative, 8 bits */
78      DASM_brrel8,        /* Bit test + register + relative, 8 bits */
79      DASM_direct_1,      /* Register-direct references, 1 operator */
80      DASM_direct_2,      /* Register-direct references, 2 operators */
81      DASM_direct_3,      /* Register-direct references, 3 operators */
82      DASM_immed_1b,      /* Immediate references to byte, 1 operator */
83      DASM_immed_2b,      /* Immediate references to byte, 2 operators */
84      DASM_immed_3b,      /* Immediate references to byte, 3 operators */
85      DASM_immed_1w,      /* Immediate references to word, 1 operator */
86      DASM_immed_2w,      /* Immediate references to word, 2 operators */
87      DASM_immed_3w,      /* Immediate references to word, 3 operators */
88      DASM_indirect_1n,   /* Indirect normal, 1 operator */
89      DASM_indirect_1,    /* Indirect, normal or auto-incrementing, 1 operator */
90      DASM_indirect_2,    /* Indirect, normal or auto-incrementing, 2 operators */
91      DASM_indirect_3,    /* Indirect, normal or auto-incrementing, 3 operators */
92      DASM_indexed_1,     /* Indexed, short or long, 1 operator */
93      DASM_indexed_2,     /* Indexed, short or long, 2 operators */
94      DASM_indexed_3,     /* Indexed, short or long, 3 operators */
76      DASM_none,              /* No parameters */
77      DASM_nop_2,             /* One ignored parameter byte */
78      DASM_rel8,              /* Relative, 8 bits */
79      DASM_rel11,             /* Relative, 11 bits */
80      DASM_rel16,             /* Relative, 16 bits */
81      DASM_rrel8,             /* Register + relative, 8 bits */
82      DASM_brrel8,            /* Bit test + register + relative, 8 bits */
83      DASM_direct_1,          /* Register-direct references, 1 operator */
84      DASM_direct_2,          /* Register-direct references, 2 operators */
85      DASM_direct_3,          /* Register-direct references, 3 operators */
86      DASM_immed_1b,          /* Immediate references to byte, 1 operator */
87      DASM_immed_2b,          /* Immediate references to byte, 2 operators */
88      DASM_immed_or_reg_2b,   /* Immediate references to byte or register, 2 operators */
89      DASM_immed_3b,          /* Immediate references to byte, 3 operators */
90      DASM_immed_1w,          /* Immediate references to word, 1 operator */
91      DASM_immed_2w,          /* Immediate references to word, 2 operators */
92      DASM_immed_3w,          /* Immediate references to word, 3 operators */
93      DASM_indirect_1n,       /* Indirect normal, 1 operator */
94      DASM_indirect_1,        /* Indirect, normal or auto-incrementing, 1 operator */
95      DASM_indirect_2,        /* Indirect, normal or auto-incrementing, 2 operators */
96      DASM_indirect_3,        /* Indirect, normal or auto-incrementing, 3 operators */
97      DASM_indexed_1,         /* Indexed, short or long, 1 operator */
98      DASM_indexed_2,         /* Indexed, short or long, 2 operators */
99      DASM_indexed_3,         /* Indexed, short or long, 3 operators */
95100   };
96101
97102   // device-level overrides
r26272r26273
245250   O(rst_none);
246251   O(scall_rel11);
247252   O(setc_none);
248   O(shl_immed_2b);
249   O(shlb_immed_2b);
250   O(shll_immed_2b);
251   O(shr_immed_2b);
252   O(shra_immed_2b);
253   O(shrab_immed_2b);
254   O(shral_immed_2b);
255   O(shrb_immed_2b);
256   O(shrl_immed_2b);
253   O(shl_immed_or_reg_2b);
254   O(shlb_immed_or_reg_2b);
255   O(shll_immed_or_reg_2b);
256   O(shr_immed_or_reg_2b);
257   O(shra_immed_or_reg_2b);
258   O(shrab_immed_or_reg_2b);
259   O(shral_immed_or_reg_2b);
260   O(shrb_immed_or_reg_2b);
261   O(shrl_immed_or_reg_2b);
257262   O(sjmp_rel11);
258263   O(skip_immed_1b);
259264   O(st_direct_2); O(st_indexed_2); O(st_indirect_2);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team