Previous 15994 Revisions Next

r15121 Monday 7th May, 2012 at 22:17:29 UTC by R. Belmont
Preliminary Z8001 support [Christian Groessler]
[src/emu/cpu/z8000]8000dasm.c z8000.c z8000cpu.h z8000ops.c z8000tbl.c

src/emu/cpu/z8000/z8000cpu.h
r15120r15121
5555#define RQ(n)   regs.Q[(n) >> 2]
5656
5757/* the register used as stack pointer */
58#define SP      15
58#define SP      (segmented_mode(cpustate) ? 14 : 15)
5959
60/* these vectors are based on cpustate->psap */
61#define RST    (cpustate->psap + 0x0000)   /* start up cpustate->fcw and cpustate->pc */
62#define EPU    (cpustate->psap + 0x0004)   /* extension processor unit? trap */
63#define TRAP   (cpustate->psap + 0x0008)   /* privilege violation trap */
64#define SYSCALL (cpustate->psap + 0x000c)   /* system call SC */
65#define SEGTRAP (cpustate->psap + 0x0010)   /* segment trap */
66#define NMI    (cpustate->psap + 0x0014)   /* non maskable interrupt */
67#define NVI    (cpustate->psap + 0x0018)   /* non vectored interrupt */
68#define VI      (cpustate->psap + 0x001c)   /* vectored interrupt */
69#define VEC00   (cpustate->psap + 0x001e)   /* vector n cpustate->pc value */
60#define PSA_ADDR (cpustate->device->type() == Z8001 ? segmented_addr((cpustate->psapseg << 16) | cpustate->psapoff) : cpustate->psapoff)
7061
62/* these vectors are based on cpustate->psap @@@*/
63#define RST    (PSA_ADDR + 0)   /* start up cpustate->fcw and cpustate->pc */
64#define EPU    (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0008 : 0x0004))   /* extension processor unit? trap */
65#define TRAP   (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0010 : 0x0008))   /* privilege violation trap */
66#define SYSCALL (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0018 : 0x000c))   /* system call SC */
67#define SEGTRAP (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0020 : 0x0010))   /* segment trap */
68#define NMI    (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0028 : 0x0014))   /* non maskable interrupt */
69#define NVI    (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0030 : 0x0018))   /* non vectored interrupt */
70#define VI      (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x0038 : 0x001c))   /* vectored interrupt */
71#define VEC00   (PSA_ADDR + (cpustate->device->type() == Z8001 ? 0x003c : 0x001e))   /* vector n cpustate->pc value */
72
7173/* bits of the cpustate->fcw */
7274#define F_SEG   0x8000            /* segmented mode (Z8001 only) */
7375#define F_S_N   0x4000            /* system / normal mode */
r15120r15121
163165/* get data from the opcode words */
164166/* o is the opcode word offset    */
165167/* s is a nibble shift factor     */
166#define GET_BIT(o)      UINT16 bit = 1 << (cpustate->op[o] & 15)
167#define GET_CCC(o,s)   UINT8 cc = (cpustate->op[o] >> (s)) & 15
168#define GET_BIT(o)      UINT16 bit = 1 << (get_operand(cpustate, o) & 15)
169#define GET_CCC(o,s)   UINT8 cc = (get_operand(cpustate, o) >> (s)) & 15
168170
169#define GET_DST(o,s)   UINT8 dst = (cpustate->op[o] >> (s)) & 15
170#define GET_SRC(o,s)   UINT8 src = (cpustate->op[o] >> (s)) & 15
171#define GET_IDX(o,s)   UINT8 idx = (cpustate->op[o] >> (s)) & 15
172#define GET_CNT(o,s)   INT8 cnt = (cpustate->op[o] >> (s)) & 15
173#define GET_IMM4(o,s)   UINT8 imm4 = (cpustate->op[o] >> (s)) & 15
171#define GET_DST(o,s)   UINT8 dst = (get_operand(cpustate, o) >> (s)) & 15
172#define GET_SRC(o,s)   UINT8 src = (get_operand(cpustate, o) >> (s)) & 15
173#define GET_IDX(o,s)   UINT8 idx = (get_operand(cpustate, o) >> (s)) & 15
174#define GET_CNT(o,s)   INT8 cnt = (get_operand(cpustate, o) >> (s)) & 15
175#define GET_IMM4(o,s)   UINT8 imm4 = (get_operand(cpustate, o) >> (s)) & 15
174176
175#define GET_I4M1(o,s)   UINT8 i4p1 = ((cpustate->op[o] >> (s)) & 15) + 1
176#define GET_IMM1(o,s)   UINT8 imm1 = (cpustate->op[o] >> (s)) & 2
177#define GET_IMM2(o,s)   UINT8 imm2 = (cpustate->op[o] >> (s)) & 3
178#define GET_IMM3(o,s)   UINT8 imm3 = (cpustate->op[o] >> (s)) & 7
177#define GET_I4M1(o,s)   UINT8 i4p1 = ((get_operand(cpustate, o) >> (s)) & 15) + 1
178#define GET_IMM1(o,s)   UINT8 imm1 = (get_operand(cpustate, o) >> (s)) & 2
179#define GET_IMM2(o,s)   UINT8 imm2 = (get_operand(cpustate, o) >> (s)) & 3
180#define GET_IMM3(o,s)   UINT8 imm3 = (get_operand(cpustate, o) >> (s)) & 7
179181
180#define GET_IMM8(o)    UINT8 imm8 = (UINT8)cpustate->op[o]
182#define GET_IMM8(o)    UINT8 imm8 = (UINT8)get_operand(cpustate, o)
181183
182#define GET_IMM16(o)   UINT16 imm16 = cpustate->op[o]
183#define GET_IMM32      UINT32 imm32 = cpustate->op[2] + (cpustate->op[1] << 16)
184#define GET_DSP7      UINT8 dsp7 = cpustate->op[0] & 127
185#define GET_DSP8      INT8 dsp8 = (INT8)cpustate->op[0]
186#define GET_DSP16      UINT16 dsp16 = cpustate->pc + (INT16)cpustate->op[1]
187#define GET_ADDR(o)    UINT16 addr = (UINT16)cpustate->op[o]
184#define GET_IMM16(o)   UINT16 imm16 = get_operand(cpustate, o)
185#define GET_IMM32      UINT32 imm32 = (get_operand(cpustate, 1) << 16) + get_operand(cpustate, 2)
186#define GET_DSP7      UINT8 dsp7 = get_operand(cpustate, 0) & 127
187#define GET_DSP8      INT8 dsp8 = (INT8)get_operand(cpustate, 0)
188#define GET_DSP16      UINT32 dsp16 = addr_add(cpustate, cpustate->pc, (INT16)get_operand(cpustate, 1))
189#define GET_ADDR(o)    UINT32 addr = (UINT32)get_addr_operand(cpustate, o)
188190
189191typedef struct _z8000_state z8000_state;
190192
r15120r15121
209211/* opcode execution table */
210212extern Z8000_exec *z8000_exec;
211213
212extern void z8001_init_tables(void);
213extern void z8002_init_tables(void);
214extern void z8000_init_tables(void);
214215extern void z8000_deinit_tables(void);
215
src/emu/cpu/z8000/z8000.c
r15120r15121
6868/* In z8000cpu.h: typedef struct _z8000_state z8000_state; */
6969struct _z8000_state
7070{
71    UINT16  op[4];      /* opcodes/data of current instruction */
71    UINT32  op[4];      /* opcodes/data of current instruction */
7272   UINT32   ppc;      /* previous program counter */
7373    UINT32  pc;         /* program counter */
74    UINT16  psap;       /* program status pointer */
74    UINT16  psapseg;    /* program status pointer, segment (Z8001 only) */
75    UINT16  psapoff;    /* program status pointer, offset */
7576    UINT16  fcw;        /* flags and control word */
7677    UINT16  refresh;    /* refresh timer/counter */
77    UINT16  nsp;        /* system stack pointer */
78    UINT16  nspseg;     /* system stack pointer, segment (Z8001 only) */
79    UINT16  nspoff;     /* system stack pointer, offset */
7880    UINT16  irq_req;    /* CPU is halted, interrupt or trap request */
7981    UINT16  irq_srv;    /* serviced interrupt request */
8082    UINT16  irq_vec;    /* interrupt vector */
83    unsigned int op_valid;  /* bit field indicating if given op[] field is already initialized */
8184    z8000_reg_file regs;/* registers */
8285   int nmi_state;      /* NMI line state */
8386   int irq_state[2];   /* IRQ line states (NVI, VI) */
r15120r15121
104107/* zero, sign and parity flags for logical byte operations */
105108static UINT8 z8000_zsp[256];
106109
110INLINE int segmented_mode(z8000_state *cpustate)
111{
112  if (cpustate->device->type() == Z8001 && (cpustate->fcw & F_SEG))
113    return 1;
114  return 0;
115}
116
117INLINE UINT32 addr_add(z8000_state *cpustate, UINT32 addr, UINT32 addend)
118{
119    if (segmented_mode(cpustate))
120        return (addr & 0xffff0000) | ((addr + addend) & 0xffff);
121    else
122        return (addr + addend) & 0xffff;
123}
124
125INLINE UINT32 addr_sub(z8000_state *cpustate, UINT32 addr, UINT32 subtrahend)
126{
127    if (segmented_mode(cpustate))
128        return (addr & 0xffff0000) | ((addr - subtrahend) & 0xffff);
129    else
130        return (addr - subtrahend) & 0xffff;
131}
132
107133/* conversion table for Z8000 DAB opcode */
108134#include "z8000dab.h"
109135
r15120r15121
114140    return res;
115141}
116142
143INLINE UINT32 get_operand (z8000_state *cpustate, int opnum)
144{
145    int i;
146    assert (cpustate->device->type() == Z8001 || cpustate->device->type() == Z8002);
147
148    for (i = 0; i < opnum; i++)
149        assert (cpustate->op_valid & (1 << i));
150
151    if (! (cpustate->op_valid & (1 << opnum)))
152    {
153        cpustate->op[opnum] = cpustate->direct->read_decrypted_word(cpustate->pc);
154        cpustate->pc += 2;
155        cpustate->op_valid |= (1 << opnum);
156    }
157    return cpustate->op[opnum];
158}
159
160INLINE UINT32 get_addr_operand (z8000_state *cpustate, int opnum)
161{
162    int i;
163    assert (cpustate->device->type() == Z8001 || cpustate->device->type() == Z8002);
164
165    for (i = 0; i < opnum; i++)
166        assert (cpustate->op_valid & (1 << i));
167
168    if (! (cpustate->op_valid & (1 << opnum)))
169    {
170        UINT32 seg = cpustate->direct->read_decrypted_word(cpustate->pc);
171        cpustate->pc += 2;
172        if (segmented_mode(cpustate))
173        {
174            if (seg & 0x8000)
175            {
176                cpustate->op[opnum] = ((seg & 0x7f00) << 8) | cpustate->direct->read_decrypted_word(cpustate->pc);
177                cpustate->pc += 2;
178            }
179            else
180                cpustate->op[opnum] = ((seg & 0x7f00) << 8) | (seg & 0xff);
181        }
182        else
183            cpustate->op[opnum] = seg;
184        cpustate->op_valid |= (1 << opnum);
185    }
186    return cpustate->op[opnum];
187}
188
189
117190INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr)
118191{
119192   return cpustate->program->read_byte(addr);
r15120r15121
130203   UINT32 result;
131204   addr &= ~1;
132205   result = cpustate->program->read_word(addr) << 16;
133   return result + cpustate->program->read_word(addr + 2);
206   return result + cpustate->program->read_word(addr_add(cpustate, addr, 2));
134207}
135208
136209INLINE void WRMEM_B(z8000_state *cpustate, UINT32 addr, UINT8 value)
r15120r15121
148221{
149222   addr &= ~1;
150223   cpustate->program->write_word(addr, value >> 16);
151   cpustate->program->write_word((UINT16)(addr + 2), value & 0xffff);
224   cpustate->program->write_word(addr_add(cpustate, addr, 2), value & 0xffff);
152225}
153226
154227INLINE UINT8 RDPORT_B(z8000_state *cpustate, int mode, UINT16 addr)
r15120r15121
203276    }
204277}
205278
206INLINE UINT16 fetch(z8000_state *cpustate)
207{
208   UINT16 data = cpustate->direct->read_decrypted_word(cpustate->pc);
209
210   cpustate->pc+=2;
211
212   return data;
213}
214
215279INLINE void cycles(z8000_state *cpustate, int cycles)
216280{
217281   cpustate->icount -= cycles;
r15120r15121
261325    cpustate->irq_req = type & ~Z8000_HALT;
262326}
263327
328#define PUSH_PC() do { \
329if (cpustate->device->type() == Z8001) \
330    PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));        /* save current cpustate->pc */ \
331 else \
332    PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */ \
333} while (0)
264334
335#define SET_PC(VEC) (cpustate->device->type() == Z8001 ? segmented_addr(RDMEM_L(cpustate, VEC)) : (RDMEM_W(cpustate, VEC)))
336
337
265338INLINE void Interrupt(z8000_state *cpustate)
266339{
267340    UINT16 fcw = cpustate->fcw;
r15120r15121
282355    if (cpustate->irq_req & Z8000_TRAP)
283356    {
284357        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
285        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
358        PUSH_PC();
286359        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
287360        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
288361        cpustate->irq_srv = cpustate->irq_req;
289362        cpustate->irq_req &= ~Z8000_TRAP;
290        cpustate->pc = TRAP;
363        cpustate->pc = SET_PC(TRAP);
291364        LOG(("Z8K '%s' trap $%04x\n", cpustate->device->tag(), cpustate->pc));
292365    }
293366    else
294367    if (cpustate->irq_req & Z8000_SYSCALL)
295368    {
296369        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
297        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
370        PUSH_PC();
298371        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
299372        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
300373        cpustate->irq_srv = cpustate->irq_req;
301374        cpustate->irq_req &= ~Z8000_SYSCALL;
302        cpustate->pc = SYSCALL;
375        cpustate->pc = SET_PC(SYSCALL);
303376        LOG(("Z8K '%s' syscall $%04x\n", cpustate->device->tag(), cpustate->pc));
304377    }
305378    else
306379    if (cpustate->irq_req & Z8000_SEGTRAP)
307380    {
308381        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
309        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
382        PUSH_PC();
310383        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
311384        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
312385        cpustate->irq_srv = cpustate->irq_req;
313386        cpustate->irq_req &= ~Z8000_SEGTRAP;
314        cpustate->pc = SEGTRAP;
387        cpustate->pc = SET_PC(SEGTRAP);
315388        LOG(("Z8K '%s' segtrap $%04x\n", cpustate->device->tag(), cpustate->pc));
316389    }
317390    else
318391    if (cpustate->irq_req & Z8000_NMI)
319392    {
320393        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
321        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
394        PUSH_PC();
322395        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
323396        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
324397        cpustate->irq_srv = cpustate->irq_req;
325398        fcw = RDMEM_W(cpustate,  NMI);
326        cpustate->pc = RDMEM_W(cpustate,  NMI + 2);
399       cpustate->pc = RDMEM_W(cpustate,  NMI + 2);
327400        cpustate->irq_req &= ~Z8000_NMI;
328        CHANGE_FCW(cpustate, fcw);
329        cpustate->pc = NMI;
401       CHANGE_FCW(cpustate, fcw);
402        cpustate->pc = SET_PC(NMI);
330403        LOG(("Z8K '%s' NMI $%04x\n", cpustate->device->tag(), cpustate->pc));
331404    }
332405    else
333406    if ((cpustate->irq_req & Z8000_NVI) && (cpustate->fcw & F_NVIE))
334407    {
335408        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
336        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
409        PUSH_PC();
337410        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
338411        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
339412        cpustate->irq_srv = cpustate->irq_req;
340413        fcw = RDMEM_W(cpustate,  NVI);
341        cpustate->pc = RDMEM_W(cpustate,  NVI + 2);
414        cpustate->pc = SET_PC(NVI + 2); //RDMEM_W(cpustate,  NVI + 2);
342415        cpustate->irq_req &= ~Z8000_NVI;
343        CHANGE_FCW(cpustate, fcw);
416       CHANGE_FCW(cpustate, fcw);
344417        LOG(("Z8K '%s' NVI $%04x\n", cpustate->device->tag(), cpustate->pc));
345418    }
346419    else
347420    if ((cpustate->irq_req & Z8000_VI) && (cpustate->fcw & F_VIE))
348421    {
349422        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
350        PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */
423        PUSH_PC();
351424        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
352425        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
353426        cpustate->irq_srv = cpustate->irq_req;
354427        fcw = RDMEM_W(cpustate,  cpustate->irq_vec);
355        cpustate->pc = RDMEM_W(cpustate,  VEC00 + 2 * (cpustate->irq_req & 0xff));
428        cpustate->pc = SET_PC(VEC00 + (cpustate->device->type() == Z8001 ? 4 : 2) * (cpustate->irq_req & 0xff)); //RDMEM_W(cpustate,  VEC00 + 2 * (cpustate->irq_req & 0xff));
356429        cpustate->irq_req &= ~Z8000_VI;
357        CHANGE_FCW(cpustate, fcw);
358        LOG(("Z8K '%s' VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", cpustate->device->tag(), cpustate->irq_vec, VEC00 + VEC00 + 2 * (cpustate->irq_req & 0xff), cpustate->fcw, cpustate->pc));
430       CHANGE_FCW(cpustate, fcw);
431        LOG(("Z8K '%s' VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", cpustate->device->tag(), cpustate->irq_vec, VEC00 + 2 * (cpustate->irq_req & 0xff), cpustate->fcw, cpustate->pc));
359432    }
360433}
361434
r15120r15121
371444
372445   /* already initialized? */
373446   if(z8000_exec == NULL)
374      z8001_init_tables();
447      z8000_init_tables();
375448}
376449
377450static CPU_INIT( z8002 )
r15120r15121
386459
387460   /* already initialized? */
388461   if(z8000_exec == NULL)
389      z8002_init_tables();
462      z8000_init_tables();
390463}
391464
392465static CPU_RESET( z8001 )
r15120r15121
451524        {
452525            Z8000_exec *exec;
453526            cpustate->op[0] = RDOP(cpustate);
527            cpustate->op_valid = 1;
454528            exec = &z8000_exec[cpustate->op[0]];
455529
456            if (exec->size > 1)
457                cpustate->op[1] = RDOP(cpustate);
458            if (exec->size > 2)
459                cpustate->op[2] = RDOP(cpustate);
460
461530            cpustate->icount -= exec->cycles;
462531            (*exec->opcode)(cpustate);
532            cpustate->op_valid = 0;
463533        }
464534    } while (cpustate->icount > 0);
465535
r15120r15121
534604      case CPUINFO_INT_PC:                     cpustate->pc = info->i;                      break;
535605      case CPUINFO_INT_REGISTER + Z8000_PC:         cpustate->pc = info->i;                     break;
536606      case CPUINFO_INT_SP:
537      case CPUINFO_INT_REGISTER + Z8000_NSP:         cpustate->nsp = info->i;                     break;
607      case CPUINFO_INT_REGISTER + Z8000_NSP:         cpustate->nspoff = info->i;                     break;
538608      case CPUINFO_INT_REGISTER + Z8000_FCW:         cpustate->fcw = info->i;                     break;
539      case CPUINFO_INT_REGISTER + Z8000_PSAP:         cpustate->psap = info->i;                     break;
609      case CPUINFO_INT_REGISTER + Z8000_PSAP:         cpustate->psapoff = info->i;                     break;
540610      case CPUINFO_INT_REGISTER + Z8000_REFRESH:      cpustate->refresh = info->i;                  break;
541611      case CPUINFO_INT_REGISTER + Z8000_IRQ_REQ:      cpustate->irq_req = info->i;                  break;
542612      case CPUINFO_INT_REGISTER + Z8000_IRQ_SRV:      cpustate->irq_srv = info->i;                  break;
r15120r15121
603673      case CPUINFO_INT_PC:
604674      case CPUINFO_INT_REGISTER + Z8000_PC:         info->i = cpustate->pc;                     break;
605675      case CPUINFO_INT_SP:
606        case CPUINFO_INT_REGISTER + Z8000_NSP:         info->i = cpustate->nsp;                     break;
676        case CPUINFO_INT_REGISTER + Z8000_NSP:         info->i = cpustate->nspoff;                     break;
607677        case CPUINFO_INT_REGISTER + Z8000_FCW:         info->i = cpustate->fcw;                     break;
608      case CPUINFO_INT_REGISTER + Z8000_PSAP:         info->i = cpustate->psap;                     break;
678      case CPUINFO_INT_REGISTER + Z8000_PSAP:         info->i = cpustate->psapoff;                     break;
609679      case CPUINFO_INT_REGISTER + Z8000_REFRESH:      info->i = cpustate->refresh;                  break;
610680      case CPUINFO_INT_REGISTER + Z8000_IRQ_REQ:      info->i = cpustate->irq_req;                  break;
611681      case CPUINFO_INT_REGISTER + Z8000_IRQ_SRV:      info->i = cpustate->irq_srv;                  break;
r15120r15121
665735            break;
666736
667737      case CPUINFO_STR_REGISTER + Z8000_PC:         sprintf(info->s, "pc :%08X", cpustate->pc);      break;
668      case CPUINFO_STR_REGISTER + Z8000_NSP:         sprintf(info->s, "SP :%04X", cpustate->nsp);   break;
738      case CPUINFO_STR_REGISTER + Z8000_NSP:         sprintf(info->s, "SP :%04X", cpustate->nspoff);   break;
669739      case CPUINFO_STR_REGISTER + Z8000_FCW:         sprintf(info->s, "fcw:%04X", cpustate->fcw);   break;
670      case CPUINFO_STR_REGISTER + Z8000_PSAP:         sprintf(info->s, "nsp:%04X", cpustate->psap);   break;
740      case CPUINFO_STR_REGISTER + Z8000_PSAP:         sprintf(info->s, "psapoff:%04X", cpustate->psapoff);   break;
671741      case CPUINFO_STR_REGISTER + Z8000_REFRESH:      sprintf(info->s, "REFR:%04X", cpustate->refresh); break;
672742      case CPUINFO_STR_REGISTER + Z8000_IRQ_REQ:      sprintf(info->s, "IRQR:%04X", cpustate->irq_req); break;
673743      case CPUINFO_STR_REGISTER + Z8000_IRQ_SRV:      sprintf(info->s, "IRQS:%04X", cpustate->irq_srv); break;
src/emu/cpu/z8000/z8000ops.c
r15120r15121
3333{
3434   if (fcw & F_S_N) {         /* system mode now? */
3535      if (!(cpustate->fcw & F_S_N)) {   /* and not before? */
36         UINT16 tmp = cpustate->RW(SP);
37         cpustate->RW(SP) = cpustate->nsp;
38         cpustate->nsp = tmp;
36            if (cpustate->device->type() == Z8001) {
37                UINT16 tmp = cpustate->RW(15);
38                cpustate->RW(15) = cpustate->nspoff;
39                cpustate->nspoff = tmp;
40                tmp = cpustate->RW(14);
41                cpustate->RW(14) = cpustate->nspseg;
42                cpustate->nspseg = tmp;
43            }
44            else {
45                UINT16 tmp = cpustate->RW(SP);
46                cpustate->RW(SP) = cpustate->nspoff;
47                cpustate->nspoff = tmp;
48            }
3949      }
4050   } else {               /* user mode now */
4151      if (cpustate->fcw & F_S_N) {      /* and not before? */
42         UINT16 tmp = cpustate->RW(SP);
43         cpustate->RW(SP) = cpustate->nsp;
44         cpustate->nsp = tmp;
52            if (cpustate->device->type() == Z8001) {
53                UINT16 tmp = cpustate->RW(15);
54                cpustate->RW(15) = cpustate->nspoff;
55                cpustate->nspoff = tmp;
56                tmp = cpustate->RW(14);
57                cpustate->RW(14) = cpustate->nspseg;
58                cpustate->nspseg = tmp;
59            }
60            else {
61                UINT16 tmp = cpustate->RW(SP);
62                cpustate->RW(SP) = cpustate->nspoff;
63                cpustate->nspoff = tmp;
64            }
4565        }
4666    }
4767    if (!(cpustate->fcw & F_NVIE) && (fcw & F_NVIE) && (cpustate->irq_state[0] != CLEAR_LINE))
r15120r15121
5171    cpustate->fcw = fcw;  /* set new cpustate->fcw */
5272}
5373
74INLINE UINT32 make_segmented_addr(UINT32 addr)
75{
76    return ((addr & 0xffff0000) << 8) | (addr & 0xffff);
77}
78
79INLINE UINT32 segmented_addr(UINT32 addr)
80{
81    return ((addr & 0x7f000000) >> 8) | (addr & 0xffff);
82}
83
84INLINE UINT32 addr_from_reg(z8000_state *cpustate, int regno)
85{
86    if (segmented_mode(cpustate))
87        return segmented_addr(cpustate->RL(regno));
88    else
89        return cpustate->RW(regno);
90}
91
92INLINE void addr_to_reg(z8000_state *cpustate, int regno, UINT32 addr)
93{
94    if (segmented_mode(cpustate))
95        cpustate->RL(regno) = /*(cpustate->RL(regno) & 0x00ff0000) |*/ make_segmented_addr(addr);
96    else
97        cpustate->RW(regno) = addr;
98}
99
54100INLINE void PUSHW(z8000_state *cpustate, UINT8 dst, UINT16 value)
55101{
56    cpustate->RW(dst) -= 2;
57   WRMEM_W(cpustate,  cpustate->RW(dst), value);
102    if (segmented_mode(cpustate))
103        cpustate->RW(dst | 1) -= 2;
104    else
105        cpustate->RW(dst) -= 2;
106   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), value);
58107}
59108
60109INLINE UINT16 POPW(z8000_state *cpustate, UINT8 src)
61110{
62   UINT16 result = RDMEM_W(cpustate,  cpustate->RW(src));
63    cpustate->RW(src) += 2;
111   UINT16 result = RDMEM_W(cpustate, addr_from_reg(cpustate, src));
112    if (segmented_mode(cpustate))
113        cpustate->RW(src | 1) += 2;
114    else
115        cpustate->RW(src) += 2;
64116   return result;
65117}
66118
67119INLINE void PUSHL(z8000_state *cpustate, UINT8 dst, UINT32 value)
68120{
69   cpustate->RW(dst) -= 4;
70   WRMEM_L(cpustate,  cpustate->RW(dst), value);
121    if (segmented_mode(cpustate))
122        cpustate->RW(dst | 1) -= 4;
123    else
124        cpustate->RW(dst) -= 4;
125   WRMEM_L(cpustate,  addr_from_reg(cpustate, dst), value);
71126}
72127
73128INLINE UINT32 POPL(z8000_state *cpustate, UINT8 src)
74129{
75   UINT32 result = RDMEM_L(cpustate,  cpustate->RW(src));
76    cpustate->RW(src) += 4;
130   UINT32 result = RDMEM_L(cpustate, addr_from_reg(cpustate, src));
131    if (segmented_mode(cpustate))
132        cpustate->RW(src | 1) += 4;
133    else
134        cpustate->RW(src) += 4;
77135   return result;
78136}
79137
r15120r15121
11211179{
11221180   GET_DST(OP0,NIB3);
11231181   GET_SRC(OP0,NIB2);
1124   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
1182   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
11251183}
11261184
11271185/******************************************
r15120r15121
11431201{
11441202   GET_DST(OP0,NIB3);
11451203   GET_SRC(OP0,NIB2);
1146   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1204   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
11471205}
11481206
11491207/******************************************
r15120r15121
11651223{
11661224   GET_DST(OP0,NIB3);
11671225   GET_SRC(OP0,NIB2);
1168   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src))); /* EHC */
1226   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src))); /* EHC */
11691227}
11701228
11711229/******************************************
r15120r15121
11871245{
11881246   GET_DST(OP0,NIB3);
11891247   GET_SRC(OP0,NIB2);
1190   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1248   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
11911249}
11921250
11931251/******************************************
r15120r15121
12091267{
12101268   GET_DST(OP0,NIB3);
12111269   GET_SRC(OP0,NIB2);
1212   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
1270   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
12131271}
12141272
12151273/******************************************
r15120r15121
12311289{
12321290   GET_DST(OP0,NIB3);
12331291   GET_SRC(OP0,NIB2);
1234   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1292   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
12351293}
12361294
12371295/******************************************
r15120r15121
12531311{
12541312   GET_DST(OP0,NIB3);
12551313   GET_SRC(OP0,NIB2);
1256   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
1314   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
12571315}
12581316
12591317/******************************************
r15120r15121
12751333{
12761334   GET_DST(OP0,NIB3);
12771335   GET_SRC(OP0,NIB2);
1278   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1336   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
12791337}
12801338
12811339/******************************************
r15120r15121
12971355{
12981356   GET_DST(OP0,NIB3);
12991357   GET_SRC(OP0,NIB2);
1300   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
1358   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
13011359}
13021360
13031361/******************************************
r15120r15121
13191377{
13201378   GET_DST(OP0,NIB3);
13211379   GET_SRC(OP0,NIB2);
1322   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1380   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
13231381}
13241382
13251383/******************************************
r15120r15121
13411399{
13421400   GET_DST(OP0,NIB3);
13431401   GET_SRC(OP0,NIB2);
1344   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
1402   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
13451403}
13461404
13471405/******************************************
r15120r15121
13631421{
13641422   GET_DST(OP0,NIB3);
13651423   GET_SRC(OP0,NIB2);
1366   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1424   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate,src)));
13671425}
13681426
13691427/******************************************
r15120r15121
13731431static void Z0C_ddN0_0000(z8000_state *cpustate)
13741432{
13751433   GET_DST(OP0,NIB3);
1376   WRMEM_B(cpustate,  cpustate->RW(dst), COMB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst))));
1434   WRMEM_B(cpustate,  cpustate->RW(dst), COMB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst))));
13771435}
13781436
13791437/******************************************
r15120r15121
13841442{
13851443   GET_DST(OP0,NIB2);
13861444   GET_IMM8(OP1);
1387   CPB(cpustate, cpustate->RB(dst), imm8);
1445   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), imm8); // @@@done
13881446}
13891447
13901448/******************************************
r15120r15121
13941452static void Z0C_ddN0_0010(z8000_state *cpustate)
13951453{
13961454   GET_DST(OP0,NIB2);
1397   WRMEM_B(cpustate,  cpustate->RW(dst), NEGB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst))));
1455    UINT32 addr = addr_from_reg(cpustate, dst);
1456   WRMEM_B(cpustate,  addr, NEGB(cpustate, RDMEM_B(cpustate, addr)));
13981457}
13991458
14001459/******************************************
r15120r15121
14041463static void Z0C_ddN0_0100(z8000_state *cpustate)
14051464{
14061465   GET_DST(OP0,NIB2);
1407   TESTB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)));
1466   TESTB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
14081467}
14091468
14101469/******************************************
r15120r15121
14151474{
14161475   GET_DST(OP0,NIB2);
14171476   GET_IMM8(OP1);
1418   WRMEM_B(cpustate,  cpustate->RW(dst), imm8);
1477   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), imm8);
14191478}
14201479
14211480/******************************************
r15120r15121
14251484static void Z0C_ddN0_0110(z8000_state *cpustate)
14261485{
14271486   GET_DST(OP0,NIB2);
1428    if (RDMEM_B(cpustate, cpustate->RW(dst)) & S08) SET_S; else CLR_S;
1429    WRMEM_B(cpustate, cpustate->RW(dst), 0xff);
1487    UINT32 addr = addr_from_reg(cpustate, dst);
1488    if (RDMEM_B(cpustate, addr) & S08) SET_S; else CLR_S;
1489    WRMEM_B(cpustate, addr, 0xff);
14301490}
14311491
14321492/******************************************
r15120r15121
14361496static void Z0C_ddN0_1000(z8000_state *cpustate)
14371497{
14381498   GET_DST(OP0,NIB2);
1439   WRMEM_B(cpustate,  cpustate->RW(dst), 0);
1499   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), 0);
14401500}
14411501
14421502/******************************************
r15120r15121
14461506static void Z0D_ddN0_0000(z8000_state *cpustate)
14471507{
14481508   GET_DST(OP0,NIB2);
1449   WRMEM_W(cpustate,  cpustate->RW(dst), COMW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst))));
1509    UINT32 addr = addr_from_reg(cpustate, dst);
1510   WRMEM_W(cpustate, addr, COMW(cpustate, RDMEM_W(cpustate, addr)));
14501511}
14511512
14521513/******************************************
r15120r15121
14571518{
14581519   GET_DST(OP0,NIB2);
14591520   GET_IMM16(OP1);
1460   CPW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), imm16);
1521   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), imm16);
14611522}
14621523
14631524/******************************************
r15120r15121
14671528static void Z0D_ddN0_0010(z8000_state *cpustate)
14681529{
14691530   GET_DST(OP0,NIB2);
1470   WRMEM_W(cpustate,  cpustate->RW(dst), NEGW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst))));
1531    UINT32 addr = addr_from_reg(cpustate, dst);
1532   WRMEM_W(cpustate,  addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
14711533}
14721534
14731535/******************************************
r15120r15121
14771539static void Z0D_ddN0_0100(z8000_state *cpustate)
14781540{
14791541   GET_DST(OP0,NIB2);
1480   TESTW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)));
1542   TESTW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)));
14811543}
14821544
14831545/******************************************
r15120r15121
14881550{
14891551   GET_DST(OP0,NIB2);
14901552   GET_IMM16(OP1);
1491   WRMEM_W(cpustate, cpustate->RW(dst), imm16);
1553   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), imm16);
14921554}
14931555
14941556/******************************************
r15120r15121
14981560static void Z0D_ddN0_0110(z8000_state *cpustate)
14991561{
15001562   GET_DST(OP0,NIB2);
1501    if (RDMEM_W(cpustate, cpustate->RW(dst)) & S16) SET_S; else CLR_S;
1502    WRMEM_W(cpustate, cpustate->RW(dst), 0xffff);
1563    UINT32 addr = addr_from_reg(cpustate, dst);
1564    if (RDMEM_W(cpustate, addr) & S16) SET_S; else CLR_S;
1565    WRMEM_W(cpustate, addr, 0xffff);
15031566}
15041567
15051568/******************************************
r15120r15121
15091572static void Z0D_ddN0_1000(z8000_state *cpustate)
15101573{
15111574   GET_DST(OP0,NIB2);
1512   WRMEM_W(cpustate,  RDMEM_W(cpustate, cpustate->RW(dst)), 0);
1575   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), 0);
15131576}
15141577
15151578/******************************************
r15120r15121
15701633{
15711634   GET_DST(OP0,NIB3);
15721635   GET_SRC(OP0,NIB2);
1573   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, cpustate->RW(src)));
1636   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
15741637}
15751638
15761639/******************************************
r15120r15121
15811644{
15821645   GET_SRC(OP0,NIB3);
15831646   GET_DST(OP0,NIB2);
1584   PUSHL(cpustate, dst, RDMEM_L(cpustate, cpustate->RW(src)));
1647   PUSHL(cpustate, dst, RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
15851648}
15861649
15871650/******************************************
r15120r15121
16031666{
16041667   GET_DST(OP0,NIB3);
16051668   GET_SRC(OP0,NIB2);
1606   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, cpustate->RW(src)));
1669   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
16071670}
16081671
16091672/******************************************
r15120r15121
16141677{
16151678   GET_SRC(OP0,NIB3);
16161679   GET_DST(OP0,NIB2);
1617   PUSHW(cpustate, dst, RDMEM_W(cpustate, cpustate->RW(src)));
1680   PUSHW(cpustate, dst, RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
16181681}
16191682
16201683/******************************************
r15120r15121
16361699{
16371700   GET_DST(OP0,NIB3);
16381701   GET_SRC(OP0,NIB2);
1639   cpustate->RL(dst) = RDMEM_L(cpustate,  cpustate->RW(src));
1702   cpustate->RL(dst) = RDMEM_L(cpustate,  addr_from_reg(cpustate, src));
16401703}
16411704
16421705/******************************************
r15120r15121
16691732{
16701733   GET_DST(OP0,NIB3);
16711734   GET_SRC(OP0,NIB2);
1672   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, cpustate->RW(src)));
1735   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
16731736}
16741737
16751738/******************************************
r15120r15121
16841747}
16851748
16861749/******************************************
1750 multl   rqd,imm32
1751 flags:  CZSV--
1752 ******************************************/
1753static void Z18_00N0_dddd_imm32(z8000_state *cpustate)
1754{
1755   GET_DST(OP0,NIB3);
1756   GET_IMM32;
1757   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), imm32);
1758}
1759
1760/******************************************
16871761 multl   rqd,@rs
16881762 flags:  CZSV--
16891763 ******************************************/
r15120r15121
16911765{
16921766   GET_DST(OP0,NIB3);
16931767   GET_SRC(OP0,NIB2);
1694   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), cpustate->RL(src));
1768   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), cpustate->RL(src)); //@@@
16951769}
16961770
16971771/******************************************
r15120r15121
17131787{
17141788   GET_DST(OP0,NIB3);
17151789   GET_SRC(OP0,NIB2);
1716   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1790   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
17171791}
17181792
17191793/******************************************
r15120r15121
17351809{
17361810   GET_DST(OP0,NIB3);
17371811   GET_SRC(OP0,NIB2);
1738   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, cpustate->RW(src)));
1812   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
17391813}
17401814
17411815/******************************************
r15120r15121
17571831{
17581832   GET_DST(OP0,NIB3);
17591833   GET_SRC(OP0,NIB2);
1760   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, cpustate->RW(src)));
1834   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
17611835}
17621836
17631837/******************************************
r15120r15121
17671841static void Z1C_ddN0_1000(z8000_state *cpustate)
17681842{
17691843   GET_DST(OP0,NIB2);
1770   TESTL(cpustate, RDMEM_L(cpustate, cpustate->RW(dst)));
1844   TESTL(cpustate, RDMEM_L(cpustate, addr_from_reg(cpustate, dst)));
17711845}
17721846
17731847/******************************************
r15120r15121
18121886{
18131887   GET_SRC(OP0,NIB3);
18141888   GET_DST(OP0,NIB2);
1815   WRMEM_L(cpustate,  cpustate->RW(dst), cpustate->RL(src));
1889   WRMEM_L(cpustate,  addr_from_reg(cpustate, dst), cpustate->RL(src));
18161890}
18171891
18181892/******************************************
r15120r15121
18241898   GET_CCC(OP0,NIB3);
18251899   GET_DST(OP0,NIB2);
18261900   switch (cc) {
1827      case  0: if (CC0) cpustate->pc = cpustate->RW(dst); break;
1828      case  1: if (CC1) cpustate->pc = cpustate->RW(dst); break;
1829      case  2: if (CC2) cpustate->pc = cpustate->RW(dst); break;
1830      case  3: if (CC3) cpustate->pc = cpustate->RW(dst); break;
1831      case  4: if (CC4) cpustate->pc = cpustate->RW(dst); break;
1832      case  5: if (CC5) cpustate->pc = cpustate->RW(dst); break;
1833      case  6: if (CC6) cpustate->pc = cpustate->RW(dst); break;
1834      case  7: if (CC7) cpustate->pc = cpustate->RW(dst); break;
1835      case  8: if (CC8) cpustate->pc = cpustate->RW(dst); break;
1836      case  9: if (CC9) cpustate->pc = cpustate->RW(dst); break;
1837      case 10: if (CCA) cpustate->pc = cpustate->RW(dst); break;
1838      case 11: if (CCB) cpustate->pc = cpustate->RW(dst); break;
1839      case 12: if (CCC) cpustate->pc = cpustate->RW(dst); break;
1840      case 13: if (CCD) cpustate->pc = cpustate->RW(dst); break;
1841      case 14: if (CCE) cpustate->pc = cpustate->RW(dst); break;
1842      case 15: if (CCF) cpustate->pc = cpustate->RW(dst); break;
1901      case  0: if (CC0) cpustate->pc = addr_from_reg(cpustate, dst); break;
1902      case  1: if (CC1) cpustate->pc = addr_from_reg(cpustate, dst); break;
1903      case  2: if (CC2) cpustate->pc = addr_from_reg(cpustate, dst); break;
1904      case  3: if (CC3) cpustate->pc = addr_from_reg(cpustate, dst); break;
1905      case  4: if (CC4) cpustate->pc = addr_from_reg(cpustate, dst); break;
1906      case  5: if (CC5) cpustate->pc = addr_from_reg(cpustate, dst); break;
1907      case  6: if (CC6) cpustate->pc = addr_from_reg(cpustate, dst); break;
1908      case  7: if (CC7) cpustate->pc = addr_from_reg(cpustate, dst); break;
1909      case  8: if (CC8) cpustate->pc = addr_from_reg(cpustate, dst); break;
1910      case  9: if (CC9) cpustate->pc = addr_from_reg(cpustate, dst); break;
1911      case 10: if (CCA) cpustate->pc = addr_from_reg(cpustate, dst); break;
1912      case 11: if (CCB) cpustate->pc = addr_from_reg(cpustate, dst); break;
1913      case 12: if (CCC) cpustate->pc = addr_from_reg(cpustate, dst); break;
1914      case 13: if (CCD) cpustate->pc = addr_from_reg(cpustate, dst); break;
1915      case 14: if (CCE) cpustate->pc = addr_from_reg(cpustate, dst); break;
1916      case 15: if (CCF) cpustate->pc = addr_from_reg(cpustate, dst); break;
18431917   }
18441918}
18451919
r15120r15121
18501924static void Z1F_ddN0_0000(z8000_state *cpustate)
18511925{
18521926   GET_DST(OP0,NIB2);
1853   PUSHW(cpustate, SP, cpustate->pc);
1854    cpustate->pc = cpustate->RW(dst);
1927    if (segmented_mode(cpustate))
1928        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
1929    else
1930        PUSHW(cpustate, SP, cpustate->pc);
1931    cpustate->pc = addr_from_reg(cpustate, dst);
18551932}
18561933
18571934/******************************************
r15120r15121
18621939{
18631940   GET_DST(OP0,NIB3);
18641941   GET_SRC(OP0,NIB2);
1865   cpustate->RB(dst) = RDMEM_B(cpustate,  cpustate->RW(src));
1942    cpustate->RB(dst) = RDMEM_B(cpustate,  addr_from_reg(cpustate, src));
18661943}
18671944
1868static void Z20_ssN0_dddd_seg(z8000_state *cpustate)
1869{
1870   UINT32 addr;
1871   GET_DST(OP0,NIB3);
1872   GET_SRC(OP0,NIB2);
1873   addr = (cpustate->RW(src) & 0x0007) << 16;
1874   addr|= cpustate->RW(src+1) & 0xffff;
1875   cpustate->RB(dst) = RDMEM_B(cpustate,  addr);
1876   //cycles?
1877}
1878
18791945/******************************************
18801946 ld      rd,imm16
18811947 flags:  ------
r15120r15121
18951961{
18961962   GET_DST(OP0,NIB3);
18971963   GET_SRC(OP0,NIB2);
1898   cpustate->RW(dst) = RDMEM_W(cpustate,  cpustate->RW(src));
1964   cpustate->RW(dst) = RDMEM_W(cpustate,  addr_from_reg(cpustate, src));
18991965}
19001966
19011967/******************************************
r15120r15121
19171983{
19181984   GET_BIT(OP0);
19191985   GET_DST(OP0,NIB2);
1920   WRMEM_B(cpustate, cpustate->RW(dst), RDMEM_B(cpustate, cpustate->RW(dst)) & ~bit);
1986    UINT32 addr = addr_from_reg(cpustate, dst);
1987   WRMEM_B(cpustate, addr, RDMEM_B(cpustate, addr) & ~bit);
19211988}
19221989
19231990/******************************************
1924 result     rd,rs
1991 res     rd,rs
19251992 flags:  ------
19261993 ******************************************/
19271994static void Z23_0000_ssss_0000_dddd_0000_0000(z8000_state *cpustate)
r15120r15121
19392006{
19402007   GET_BIT(OP0);
19412008   GET_DST(OP0,NIB2);
1942   WRMEM_W(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(dst)) & ~bit);
2009    UINT32 addr = addr_from_reg(cpustate, dst);
2010   WRMEM_W(cpustate, addr, RDMEM_W(cpustate, addr) & ~bit);
19432011}
19442012
19452013/******************************************
r15120r15121
19612029{
19622030   GET_BIT(OP0);
19632031   GET_DST(OP0,NIB2);
1964   WRMEM_B(cpustate, cpustate->RW(dst), RDMEM_B(cpustate, cpustate->RW(dst)) | bit);
2032    UINT32 addr = addr_from_reg(cpustate, dst);
2033   WRMEM_B(cpustate, addr, RDMEM_B(cpustate, addr) | bit);
19652034}
19662035
19672036/******************************************
r15120r15121
19832052{
19842053   GET_BIT(OP0);
19852054   GET_DST(OP0,NIB2);
1986   WRMEM_W(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(dst)) | bit);
2055    UINT32 addr = addr_from_reg(cpustate, dst);
2056   WRMEM_W(cpustate, addr, RDMEM_W(cpustate, addr) | bit);
19872057}
19882058
19892059/******************************************
r15120r15121
20052075{
20062076   GET_BIT(OP0);
20072077   GET_DST(OP0,NIB2);
2008   if (RDMEM_B(cpustate, cpustate->RW(dst)) & bit) CLR_Z; else SET_Z;
2078   if (RDMEM_B(cpustate, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
20092079}
20102080
20112081/******************************************
r15120r15121
20272097{
20282098   GET_BIT(OP0);
20292099   GET_DST(OP0,NIB2);
2030   if (RDMEM_W(cpustate, cpustate->RW(dst)) & bit) CLR_Z; else SET_Z;
2100   if (RDMEM_W(cpustate, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
20312101}
20322102
20332103/******************************************
r15120r15121
20382108{
20392109   GET_I4M1(OP0,NIB3);
20402110   GET_DST(OP0,NIB2);
2041   WRMEM_B(cpustate,  cpustate->RW(dst), INCB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), i4p1));
2111    UINT32 addr = addr_from_reg(cpustate, dst);
2112   WRMEM_B(cpustate,  addr, INCB(cpustate, RDMEM_B(cpustate, addr), i4p1));
20422113}
20432114
20442115/******************************************
r15120r15121
20492120{
20502121   GET_I4M1(OP0,NIB3);
20512122   GET_DST(OP0,NIB2);
2052   WRMEM_W(cpustate,  cpustate->RW(dst), INCW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), i4p1));
2123    UINT32 addr = addr_from_reg(cpustate, dst);
2124   WRMEM_W(cpustate, addr, INCW(cpustate, RDMEM_W(cpustate, addr), i4p1));
20532125}
20542126
20552127/******************************************
r15120r15121
20602132{
20612133   GET_I4M1(OP0,NIB3);
20622134   GET_DST(OP0,NIB2);
2063   WRMEM_B(cpustate,  cpustate->RW(dst), DECB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), i4p1));
2135    UINT32 addr = addr_from_reg(cpustate, dst);
2136   WRMEM_B(cpustate, addr, DECB(cpustate, RDMEM_B(cpustate, addr), i4p1));
20642137}
20652138
20662139/******************************************
r15120r15121
20712144{
20722145   GET_I4M1(OP0,NIB3);
20732146   GET_DST(OP0,NIB2);
2074   WRMEM_W(cpustate,  cpustate->RW(dst), DECW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), i4p1));
2147    UINT32 addr = addr_from_reg(cpustate, dst);
2148   WRMEM_W(cpustate, addr, DECW(cpustate, RDMEM_W(cpustate, addr), i4p1));
20752149}
20762150
20772151/******************************************
r15120r15121
20822156{
20832157   GET_DST(OP0,NIB3);
20842158   GET_SRC(OP0,NIB2);
2085   UINT8 tmp = RDMEM_B(cpustate,  cpustate->RW(src));
2086   WRMEM_B(cpustate,  cpustate->RW(src), cpustate->RB(dst));
2159    UINT32 addr = addr_from_reg(cpustate, src);
2160   UINT8 tmp = RDMEM_B(cpustate,  addr);
2161   WRMEM_B(cpustate, addr, cpustate->RB(dst));
20872162   cpustate->RB(dst) = tmp;
20882163}
20892164
r15120r15121
20952170{
20962171   GET_DST(OP0,NIB3);
20972172   GET_SRC(OP0,NIB2);
2098   UINT16 tmp = RDMEM_W(cpustate,  cpustate->RW(src));
2099   WRMEM_W(cpustate,  cpustate->RW(src), cpustate->RW(dst));
2173    UINT32 addr = addr_from_reg(cpustate, src);
2174   UINT16 tmp = RDMEM_W(cpustate, addr);
2175   WRMEM_W(cpustate, addr, cpustate->RW(dst));
21002176   cpustate->RW(dst) = tmp;
21012177}
21022178
r15120r15121
21082184{
21092185   GET_SRC(OP0,NIB3);
21102186   GET_DST(OP0,NIB2);
2111   WRMEM_B(cpustate,  cpustate->RW(dst), cpustate->RB(src));
2187   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), cpustate->RB(src));
21122188}
21132189
21142190/******************************************
r15120r15121
21192195{
21202196   GET_SRC(OP0,NIB3);
21212197   GET_DST(OP0,NIB2);
2122   WRMEM_W(cpustate,  cpustate->RW(dst), cpustate->RW(src));
2198   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), cpustate->RW(src));
21232199}
21242200
21252201/******************************************
r15120r15121
21422218   GET_DST(OP0,NIB3);
21432219   GET_SRC(OP0,NIB2);
21442220   GET_IMM16(OP1);
2145   imm16 += cpustate->RW(src);
2221   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
21462222   cpustate->RB(dst) = RDMEM_B(cpustate,  imm16);
21472223}
21482224
r15120r15121
21662242   GET_DST(OP0,NIB3);
21672243   GET_SRC(OP0,NIB2);
21682244   GET_IMM16(OP1);
2169   imm16 += cpustate->RW(src);
2245   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
21702246   cpustate->RW(dst) = RDMEM_W(cpustate,  imm16);
21712247}
21722248
r15120r15121
21902266   GET_SRC(OP0,NIB3);
21912267   GET_DST(OP0,NIB2);
21922268   GET_IMM16(OP1);
2193   imm16 += cpustate->RW(dst);
2269   imm16 = addr_add(cpustate, addr_from_reg(cpustate, dst), imm16);
21942270   WRMEM_B(cpustate,  imm16, cpustate->RB(src));
21952271}
21962272
r15120r15121
22142290   GET_SRC(OP0,NIB3);
22152291   GET_DST(OP0,NIB2);
22162292   GET_IMM16(OP1);
2217   imm16 += cpustate->RW(dst);
2293   imm16 = addr_add(cpustate, addr_from_reg(cpustate,dst), imm16);
22182294   WRMEM_W(cpustate,  imm16, cpustate->RW(src));
22192295}
22202296
r15120r15121
22262302{
22272303   GET_DST(OP0,NIB3);
22282304   GET_DSP16;
2229   cpustate->RW(dst) = dsp16;
2305   addr_to_reg(cpustate, dst, dsp16);
22302306}
22312307
22322308/******************************************
r15120r15121
22382314   GET_DST(OP0,NIB3);
22392315   GET_SRC(OP0,NIB2);
22402316   GET_IMM16(OP1);
2241   imm16 += cpustate->RW(src);
2242   cpustate->RW(dst) = imm16;
2317   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
2318   addr_to_reg(cpustate, dst, imm16);
22432319}
22442320
22452321/******************************************
r15120r15121
22622338   GET_DST(OP0,NIB3);
22632339   GET_SRC(OP0,NIB2);
22642340   GET_IMM16(OP1);
2265   imm16 += cpustate->RW(src);
2341   imm16 = addr_add(cpustate, addr_from_reg(cpustate, src), imm16);
22662342   cpustate->RL(dst) = RDMEM_L(cpustate,  imm16);
22672343}
22682344
r15120r15121
23102386   GET_SRC(OP0,NIB3);
23112387   GET_DST(OP0,NIB2);
23122388   GET_IMM16(OP1);
2313   imm16 += cpustate->RW(dst);
2389   imm16 = addr_add(cpustate, addr_from_reg(cpustate, dst), imm16);
23142390   WRMEM_L(cpustate,  imm16, cpustate->RL(src));
23152391}
23162392
r15120r15121
23362412{
23372413   GET_SRC(OP0,NIB2);
23382414   UINT16 fcw;
2339   fcw = RDMEM_W(cpustate,  cpustate->RW(src));
2340   cpustate->pc   = RDMEM_W(cpustate,  (UINT16)(cpustate->RW(src) + 2));
2415    if (segmented_mode(cpustate)) {
2416        UINT32 addr = addr_from_reg(cpustate, src);
2417        fcw = RDMEM_W(cpustate,  addr + 2);
2418        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
2419    }
2420    else {
2421        fcw = RDMEM_W(cpustate,  cpustate->RW(src));
2422        cpustate->pc = RDMEM_W(cpustate,  (UINT16)(cpustate->RW(src) + 2));
2423    }
23412424   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
23422425}
23432426
r15120r15121
23462429 flags:  ---V--
23472430 ******************************************/
23482431static void Z3A_ssss_0000_0000_aaaa_dddd_x000(z8000_state *cpustate)
2349{
2432{//@@@@
23502433    GET_SRC(OP0,NIB2);
23512434    GET_CNT(OP1,NIB1);
23522435    GET_DST(OP1,NIB2);
r15120r15121
23632446 flags:  ------
23642447 ******************************************/
23652448static void Z3A_ssss_0001_0000_aaaa_dddd_x000(z8000_state *cpustate)
2366{
2449{//@@@@
23672450    GET_SRC(OP0,NIB2);
23682451    GET_CNT(OP1,NIB1);
23692452    GET_DST(OP1,NIB2);
r15120r15121
23802463 flags:  ---V--
23812464 ******************************************/
23822465static void Z3A_ssss_0010_0000_aaaa_dddd_x000(z8000_state *cpustate)
2383{
2466{//@@@@
23842467    GET_SRC(OP0,NIB2);
23852468    GET_CNT(OP1,NIB1);
23862469    GET_DST(OP1,NIB2);
r15120r15121
23972480 flags:  ------
23982481 ******************************************/
23992482static void Z3A_ssss_0011_0000_aaaa_dddd_x000(z8000_state *cpustate)
2400{
2483{//@@@@
24012484    GET_SRC(OP0,NIB2);
24022485    GET_CNT(OP1,NIB1);
24032486    GET_DST(OP1,NIB2);
r15120r15121
24582541 flags:  ---V--
24592542 ******************************************/
24602543static void Z3A_ssss_1000_0000_aaaa_dddd_x000(z8000_state *cpustate)
2461{
2544{//@@@
24622545   GET_SRC(OP0,NIB2);
24632546   GET_CNT(OP1,NIB1);
24642547   GET_DST(OP1,NIB2);
r15120r15121
24752558 flags:  ------
24762559 ******************************************/
24772560static void Z3A_ssss_1001_0000_aaaa_dddd_x000(z8000_state *cpustate)
2478{
2561{//@@@
24792562   GET_SRC(OP0,NIB2);
24802563   GET_CNT(OP1,NIB1);
24812564   GET_DST(OP1,NIB2);
r15120r15121
24922575 flags:  ---V--
24932576 ******************************************/
24942577static void Z3A_ssss_1010_0000_aaaa_dddd_x000(z8000_state *cpustate)
2495{
2578{//@@@
24962579   GET_SRC(OP0,NIB2);
24972580   GET_CNT(OP1,NIB1);
24982581   GET_DST(OP1,NIB2);
r15120r15121
25092592 flags:  ------
25102593 ******************************************/
25112594static void Z3A_ssss_1011_0000_aaaa_dddd_x000(z8000_state *cpustate)
2512{
2595{//@@@
25132596   GET_SRC(OP0,NIB2);
25142597   GET_CNT(OP1,NIB1);
25152598   GET_DST(OP1,NIB2);
r15120r15121
25262609 flags:  ---V--
25272610 ******************************************/
25282611static void Z3B_ssss_0000_0000_aaaa_dddd_x000(z8000_state *cpustate)
2529{
2612{//@@@
25302613   GET_SRC(OP0,NIB2);
25312614    GET_CNT(OP1,NIB1);
25322615   GET_DST(OP1,NIB2);
r15120r15121
25432626 flags:  ------
25442627 ******************************************/
25452628static void Z3B_ssss_0001_0000_aaaa_dddd_x000(z8000_state *cpustate)
2546{
2629{//@@@
25472630   GET_SRC(OP0,NIB2);
25482631    GET_CNT(OP1,NIB1);
25492632   GET_DST(OP1,NIB2);
r15120r15121
25602643 flags:  ---V--
25612644 ******************************************/
25622645static void Z3B_ssss_0010_0000_aaaa_dddd_x000(z8000_state *cpustate)
2563{
2646{//@@@
25642647   GET_SRC(OP0,NIB2);
25652648    GET_CNT(OP1,NIB1);
25662649   GET_DST(OP1,NIB2);
r15120r15121
25772660 flags:  ------
25782661 ******************************************/
25792662static void Z3B_ssss_0011_0000_aaaa_dddd_x000(z8000_state *cpustate)
2580{
2663{//@@@
25812664   GET_SRC(OP0,NIB2);
25822665    GET_CNT(OP1,NIB1);
25832666   GET_DST(OP1,NIB2);
r15120r15121
26382721 flags:  ---V--
26392722 ******************************************/
26402723static void Z3B_ssss_1000_0000_aaaa_dddd_x000(z8000_state *cpustate)
2641{
2724{//@@@
26422725   GET_SRC(OP0,NIB2);
26432726    GET_CNT(OP1,NIB1);
26442727   GET_DST(OP1,NIB2);
r15120r15121
26552738 flags:  ------
26562739 ******************************************/
26572740static void Z3B_ssss_1001_0000_aaaa_dddd_x000(z8000_state *cpustate)
2658{
2741{//@@@
26592742   GET_SRC(OP0,NIB2);
26602743    GET_CNT(OP1,NIB1);
26612744   GET_DST(OP1,NIB2);
r15120r15121
26722755 flags:  ---V--
26732756 ******************************************/
26742757static void Z3B_ssss_1010_0000_aaaa_dddd_x000(z8000_state *cpustate)
2675{
2758{//@@@
26762759   GET_SRC(OP0,NIB2);
26772760    GET_CNT(OP1,NIB1);
26782761   GET_DST(OP1,NIB2);
r15120r15121
26892772 flags:  ------
26902773 ******************************************/
26912774static void Z3B_ssss_1011_0000_aaaa_dddd_x000(z8000_state *cpustate)
2692{
2775{//@@@
26932776   GET_SRC(OP0,NIB2);
26942777    GET_CNT(OP1,NIB1);
26952778   GET_DST(OP1,NIB2);
r15120r15121
27052788 flags:  ------
27062789 ******************************************/
27072790static void Z3C_ssss_dddd(z8000_state *cpustate)
2708{
2791{//@@@check
27092792   GET_SRC(OP0,NIB2);
27102793   GET_DST(OP0,NIB3);
27112794   cpustate->RB(dst) = RDPORT_B(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(src)));
r15120r15121
27162799 flags:  ------
27172800 ******************************************/
27182801static void Z3D_ssss_dddd(z8000_state *cpustate)
2719{
2802{//@@@check
27202803   GET_SRC(OP0,NIB2);
27212804   GET_DST(OP0,NIB3);
27222805   cpustate->RW(dst) = RDPORT_W(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(src)));
r15120r15121
27272810 flags:  ---V--
27282811 ******************************************/
27292812static void Z3E_dddd_ssss(z8000_state *cpustate)
2730{
2813{//@@@check
27312814   GET_DST(OP0,NIB2);
27322815   GET_SRC(OP0,NIB3);
27332816   WRPORT_B(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(dst)), cpustate->RB(src));
27342817}
27352818
2736/* FIXME: aforementioned opcode looks bugged. */
2737static void Z3E_dddd_ssss_seg(z8000_state *cpustate)
2738{
2739   GET_DST(OP0,NIB2);
2740   GET_SRC(OP0,NIB3);
2741   WRPORT_B(cpustate,  0, cpustate->RW(dst), cpustate->RB(src));
2742}
2743
27442819/******************************************
27452820 out     @rd,rs
27462821 flags:  ---V--
27472822 ******************************************/
27482823static void Z3F_dddd_ssss(z8000_state *cpustate)
2749{
2824{//check
27502825   GET_DST(OP0,NIB2);
27512826   GET_SRC(OP0,NIB3);
27522827   WRPORT_W(cpustate,  0, RDMEM_W(cpustate,  cpustate->RW(dst)), cpustate->RW(src));
r15120r15121
27722847   GET_DST(OP0,NIB3);
27732848   GET_SRC(OP0,NIB2);
27742849   GET_ADDR(OP1);
2775   addr += cpustate->RW(src);
2850   addr = addr_add(cpustate, addr, cpustate->RW(src));
27762851   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
27772852}
27782853
r15120r15121
27962871   GET_DST(OP0,NIB3);
27972872   GET_SRC(OP0,NIB2);
27982873   GET_ADDR(OP1);
2799   addr += cpustate->RW(src);
2874   addr = addr_add(cpustate, addr, cpustate->RW(src));
28002875   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));   /* ASG */
28012876}
28022877
r15120r15121
28202895   GET_DST(OP0,NIB3);
28212896   GET_SRC(OP0,NIB2);
28222897   GET_ADDR(OP1);
2823   addr += cpustate->RW(src);
2898   addr = addr_add(cpustate, addr, cpustate->RW(src));
28242899   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
28252900}
28262901
r15120r15121
28442919   GET_DST(OP0,NIB3);
28452920   GET_SRC(OP0,NIB2);
28462921   GET_ADDR(OP1);
2847   addr += cpustate->RW(src);
2922   addr = addr_add(cpustate, addr, cpustate->RW(src));
28482923   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
28492924}
28502925
r15120r15121
28682943   GET_DST(OP0,NIB3);
28692944   GET_SRC(OP0,NIB2);
28702945   GET_ADDR(OP1);
2871   addr += cpustate->RW(src);
2946   addr = addr_add(cpustate, addr, cpustate->RW(src));
28722947   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
28732948}
28742949
r15120r15121
28922967   GET_DST(OP0,NIB3);
28932968   GET_SRC(OP0,NIB2);
28942969   GET_ADDR(OP1);
2895   addr += cpustate->RW(src);
2970   addr = addr_add(cpustate, addr, cpustate->RW(src));
28962971   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
28972972}
28982973
r15120r15121
29162991   GET_DST(OP0,NIB3);
29172992   GET_SRC(OP0,NIB2);
29182993   GET_ADDR(OP1);
2919   addr += cpustate->RW(src);
2994   addr = addr_add(cpustate, addr, cpustate->RW(src));
29202995   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
29212996}
29222997
r15120r15121
29403015   GET_DST(OP0,NIB3);
29413016   GET_SRC(OP0,NIB2);
29423017   GET_ADDR(OP1);
2943   addr += cpustate->RW(src);
3018   addr = addr_add(cpustate, addr, cpustate->RW(src));
29443019   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
29453020}
29463021
r15120r15121
29643039   GET_DST(OP0,NIB3);
29653040   GET_SRC(OP0,NIB2);
29663041   GET_ADDR(OP1);
2967   addr += cpustate->RW(src);
3042   addr = addr_add(cpustate, addr, cpustate->RW(src));
29683043   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
29693044}
29703045
r15120r15121
29883063   GET_DST(OP0,NIB3);
29893064   GET_SRC(OP0,NIB2);
29903065   GET_ADDR(OP1);
2991   addr += cpustate->RW(src);
3066   addr = addr_add(cpustate, addr, cpustate->RW(src));
29923067   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
29933068}
29943069
r15120r15121
30123087   GET_DST(OP0,NIB3);
30133088   GET_SRC(OP0,NIB2);
30143089   GET_ADDR(OP1);
3015   addr += cpustate->RW(src);
3090   addr = addr_add(cpustate, addr, cpustate->RW(src));
30163091   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
30173092}
30183093
r15120r15121
30363111   GET_DST(OP0,NIB3);
30373112   GET_SRC(OP0,NIB2);
30383113   GET_ADDR(OP1);
3039   addr += cpustate->RW(src);
3114   addr = addr_add(cpustate, addr, cpustate->RW(src));
30403115   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
30413116}
30423117
r15120r15121
31133188   WRMEM_B(cpustate,  addr, 0);
31143189}
31153190
3116static void Z4C_0000_1000_addr_seg(z8000_state *cpustate)
3117{
3118   static UINT32 offset;
3119   UINT16 operand1 = fetch(cpustate);
3120
3121   if(operand1 & 0x8000)
3122   {
3123      UINT16 operand2 = fetch(cpustate);
3124
3125      offset = (operand1 & 0x0700) << 8;
3126      offset|= (operand2 & 0xffff);
3127      WRMEM_B(cpustate,  offset, 0);
3128      cycles(cpustate, 14);
3129   }
3130   else
3131   {
3132      offset = (operand1 & 0x0700) << 8;
3133      offset|= (operand1 & 0x00ff);
3134      WRMEM_B(cpustate,  offset, 0);
3135      cycles(cpustate, 12);
3136   }
3137}
3138
31393191/******************************************
31403192 comb    addr(rd)
31413193 flags:  -ZSP--
r15120r15121
31443196{
31453197   GET_DST(OP0,NIB2);
31463198   GET_ADDR(OP1);
3147   addr += cpustate->RW(dst);
3199   addr = addr_add(cpustate, addr, cpustate->RW(dst));
31483200   WRMEM_B(cpustate,  addr, COMB(cpustate, RDMEM_B(cpustate, addr)));
31493201}
31503202
r15120r15121
31573209   GET_DST(OP0,NIB2);
31583210   GET_ADDR(OP1);
31593211   GET_IMM8(OP2);
3160   addr += cpustate->RW(dst);
3212   addr = addr_add(cpustate, addr, cpustate->RW(dst));
31613213   CPB(cpustate, RDMEM_B(cpustate, addr), imm8);
31623214}
31633215
r15120r15121
31693221{
31703222   GET_DST(OP0,NIB2);
31713223   GET_ADDR(OP1);
3172   addr += cpustate->RW(dst);
3224   addr = addr_add(cpustate, addr, cpustate->RW(dst));
31733225   WRMEM_B(cpustate,  addr, NEGB(cpustate, RDMEM_B(cpustate, addr)));
31743226}
31753227
r15120r15121
31813233{
31823234   GET_DST(OP0,NIB2);
31833235   GET_ADDR(OP1);
3184   addr += cpustate->RW(dst);
3236   addr = addr_add(cpustate, addr, cpustate->RW(dst));
31853237   TESTB(cpustate, RDMEM_B(cpustate, addr));
31863238}
31873239
r15120r15121
31943246   GET_DST(OP0,NIB2);
31953247   GET_ADDR(OP1);
31963248   GET_IMM8(OP2);
3197   addr += cpustate->RW(dst);
3249   addr = addr_add(cpustate, addr, cpustate->RW(dst));
31983250   WRMEM_B(cpustate,  addr, imm8);
31993251}
32003252
r15120r15121
32063258{
32073259   GET_DST(OP0,NIB2);
32083260   GET_ADDR(OP1);
3209   addr += cpustate->RW(dst);
3261   addr = addr_add(cpustate, addr, cpustate->RW(dst));
32103262    if (RDMEM_B(cpustate, addr) & S08) SET_S; else CLR_S;
32113263    WRMEM_B(cpustate, addr, 0xff);
32123264}
r15120r15121
32193271{
32203272   GET_DST(OP0,NIB2);
32213273   GET_ADDR(OP1);
3222   addr += cpustate->RW(dst);
3274   addr = addr_add(cpustate, addr, cpustate->RW(dst));
32233275   WRMEM_B(cpustate,  addr, 0);
32243276}
32253277
r15120r15121
32753327   WRMEM_W(cpustate,  addr, imm16);
32763328}
32773329
3278static void Z4D_0000_0101_addr_imm16_seg(z8000_state *cpustate)
3279{
3280   static UINT32 offset;
3281   UINT16 operand1 = fetch(cpustate);
3282
3283   if(operand1 & 0x8000)
3284   {
3285      UINT16 operand2 = fetch(cpustate);
3286      UINT16 imm16 = fetch(cpustate);
3287
3288      offset = (operand1 & 0x0700) << 8;
3289      offset|= (operand2 & 0xffff);
3290      WRMEM_W(cpustate,  offset, imm16);
3291      cycles(cpustate, 17);
3292   }
3293   else
3294   {
3295      UINT16 imm16 = fetch(cpustate);
3296
3297      offset = (operand1 & 0x0700) << 8;
3298      offset|= (operand1 & 0x00ff);
3299      WRMEM_W(cpustate,  offset, imm16);
3300      cycles(cpustate, 15);
3301   }
3302}
3303
33043330/******************************************
33053331 tset    addr
33063332 flags:  --S---
r15120r15121
33223348   WRMEM_W(cpustate,  addr, 0);
33233349}
33243350
3325static void Z4D_0000_1000_addr_seg(z8000_state *cpustate)
3326{
3327   static UINT32 offset;
3328   UINT16 operand1 = fetch(cpustate);
3329
3330   if(operand1 & 0x8000)
3331   {
3332      UINT16 operand2 = fetch(cpustate);
3333
3334      offset = (operand1 & 0x0700) << 8;
3335      offset|= (operand2 & 0xffff);
3336      WRMEM_W(cpustate,  offset, 0);
3337      cycles(cpustate, 15);
3338   }
3339   else
3340   {
3341      offset = (operand1 & 0x0700) << 8;
3342      offset|= (operand1 & 0x00ff);
3343      WRMEM_W(cpustate,  offset, 0);
3344      cycles(cpustate, 12);
3345   }
3346}
3347
33483351/******************************************
33493352 com     addr(rd)
33503353 flags:  -ZS---
r15120r15121
33533356{
33543357   GET_DST(OP0,NIB2);
33553358   GET_ADDR(OP1);
3356   addr += cpustate->RW(dst);
3359   addr = addr_add(cpustate, addr, cpustate->RW(dst));
33573360   WRMEM_W(cpustate,  addr, COMW(cpustate, RDMEM_W(cpustate, addr)));
33583361}
33593362
r15120r15121
33663369   GET_DST(OP0,NIB2);
33673370   GET_ADDR(OP1);
33683371   GET_IMM16(OP2);
3369   addr += cpustate->RW(dst);
3372   addr = addr_add(cpustate, addr, cpustate->RW(dst));
33703373   CPW(cpustate, RDMEM_W(cpustate, addr), imm16);
33713374}
33723375
r15120r15121
33783381{
33793382   GET_DST(OP0,NIB2);
33803383   GET_ADDR(OP1);
3381   addr += cpustate->RW(dst);
3384   addr = addr_add(cpustate, addr, cpustate->RW(dst));
33823385   WRMEM_W(cpustate,  addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
33833386}
33843387
r15120r15121
33903393{
33913394   GET_DST(OP0,NIB2);
33923395   GET_ADDR(OP1);
3393   addr += cpustate->RW(dst);
3396   addr = addr_add(cpustate, addr, cpustate->RW(dst));
33943397   TESTW(cpustate, RDMEM_W(cpustate, addr));
33953398}
33963399
r15120r15121
34033406   GET_DST(OP0,NIB2);
34043407   GET_ADDR(OP1);
34053408   GET_IMM16(OP2);
3406   addr += cpustate->RW(dst);
3409   addr = addr_add(cpustate, addr, cpustate->RW(dst));
34073410   WRMEM_W(cpustate,  addr, imm16);
34083411}
34093412
r15120r15121
34153418{
34163419   GET_DST(OP0,NIB2);
34173420   GET_ADDR(OP1);
3418   addr += cpustate->RW(dst);
3421   addr = addr_add(cpustate, addr, cpustate->RW(dst));
34193422    if (RDMEM_W(cpustate, addr) & S16) SET_S; else CLR_S;
34203423    WRMEM_W(cpustate, addr, 0xffff);
34213424}
r15120r15121
34283431{
34293432   GET_DST(OP0,NIB2);
34303433   GET_ADDR(OP1);
3431   addr += cpustate->RW(dst);
3434   addr = addr_add(cpustate, addr, cpustate->RW(dst));
34323435   WRMEM_W(cpustate,  addr, 0);
34333436}
34343437
r15120r15121
34413444   GET_DST(OP0,NIB2);
34423445   GET_SRC(OP0,NIB3);
34433446   GET_ADDR(OP1);
3444   addr += cpustate->RW(dst);
3447   addr = addr_add(cpustate, addr, cpustate->RW(dst));
34453448   WRMEM_B(cpustate,  addr, cpustate->RB(src));
34463449}
34473450
r15120r15121
34653468   GET_DST(OP0,NIB3);
34663469   GET_SRC(OP0,NIB2);
34673470   GET_ADDR(OP1);
3468   addr += cpustate->RW(src);
3471   addr = addr_add(cpustate, addr, cpustate->RW(src));
34693472   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
34703473}
34713474
r15120r15121
34893492   GET_SRC(OP0,NIB3);
34903493   GET_DST(OP0,NIB2);
34913494   GET_ADDR(OP1);
3492   addr += cpustate->RW(src);
3495   addr = addr_add(cpustate, addr, cpustate->RW(src));
34933496   PUSHL(cpustate, dst, RDMEM_L(cpustate, addr));
34943497}
34953498
r15120r15121
35133516   GET_DST(OP0,NIB3);
35143517   GET_SRC(OP0,NIB2);
35153518   GET_ADDR(OP1);
3516   addr += cpustate->RW(src);
3519   addr = addr_add(cpustate, addr, cpustate->RW(src));
35173520   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
35183521}
35193522
r15120r15121
35373540   GET_DST(OP0,NIB2);
35383541   GET_SRC(OP0,NIB3);
35393542   GET_ADDR(OP1);
3540   addr += cpustate->RW(src);
3543   addr = addr_add(cpustate, addr, cpustate->RW(src));
35413544   PUSHW(cpustate, dst, RDMEM_W(cpustate, addr));
35423545}
35433546
r15120r15121
35613564   GET_DST(OP0,NIB3);
35623565   GET_SRC(OP0,NIB2);
35633566   GET_ADDR(OP1);
3564   addr += cpustate->RW(src);
3567   addr = addr_add(cpustate, addr, cpustate->RW(src));
35653568   cpustate->RL(dst) = RDMEM_L(cpustate,  addr);
35663569}
35673570
r15120r15121
35853588   GET_DST(OP0,NIB3);
35863589   GET_SRC(OP0,NIB2);
35873590   GET_ADDR(OP1);
3588   addr += cpustate->RW(dst);
3591   addr = addr_add(cpustate, addr, cpustate->RW(dst));
35893592   WRMEM_L(cpustate,  addr, POPL(cpustate, src));
35903593}
35913594
r15120r15121
36093612   GET_DST(OP0,NIB3);
36103613   GET_SRC(OP0,NIB2);
36113614   GET_ADDR(OP1);
3612   addr += cpustate->RW(src);
3615   addr = addr_add(cpustate, addr, cpustate->RW(src));
36133616   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
36143617}
36153618
r15120r15121
36333636   GET_DST(OP0,NIB3);
36343637   GET_SRC(OP0,NIB2);
36353638   GET_ADDR(OP1);
3636   addr += cpustate->RW(dst);
3639   addr = addr_add(cpustate, addr, cpustate->RW(dst));
36373640   WRMEM_W(cpustate,  addr, POPW(cpustate, src));
36383641}
36393642
r15120r15121
36573660   GET_DST(OP0,NIB3);
36583661   GET_SRC(OP0,NIB2);
36593662   GET_ADDR(OP1);
3660   addr += cpustate->RW(src);
3663   addr = addr_add(cpustate, addr, cpustate->RW(src));
36613664   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
36623665}
36633666
r15120r15121
36813684   GET_DST(OP0,NIB3);
36823685   GET_SRC(OP0,NIB2);
36833686   GET_ADDR(OP1);
3684   addr += cpustate->RW(src);
3687   addr = addr_add(cpustate, addr, cpustate->RW(src));
36853688   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
36863689}
36873690
r15120r15121
37053708   GET_DST(OP0,NIB3);
37063709   GET_SRC(OP0,NIB2);
37073710   GET_ADDR(OP1);
3708   addr += cpustate->RW(src);
3711   addr = addr_add(cpustate, addr, cpustate->RW(src));
37093712   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
37103713}
37113714
r15120r15121
37293732   GET_DST(OP0,NIB3);
37303733   GET_SRC(OP0,NIB2);
37313734   GET_ADDR(OP1);
3732   addr += cpustate->RW(src);
3735   addr = addr_add(cpustate, addr, cpustate->RW(src));
37333736   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
37343737}
37353738
r15120r15121
37453748   while (cnt-- >= 0) {
37463749      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
37473750      dst = (dst+1) & 15;
3748      addr = (addr + 2) & 0xffff;
3751        addr = addr_add (cpustate, addr, 2);
37493752   }
37503753}
37513754
r15120r15121
37713774   while (cnt-- >= 0) {
37723775      WRMEM_W(cpustate,  addr, cpustate->RW(src));
37733776      src = (src+1) & 15;
3774      addr = (addr + 2) & 0xffff;
3777        addr = addr_add (cpustate, addr, 2);
37753778   }
37763779}
37773780
r15120r15121
37833786{
37843787   GET_DST(OP0,NIB2);
37853788   GET_ADDR(OP1);
3786   addr += cpustate->RW(dst);
3789   addr = addr_add(cpustate, addr, cpustate->RW(dst));
37873790   TESTL(cpustate, RDMEM_L(cpustate, addr));
37883791}
37893792
r15120r15121
37973800   GET_SRC(OP1,NIB1);
37983801   GET_CNT(OP1,NIB3);
37993802   GET_ADDR(OP2);
3800   addr += cpustate->RW(dst);
3803   addr = addr_add(cpustate, addr, cpustate->RW(dst));
38013804   while (cnt-- >= 0) {
38023805      WRMEM_W(cpustate,  addr, cpustate->RW(src));
38033806      src = (src+1) & 15;
3804      addr = (addr + 2) & 0xffff;
3807      addr = addr_add(cpustate, addr, 2);
38053808   }
38063809}
38073810
r15120r15121
38153818   GET_DST(OP1,NIB1);
38163819   GET_CNT(OP1,NIB3);
38173820   GET_ADDR(OP2);
3818   addr += cpustate->RW(src);
3821   addr = addr_add(cpustate, addr, cpustate->RW(src));
38193822   while (cnt-- >= 0) {
38203823      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
38213824      dst = (dst+1) & 15;
3822      addr = (addr + 2) & 0xffff;
3825      addr = addr_add(cpustate, addr, 2);
38233826   }
38243827}
38253828
r15120r15121
38433846   GET_SRC(OP0,NIB3);
38443847   GET_DST(OP0,NIB2);
38453848   GET_ADDR(OP1);
3846   addr += cpustate->RW(dst);
3849   addr = addr_add(cpustate, addr, cpustate->RW(dst));
38473850   WRMEM_L(cpustate,  addr, cpustate->RL(src));
38483851}
38493852
r15120r15121
38843887   GET_CCC(OP0,NIB3);
38853888   GET_DST(OP0,NIB2);
38863889   GET_ADDR(OP1);
3887   addr += cpustate->RW(dst);
3890   addr = addr_add(cpustate, addr, cpustate->RW(dst));
38883891   switch (cc) {
38893892      case  0: if (CC0) cpustate->pc = addr; break;
38903893      case  1: if (CC1) cpustate->pc = addr; break;
r15120r15121
39123915static void Z5F_0000_0000_addr(z8000_state *cpustate)
39133916{
39143917   GET_ADDR(OP1);
3915   PUSHW(cpustate, SP, cpustate->pc);
3918    if (segmented_mode(cpustate))
3919        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
3920    else
3921        PUSHW(cpustate, SP, cpustate->pc);
39163922   cpustate->pc = addr;
39173923}
39183924
r15120r15121
39243930{
39253931   GET_DST(OP0,NIB2);
39263932   GET_ADDR(OP1);
3927   PUSHW(cpustate, SP, cpustate->pc);
3928   addr += cpustate->RW(dst);
3933    if (segmented_mode(cpustate))
3934        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
3935    else
3936        PUSHW(cpustate, SP, cpustate->pc);
3937   addr = addr_add(cpustate, addr, cpustate->RW(dst));
39293938   cpustate->pc = addr;
39303939}
39313940
r15120r15121
39493958   GET_DST(OP0,NIB3);
39503959   GET_SRC(OP0,NIB2);
39513960   GET_ADDR(OP1);
3952   addr += cpustate->RW(src);
3961   addr = addr_add(cpustate, addr, cpustate->RW(src));
39533962   cpustate->RB(dst) = RDMEM_B(cpustate, addr);
39543963}
39553964
r15120r15121
39733982   GET_DST(OP0,NIB3);
39743983   GET_SRC(OP0,NIB2);
39753984   GET_ADDR(OP1);
3976   addr += cpustate->RW(src);
3985   addr = addr_add(cpustate, addr, cpustate->RW(src));
39773986   cpustate->RW(dst) = RDMEM_W(cpustate, addr);
39783987}
39793988
r15120r15121
39974006   GET_BIT(OP0);
39984007   GET_DST(OP0,NIB2);
39994008   GET_ADDR(OP1);
4000   addr += cpustate->RW(dst);
4009   addr = addr_add(cpustate, addr, cpustate->RW(dst));
40014010   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) & ~bit);
40024011}
40034012
r15120r15121
40214030   GET_BIT(OP0);
40224031   GET_DST(OP0,NIB2);
40234032   GET_ADDR(OP1);
4024   addr += cpustate->RW(dst);
4033   addr = addr_add(cpustate, addr, cpustate->RW(dst));
40254034   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) & ~bit);
40264035}
40274036
r15120r15121
40454054   GET_BIT(OP0);
40464055   GET_DST(OP0,NIB2);
40474056   GET_ADDR(OP1);
4048   addr += cpustate->RW(dst);
4057   addr = addr_add(cpustate, addr, cpustate->RW(dst));
40494058   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) | bit);
40504059}
40514060
r15120r15121
40694078   GET_BIT(OP0);
40704079   GET_DST(OP0,NIB2);
40714080   GET_ADDR(OP1);
4072   addr += cpustate->RW(dst);
4081   addr = addr_add(cpustate, addr, cpustate->RW(dst));
40734082   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) | bit);
40744083}
40754084
r15120r15121
40934102   GET_BIT(OP0);
40944103   GET_DST(OP0,NIB2);
40954104   GET_ADDR(OP1);
4096 addr += cpustate->RW(dst);
4105   addr = addr_add(cpustate, addr, cpustate->RW(dst));
40974106    if (RDMEM_B(cpustate, addr) & bit) CLR_Z; else SET_Z;
40984107}
40994108
r15120r15121
41174126   GET_BIT(OP0);
41184127   GET_DST(OP0,NIB2);
41194128   GET_ADDR(OP1);
4120 addr += cpustate->RW(dst);
4129   addr = addr_add(cpustate, addr, cpustate->RW(dst));
41214130   if (RDMEM_W(cpustate, addr) & bit) CLR_Z; else SET_Z;
41224131}
41234132
r15120r15121
41414150   GET_I4M1(OP0,NIB3);
41424151   GET_DST(OP0,NIB2);
41434152   GET_ADDR(OP1);
4144   addr += cpustate->RW(dst);
4153   addr = addr_add(cpustate, addr, cpustate->RW(dst));
41454154   WRMEM_B(cpustate,  addr, INCB(cpustate, RDMEM_B(cpustate, addr), i4p1));
41464155}
41474156
r15120r15121
41654174   GET_I4M1(OP0,NIB3);
41664175   GET_DST(OP0,NIB2);
41674176   GET_ADDR(OP1);
4168   addr += cpustate->RW(dst);
4177   addr = addr_add(cpustate, addr, cpustate->RW(dst));
41694178   WRMEM_W(cpustate,  addr, INCW(cpustate, RDMEM_W(cpustate, addr), i4p1));
41704179}
41714180
r15120r15121
41894198   GET_I4M1(OP0,NIB3);
41904199   GET_DST(OP0,NIB2);
41914200   GET_ADDR(OP1);
4192   addr += cpustate->RW(dst);
4201   addr = addr_add(cpustate, addr, cpustate->RW(dst));
41934202   WRMEM_B(cpustate,  addr, DECB(cpustate, RDMEM_B(cpustate, addr), i4p1));
41944203}
41954204
r15120r15121
42134222   GET_I4M1(OP0,NIB3);
42144223   GET_DST(OP0,NIB2);
42154224   GET_ADDR(OP1);
4216   addr += cpustate->RW(dst);
4225   addr = addr_add(cpustate, addr, cpustate->RW(dst));
42174226   WRMEM_W(cpustate,  addr, DECW(cpustate, RDMEM_W(cpustate, addr), i4p1));
42184227}
42194228
r15120r15121
42404249   GET_SRC(OP0,NIB2);
42414250   GET_ADDR(OP1);
42424251   UINT8 tmp;
4243   addr += cpustate->RW(src);
4252   addr = addr_add(cpustate, addr, cpustate->RW(src));
42444253   tmp = RDMEM_B(cpustate, addr);
42454254   WRMEM_B(cpustate, addr, cpustate->RB(dst));
42464255    cpustate->RB(dst) = tmp;
r15120r15121
42694278   GET_SRC(OP0,NIB2);
42704279   GET_ADDR(OP1);
42714280   UINT16 tmp;
4272   addr += cpustate->RW(src);
4281   addr = addr_add(cpustate, addr, cpustate->RW(src));
42734282   tmp = RDMEM_W(cpustate, addr);
42744283   WRMEM_W(cpustate,  addr, cpustate->RW(dst));
42754284    cpustate->RW(dst) = tmp;
r15120r15121
42954304   GET_SRC(OP0,NIB3);
42964305   GET_DST(OP0,NIB2);
42974306   GET_ADDR(OP1);
4298   addr += cpustate->RW(dst);
4307   addr = addr_add(cpustate, addr, cpustate->RW(dst));
42994308   WRMEM_B(cpustate,  addr, cpustate->RB(src));
43004309}
43014310
r15120r15121
43194328   GET_SRC(OP0,NIB3);
43204329   GET_DST(OP0,NIB2);
43214330   GET_ADDR(OP1);
4322   addr += cpustate->RW(dst);
4331   addr = addr_add(cpustate, addr, cpustate->RW(dst));
43234332   WRMEM_W(cpustate,  addr, cpustate->RW(src));
43244333}
43254334
r15120r15121
43324341   GET_DST(OP0,NIB3);
43334342   GET_SRC(OP0,NIB2);
43344343   GET_IDX(OP1,NIB1);
4335   cpustate->RB(dst) = RDMEM_B(cpustate, (UINT16)(cpustate->RW(src) + cpustate->RW(idx)));
4344   cpustate->RB(dst) = RDMEM_B(cpustate, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
43364345}
43374346
43384347/******************************************
r15120r15121
43444353   GET_DST(OP0,NIB3);
43454354   GET_SRC(OP0,NIB2);
43464355   GET_IDX(OP1,NIB1);
4347   cpustate->RW(dst) = RDMEM_W(cpustate, (UINT16)(cpustate->RW(src) + cpustate->RW(idx)));
4356   cpustate->RW(dst) = RDMEM_W(cpustate, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
43484357}
43494358
43504359/******************************************
r15120r15121
43564365   GET_SRC(OP0,NIB3);
43574366   GET_DST(OP0,NIB2);
43584367   GET_IDX(OP1,NIB1);
4359   WRMEM_B(cpustate,  (UINT16)(cpustate->RW(dst) + cpustate->RW(idx)), cpustate->RB(src));
4368   WRMEM_B(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RB(src));
43604369}
43614370
43624371/******************************************
r15120r15121
43684377   GET_SRC(OP0,NIB3);
43694378   GET_DST(OP0,NIB2);
43704379   GET_IDX(OP1,NIB1);
4371   WRMEM_W(cpustate,  (UINT16)(cpustate->RW(dst) + cpustate->RW(idx)), cpustate->RW(src));
4380   WRMEM_W(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RW(src));
43724381}
43734382
43744383/******************************************
r15120r15121
43804389   GET_DST(OP0,NIB3);
43814390   GET_SRC(OP0,NIB2);
43824391   GET_IDX(OP1,NIB1);
4383   cpustate->RW(dst) = (UINT16)(cpustate->RW(src) + cpustate->RW(idx));
4392   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
43844393}
43854394
43864395/******************************************
r15120r15121
43924401   GET_DST(OP0,NIB3);
43934402   GET_SRC(OP0,NIB2);
43944403   GET_IDX(OP1,NIB1);
4395   cpustate->RL(dst) = RDMEM_L(cpustate,  (UINT16)(cpustate->RW(src) + cpustate->RW(idx)));
4404   cpustate->RL(dst) = RDMEM_L(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
43964405}
43974406
43984407/******************************************
r15120r15121
44034412{
44044413   GET_DST(OP0,NIB3);
44054414   GET_ADDR(OP1);
4406   cpustate->RW(dst) = addr;
4415    addr_to_reg(cpustate, dst, addr);
44074416}
44084417
4409static void Z76_0000_dddd_addr_seg(z8000_state *cpustate)
4410{
4411   static UINT32 offset;
4412   UINT16 operand1;
4413
4414   GET_DST(OP0,NIB3);
4415   operand1 = fetch(cpustate);
4416
4417   if(operand1 & 0x8000)
4418   {
4419      UINT16 operand2 = fetch(cpustate);
4420
4421      offset = (operand1 & 0x0700) << 8;
4422      offset|= (operand2 & 0xffff);
4423      cpustate->RW(dst) = (offset & 0x70000) >> 16;
4424      cpustate->RW(dst+1) = offset & 0xffff;
4425      cycles(cpustate, 15);
4426   }
4427   else
4428   {
4429      offset = (operand1 & 0x0700) << 8;
4430      offset|= (operand1 & 0x00ff);
4431      cpustate->RW(dst) = (offset & 0x70000) >> 16;
4432      cpustate->RW(dst+1) = offset & 0x00ff;
4433      cycles(cpustate, 13);
4434   }
4435}
4436
44374418/******************************************
44384419 lda     prd,addr(rs)
44394420 flags:  ------
r15120r15121
44434424   GET_DST(OP0,NIB3);
44444425   GET_SRC(OP0,NIB2);
44454426   GET_ADDR(OP1);
4446   addr += cpustate->RW(src);
4447    cpustate->RW(dst) = addr;
4427   addr = addr_add(cpustate, addr, cpustate->RW(src));
4428    addr_to_reg(cpustate, dst, addr);
44484429}
44494430
44504431/******************************************
r15120r15121
44564437   GET_SRC(OP0,NIB3);
44574438   GET_DST(OP0,NIB2);
44584439   GET_IDX(OP1,NIB1);
4459   WRMEM_L(cpustate,  (UINT16)(cpustate->RW(dst) + cpustate->RW(idx)), cpustate->RL(src));
4440   WRMEM_L(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RL(src));
44604441}
44614442
44624443/******************************************
r15120r15121
44814462{
44824463   GET_ADDR(OP1);
44834464   UINT16 fcw;
4484   fcw = RDMEM_W(cpustate, addr);
4485   cpustate->pc   = RDMEM_W(cpustate, (UINT16)(addr + 2));
4465    //printf("LDPS from 0x%x: old pc: 0x%x\n", addr, cpustate->pc);
4466    if (segmented_mode(cpustate)) {
4467        fcw = RDMEM_W(cpustate,  addr + 2);
4468        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
4469    }
4470    else {
4471        fcw = RDMEM_W(cpustate, addr);
4472        cpustate->pc = RDMEM_W(cpustate, (UINT16)(addr + 2));
4473    }
44864474   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
4475    //printf("LDPS: new pc: 0x%x\n", cpustate->pc);
44874476}
44884477
44894478/******************************************
r15120r15121
44954484   GET_SRC(OP0,NIB2);
44964485   GET_ADDR(OP1);
44974486   UINT16 fcw;
4498   addr += cpustate->RW(src);
4499   fcw = RDMEM_W(cpustate, addr);
4500   cpustate->pc   = RDMEM_W(cpustate, (UINT16)(addr + 2));
4487   addr = addr_add(cpustate, addr, cpustate->RW(src));
4488    if (segmented_mode(cpustate)) {
4489        fcw = RDMEM_W(cpustate,  addr + 2);
4490        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
4491    }
4492    else {
4493        fcw = RDMEM_W(cpustate, addr);
4494        cpustate->pc   = RDMEM_W(cpustate, (UINT16)(addr + 2));
4495    }
45014496   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
45024497}
45034498
r15120r15121
45204515   UINT16 tag, fcw;
45214516   tag = POPW(cpustate, SP);   /* get type tag */
45224517   fcw = POPW(cpustate, SP);   /* get cpustate->fcw  */
4523   cpustate->pc   = POPW(cpustate, SP);   /* get cpustate->pc   */
4518    if (segmented_mode(cpustate))
4519        cpustate->pc = segmented_addr(POPL(cpustate, SP));
4520    else
4521        cpustate->pc   = POPW(cpustate, SP);   /* get cpustate->pc   */
45244522    cpustate->irq_srv &= ~tag;    /* remove IRQ serviced flag */
45254523   CHANGE_FCW(cpustate, fcw);       /* check for user/system mode change */
45264524   LOG(("Z8K '%s' IRET tag $%04x, fcw $%04x, pc $%04x\n", cpustate->device->tag(), tag, fcw, cpustate->pc));
r15120r15121
45914589 flags:  ------
45924590 ******************************************/
45934591static void Z7D_dddd_0ccc(z8000_state *cpustate)
4594{
4592{//@@@
45954593   GET_IMM3(OP0,NIB3);
45964594   GET_DST(OP0,NIB2);
45974595   switch (imm3) {
r15120r15121
46014599      case 3:
46024600         cpustate->RW(dst) = cpustate->refresh;
46034601         break;
4602      case 4:
4603         cpustate->RW(dst) = cpustate->psapseg;
4604         break;
46044605      case 5:
4605         cpustate->RW(dst) = cpustate->psap;
4606         cpustate->RW(dst) = cpustate->psapoff;
46064607         break;
46074608      case 7:
4608         cpustate->RW(dst) = cpustate->nsp;
4609         cpustate->RW(dst) = cpustate->nspoff;
46094610         break;
46104611      default:
46114612         LOG(("Z8K '%s' LDCTL R%d,%d\n", cpustate->device->tag(), dst, imm3));
r15120r15121
46174618 flags:  ------
46184619 ******************************************/
46194620static void Z7D_ssss_1ccc(z8000_state *cpustate)
4620{
4621{//@@@
46214622   GET_IMM3(OP0,NIB3);
46224623   GET_SRC(OP0,NIB2);
46234624   switch (imm3) {
r15120r15121
46314632      case 3:
46324633         cpustate->refresh = cpustate->RW(src);
46334634         break;
4635      case 4:
4636         cpustate->psapseg = cpustate->RW(src);
4637         break;
46344638      case 5:
4635         cpustate->psap = cpustate->RW(src);
4639         cpustate->psapoff = cpustate->RW(src);
46364640         break;
46374641      case 7:
4638         cpustate->nsp = cpustate->RW(src);
4642         cpustate->nspoff = cpustate->RW(src);
46394643         break;
46404644      default:
46414645         LOG(("Z8K '%s' LDCTL %d,R%d\n", cpustate->device->tag(), imm3, src));
r15120r15121
48424846}
48434847
48444848/******************************************
4849 ldctlb rbd,flags
4850 flags:  CZSVDH
4851 ******************************************/
4852static void Z8C_dddd_0001(z8000_state *cpustate)
4853{
4854   GET_DST(OP0,NIB2);
4855   cpustate->RB(dst) = cpustate->fcw & 0xfc;
4856}
4857
4858/******************************************
48454859 clrb    rbd
48464860 flags:  ------
48474861 ******************************************/
r15120r15121
48524866}
48534867
48544868/******************************************
4869 ldctlb flags,rbd
4870 flags:  ------
4871 ******************************************/
4872static void Z8C_dddd_1001(z8000_state *cpustate)
4873{
4874   GET_DST(OP0,NIB2);
4875    cpustate->fcw &= ~0x00fc;
4876    cpustate->fcw |= (cpustate->RB(dst) & 0xfc);
4877}
4878
4879/******************************************
48554880 nop
48564881 flags:  ------
48574882 ******************************************/
r15120r15121
49825007 flags:  ------
49835008 ******************************************/
49845009static void Z91_ddN0_ssss(z8000_state *cpustate)
4985{
5010{//@@@
49865011    GET_SRC(OP0,NIB3);
49875012    GET_DST(OP0,NIB2);
49885013    PUSHL(cpustate, dst, cpustate->RL(src));
r15120r15121
51315156static void Z9E_0000_cccc(z8000_state *cpustate)
51325157{
51335158   GET_CCC(OP0,NIB3);
5134   switch (cc) {
5135      case  0: if (CC0) cpustate->pc = POPW(cpustate, SP); break;
5136      case  1: if (CC1) cpustate->pc = POPW(cpustate, SP); break;
5137      case  2: if (CC2) cpustate->pc = POPW(cpustate, SP); break;
5138      case  3: if (CC3) cpustate->pc = POPW(cpustate, SP); break;
5139      case  4: if (CC4) cpustate->pc = POPW(cpustate, SP); break;
5140      case  5: if (CC5) cpustate->pc = POPW(cpustate, SP); break;
5141      case  6: if (CC6) cpustate->pc = POPW(cpustate, SP); break;
5142      case  7: if (CC7) cpustate->pc = POPW(cpustate, SP); break;
5143      case  8: if (CC8) cpustate->pc = POPW(cpustate, SP); break;
5144      case  9: if (CC9) cpustate->pc = POPW(cpustate, SP); break;
5145      case 10: if (CCA) cpustate->pc = POPW(cpustate, SP); break;
5146      case 11: if (CCB) cpustate->pc = POPW(cpustate, SP); break;
5147      case 12: if (CCC) cpustate->pc = POPW(cpustate, SP); break;
5148      case 13: if (CCD) cpustate->pc = POPW(cpustate, SP); break;
5149      case 14: if (CCE) cpustate->pc = POPW(cpustate, SP); break;
5150      case 15: if (CCF) cpustate->pc = POPW(cpustate, SP); break;
5151   }
5159    if (segmented_mode(cpustate))
5160        switch (cc) {
5161            case  0: if (CC0) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5162            case  1: if (CC1) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5163            case  2: if (CC2) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5164            case  3: if (CC3) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5165            case  4: if (CC4) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5166            case  5: if (CC5) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5167            case  6: if (CC6) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5168            case  7: if (CC7) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5169            case  8: if (CC8) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5170            case  9: if (CC9) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5171            case 10: if (CCA) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5172            case 11: if (CCB) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5173            case 12: if (CCC) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5174            case 13: if (CCD) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5175            case 14: if (CCE) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5176            case 15: if (CCF) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5177        }
5178    else
5179        switch (cc) {
5180          case  0: if (CC0) cpustate->pc = POPW(cpustate, SP); break;
5181          case  1: if (CC1) cpustate->pc = POPW(cpustate, SP); break;
5182          case  2: if (CC2) cpustate->pc = POPW(cpustate, SP); break;
5183          case  3: if (CC3) cpustate->pc = POPW(cpustate, SP); break;
5184          case  4: if (CC4) cpustate->pc = POPW(cpustate, SP); break;
5185          case  5: if (CC5) cpustate->pc = POPW(cpustate, SP); break;
5186          case  6: if (CC6) cpustate->pc = POPW(cpustate, SP); break;
5187          case  7: if (CC7) cpustate->pc = POPW(cpustate, SP); break;
5188          case  8: if (CC8) cpustate->pc = POPW(cpustate, SP); break;
5189          case  9: if (CC9) cpustate->pc = POPW(cpustate, SP); break;
5190          case 10: if (CCA) cpustate->pc = POPW(cpustate, SP); break;
5191          case 11: if (CCB) cpustate->pc = POPW(cpustate, SP); break;
5192          case 12: if (CCC) cpustate->pc = POPW(cpustate, SP); break;
5193          case 13: if (CCD) cpustate->pc = POPW(cpustate, SP); break;
5194          case 14: if (CCE) cpustate->pc = POPW(cpustate, SP); break;
5195          case 15: if (CCF) cpustate->pc = POPW(cpustate, SP); break;
5196        }
51525197}
51535198
51545199/******************************************
r15120r15121
57335778 flags:  -ZSV--
57345779 ******************************************/
57355780static void ZB8_ddN0_0010_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5736{
5781{//@@@
57375782   GET_DST(OP0,NIB2);
57385783   GET_SRC(OP1,NIB2);
57395784   GET_CNT(OP1,NIB1);
r15120r15121
57495794 flags:  -ZSV--
57505795 ******************************************/
57515796static void ZB8_ddN0_0110_0000_rrrr_ssN0_1110(z8000_state *cpustate)
5752{
5797{//@@@
57535798   GET_DST(OP0,NIB2);
57545799   GET_SRC(OP1,NIB2);
57555800   GET_CNT(OP1,NIB1);
r15120r15121
57655810 flags:  -ZSV--
57665811 ******************************************/
57675812static void ZB8_ddN0_1010_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5768{
5813{//@@@
57695814   GET_DST(OP0,NIB2);
57705815   GET_SRC(OP1,NIB2);
57715816   GET_CNT(OP1,NIB1);
r15120r15121
57815826 flags:  -ZSV--
57825827 ******************************************/
57835828static void ZB8_ddN0_1110_0000_rrrr_ssN0_1110(z8000_state *cpustate)
5784{
5829{//@@@
57855830   GET_DST(OP0,NIB2);
57865831   GET_SRC(OP1,NIB2);
57875832   GET_CNT(OP1,NIB1);
r15120r15121
57975842 flags:  -ZSV--
57985843 ******************************************/
57995844static void ZB8_ddN0_0000_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5800{
5845{//@@@
58015846   GET_DST(OP0,NIB2);
58025847   GET_SRC(OP1,NIB2);
58035848   GET_CNT(OP1,NIB1);
r15120r15121
58125857 flags:  -ZSV--
58135858 ******************************************/
58145859static void ZB8_ddN0_0100_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5815{
5860{//@@@
58165861   GET_DST(OP0,NIB2);
58175862   GET_SRC(OP1,NIB2);
58185863   GET_CNT(OP1,NIB1);
r15120r15121
58275872 flags:  -ZSV--
58285873 ******************************************/
58295874static void ZB8_ddN0_1000_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5830{
5875{//@@@
58315876   GET_DST(OP0,NIB2);
58325877   GET_SRC(OP1,NIB2);
58335878   GET_CNT(OP1,NIB1);
r15120r15121
58425887 flags:  -ZSV--
58435888 ******************************************/
58445889static void ZB8_ddN0_1100_0000_rrrr_ssN0_0000(z8000_state *cpustate)
5845{
5890{//@@@
58465891   GET_DST(OP0,NIB2);
58475892   GET_SRC(OP1,NIB2);
58485893   GET_CNT(OP1,NIB1);
r15120r15121
58775922   GET_CCC(OP1,NIB3);
58785923   GET_DST(OP1,NIB2);
58795924   GET_CNT(OP1,NIB1);
5880   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
5925   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
58815926   switch (cc) {
58825927      case  0: if (CC0) SET_Z; else CLR_Z; break;
58835928      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
58965941      case 14: if (CCE) SET_Z; else CLR_Z; break;
58975942      case 15: if (CCF) SET_Z; else CLR_Z; break;
58985943    }
5899   cpustate->RW(src)++;
5944   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
59005945   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
59015946}
59025947
r15120r15121
59115956    GET_CNT(OP1,NIB1);
59125957   GET_DST(OP1,NIB2);
59135958   GET_CCC(OP1,NIB3);   /* repeat? */
5914    WRMEM_B(cpustate,  cpustate->RW(dst), RDMEM_B(cpustate, cpustate->RW(src)));
5915   cpustate->RW(dst)++;
5916   cpustate->RW(src)++;
5959    WRMEM_B(cpustate,  cpustate->RW(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
5960   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5961   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
59175962   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
59185963}
59195964
r15120r15121
59275972   GET_CCC(OP1,NIB3);
59285973   GET_DST(OP1,NIB2);
59295974   GET_CNT(OP1,NIB1);
5930   CPB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), RDMEM_B(cpustate, cpustate->RW(src)));
5975   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
59315976   switch (cc) {
59325977      case  0: if (CC0) SET_Z; else CLR_Z; break;
59335978      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
59465991      case 14: if (CCE) SET_Z; else CLR_Z; break;
59475992      case 15: if (CCF) SET_Z; else CLR_Z; break;
59485993    }
5949   cpustate->RW(dst)++;
5950   cpustate->RW(src)++;
5994   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
5995   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
59515996   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
59525997}
59535998
r15120r15121
59616006   GET_CCC(OP1,NIB3);
59626007   GET_DST(OP1,NIB2);
59636008   GET_CNT(OP1,NIB1);
5964   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
6009   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
59656010   switch (cc) {
59666011      case  0: if (CC0) SET_Z; else CLR_Z; break;
59676012      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
59806025      case 14: if (CCE) SET_Z; else CLR_Z; break;
59816026      case 15: if (CCF) SET_Z; else CLR_Z; break;
59826027    }
5983   cpustate->RW(src)++;
6028   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
59846029   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
59856030}
59866031
r15120r15121
59946039   GET_CCC(OP1,NIB3);
59956040   GET_DST(OP1,NIB2);
59966041   GET_CNT(OP1,NIB1);
5997   CPB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), RDMEM_B(cpustate, cpustate->RW(src)));
6042   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
59986043   switch (cc) {
59996044      case  0: if (CC0) SET_Z; else CLR_Z; break;
60006045      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
60136058      case 14: if (CCE) SET_Z; else CLR_Z; break;
60146059      case 15: if (CCF) SET_Z; else CLR_Z; break;
60156060    }
6016   cpustate->RW(dst)++;
6017   cpustate->RW(src)++;
6061   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 1));
6062   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 1));
60186063   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
60196064}
60206065
r15120r15121
60286073   GET_CCC(OP1,NIB3);
60296074   GET_DST(OP1,NIB2);
60306075   GET_CNT(OP1,NIB1);
6031    CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
6076    CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
60326077    switch (cc) {
60336078      case  0: if (CC0) SET_Z; else CLR_Z; break;
60346079      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
60476092      case 14: if (CCE) SET_Z; else CLR_Z; break;
60486093      case 15: if (CCF) SET_Z; else CLR_Z; break;
60496094    }
6050   cpustate->RW(src)--;
6095   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
60516096   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
60526097}
60536098
r15120r15121
60626107    GET_CNT(OP1,NIB1);
60636108   GET_DST(OP1,NIB2);
60646109   GET_CCC(OP1,NIB3);
6065   WRMEM_B(cpustate,  cpustate->RW(dst), RDMEM_B(cpustate, cpustate->RW(src)));
6066   cpustate->RW(dst)--;
6067   cpustate->RW(src)--;
6110   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6111   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6112   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
60686113   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
60696114}
60706115
r15120r15121
60786123   GET_CCC(OP1,NIB3);
60796124   GET_DST(OP1,NIB2);
60806125   GET_CNT(OP1,NIB1);
6081    CPB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), RDMEM_B(cpustate, cpustate->RW(src)));
6126    CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
60826127   switch (cc) {
60836128      case  0: if (CC0) SET_Z; else CLR_Z; break;
60846129      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
60976142      case 14: if (CCE) SET_Z; else CLR_Z; break;
60986143      case 15: if (CCF) SET_Z; else CLR_Z; break;
60996144    }
6100   cpustate->RW(dst)--;
6101   cpustate->RW(src)--;
6145   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6146   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
61026147   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
61036148}
61046149
r15120r15121
61126157   GET_CCC(OP1,NIB3);
61136158   GET_DST(OP1,NIB2);
61146159   GET_CNT(OP1,NIB1);
6115   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, cpustate->RW(src)));
6160   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
61166161   switch (cc) {
61176162      case  0: if (CC0) SET_Z; else CLR_Z; break;
61186163      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
61316176      case 14: if (CCE) SET_Z; else CLR_Z; break;
61326177      case 15: if (CCF) SET_Z; else CLR_Z; break;
61336178    }
6134   cpustate->RW(src)--;
6179   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
61356180   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
61366181}
61376182
r15120r15121
61456190   GET_CCC(OP1,NIB3);
61466191   GET_DST(OP1,NIB2);
61476192   GET_CNT(OP1,NIB1);
6148    CPB(cpustate, RDMEM_B(cpustate, cpustate->RW(dst)), RDMEM_B(cpustate, cpustate->RW(src)));
6193    CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
61496194   switch (cc) {
61506195      case  0: if (CC0) SET_Z; else CLR_Z; break;
61516196      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
61646209      case 14: if (CCE) SET_Z; else CLR_Z; break;
61656210      case 15: if (CCF) SET_Z; else CLR_Z; break;
61666211   }
6167   cpustate->RW(dst)--;
6168   cpustate->RW(src)--;
6212   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 1));
6213   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 1));
61696214   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
61706215}
61716216
r15120r15121
61796224   GET_CCC(OP1,NIB3);
61806225   GET_DST(OP1,NIB2);
61816226   GET_CNT(OP1,NIB1);
6182   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6227   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
61836228    switch (cc) {
61846229      case  0: if (CC0) SET_Z; else CLR_Z; break;
61856230      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
61986243      case 14: if (CCE) SET_Z; else CLR_Z; break;
61996244      case 15: if (CCF) SET_Z; else CLR_Z; break;
62006245    }
6201   cpustate->RW(src) += 2;
6246   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
62026247   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
62036248}
62046249
r15120r15121
62136258    GET_CNT(OP1,NIB1);
62146259   GET_DST(OP1,NIB2);
62156260   GET_CCC(OP1,NIB3);
6216   WRMEM_W(cpustate,  cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6217   cpustate->RW(dst) += 2;
6218   cpustate->RW(src) += 2;
6261   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6262   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6263   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
62196264   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
62206265}
62216266
r15120r15121
62296274   GET_CCC(OP1,NIB3);
62306275   GET_DST(OP1,NIB2);
62316276   GET_CNT(OP1,NIB1);
6232   CPW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), RDMEM_W(cpustate, cpustate->RW(src)));
6277   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
62336278   switch (cc) {
62346279      case  0: if (CC0) SET_Z; else CLR_Z; break;
62356280      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
62486293      case 14: if (CCE) SET_Z; else CLR_Z; break;
62496294      case 15: if (CCF) SET_Z; else CLR_Z; break;
62506295    }
6251   cpustate->RW(dst) += 2;
6252   cpustate->RW(src) += 2;
6296   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6297   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
62536298   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
62546299}
62556300
r15120r15121
62636308   GET_CCC(OP1,NIB3);
62646309   GET_DST(OP1,NIB2);
62656310   GET_CNT(OP1,NIB1);
6266   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6311   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
62676312   switch (cc) {
62686313      case  0: if (CC0) SET_Z; else CLR_Z; break;
62696314      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
62826327      case 14: if (CCE) SET_Z; else CLR_Z; break;
62836328      case 15: if (CCF) SET_Z; else CLR_Z; break;
62846329    }
6285   cpustate->RW(src) += 2;
6330   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
62866331   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
62876332}
62886333
r15120r15121
62966341   GET_CCC(OP1,NIB3);
62976342   GET_DST(OP1,NIB2);
62986343   GET_CNT(OP1,NIB1);
6299   CPW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), RDMEM_W(cpustate, cpustate->RW(src)));
6344   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
63006345   switch (cc) {
63016346      case  0: if (CC0) SET_Z; else CLR_Z; break;
63026347      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
63156360      case 14: if (CCE) SET_Z; else CLR_Z; break;
63166361      case 15: if (CCF) SET_Z; else CLR_Z; break;
63176362    }
6318   cpustate->RW(dst) += 2;
6319    cpustate->RW(src) += 2;
6363   addr_to_reg(cpustate, src, addr_add(cpustate, addr_from_reg(cpustate, src), 2));
6364   addr_to_reg(cpustate, dst, addr_add(cpustate, addr_from_reg(cpustate, dst), 2));
63206365   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
63216366}
63226367
r15120r15121
63306375   GET_CCC(OP1,NIB3);
63316376   GET_DST(OP1,NIB2);
63326377   GET_CNT(OP1,NIB1);
6333   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6378   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
63346379    switch (cc) {
63356380      case  0: if (CC0) SET_Z; else CLR_Z; break;
63366381      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
63496394      case 14: if (CCE) SET_Z; else CLR_Z; break;
63506395      case 15: if (CCF) SET_Z; else CLR_Z; break;
63516396    }
6352   cpustate->RW(src) -= 2;
6397   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
63536398   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
63546399}
63556400
r15120r15121
63646409    GET_CNT(OP1,NIB1);
63656410    GET_DST(OP1,NIB2);
63666411   GET_CCC(OP1,NIB3);
6367    WRMEM_W(cpustate,  cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6368    cpustate->RW(dst) -= 2;
6369    cpustate->RW(src) -= 2;
6412    WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6413   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6414   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
63706415   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
63716416}
63726417
r15120r15121
63806425   GET_CCC(OP1,NIB3);
63816426   GET_DST(OP1,NIB2);
63826427   GET_CNT(OP1,NIB1);
6383   CPW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), RDMEM_W(cpustate, cpustate->RW(src)));
6428   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
63846429   switch (cc) {
63856430      case  0: if (CC0) SET_Z; else CLR_Z; break;
63866431      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
63996444      case 14: if (CCE) SET_Z; else CLR_Z; break;
64006445      case 15: if (CCF) SET_Z; else CLR_Z; break;
64016446    }
6402    cpustate->RW(dst) -= 2;
6403    cpustate->RW(src) -= 2;
6447   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6448   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
64046449   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
64056450}
64066451
r15120r15121
64146459   GET_CCC(OP1,NIB3);
64156460   GET_DST(OP1,NIB2);
64166461   GET_CNT(OP1,NIB1);
6417   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, cpustate->RW(src)));
6462   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
64186463   switch (cc) {
64196464      case  0: if (CC0) SET_Z; else CLR_Z; break;
64206465      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
64336478      case 14: if (CCE) SET_Z; else CLR_Z; break;
64346479      case 15: if (CCF) SET_Z; else CLR_Z; break;
64356480    }
6436   cpustate->RW(src) -= 2;
6481   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
64376482   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
64386483}
64396484
r15120r15121
64476492   GET_CCC(OP1,NIB3);
64486493   GET_DST(OP1,NIB2);
64496494   GET_CNT(OP1,NIB1);
6450   CPW(cpustate, RDMEM_W(cpustate, cpustate->RW(dst)), RDMEM_W(cpustate, cpustate->RW(src)));
6495   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
64516496   switch (cc) {
64526497      case  0: if (CC0) SET_Z; else CLR_Z; break;
64536498      case  1: if (CC1) SET_Z; else CLR_Z; break;
r15120r15121
64666511      case 14: if (CCE) SET_Z; else CLR_Z; break;
64676512      case 15: if (CCF) SET_Z; else CLR_Z; break;
64686513    }
6469    cpustate->RW(dst) -= 2;
6470    cpustate->RW(src) -= 2;
6514   addr_to_reg(cpustate, dst, addr_sub(cpustate, addr_from_reg(cpustate, dst), 2));
6515   addr_to_reg(cpustate, src, addr_sub(cpustate, addr_from_reg(cpustate, src), 2));
64716516   if (--cpustate->RW(cnt)) { CLR_V; if (!(cpustate->fcw & F_Z)) cpustate->pc -= 4; } else SET_V;
64726517}
64736518
r15120r15121
65436588static void ZD_dsp12(z8000_state *cpustate)
65446589{
65456590   INT16 dsp12 = cpustate->op[0] & 0xfff;
6546   PUSHW(cpustate, SP, cpustate->pc);
6547   dsp12 = (dsp12 & 2048) ? 4096 -2 * (dsp12 & 2047) : -2 * (dsp12 & 2047);
6548   cpustate->pc += dsp12;
6591    if (segmented_mode(cpustate))
6592        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
6593    else
6594        PUSHW(cpustate, SP, cpustate->pc);
6595   dsp12 = (dsp12 & 2048) ? 4096 - 2 * (dsp12 & 2047) : -2 * (dsp12 & 2047);
6596   cpustate->pc = addr_add(cpustate, cpustate->pc, dsp12);
65496597}
65506598
65516599/******************************************
r15120r15121
65576605   GET_DSP8;
65586606   GET_CCC(OP0,NIB1);
65596607   switch (cc) {
6560      case  0: if (CC0) cpustate->pc += dsp8 * 2; break;
6561      case  1: if (CC1) cpustate->pc += dsp8 * 2; break;
6562      case  2: if (CC2) cpustate->pc += dsp8 * 2; break;
6563      case  3: if (CC3) cpustate->pc += dsp8 * 2; break;
6564      case  4: if (CC4) cpustate->pc += dsp8 * 2; break;
6565      case  5: if (CC5) cpustate->pc += dsp8 * 2; break;
6566      case  6: if (CC6) cpustate->pc += dsp8 * 2; break;
6567      case  7: if (CC7) cpustate->pc += dsp8 * 2; break;
6568      case  8: if (CC8) cpustate->pc += dsp8 * 2; break;
6569      case  9: if (CC9) cpustate->pc += dsp8 * 2; break;
6570      case 10: if (CCA) cpustate->pc += dsp8 * 2; break;
6571      case 11: if (CCB) cpustate->pc += dsp8 * 2; break;
6572      case 12: if (CCC) cpustate->pc += dsp8 * 2; break;
6573      case 13: if (CCD) cpustate->pc += dsp8 * 2; break;
6574      case 14: if (CCE) cpustate->pc += dsp8 * 2; break;
6575      case 15: if (CCF) cpustate->pc += dsp8 * 2; break;
6576    }
6608      case  0: if (CC0) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6609      case  1: if (CC1) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6610      case  2: if (CC2) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6611      case  3: if (CC3) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6612      case  4: if (CC4) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6613      case  5: if (CC5) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6614      case  6: if (CC6) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6615      case  7: if (CC7) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6616      case  8: if (CC8) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6617      case  9: if (CC9) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6618      case  10: if (CCA) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6619      case  11: if (CCB) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6620      case  12: if (CCC) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6621      case  13: if (CCD) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6622      case  14: if (CCE) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6623      case  15: if (CCF) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6624   }
65776625}
65786626
65796627/******************************************
r15120r15121
65866634    GET_DSP7;
65876635    cpustate->RB(dst) -= 1;
65886636    if (cpustate->RB(dst)) {
6589        cpustate->pc = cpustate->pc - 2 * dsp7;
6637        cpustate->pc = addr_sub(cpustate, cpustate->pc, 2 * dsp7);
65906638    }
65916639}
65926640
r15120r15121
66006648   GET_DSP7;
66016649   cpustate->RW(dst) -= 1;
66026650   if (cpustate->RW(dst)) {
6603      cpustate->pc = cpustate->pc - 2 * dsp7;
6651        cpustate->pc = addr_sub(cpustate, cpustate->pc, 2 * dsp7);
66046652   }
66056653}
6606
6607
src/emu/cpu/z8000/z8000tbl.c
r15120r15121
7575{0x1600,0x160f, 1,3, 14,Z16_0000_dddd_imm32,                "addl    %rl3,%#l1",            0},
7676{0x1610,0x16ff, 1,1, 14,Z16_ssN0_dddd,                      "addl    %rl3,@%rw2",            0},
7777{0x1711,0x17ff, 1,1, 12,Z17_ssN0_ddN0,                      "pop     @%rw3,@%rw2",            0},
78{0x1800,0x180f, 1,1,282,Z18_00N0_dddd_imm32,                "multl   %rq3,@%l#1",            0},
7879{0x1810,0x18ff, 1,1,282,Z18_ssN0_dddd,                      "multl   %rq3,@%rw2",            0},
7980{0x1900,0x190f, 1,2, 70,Z19_0000_dddd_imm16,                "mult    %rl3,%#w1",            0},
8081{0x1910,0x19ff, 1,1, 70,Z19_ssN0_dddd,                      "mult    %rl3,@%rw2",            0},
r15120r15121
388389{0x8c02,0x8cf2,16,1,  7,Z8C_dddd_0010,                      "negb    %rb2",               0},
389390{0x8c04,0x8cf4,16,1,  7,Z8C_dddd_0100,                      "testb   %rb2",               0},
390391{0x8c06,0x8cf6,16,1,  7,Z8C_dddd_0110,                      "tsetb   %rb2",               0},
391{0x8c08,0x8cf8,16,1,  7,Z8C_dddd_1000,                      "clrb    %rb2",               0},
392{0x8d00,0x8df0,16,1,  7,Z8D_dddd_0000,                      "com     %rw2",               0},
393{0x8d01,0x8df1,16,1,  7,Z8D_imm4_0001,                      "setflg  %f2",                  0},
394{0x8d02,0x8df2,16,1,  7,Z8D_dddd_0010,                      "neg     %rw2",               0},
395{0x8d03,0x8df3,16,1,  7,Z8D_imm4_0011,                      "resflg  %f2",                  0},
396{0x8d04,0x8df4,16,1,  7,Z8D_dddd_0100,                      "test    %rw2",               0},
397{0x8d05,0x8df5,16,1,  7,Z8D_imm4_0101,                      "comflg  %f2",                  0},
398{0x8d06,0x8df6,16,1,  7,Z8D_dddd_0110,                      "tset    %rw2",               0},
399{0x8d07,0x8d07, 1,1,  7,Z8D_0000_0111,                      "nop",                        0},
400{0x8d08,0x8df8,16,1,  7,Z8D_dddd_1000,                      "clr     %rw2",               0},
401{0x8e00,0x8eff, 1,1, 10,Z8E_imm8,                         "ext8e   %#b1",               0},
402{0x8f00,0x8fff, 1,1, 10,Z8F_imm8,                         "ext8f   %#b1",               0},
403{0x9000,0x90ff, 1,1,  8,Z90_ssss_dddd,                      "cpl     %rl3,%rl2",            0},
404{0x9110,0x91ff, 1,1, 12,Z91_ddN0_ssss,                      "pushl   @%rw2,%rl3",            0},
405{0x9200,0x92ff, 1,1,  8,Z92_ssss_dddd,                      "subl    %rl3,%rl2",            0},
406{0x9310,0x93ff, 1,1,  9,Z93_ddN0_ssss,                      "push    @%rw2,%rw3",            0},
407{0x9400,0x94ff, 1,1,  5,Z94_ssss_dddd,                      "ldl     %rl3,%rl2",            0},
408{0x9510,0x95ff, 1,1, 12,Z95_ssN0_dddd,                      "popl    %rl3,@%rw2",            0},
409{0x9600,0x96ff, 1,1,  8,Z96_ssss_dddd,                      "addl    %rl3,%rl2",            0},
410{0x9710,0x97ff, 1,1,  8,Z97_ssN0_dddd,                      "pop     %rw3,@%rw2",            0},
411{0x9800,0x98ff, 1,1,282,Z98_ssss_dddd,                      "multl   %rq3,%rl2",            0},
412{0x9900,0x99ff, 1,1, 70,Z99_ssss_dddd,                      "mult    %rl3,%rw2",            0},
413{0x9a00,0x9aff, 1,1,744,Z9A_ssss_dddd,                      "divl    %rq3,%rl2",            0},
414{0x9b00,0x9bff, 1,1,107,Z9B_ssss_dddd,                      "div     %rl3,%rw2",            0},
415{0x9c08,0x9cf8,16,1, 13,Z9C_dddd_1000,                      "testl   %rl2",               0},
416{0x9d00,0x9dff, 1,1, 10,Z9D_imm8,                         "rsvd9d",                     0},
417{0x9e00,0x9e0f, 1,1, 10,Z9E_0000_cccc,                      "ret     %c3",                  DASMFLAG_STEP_OUT},
418{0x9f00,0x9fff, 1,1, 10,Z9F_imm8,                         "rsvd9f",                     0},
419{0xa000,0xa0ff, 1,1,  3,ZA0_ssss_dddd,                      "ldb     %rb3,%rb2",            0},
420{0xa100,0xa1ff, 1,1,  3,ZA1_ssss_dddd,                      "ld      %rw3,%rw2",            0},
421{0xa200,0xa2ff, 1,1,  4,ZA2_dddd_imm4,                      "resb    %rb2,%3",               0},
422{0xa300,0xa3ff, 1,1,  4,ZA3_dddd_imm4,                      "res     %rw2,%3",               0},
423{0xa400,0xa4ff, 1,1,  4,ZA4_dddd_imm4,                      "setb    %rb2,%3",               0},
424{0xa500,0xa5ff, 1,1,  4,ZA5_dddd_imm4,                      "set     %rw2,%3",               0},
425{0xa600,0xa6ff, 1,1,  4,ZA6_dddd_imm4,                      "bitb    %rb2,%3",               0},
426{0xa700,0xa7ff, 1,1,  4,ZA7_dddd_imm4,                      "bit     %rw2,%3",               0},
427{0xa800,0xa8ff, 1,1,  4,ZA8_dddd_imm4m1,                   "incb    %rb2,%+3",            0},
428{0xa900,0xa9ff, 1,1,  4,ZA9_dddd_imm4m1,                   "inc     %rw2,%+3",            0},
429{0xaa00,0xaaff, 1,1,  4,ZAA_dddd_imm4m1,                   "decb    %rb2,%+3",            0},
430{0xab00,0xabff, 1,1,  4,ZAB_dddd_imm4m1,                   "dec     %rw2,%+3",            0},
431{0xac00,0xacff, 1,1,  6,ZAC_ssss_dddd,                      "exb     %rb3,%rb2",            0},
432{0xad00,0xadff, 1,1,  6,ZAD_ssss_dddd,                      "ex      %rw3,%rw2",            0},
433{0xae00,0xaeff, 1,1,  5,ZAE_dddd_cccc,                      "tccb    %c3,%rb2",            0},
434{0xaf00,0xafff, 1,1,  5,ZAF_dddd_cccc,                      "tcc     %c3,%rw2",            0},
435{0xb000,0xb0f0,16,1,  5,ZB0_dddd_0000,                      "dab     %rb2",               0},
436{0xb100,0xb1f0,16,1, 11,ZB1_dddd_0000,                      "extsb   %rw2",               0},
437{0xb107,0xb1f7,16,1, 11,ZB1_dddd_0111,                      "extsl   %rq2",               0},
438{0xb10a,0xb1fa,16,1, 11,ZB1_dddd_1010,                      "exts    %rl2",               0},
439{0xb200,0xb2f0,16,1,  6,ZB2_dddd_00I0,                      "rlb     %rb2,%?3",            0},
440{0xb201,0xb2f1,16,2, 13,ZB2_dddd_0001_imm8,                   "s%*lb    %rb2,%$3",            0},
441{0xb202,0xb2f2,16,1,  6,ZB2_dddd_00I0,                      "rlb     %rb2,%?3",            0},
442{0xb203,0xb2f3,16,2, 15,ZB2_dddd_0011_0000_ssss_0000_0000,       "sdlb    %rb2,%rw5",            0},
443{0xb204,0xb2f4,16,1,  6,ZB2_dddd_01I0,                      "rrb     %rb2,%?3",            0},
444{0xb206,0xb2f6,16,1,  6,ZB2_dddd_01I0,                      "rrb     %rb2,%?3",            0},
445{0xb208,0xb2f8,16,1,  9,ZB2_dddd_10I0,                      "rlcb    %rb2,%?3",            0},
446{0xb209,0xb2f9,16,2, 13,ZB2_dddd_1001_imm8,                   "s%*ab    %rb2,%$3",            0},
447{0xb20a,0xb2fa,16,1,  9,ZB2_dddd_10I0,                      "rlcb    %rb2,%?3",            0},
448{0xb20b,0xb2fb,16,2, 15,ZB2_dddd_1011_0000_ssss_0000_0000,       "sdab    %rb2,%rw5",            0},
449{0xb20c,0xb2fc,16,1,  9,ZB2_dddd_11I0,                      "rrcb    %rb2,%?3",            0},
450{0xb20e,0xb2fe,16,1,  9,ZB2_dddd_11I0,                      "rrcb    %rb2,%?3",            0},
451{0xb300,0xb3f0,16,1,  6,ZB3_dddd_00I0,                      "rl      %rw2,%?3",            0},
452{0xb301,0xb3f1,16,2, 13,ZB3_dddd_0001_imm8,                   "s%*l     %rw2,%$3",            0},
453{0xb302,0xb3f2,16,1,  6,ZB3_dddd_00I0,                      "rl      %rw2,%?3",            0},
454{0xb303,0xb3f3,16,2, 15,ZB3_dddd_0011_0000_ssss_0000_0000,       "sdl     %rw2,%rw5",            0},
455{0xb304,0xb3f4,16,1,  6,ZB3_dddd_01I0,                      "rr      %rw2,%?3",            0},
456{0xb305,0xb3f5,16,2, 13,ZB3_dddd_0101_imm8,                   "s%*ll    %rl2,%$3",            0},
457{0xb306,0xb3f6,16,1,  6,ZB3_dddd_01I0,                      "rr      %rw2,%?3",            0},
458{0xb307,0xb3f7,16,2, 15,ZB3_dddd_0111_0000_ssss_0000_0000,       "sdll    %rl2,%rw5",            0},
459{0xb308,0xb3f8,16,1,  6,ZB3_dddd_10I0,                      "rlc     %rw2,%?3",            0},
460{0xb309,0xb3f9,16,2, 13,ZB3_dddd_1001_imm8,                   "s%*a     %rw2,%$3",            0},
461{0xb30a,0xb3fa,16,1,  6,ZB3_dddd_10I0,                      "rlc     %rw2,%?3",            0},
462{0xb30b,0xb3fb,16,2, 15,ZB3_dddd_1011_0000_ssss_0000_0000,       "sda     %rw2,%rw5",            0},
463{0xb30c,0xb3fc,16,1,  6,ZB3_dddd_11I0,                      "rrc     %rw2,%?3",            0},
464{0xb30d,0xb3fd,16,2, 13,ZB3_dddd_1101_imm8,                   "s%*al    %rl2,%$3",            0},
465{0xb30e,0xb3fe,16,1,  6,ZB3_dddd_11I0,                      "rrc     %rw2,%?3",            0},
466{0xb30f,0xb3ff,16,2, 15,ZB3_dddd_1111_0000_ssss_0000_0000,       "sdal    %rl2,%rw5",            0},
467{0xb400,0xb4ff, 1,1,  5,ZB4_ssss_dddd,                      "adcb    %rb3,%rb2",            0},
468{0xb500,0xb5ff, 1,1,  5,ZB5_ssss_dddd,                      "adc     %rw3,%rw2",            0},
469{0xb600,0xb6ff, 1,1,  5,ZB6_ssss_dddd,                      "sbcb    %rb3,%rb2",            0},
470{0xb700,0xb7ff, 1,1,  5,ZB7_ssss_dddd,                      "sbc     %rw3,%rw2",            0},
471{0xb810,0xb8f0,16,2, 25,ZB8_ddN0_0000_0000_rrrr_ssN0_0000,       "trib    @%rw2,@%rw6,%rb5",      0},
472{0xb812,0xb8f2,16,2, 25,ZB8_ddN0_0010_0000_rrrr_ssN0_0000,       "trtib   @%rw2,@%rw6,%rb5",      0},
473{0xb814,0xb8f4,16,2, 25,ZB8_ddN0_0100_0000_rrrr_ssN0_0000,       "trirb   @%rw2,@%rw6,%rb5",      0},
474{0xb816,0xb8f6,16,2, 25,ZB8_ddN0_0110_0000_rrrr_ssN0_1110,       "trtirb  @%rw2,@%rw6,%rb5",      0},
475{0xb818,0xb8f8,16,2, 25,ZB8_ddN0_1000_0000_rrrr_ssN0_0000,       "trdb    @%rw2,@%rw6,%rb5",      0},
476{0xb81a,0xb8fa,16,2, 25,ZB8_ddN0_1010_0000_rrrr_ssN0_0000,       "trtrb   @%rw2,@%rw6,%rb5",      0},
477{0xb81c,0xb8fc,16,2, 25,ZB8_ddN0_1100_0000_rrrr_ssN0_0000,       "trdrb   @%rw2,@%rw6,%rb5",      0},
478{0xb81e,0xb8fe,16,2, 25,ZB8_ddN0_1110_0000_rrrr_ssN0_1110,       "trtdrb  @%rw2,@%rw6,%rb5",      0},
479{0xb900,0xb9ff,16,1, 10,ZB9_imm8,                         "rsvdb9",                     0},
480{0xba10,0xbaf0,16,2, 11,ZBA_ssN0_0000_0000_rrrr_dddd_cccc,       "cpib    %rb6,@%rw2,%rw5,%c7",      0},
481{0xba11,0xbaf1,16,2, 11,ZBA_ssN0_0001_0000_rrrr_ddN0_x000,       "ldirb   @%rw6,@%rw2,%rw5",      DASMFLAG_STEP_OVER},
482{0xba12,0xbaf2,16,2, 11,ZBA_ssN0_0010_0000_rrrr_ddN0_cccc,       "cpsib   @%rw6,@%rw2,%rw5,%c7",   0},
483{0xba14,0xbaf4,16,2, 11,ZBA_ssN0_0100_0000_rrrr_dddd_cccc,       "cpirb   %rb6,@%rw2,%rw5,%c7",      DASMFLAG_STEP_OVER},
484{0xba16,0xbaf6,16,2, 11,ZBA_ssN0_0110_0000_rrrr_ddN0_cccc,       "cpsirb  @%rw6,@%rw2,%rw5,%c7",   DASMFLAG_STEP_OVER},
485{0xba18,0xbaf8,16,2, 11,ZBA_ssN0_1000_0000_rrrr_dddd_cccc,       "cpdb    %rb6,@%rw2,%rw5,%c7",      0},
486{0xba19,0xbaf9,16,2, 11,ZBA_ssN0_1001_0000_rrrr_ddN0_x000,       "lddrb   @%rw2,@%rw6,%rw5",      DASMFLAG_STEP_OVER},
487{0xba1a,0xbafa,16,2, 11,ZBA_ssN0_1010_0000_rrrr_ddN0_cccc,       "cpsdb   @%rw6,@%rw2,%rw5,%c7",   0},
488{0xba1c,0xbafc,16,2, 11,ZBA_ssN0_1100_0000_rrrr_dddd_cccc,       "cpdrb   %rb6,@%rw2,%rw5,%c7",      DASMFLAG_STEP_OVER},
489{0xba1e,0xbafe,16,2, 11,ZBA_ssN0_1110_0000_rrrr_ddN0_cccc,       "cpsdrb  @%rw6,@%rw2,%rw5,%c7",   DASMFLAG_STEP_OVER},
490{0xbb10,0xbbf0,16,2, 11,ZBB_ssN0_0000_0000_rrrr_dddd_cccc,       "cpi     %rw6,@%rw2,%rw5,%c7",      0},
491{0xbb11,0xbbf1,16,2, 11,ZBB_ssN0_0001_0000_rrrr_ddN0_x000,       "ldir    @%rw6,@%rw2,%rw5",      DASMFLAG_STEP_OVER},
492{0xbb12,0xbbf2,16,2, 11,ZBB_ssN0_0010_0000_rrrr_ddN0_cccc,       "cpsi    @%rw6,@%rw2,%rw5,%c7",   0},
493{0xbb14,0xbbf4,16,2, 11,ZBB_ssN0_0100_0000_rrrr_dddd_cccc,       "cpir    %rw6,@%rw2,%rw5,%c7",      DASMFLAG_STEP_OVER},
494{0xbb16,0xbbf6,16,2, 11,ZBB_ssN0_0110_0000_rrrr_ddN0_cccc,       "cpsir   @%rw6,@%rw2,%rw5,%c7",   DASMFLAG_STEP_OVER},
495{0xbb18,0xbbf8,16,2, 11,ZBB_ssN0_1000_0000_rrrr_dddd_cccc,       "cpd     %rw6,@%rw2,%rw5,%c7",      0},
496{0xbb19,0xbbf9,16,2, 11,ZBB_ssN0_1001_0000_rrrr_ddN0_x000,       "lddr    @%rw2,@%rw6,%rw5",      DASMFLAG_STEP_OVER},
497{0xbb1a,0xbbfa,16,2, 11,ZBB_ssN0_1010_0000_rrrr_ddN0_cccc,       "cpsd    @%rw6,@%rw2,%rw5,%c7",   0},
498{0xbb1c,0xbbfc,16,2, 11,ZBB_ssN0_1100_0000_rrrr_dddd_cccc,       "cpdr    %rw6,@%rw2,%rw5,%c7",      DASMFLAG_STEP_OVER},
499{0xbb1e,0xbbfe,16,2, 11,ZBB_ssN0_1110_0000_rrrr_ddN0_cccc,       "cpsdr   @%rw6,@%rw2,%rw5,%c7",   DASMFLAG_STEP_OVER},
500{0xbc00,0xbcff, 1,1,  9,ZBC_aaaa_bbbb,                      "rrdb    %rb3,%rb2",            0},
501{0xbd00,0xbdff, 1,1,  5,ZBD_dddd_imm4,                      "ldk     %rw2,%3",               0},
502{0xbe00,0xbeff, 1,1,  9,ZBE_aaaa_bbbb,                      "rldb    %rb3,%rb2",            0},
503{0xbf00,0xbfff, 1,1, 10,ZBF_imm8,                         "rsvdbf",                     0},
504{0xc000,0xcfff, 1,1,  5,ZC_dddd_imm8,                      "ldb     %rb1,%#b1",            0},
505{0xd000,0xdfff, 1,1, 10,ZD_dsp12,                         "calr    %d2",                  DASMFLAG_STEP_OVER},
506{0xe000,0xefff, 1,1,  6,ZE_cccc_dsp8,                      "jr      %c1,%d1",               0},
507{0xf000,0xf07f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
508{0xf100,0xf17f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
509{0xf200,0xf27f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
510{0xf300,0xf37f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
511{0xf400,0xf47f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
512{0xf500,0xf57f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
513{0xf600,0xf67f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
514{0xf700,0xf77f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
515{0xf800,0xf87f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
516{0xf900,0xf97f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
517{0xfa00,0xfa7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
518{0xfb00,0xfb7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
519{0xfc00,0xfc7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
520{0xfd00,0xfd7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
521{0xfe00,0xfe7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
522{0xff00,0xff7f, 1,1, 11,ZF_dddd_0dsp7,                      "dbjnz   %rb1,%d0",            DASMFLAG_STEP_OVER},
523{0xf080,0xf0ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
524{0xf180,0xf1ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
525{0xf280,0xf2ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
526{0xf380,0xf3ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
527{0xf480,0xf4ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
528{0xf580,0xf5ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
529{0xf680,0xf6ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
530{0xf780,0xf7ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
531{0xf880,0xf8ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
532{0xf980,0xf9ff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
533{0xfa80,0xfaff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
534{0xfb80,0xfbff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
535{0xfc80,0xfcff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
536{0xfd80,0xfdff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
537{0xfe80,0xfeff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
538{0xff80,0xffff, 1,1, 11,ZF_dddd_1dsp7,                      "djnz    %rw1,%d0",            DASMFLAG_STEP_OVER},
539{0,    0,      0,0,  0,NULL,                           NULL,                        0}
540};
541392
542/*
543opcodes in segmented mode
544*/
393{0x8c01,0x8cf1,16,1,  7,Z8C_dddd_0001,                      "ldctlb  %rb2,flags",               0},
545394
546static const Z8000_init seg_table[] = {
547{0x0000,0x000f, 1,2,  7,Z00_0000_dddd_imm8,                   "addb    %rb3,%#b3",            0},
548{0x0010,0x00ff, 1,1,  7,Z00_ssN0_dddd,                      "addb    %rb3,@%rw2",            0},
549{0x0100,0x010f, 1,2,  7,Z01_0000_dddd_imm16,                "add     %rw3,%#w1",            0},
550{0x0110,0x01ff, 1,1,  7,Z01_ssN0_dddd,                      "add     %rw3,@%rw2",            0},
551{0x0200,0x020f, 1,2,  7,Z02_0000_dddd_imm8,                   "subb    %rb3,%#b3",            0},
552{0x0210,0x02ff, 1,1,  7,Z02_ssN0_dddd,                      "subb    %rb3,@%rw2",            0},
553{0x0300,0x030f, 1,2,  7,Z03_0000_dddd_imm16,                "sub     %rw3,%#w1",            0},
554{0x0310,0x03ff, 1,1,  7,Z03_ssN0_dddd,                      "sub     %rw3,@%rw2",            0},
555{0x0400,0x040f, 1,2,  7,Z04_0000_dddd_imm8,                   "orb     %rb3,%#b3",            0},
556{0x0410,0x04ff, 1,1,  7,Z04_ssN0_dddd,                      "orb     %rb3,@%rw2",            0},
557{0x0500,0x050f, 1,2,  7,Z05_0000_dddd_imm16,                "or      %rw3,%#w1",            0},
558{0x0510,0x05ff, 1,1,  7,Z05_ssN0_dddd,                      "or      %rw3,@%rw2",            0},
559{0x0600,0x060f, 1,2,  7,Z06_0000_dddd_imm8,                   "andb    %rb3,%#b3",            0},
560{0x0610,0x06ff, 1,1,  7,Z06_ssN0_dddd,                      "andb    %rb3,@%rw2",            0},
561{0x0700,0x070f, 1,2,  7,Z07_0000_dddd_imm16,                "and     %rw3,%#w1",            0},
562{0x0710,0x07ff, 1,1,  7,Z07_ssN0_dddd,                      "and     %rw3,@%rw2",            0},
563{0x0800,0x080f, 1,2,  7,Z08_0000_dddd_imm8,                   "xorb    %rb3,%#b3",            0},
564{0x0810,0x08ff, 1,1,  7,Z08_ssN0_dddd,                      "xorb    %rb3,@%rw2",            0},
565{0x0900,0x090f, 1,2,  7,Z09_0000_dddd_imm16,                "xor     %rw3,%#w1",            0},
566{0x0910,0x09ff, 1,1,  7,Z09_ssN0_dddd,                      "xor     %rw3,@%rw2",            0},
567{0x0a00,0x0a0f, 1,2,  7,Z0A_0000_dddd_imm8,                   "cpb     %rb3,%#b3",            0},
568{0x0a10,0x0aff, 1,1,  7,Z0A_ssN0_dddd,                      "cpb     %rb3,@%rw2",            0},
569{0x0b00,0x0b0f, 1,2,  7,Z0B_0000_dddd_imm16,                "cp      %rw3,%#w1",            0},
570{0x0b10,0x0bff, 1,1,  7,Z0B_ssN0_dddd,                      "cp      %rw3,@%rw2",            0},
571{0x0c10,0x0cf0,16,1, 12,Z0C_ddN0_0000,                      "comb    @%rw2",               0},
572{0x0c11,0x0cf1,16,2, 11,Z0C_ddN0_0001_imm8,                   "cpb     @%rw2,%#b3",            0},
573{0x0c12,0x0cf2,16,1, 12,Z0C_ddN0_0010,                      "negb    @%rw2",               0},
574{0x0c14,0x0cf4,16,1,  8,Z0C_ddN0_0100,                      "testb   @%rw2",               0},
575{0x0c15,0x0cf5,16,2,  7,Z0C_ddN0_0101_imm8,                   "ldb     @%rw2,%#b3",            0},
576{0x0c16,0x0cf6,16,1, 11,Z0C_ddN0_0110,                      "tsetb   @%rw2",               0},
577{0x0c18,0x0cf8,16,1,  8,Z0C_ddN0_1000,                      "clrb    @%rw2",               0},
578{0x0d10,0x0df0,16,1, 12,Z0D_ddN0_0000,                      "com     @%rw2",               0},
579{0x0d11,0x0df1,16,2, 11,Z0D_ddN0_0001_imm16,                "cp      @%rw2,%#w1",            0},
580{0x0d12,0x0df2,16,1, 12,Z0D_ddN0_0010,                      "neg     @%rw2",               0},
581{0x0d14,0x0df4,16,1,  8,Z0D_ddN0_0100,                      "test    @%rw2",               0},
582{0x0d15,0x0df5,16,2, 11,Z0D_ddN0_0101_imm16,                "ld      @%rw2,%#w1",            0},  /* fix cycles ld IR,IM */
583{0x0d16,0x0df6,16,1, 11,Z0D_ddN0_0110,                      "tset    @%rw2",               0},
584{0x0d18,0x0df8,16,1,  8,Z0D_ddN0_1000,                      "clr     @%rw2",               0},
585{0x0d19,0x0df9,16,2, 12,Z0D_ddN0_1001_imm16,                "push    @%rw2,%#w1",            0},
586{0x0e00,0x0eff, 1,1, 10,Z0E_imm8,                         "ext0e   %#b1",               0},
587{0x0f00,0x0fff, 1,1, 10,Z0F_imm8,                         "ext0f   %#b1",               0},
588{0x1000,0x100f, 1,3, 14,Z10_0000_dddd_imm32,                "cpl     %rl3,%#l1",            0},
589{0x1010,0x10ff, 1,1, 14,Z10_ssN0_dddd,                      "cpl     %rl3,@%rw2",            0},
590{0x1111,0x11ff, 1,1, 20,Z11_ddN0_ssN0,                      "pushl   @%rw2,@%rw3",            0},
591{0x1200,0x120f, 1,3, 14,Z12_0000_dddd_imm32,                "subl    %rl3,%#l1",            0},
592{0x1210,0x12ff, 1,1, 14,Z12_ssN0_dddd,                      "subl    %rl3,@%rw2",            0},
593{0x1311,0x13ff, 1,1, 13,Z13_ddN0_ssN0,                      "push    @%rw2,@%rw3",            0},
594{0x1400,0x140f, 1,3, 11,Z14_0000_dddd_imm32,                "ldl     %rl3,%#l1",            0},
595{0x1410,0x14ff, 1,1, 11,Z14_ssN0_dddd,                      "ldl     %rl3,@%rw2",            0},
596{0x1511,0x15ff, 1,1, 19,Z15_ssN0_ddN0,                      "popl    @%rw3,@%rw2",            0},
597{0x1600,0x160f, 1,3, 14,Z16_0000_dddd_imm32,                "addl    %rl3,%#l1",            0},
598{0x1610,0x16ff, 1,1, 14,Z16_ssN0_dddd,                      "addl    %rl3,@%rw2",            0},
599{0x1711,0x17ff, 1,1, 12,Z17_ssN0_ddN0,                      "pop     @%rw3,@%rw2",            0},
600{0x1810,0x18ff, 1,1,282,Z18_ssN0_dddd,                      "multl   %rq3,@%rw2",            0},
601{0x1900,0x190f, 1,2, 70,Z19_0000_dddd_imm16,                "mult    %rl3,%#w1",            0},
602{0x1910,0x19ff, 1,1, 70,Z19_ssN0_dddd,                      "mult    %rl3,@%rw2",            0},
603{0x1a00,0x1a0f, 1,3,744,Z1A_0000_dddd_imm32,                "divl    %rq3,%#l1",            0},
604{0x1a10,0x1aff, 1,1,744,Z1A_ssN0_dddd,                      "divl    %rq3,@%rw2",            0},
605{0x1b00,0x1b0f, 1,2,107,Z1B_0000_dddd_imm16,                "div     %rl3,%#w1",            0},
606{0x1b10,0x1bff, 1,1,107,Z1B_ssN0_dddd,                      "div     %rl3,@%rw2",            0},
607{0x1c11,0x1cf1,16,2, 11,Z1C_ssN0_0001_0000_dddd_0000_nmin1,       "ldm     %rw5,@%rw2,#%n",         0},
608{0x1c18,0x1cf8,16,1, 13,Z1C_ddN0_1000,                      "testl   @%rw2",               0},
609{0x1c19,0x1cf9,16,2, 11,Z1C_ddN0_1001_0000_ssss_0000_nmin1,       "ldm     @%rw2,%rw5,#%n",         0},
610{0x1d10,0x1dff, 1,1, 11,Z1D_ddN0_ssss,                      "ldl     @%rw2,%rl3",            0},
611{0x1e10,0x1eff, 1,1, 10,Z1E_ddN0_cccc,                      "jp      %c3,@%rl2",            0},
612{0x1f10,0x1ff0,16,1, 10,Z1F_ddN0_0000,                      "call    %rw2",               DASMFLAG_STEP_OVER},
613{0x2010,0x20ff, 1,1,  7,Z20_ssN0_dddd_seg,                   "ldb     %rb3,@%rw2",            0},
614{0x2100,0x210f, 1,2,  7,Z21_0000_dddd_imm16,                "ld      %rw3,%#w1",            0},
615{0x2110,0x21ff, 1,1,  7,Z21_ssN0_dddd,                      "ld      %rw3,@%rw2",            0},
616{0x2200,0x220f, 1,2, 10,Z22_0000_ssss_0000_dddd_0000_0000,       "resb    %rb5,%rw3",            0},
617{0x2210,0x22ff, 1,1, 11,Z22_ddN0_imm4,                      "resb    @%rw3,%3",            0},
618{0x2300,0x230f, 1,2, 10,Z23_0000_ssss_0000_dddd_0000_0000,       "res     %rw5,%rw3",            0},
619{0x2310,0x23ff, 1,1, 11,Z23_ddN0_imm4,                      "res     @%rw3,%3",            0},
620{0x2400,0x240f, 1,2, 10,Z24_0000_ssss_0000_dddd_0000_0000,       "setb    %rb5,%rw3",            0},
621{0x2410,0x24ff, 1,1, 11,Z24_ddN0_imm4,                      "setb    @%rw3,%3",            0},
622{0x2500,0x250f, 1,2, 10,Z25_0000_ssss_0000_dddd_0000_0000,       "set     %rw5,%rw3",            0},
623{0x2510,0x25ff, 1,1, 11,Z25_ddN0_imm4,                      "set     @%rw3,%3",            0},
624{0x2600,0x260f, 1,2, 10,Z26_0000_ssss_0000_dddd_0000_0000,       "bitb    %rb5,%rw3",            0},
625{0x2610,0x26ff, 1,1,  8,Z26_ddN0_imm4,                      "bitb    @%rw3,%3",            0},
626{0x2700,0x270f, 1,2, 10,Z27_0000_ssss_0000_dddd_0000_0000,       "bit     %rw5,%rw3",            0},
627{0x2710,0x27ff, 1,1,  8,Z27_ddN0_imm4,                      "bit     @%rw2,%3",            0},
628{0x2810,0x28ff, 1,1, 11,Z28_ddN0_imm4m1,                   "incb    @%rw2,%+3",            0},
629{0x2910,0x29ff, 1,1, 11,Z29_ddN0_imm4m1,                   "inc     @%rw2,%+3",            0},
630{0x2a10,0x2aff, 1,1, 11,Z2A_ddN0_imm4m1,                   "decb    @%rw2,%+3",            0},
631{0x2b10,0x2bff, 1,1, 11,Z2B_ddN0_imm4m1,                   "dec     @%rw2,%+3",            0},
632{0x2c10,0x2cff, 1,1, 12,Z2C_ssN0_dddd,                      "exb     %rb3,@%rw2",            0},
633{0x2d10,0x2dff, 1,1, 12,Z2D_ssN0_dddd,                      "ex      %rw3,@%rw2",            0},
634{0x2e10,0x2eff, 1,1,  8,Z2E_ddN0_ssss,                      "ldb     @%rw2,%rb3",            0},
635{0x2f10,0x2fff, 1,1,  8,Z2F_ddN0_ssss,                      "ld      @%rw2,%rw3",            0},
636{0x3000,0x300f, 1,2, 14,Z30_0000_dddd_dsp16,                "ldrb    %rb3,%p1",            0},
637{0x3010,0x30ff, 1,2, 14,Z30_ssN0_dddd_imm16,                "ldb     %rb3,%rw2(%#w1)",         0},
638{0x3100,0x310f, 1,2, 14,Z31_0000_dddd_dsp16,                "ldr     %rw3,%p1",            0},
639{0x3110,0x31ff, 1,2, 14,Z31_ssN0_dddd_imm16,                "ld      %rw3,%rw2(%#w1)",         0},
640{0x3200,0x320f, 1,2, 14,Z32_0000_ssss_dsp16,                "ldrb    %p1,%rb3",            0},
641{0x3210,0x32ff, 1,2, 14,Z32_ddN0_ssss_imm16,                "ldb     %rw2(%#w1),%rb3",         0},
642{0x3300,0x330f, 1,2, 14,Z33_0000_ssss_dsp16,                "ldr     %p1,%rw3",            0},
643{0x3310,0x33ff, 1,2, 14,Z33_ddN0_ssss_imm16,                "ld      %rw2(%#w1),%rw3",         0},
644{0x3400,0x340f, 1,2, 15,Z34_0000_dddd_dsp16,                "ldar    p%rw3,%p1",            0},
645{0x3410,0x34ff, 1,2, 15,Z34_ssN0_dddd_imm16,                "lda     p%rw3,%rw2(%#w1)",      0},
646{0x3500,0x350f, 1,2, 17,Z35_0000_dddd_dsp16,                "ldrl    %rl3,%p1",            0},
647{0x3510,0x35ff, 1,2, 17,Z35_ssN0_dddd_imm16,                "ldl     %rl3,%rw2(%#w1)",         0},
648{0x3600,0x3600, 1,1,  2,Z36_0000_0000,                      "bpt",                        0},
649{0x3601,0x36ff, 1,1, 10,Z36_imm8,                         "rsvd36",                     0},
650{0x3700,0x370f, 1,2, 17,Z37_0000_ssss_dsp16,                "ldrl    %p1,%rl3",            0},
651{0x3710,0x37ff, 1,2, 17,Z37_ddN0_ssss_imm16,                "ldl     %rw2(%#w1),%rl3",         0},
652{0x3800,0x38ff, 1,1, 10,Z38_imm8,                         "rsvd38",                     0},
653{0x3910,0x39f0,16,1, 12,Z39_ssN0_0000,                      "ldps    @%rw2",               0},
654{0x3a00,0x3af0,16,2, 21,Z3A_ssss_0000_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
655{0x3a01,0x3af1,16,2, 21,Z3A_ssss_0001_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
656{0x3a02,0x3af2,16,2, 21,Z3A_ssss_0010_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
657{0x3a03,0x3af3,16,2, 21,Z3A_ssss_0011_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
658{0x3a04,0x3af4,16,2, 10,Z3A_dddd_0100_imm16,                "%R %rb2,%#w1",               0},
659{0x3a05,0x3af5,16,2, 10,Z3A_dddd_0101_imm16,                "%R %rb2,%#w1",               0},
660{0x3a06,0x3af6,16,2, 12,Z3A_ssss_0110_imm16,                "%R %#w1,%rb2",               0},
661{0x3a07,0x3af7,16,2, 12,Z3A_ssss_0111_imm16,                "%R %#w1,%rb2",               0},
662{0x3a08,0x3af8,16,2, 21,Z3A_ssss_1000_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
663{0x3a09,0x3af9,16,2, 21,Z3A_ssss_1001_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
664{0x3a0a,0x3afa,16,2, 21,Z3A_ssss_1010_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
665{0x3a0b,0x3afb,16,2, 21,Z3A_ssss_1011_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
666{0x3b00,0x3bf0,16,2, 21,Z3B_ssss_0000_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
667{0x3b01,0x3bf1,16,2, 21,Z3B_ssss_0001_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
668{0x3b02,0x3bf2,16,2, 21,Z3B_ssss_0010_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
669{0x3b03,0x3bf3,16,2, 21,Z3B_ssss_0011_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
670{0x3b04,0x3bf4,16,2, 12,Z3B_dddd_0100_imm16,                "%R %rw2,%#w1",               0},
671{0x3b05,0x3bf5,16,2, 12,Z3B_dddd_0101_imm16,                "%R %rw2,%#w1",               0},
672{0x3b06,0x3bf6,16,2, 12,Z3B_ssss_0110_imm16,                "%R %#w1,%rw2",               0},
673{0x3b07,0x3bf7,16,2, 12,Z3B_ssss_0111_imm16,                "%R %#w1,%rw2",               0},
674{0x3b08,0x3bf8,16,2, 21,Z3B_ssss_1000_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
675{0x3b09,0x3bf9,16,2, 21,Z3B_ssss_1001_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rw5",            0},
676{0x3b0a,0x3bfa,16,2, 21,Z3B_ssss_1010_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rb5",            0},
677{0x3b0b,0x3bfb,16,2, 21,Z3B_ssss_1011_0000_aaaa_dddd_x000,       "%R @%rw6,@%rw2,%rb5",            0},
678{0x3c00,0x3cff, 1,1, 10,Z3C_ssss_dddd,                      "inb     %rb3,@%rw2",            0},
679{0x3d00,0x3dff, 1,1, 10,Z3D_ssss_dddd,                      "in      %rw3,@%rw2",            0},
680{0x3e00,0x3eff, 1,1, 12,Z3E_dddd_ssss_seg,                   "outb    @%rw2,%rb3",            0},
681{0x3f00,0x3fff, 1,1, 12,Z3F_dddd_ssss,                      "out     @%rw2,%rw3",            0},
682{0x4000,0x400f, 1,2,  9,Z40_0000_dddd_addr,                   "addb    %rb3,%a1",            0},
683{0x4010,0x40ff, 1,2, 10,Z40_ssN0_dddd_addr,                   "addb    %rb3,%a1(%rw2)",         0},
684{0x4100,0x410f, 1,2,  9,Z41_0000_dddd_addr,                   "add     %rw3,%a1",            0},
685{0x4110,0x41ff, 1,2, 10,Z41_ssN0_dddd_addr,                   "add     %rw3,%a1(%rw2)",         0},
686{0x4200,0x420f, 1,2,  9,Z42_0000_dddd_addr,                   "subb    %rb3,%a1",            0},
687{0x4210,0x42ff, 1,2, 10,Z42_ssN0_dddd_addr,                   "subb    %rb3,%a1(%rw2)",         0},
688{0x4300,0x430f, 1,2,  9,Z43_0000_dddd_addr,                   "sub     %rw3,%a1",            0},
689{0x4310,0x43ff, 1,2, 10,Z43_ssN0_dddd_addr,                   "sub     %rw3,%a1(%rw2)",         0},
690{0x4400,0x440f, 1,2,  9,Z44_0000_dddd_addr,                   "orb     %rb3,%a1",            0},
691{0x4410,0x44ff, 1,2, 10,Z44_ssN0_dddd_addr,                   "orb     %rb3,%a1(%rw2)",         0},
692{0x4500,0x450f, 1,2,  9,Z45_0000_dddd_addr,                   "or      %rw3,%a1",            0},
693{0x4510,0x45ff, 1,2, 10,Z45_ssN0_dddd_addr,                   "or      %rw3,%a1(%rw2)",         0},
694{0x4600,0x460f, 1,2,  9,Z46_0000_dddd_addr,                   "andb    %rb3,%a1",            0},
695{0x4610,0x46ff, 1,2, 10,Z46_ssN0_dddd_addr,                   "andb    %rb3,%a1(%rw2)",         0},
696{0x4700,0x470f, 1,2,  9,Z47_0000_dddd_addr,                   "and     %rw3,%a1",            0},
697{0x4710,0x47ff, 1,2, 10,Z47_ssN0_dddd_addr,                   "and     %rw3,%a1(%rw2)",         0},
698{0x4800,0x480f, 1,2,  9,Z48_0000_dddd_addr,                   "xorb    %rb3,%a1",            0},
699{0x4810,0x48ff, 1,2, 10,Z48_ssN0_dddd_addr,                   "xorb    %rb3,%a1(%rw2)",         0},
700{0x4900,0x490f, 1,2,  9,Z49_0000_dddd_addr,                   "xor     %rw3,%a1",            0},
701{0x4910,0x49ff, 1,2, 10,Z49_ssN0_dddd_addr,                   "xor     %rw3,%a1(%rw2)",         0},
702{0x4a00,0x4a0f, 1,2,  9,Z4A_0000_dddd_addr,                   "cpb     %rb3,%a1",            0},
703{0x4a10,0x4aff, 1,2, 10,Z4A_ssN0_dddd_addr,                   "cpb     %rb3,%a1(%rw2)",         0},
704{0x4b00,0x4b0f, 1,2,  9,Z4B_0000_dddd_addr,                   "cp      %rw3,%a1",            0},
705{0x4b10,0x4bff, 1,2, 10,Z4B_ssN0_dddd_addr,                   "cp      %rw3,%a1(%rw2)",         0},
706{0x4c00,0x4c00, 1,2, 15,Z4C_0000_0000_addr,                   "comb    %a1",                  0},
707{0x4c01,0x4c01, 1,3, 14,Z4C_0000_0001_addr_imm8,             "cpb     %a1,%#b3",            0},
708{0x4c02,0x4c02, 1,2, 15,Z4C_0000_0010_addr,                   "negb    %a1",                  0},
709{0x4c04,0x4c04, 1,2, 11,Z4C_0000_0100_addr,                   "testb   %a1",                  0},
710{0x4c05,0x4c05, 1,3, 14,Z4C_0000_0101_addr_imm8,             "ldb     %a1,%#b3",            0},
711{0x4c06,0x4c06, 1,2, 14,Z4C_0000_0110_addr,                   "tsetb   %a1",                  0},
712{0x4c08,0x4c08, 1,1, 0, Z4C_0000_1000_addr_seg,                "clrb    %a1",                  0},
713{0x4c10,0x4cf0,16,2, 16,Z4C_ddN0_0000_addr,                   "comb    %a1(%rw2)",            0},
714{0x4c11,0x4cf1,16,3, 15,Z4C_ddN0_0001_addr_imm8,             "cpb     %a1(%rw2),%#b3",         0},
715{0x4c12,0x4cf2,16,2, 16,Z4C_ddN0_0010_addr,                   "negb    %a1(%rw2)",            0},
716{0x4c14,0x4cf4,16,2, 12,Z4C_ddN0_0100_addr,                   "testb   %a1(%rw2)",            0},
717{0x4c15,0x4cf5,16,3, 15,Z4C_ddN0_0101_addr_imm8,             "ldb     %a1(%rw2),%#b3",         0},
718{0x4c16,0x4cf6,16,2, 15,Z4C_ddN0_0110_addr,                   "tsetb   %a1(%rw2)",            0},
719{0x4c18,0x4cf8,16,2, 12,Z4C_ddN0_1000_addr,                   "clrb    %a1(%rw2)",            0},
720{0x4d00,0x4d00, 1,2, 15,Z4D_0000_0000_addr,                   "com     %a1",                  0},
721{0x4d01,0x4d01, 1,3, 14,Z4D_0000_0001_addr_imm16,             "cp      %a1,%#w2",            0},
722{0x4d02,0x4d02, 1,2, 15,Z4D_0000_0010_addr,                   "neg     %a1",                  0},
723{0x4d04,0x4d04, 1,2, 11,Z4D_0000_0100_addr,                   "test    %a1",                  0},
724{0x4d05,0x4d05, 1,1, 0, Z4D_0000_0101_addr_imm16_seg,          "ld      %a1,%#w2",            0},
725{0x4d06,0x4d06, 1,2, 14,Z4D_0000_0110_addr,                   "tset    %a1",                  0},
726{0x4d08,0x4d08, 1,1, 0, Z4D_0000_1000_addr_seg,                "clr     %a1",                  0},
727{0x4d10,0x4df0,16,2, 16,Z4D_ddN0_0000_addr,                   "com     %a1(%rw2)",            0},
728{0x4d11,0x4df1,16,3, 15,Z4D_ddN0_0001_addr_imm16,             "cp      %a1(%rw2),%#w2",         0},
729{0x4d12,0x4df2,16,2, 16,Z4D_ddN0_0010_addr,                   "neg     %a1(%rw2)",            0},
730{0x4d14,0x4df4,16,2, 12,Z4D_ddN0_0100_addr,                   "test    %a1(%rw2)",            0},
731{0x4d15,0x4df5,16,3, 15,Z4D_ddN0_0101_addr_imm16,             "ld      %a1(%rw2),%#w2",         0},
732{0x4d16,0x4df6,16,2, 15,Z4D_ddN0_0110_addr,                   "tset    %a1(%rw2)",            0},
733{0x4d18,0x4df8,16,2, 12,Z4D_ddN0_1000_addr,                   "clr     %a1(%rw2)",            0},
734{0x4e11,0x4ef0,16,2, 12,Z4E_ddN0_ssN0_addr,                   "ldb     %a1(%rw2),%rb3",         0},
735{0x5000,0x500f, 1,2, 15,Z50_0000_dddd_addr,                   "cpl     %rl3,%a1",            0},
736{0x5010,0x50ff, 1,2, 16,Z50_ssN0_dddd_addr,                   "cpl     %rl3,%a1(%rw2)",         0},
737{0x5110,0x51f0,16,2, 21,Z51_ddN0_0000_addr,                   "pushl   @%rw2,%a1",            0},
738{0x5111,0x51f1,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
739{0x5112,0x51f2,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
740{0x5113,0x51f3,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
741{0x5114,0x51f4,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
742{0x5115,0x51f5,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
743{0x5116,0x51f6,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
744{0x5117,0x51f7,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
745{0x5118,0x51f8,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
746{0x5119,0x51f9,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
747{0x511a,0x51fa,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
748{0x511b,0x51fb,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
749{0x511c,0x51fc,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
750{0x511d,0x51fd,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
751{0x511e,0x51fe,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
752{0x511f,0x51ff,16,2, 21,Z51_ddN0_ssN0_addr,                   "pushl   @%rw2,%a1(%rw3)",         0},
753{0x5200,0x520f, 1,2, 15,Z52_0000_dddd_addr,                   "subl    %rl3,%a1",            0},
754{0x5210,0x52ff, 1,2, 16,Z52_ssN0_dddd_addr,                   "subl    %rl3,%a1(%rw2)",         0},
755{0x5310,0x53f0,16,2, 14,Z53_ddN0_0000_addr,                   "push    @%rw2,%a1",            0},
756{0x5311,0x53f1,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
757{0x5312,0x53f2,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
758{0x5313,0x53f3,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
759{0x5314,0x53f4,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
760{0x5315,0x53f5,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
761{0x5316,0x53f6,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
762{0x5317,0x53f7,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
763{0x5318,0x53f8,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
764{0x5319,0x53f9,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
765{0x531a,0x53fa,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
766{0x531b,0x53fb,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
767{0x531c,0x53fc,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
768{0x531d,0x53fd,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
769{0x531e,0x53fe,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
770{0x531f,0x53ff,16,2, 14,Z53_ddN0_ssN0_addr,                   "push    @%rw2,%a1(%rw3)",         0},
771{0x5400,0x540f, 1,2, 12,Z54_0000_dddd_addr,                   "ldl     %rl3,%a1",            0},
772{0x5410,0x54ff, 1,2, 13,Z54_ssN0_dddd_addr,                   "ldl     %rl3,%a1(%rw2)",         0},
773{0x5510,0x55f0,16,2, 23,Z55_ssN0_0000_addr,                   "popl    %a1,@%rw2",            0},
774{0x5511,0x55f1,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
775{0x5512,0x55f2,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
776{0x5513,0x55f3,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
777{0x5514,0x55f4,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
778{0x5515,0x55f5,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
779{0x5516,0x55f6,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
780{0x5517,0x55f7,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
781{0x5518,0x55f8,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
782{0x5519,0x55f9,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
783{0x551a,0x55fa,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
784{0x551b,0x55fb,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
785{0x551c,0x55fc,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
786{0x551d,0x55fd,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
787{0x551e,0x55fe,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
788{0x551f,0x55ff,16,2, 23,Z55_ssN0_ddN0_addr,                   "popl    %a1(%rw3),@%rw2",         0},
789{0x5600,0x560f, 1,2, 15,Z56_0000_dddd_addr,                   "addl    %rl3,%a1",            0},
790{0x5610,0x56ff, 1,2, 16,Z56_ssN0_dddd_addr,                   "addl    %rl3,%a1(%rw2)",         0},
791{0x5710,0x57f0,16,2, 16,Z57_ssN0_0000_addr,                   "pop     %a1,@%rw2",            0},
792{0x5711,0x57f1,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
793{0x5712,0x57f2,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
794{0x5713,0x57f3,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
795{0x5714,0x57f4,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
796{0x5715,0x57f5,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
797{0x5716,0x57f6,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
798{0x5717,0x57f7,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
799{0x5718,0x57f8,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
800{0x5719,0x57f9,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
801{0x571a,0x57fa,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
802{0x571b,0x57fb,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
803{0x571c,0x57fc,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
804{0x571d,0x57fd,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
805{0x571e,0x57fe,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
806{0x571f,0x57ff,16,2, 16,Z57_ssN0_ddN0_addr,                   "pop     %a1(%rw3),@%rw2",         0},
807{0x5800,0x580f, 1,2,283,Z58_0000_dddd_addr,                   "multl   %rq3,%a1",            0},
808{0x5810,0x58ff, 1,2,284,Z58_ssN0_dddd_addr,                   "multl   %rq3,%a1(%rw2)",         0},
809{0x5900,0x590f, 1,2, 71,Z59_0000_dddd_addr,                   "mult    %rl3,%a1",            0},
810{0x5910,0x59ff, 1,2, 72,Z59_ssN0_dddd_addr,                   "mult    %rl3,%a1(%rw2)",         0},
811{0x5a00,0x5a0f, 1,2,745,Z5A_0000_dddd_addr,                   "divl    %rq3,%a1",            0},
812{0x5a10,0x5aff, 1,2,746,Z5A_ssN0_dddd_addr,                   "divl    %rq3,%a1(%rw2)",         0},
813{0x5b00,0x5b0f, 1,2,108,Z5B_0000_dddd_addr,                   "div     %rl3,%a1",            0},
814{0x5b10,0x5bff, 1,2,109,Z5B_ssN0_dddd_addr,                   "div     %rl3,%a1(%rw2)",         0},
815{0x5c01,0x5c01, 1,3, 14,Z5C_0000_0001_0000_dddd_0000_nmin1_addr, "ldm     %rw5,%a2,#%n",         0},
816{0x5c08,0x5c08, 1,2, 16,Z5C_0000_1000_addr,                   "testl   %a1",                  0},
817{0x5c09,0x5c09, 1,3, 14,Z5C_0000_1001_0000_ssss_0000_nmin1_addr, "ldm     %a2,%rw5,#%n",         0},
818{0x5c11,0x5cf1,16,3, 15,Z5C_ssN0_0001_0000_dddd_0000_nmin1_addr, "ldm     %rw5,%a2(%rw2),#%n",      0},
819{0x5c18,0x5cf8,16,2, 17,Z5C_ddN0_1000_addr,                   "testl   %a1(%rw2)",            0},
820{0x5c19,0x5cf9,16,3, 15,Z5C_ddN0_1001_0000_ssN0_0000_nmin1_addr, "ldm     %a2(%rw2),%rw5,#%n",      0},
821{0x5d00,0x5d0f, 1,2, 15,Z5D_0000_ssss_addr,                   "ldl     %a1,%rl3",            0},
822{0x5d10,0x5dff, 1,2, 14,Z5D_ddN0_ssss_addr,                   "ldl     %a1(%rw2),%rl3",         0},
823{0x5e00,0x5e0f, 1,2,  7,Z5E_0000_cccc_addr,                   "jp      %c3,%a1",               0},
824{0x5e10,0x5eff, 1,2,  8,Z5E_ddN0_cccc_addr,                   "jp      %c3,%a1(%rw2)",         0},
825{0x5f00,0x5f00, 1,2, 12,Z5F_0000_0000_addr,                   "call    %a1",                  DASMFLAG_STEP_OVER},
826{0x5f10,0x5ff0,16,2, 13,Z5F_ddN0_0000_addr,                   "call    %a1(%rw2)",            DASMFLAG_STEP_OVER},
827{0x6000,0x600f, 1,2,  9,Z60_0000_dddd_addr,                   "ldb     %rb3,%a1",            0},
828{0x6010,0x60ff, 1,2, 10,Z60_ssN0_dddd_addr,                   "ldb     %rb3,%a1(%rw2)",         0},
829{0x6100,0x610f, 1,2,  9,Z61_0000_dddd_addr,                   "ld      %rw3,%a1",            0},
830{0x6110,0x61ff, 1,2, 10,Z61_ssN0_dddd_addr,                   "ld      %rw3,%a1(%rw2)",         0},
831{0x6200,0x620f, 1,2, 13,Z62_0000_imm4_addr,                   "resb    %a1,%3",               0},
832{0x6210,0x62ff, 1,2, 14,Z62_ddN0_imm4_addr,                   "resb    %a1(%rw2),%3",         0},
833{0x6300,0x630f, 1,2, 13,Z63_0000_imm4_addr,                   "res     %a1,%3",               0},
834{0x6310,0x63ff, 1,2, 14,Z63_ddN0_imm4_addr,                   "res     %a1(%rw2),%3",         0},
835{0x6400,0x640f, 1,2, 13,Z64_0000_imm4_addr,                   "setb    %a1,%3",               0},
836{0x6410,0x64ff, 1,2, 14,Z64_ddN0_imm4_addr,                   "setb    %a1(%rw2),%3",         0},
837{0x6500,0x650f, 1,2, 13,Z65_0000_imm4_addr,                   "set     %a1,%3",               0},
838{0x6510,0x65ff, 1,2, 14,Z65_ddN0_imm4_addr,                   "set     %a1(%rw2),%3",         0},
839{0x6600,0x660f, 1,2, 10,Z66_0000_imm4_addr,                   "bitb    %a1,%3",               0},
840{0x6610,0x66ff, 1,2, 11,Z66_ddN0_imm4_addr,                   "bitb    %a1(%rw2),%3",         0},
841{0x6700,0x670f, 1,2, 10,Z67_0000_imm4_addr,                   "bit     %a1,%3",               0},
842{0x6710,0x67ff, 1,2, 11,Z67_ddN0_imm4_addr,                   "bit     %a1(%rw2),%3",         0},
843{0x6800,0x680f, 1,2, 13,Z68_0000_imm4m1_addr,                "incb    %a1,%+3",               0},
844{0x6810,0x68ff, 1,2, 14,Z68_ddN0_imm4m1_addr,                "incb    %a1(%rw2),%+3",         0},
845{0x6900,0x690f, 1,2, 13,Z69_0000_imm4m1_addr,                "inc     %a1,%+3",               0},
846{0x6910,0x69ff, 1,2, 14,Z69_ddN0_imm4m1_addr,                "inc     %a1(%rw2),%+3",         0},
847{0x6a00,0x6a0f, 1,2, 13,Z6A_0000_imm4m1_addr,                "decb    %a1,%+3",               0},
848{0x6a10,0x6aff, 1,2, 14,Z6A_ddN0_imm4m1_addr,                "decb    %a1(%rw2),%+3",         0},
849{0x6b00,0x6b0f, 1,2, 13,Z6B_0000_imm4m1_addr,                "dec     %a1,%+3",               0},
850{0x6b10,0x6bff, 1,2, 14,Z6B_ddN0_imm4m1_addr,                "dec     %a1(%rw2),%+3",         0},
851{0x6c00,0x6c0f, 1,2, 15,Z6C_0000_dddd_addr,                   "exb     %rb3,%a1",            0},
852{0x6c10,0x6cff, 1,2, 16,Z6C_ssN0_dddd_addr,                   "exb     %rb3,%a1(%rw2)",         0},
853{0x6d00,0x6d0f, 1,2, 15,Z6D_0000_dddd_addr,                   "ex      %rw3,%a1",            0},
854{0x6d10,0x6dff, 1,2, 16,Z6D_ssN0_dddd_addr,                   "ex      %rw3,%a1(%rw2)",         0},
855{0x6e00,0x6e0f, 1,2, 11,Z6E_0000_ssss_addr,                   "ldb     %a1,%rb3",            0},
856{0x6e10,0x6eff, 1,2, 11,Z6E_ddN0_ssss_addr,                   "ldb     %a1(%rw2),%rb3",         0},
857{0x6f00,0x6f0f, 1,2, 11,Z6F_0000_ssss_addr,                   "ld      %a1,%rw3",            0},
858{0x6f10,0x6fff, 1,2, 12,Z6F_ddN0_ssss_addr,                   "ld      %a1(%rw2),%rw3",         0},
859{0x7010,0x70ff, 1,2, 14,Z70_ssN0_dddd_0000_xxxx_0000_0000,       "ldb     %rb3,%rw2(%rw5)",         0},
860{0x7110,0x71ff, 1,2, 14,Z71_ssN0_dddd_0000_xxxx_0000_0000,       "ld      %rw3,%rw2(%rw5)",         0},
861{0x7210,0x72ff, 1,2, 14,Z72_ddN0_ssss_0000_xxxx_0000_0000,       "ldb     %rw2(%rw5),%rb3",         0},
862{0x7310,0x73ff, 1,2, 14,Z73_ddN0_ssss_0000_xxxx_0000_0000,       "ld      %rw2(%rw5),%rw3",         0},
863{0x7410,0x74ff, 1,2, 15,Z74_ssN0_dddd_0000_xxxx_0000_0000,       "lda     p%rw3,%rw2(%rw5)",      0},
864{0x7510,0x75ff, 1,2, 17,Z75_ssN0_dddd_0000_xxxx_0000_0000,       "ldl     %rl3,%rw2(%rw5)",         0},
865{0x7600,0x760f, 1,1, 0, Z76_0000_dddd_addr_seg,                "lda     p%rw3,%a1",            0},
866{0x7610,0x76ff, 1,2, 13,Z76_ssN0_dddd_addr,                   "lda     p%rw3,%a1(%rw2)",         0},
867{0x7710,0x77ff, 1,2, 17,Z77_ddN0_ssss_0000_xxxx_0000_0000,       "ldl     %rw2(%rw5),%rl3",         0},
868{0x7800,0x78ff, 1,1, 10,Z78_imm8,                         "rsvd78",                     0},
869{0x7900,0x7900, 1,2, 16,Z79_0000_0000_addr,                   "ldps    %a1",                  0},
870{0x7910,0x79f0,16,2, 17,Z79_ssN0_0000_addr,                   "ldps    %a1(%rw2)",            0},
871{0x7a00,0x7a00, 1,1,  8,Z7A_0000_0000,                      "halt",                     DASMFLAG_STEP_OVER},
872{0x7b00,0x7b00, 1,1, 13,Z7B_0000_0000,                      "iret",                     DASMFLAG_STEP_OUT},
873{0x7b08,0x7b08, 1,1,  5,Z7B_0000_1000,                      "mset",                     0},
874{0x7b09,0x7b09, 1,1,  5,Z7B_0000_1001,                      "mres",                     0},
875{0x7b0a,0x7b0a, 1,1,  7,Z7B_0000_1010,                      "mbit",                     0},
876{0x7b0d,0x7bfd,16,1, 12,Z7B_dddd_1101,                      "mreq    %rw2",               0},
877{0x7c00,0x7c03, 1,1,  7,Z7C_0000_00ii,                      "di      %i3",                  0},
878{0x7c04,0x7c07, 1,1,  7,Z7C_0000_01ii,                      "ei      %i3",                  0},
879{0x7d00,0x7df0,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl0",            0},
880{0x7d01,0x7df1,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl1",            0},
881{0x7d02,0x7df2,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,fcw",            0},
882{0x7d03,0x7df3,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,refresh",         0},
883{0x7d04,0x7df4,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl4",            0},
884{0x7d05,0x7df5,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,psap",            0},
885{0x7d06,0x7df6,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,ctrl6",            0},
886{0x7d07,0x7df7,16,1,  7,Z7D_dddd_0ccc,                      "ldctl   %rw2,nsp",            0},
887{0x7d08,0x7df8,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl0,%rw2",            0},
888{0x7d09,0x7df9,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl1,%rw2",            0},
889{0x7d0a,0x7dfa,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   fcw,%rw2",            0},
890{0x7d0b,0x7dfb,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   refresh,%rw2",         0},
891{0x7d0c,0x7dfc,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl4,%rw2",            0},
892{0x7d0d,0x7dfd,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   psap,%rw2",            0},
893{0x7d0e,0x7dfe,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   ctrl6,%rw2",            0},
894{0x7d0f,0x7dff,16,1,  7,Z7D_ssss_1ccc,                      "ldctl   nsp,%rw2",            0},
895{0x7e00,0x7eff, 1,1, 10,Z7E_imm8,                         "rsvd7e  %#b1",               0},
896{0x7f00,0x7fff, 1,1, 33,Z7F_imm8,                         "sc      %#b1",               0},
897{0x8000,0x80ff, 1,1,  4,Z80_ssss_dddd,                      "addb    %rb3,%rb2",            0},
898{0x8100,0x81ff, 1,1,  4,Z81_ssss_dddd,                      "add     %rw3,%rw2",            0},
899{0x8200,0x82ff, 1,1,  4,Z82_ssss_dddd,                      "subb    %rb3,%rb2",            0},
900{0x8300,0x83ff, 1,1,  4,Z83_ssss_dddd,                      "sub     %rw3,%rw2",            0},
901{0x8400,0x84ff, 1,1,  4,Z84_ssss_dddd,                      "orb     %rb3,%rb2",            0},
902{0x8500,0x85ff, 1,1,  4,Z85_ssss_dddd,                      "or      %rw3,%rw2",            0},
903{0x8600,0x86ff, 1,1,  4,Z86_ssss_dddd,                      "andb    %rb3,%rb2",            0},
904{0x8700,0x87ff, 1,1,  4,Z87_ssss_dddd,                      "and     %rw3,%rw2",            0},
905{0x8800,0x88ff, 1,1,  4,Z88_ssss_dddd,                      "xorb    %rb3,%rb2",            0},
906{0x8900,0x89ff, 1,1,  4,Z89_ssss_dddd,                      "xor     %rw3,%rw2",            0},
907{0x8a00,0x8aff, 1,1,  4,Z8A_ssss_dddd,                      "cpb     %rb3,%rb2",            0},
908{0x8b00,0x8bff, 1,1,  4,Z8B_ssss_dddd,                      "cp      %rw3,%rw2",            0},
909{0x8c00,0x8cf0,16,1,  7,Z8C_dddd_0000,                      "comb    %rb2",               0},
910{0x8c02,0x8cf2,16,1,  7,Z8C_dddd_0010,                      "negb    %rb2",               0},
911{0x8c04,0x8cf4,16,1,  7,Z8C_dddd_0100,                      "testb   %rb2",               0},
912{0x8c06,0x8cf6,16,1,  7,Z8C_dddd_0110,                      "tsetb   %rb2",               0},
913395{0x8c08,0x8cf8,16,1,  7,Z8C_dddd_1000,                      "clrb    %rb2",               0},
396
397{0x8c09,0x8cf9,16,1,  7,Z8C_dddd_1001,                      "ldctlb  flags,%rb2",               0},
398
914399{0x8d00,0x8df0,16,1,  7,Z8D_dddd_0000,                      "com     %rw2",               0},
915400{0x8d01,0x8df1,16,1,  7,Z8D_imm4_0001,                      "setflg  %f2",                  0},
916401{0x8d02,0x8df2,16,1,  7,Z8D_dddd_0010,                      "neg     %rw2",               0},
r15120r15121
1062547};
1063548
1064549
1065void z8001_init_tables(void)
550void z8000_init_tables(void)
1066551{
1067552   const Z8000_init *init;
1068553   int i;
r15120r15121
1087572   }
1088573
1089574    /* now decompose the initialization table */
1090   for (init = seg_table; init->size; init++)
1091   {
1092      for (i = init->beg; i <= init->end; i += init->step)
1093      {
1094         if (z8000_exec[i].opcode != zinvalid)
1095            logerror("Z8000 opcode %04x clash '%s'\n", i, z8000_exec[i].dasm);
1096
1097         z8000_exec[i].opcode = init->opcode;
1098         z8000_exec[i].cycles = init->cycles;
1099         z8000_exec[i].size    = init->size;
1100         z8000_exec[i].dasm    = init->dasm;
1101         z8000_exec[i].dasmflags = init->dasmflags;
1102      }
1103   }
1104}
1105
1106void z8002_init_tables(void)
1107{
1108   const Z8000_init *init;
1109   int i;
1110
1111   /* allocate the opcode execution and disassembler array */
1112   z8000_exec = global_alloc_array(Z8000_exec, 0x10000);
1113
1114   /* set up the zero, sign, parity lookup table */
1115    for (i = 0; i < 256; i++)
1116      z8000_zsp[i] = ((i == 0) ? F_Z : 0) |
1117                       ((i & 128) ? F_S : 0) |
1118                       ((((i>>7)^(i>>6)^(i>>5)^(i>>4)^(i>>3)^(i>>2)^(i>>1)^i) & 1) ? F_PV : 0);
1119
1120    /* first set all 64K opcodes to invalid */
1121   for (i = 0; i < 0x10000; i++)
1122   {
1123      z8000_exec[i].opcode = zinvalid;
1124      z8000_exec[i].cycles = 4;
1125      z8000_exec[i].size    = 1;
1126      z8000_exec[i].dasm    = ".word   %#w0";
1127      z8000_exec[i].dasmflags = 0;
1128   }
1129
1130    /* now decompose the initialization table */
1131575   for (init = table; init->size; init++)
1132576   {
1133577      for (i = init->beg; i <= init->end; i += init->step)
src/emu/cpu/z8000/8000dasm.c
r15120r15121
8888
8989   /* already initialized? */
9090   if(z8000_exec == NULL)
91      z8002_init_tables();
91      z8000_init_tables();
9292
9393    GET_OP(oprom, 0, new_pc - pc);
9494   new_pc += 2;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team