Previous 199869 Revisions Next

r19441 Monday 10th December, 2012 at 00:53:47 UTC by R. Belmont
Z8001: Implement separate program/data address spaces [Christian Grössler]

(MESS) m20: Implement memory map correctly.  BASIC now shows its startup banner. [Christian Grössler]
[src/emu/cpu/z8000]z8000.c z8000ops.c
[src/mess/drivers]m20.c

trunk/src/emu/cpu/z8000/z8000.c
r19440r19441
8585   device_irq_acknowledge_callback irq_callback;
8686   legacy_cpu_device *device;
8787   address_space *program;
88   address_space *data;
8889   direct_read_data *direct;
8990   address_space *io;
9091   int icount;
r19440r19441
133134
134135INLINE UINT16 RDOP(z8000_state *cpustate)
135136{
136   UINT16 res = cpustate->direct->read_decrypted_word(cpustate->pc);
137   UINT16 res = cpustate->program->read_word(cpustate->pc);
137138    cpustate->pc += 2;
138139    return res;
139140}
r19440r19441
148149
149150    if (! (cpustate->op_valid & (1 << opnum)))
150151    {
151        cpustate->op[opnum] = cpustate->direct->read_decrypted_word(cpustate->pc);
152        cpustate->op[opnum] = cpustate->program->read_word(cpustate->pc);
152153        cpustate->pc += 2;
153154        cpustate->op_valid |= (1 << opnum);
154155    }
r19440r19441
165166
166167    if (! (cpustate->op_valid & (1 << opnum)))
167168    {
168        UINT32 seg = cpustate->direct->read_decrypted_word(cpustate->pc);
169        UINT32 seg = cpustate->program->read_word(cpustate->pc);
169170        cpustate->pc += 2;
170171        if (segmented_mode(cpustate))
171172        {
172173            if (seg & 0x8000)
173174            {
174                cpustate->op[opnum] = ((seg & 0x7f00) << 8) | cpustate->direct->read_decrypted_word(cpustate->pc);
175                cpustate->op[opnum] = ((seg & 0x7f00) << 8) | cpustate->program->read_word(cpustate->pc);
175176                cpustate->pc += 2;
176177            }
177178            else
r19440r19441
194195
195196    if (! (cpustate->op_valid & (1 << opnum)))
196197    {
197        UINT32 seg = cpustate->direct->read_decrypted_word(cpustate->pc);
198        UINT32 seg = cpustate->program->read_word(cpustate->pc);
198199        cpustate->pc += 2;
199200        if (segmented_mode(cpustate))
200201        {
201202            if (seg & 0x8000)
202203            {
203                cpustate->op[opnum] = (seg << 16) | cpustate->direct->read_decrypted_word(cpustate->pc);
204                cpustate->op[opnum] = (seg << 16) | cpustate->program->read_word(cpustate->pc);
204205                cpustate->pc += 2;
205206            }
206207            else
r19440r19441
213214    return cpustate->op[opnum];
214215}
215216
216INLINE UINT8 RDMEM_B(z8000_state *cpustate, UINT32 addr)
217INLINE UINT32 adjust_addr_for_nonseg_mode(z8000_state *cpustate, UINT32 addr)
217218{
218   return cpustate->program->read_byte(addr);
219   if (cpustate->device->type() == Z8001 && !(cpustate->fcw & F_SEG))
220      /*return (addr & 0xffff) | (cpustate->pc & 0xffff0000);*/
221      return (addr & 0xffff) | (cpustate->pc & 0x7f0000);
222   else
223      return addr;
219224}
220225
221INLINE UINT16 RDMEM_W(z8000_state *cpustate, UINT32 addr)
226INLINE UINT8 RDMEM_B(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr)
222227{
228   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
229   if (spacenum == AS_PROGRAM)
230      return cpustate->program->read_byte(addr);
231   else
232      return cpustate->data->read_byte(addr);
233}
234
235INLINE UINT16 RDMEM_W(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr)
236{
237   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
223238   addr &= ~1;
224239    /* hack for m20 driver: BIOS accesses 0x7f0000 and expects a segmentation violation */
225240    if (addr >= 0x7f0000) {
226241        cpustate->irq_req = Z8000_SEGTRAP;
227242        return 0xffff;
228243    }
229   return cpustate->program->read_word(addr);
244   if (spacenum == AS_PROGRAM)
245      return cpustate->program->read_word(addr);
246   else
247      return cpustate->data->read_word(addr);
230248}
231249
232INLINE UINT32 RDMEM_L(z8000_state *cpustate, UINT32 addr)
250INLINE UINT32 RDMEM_L(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr)
233251{
234252   UINT32 result;
253   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
235254   addr &= ~1;
236   result = cpustate->program->read_word(addr) << 16;
237   return result + cpustate->program->read_word(addr_add(cpustate, addr, 2));
255   if (spacenum == AS_PROGRAM)
256   {
257      result = cpustate->program->read_word(addr) << 16;
258      return result + cpustate->program->read_word(addr_add(cpustate, addr, 2));
259   }
260   else
261   {
262      result = cpustate->data->read_word(addr) << 16;
263      return result + cpustate->data->read_word(addr_add(cpustate, addr, 2));
264   }
238265}
239266
240INLINE void WRMEM_B(z8000_state *cpustate, UINT32 addr, UINT8 value)
267INLINE void WRMEM_B(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr, UINT8 value)
241268{
242   cpustate->program->write_byte(addr, value);
269   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
270   if (spacenum == AS_PROGRAM)
271      cpustate->program->write_byte(addr, value);
272   else
273      cpustate->data->write_byte(addr, value);
243274}
244275
245INLINE void WRMEM_W(z8000_state *cpustate, UINT32 addr, UINT16 value)
276INLINE void WRMEM_W(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr, UINT16 value)
246277{
278   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
247279   addr &= ~1;
248   cpustate->program->write_word(addr, value);
280   if (spacenum == AS_PROGRAM)
281      cpustate->program->write_word(addr, value);
282   else
283      cpustate->data->write_word(addr, value);
249284}
250285
251INLINE void WRMEM_L(z8000_state *cpustate, UINT32 addr, UINT32 value)
286INLINE void WRMEM_L(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr, UINT32 value)
252287{
288   addr = adjust_addr_for_nonseg_mode(cpustate, addr);
253289   addr &= ~1;
254   cpustate->program->write_word(addr, value >> 16);
255   cpustate->program->write_word(addr_add(cpustate, addr, 2), value & 0xffff);
290   if (spacenum == AS_PROGRAM)
291   {
292      cpustate->program->write_word(addr, value >> 16);
293      cpustate->program->write_word(addr_add(cpustate, addr, 2), value & 0xffff);
294   }
295   else
296   {
297      cpustate->data->write_word(addr, value >> 16);
298      cpustate->data->write_word(addr_add(cpustate, addr, 2), value & 0xffff);
299   }
256300}
257301
258302INLINE UINT8 RDPORT_B(z8000_state *cpustate, int mode, UINT16 addr)
r19440r19441
382426    PUSHW(cpustate, SP, cpustate->pc);        /* save current cpustate->pc */ \
383427} while (0)
384428
385#define GET_PC(VEC) (cpustate->device->type() == Z8001 ? segmented_addr(RDMEM_L(cpustate, VEC + 4)) : RDMEM_W(cpustate, VEC + 2))
386#define GET_FCW(VEC) (cpustate->device->type() == Z8001 ? RDMEM_W(cpustate, VEC + 2) : RDMEM_W(cpustate, VEC))
429#define GET_PC(VEC) (cpustate->device->type() == Z8001 ? segmented_addr(RDMEM_L(cpustate, AS_PROGRAM, VEC + 4)) : RDMEM_W(cpustate, AS_PROGRAM, VEC + 2))
430#define GET_FCW(VEC) (cpustate->device->type() == Z8001 ? RDMEM_W(cpustate, AS_PROGRAM, VEC + 2) : RDMEM_W(cpustate, AS_PROGRAM, VEC))
431#define F_SEG_Z8001 (cpustate->device->type() == Z8001 ? F_SEG : 0)
387432
388
389433INLINE void Interrupt(z8000_state *cpustate)
390434{
391435    UINT16 fcw = cpustate->fcw;
r19440r19441
405449    /* trap ? */
406450    if (cpustate->irq_req & Z8000_EPU)
407451    {
408        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
452        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
409453        PUSH_PC();
410454        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
411455        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
r19440r19441
418462    else
419463    if (cpustate->irq_req & Z8000_TRAP)
420464    {
421        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
465        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
422466        PUSH_PC();
423467        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
424468        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
r19440r19441
431475    else
432476    if (cpustate->irq_req & Z8000_SYSCALL)
433477    {
434        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
478        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
435479        PUSH_PC();
436480        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
437481        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
r19440r19441
444488    else
445489    if (cpustate->irq_req & Z8000_SEGTRAP)
446490    {
447        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
491        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
448492        PUSH_PC();
449493        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
450494        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
r19440r19441
457501    else
458502    if (cpustate->irq_req & Z8000_NMI)
459503    {
460        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
504        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
461505        PUSH_PC();
462506        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
463507        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
464508        cpustate->irq_srv = cpustate->irq_req;
465        cpustate->pc = RDMEM_W(cpustate,  NMI);
509        cpustate->pc = RDMEM_W(cpustate, AS_PROGRAM, NMI);
466510        cpustate->irq_req &= ~Z8000_NMI;
467511        CHANGE_FCW(cpustate, GET_FCW(NMI));
468512        cpustate->pc = GET_PC(NMI);
r19440r19441
471515    else
472516    if ((cpustate->irq_req & Z8000_NVI) && (cpustate->fcw & F_NVIE))
473517    {
474        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
518        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
475519        PUSH_PC();
476520        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
477521        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
478522        cpustate->irq_srv = cpustate->irq_req;
479        cpustate->pc = GET_PC(NVI); //RDMEM_W(cpustate,  NVI + 2);
523        cpustate->pc = GET_PC(NVI);
480524        cpustate->irq_req &= ~Z8000_NVI;
481525        CHANGE_FCW(cpustate, GET_FCW(NVI));
482526        LOG(("Z8K '%s' NVI $%04x\n", cpustate->device->tag(), cpustate->pc));
r19440r19441
484528    else
485529    if ((cpustate->irq_req & Z8000_VI) && (cpustate->fcw & F_VIE))
486530    {
487        CHANGE_FCW(cpustate, fcw | F_S_N);/* swap to system stack */
531        CHANGE_FCW(cpustate, fcw | F_S_N | F_SEG_Z8001);/* switch to segmented (on Z8001) system mode */
488532        PUSH_PC();
489533        PUSHW(cpustate, SP, fcw);       /* save current cpustate->fcw */
490534        PUSHW(cpustate, SP, cpustate->irq_req);   /* save interrupt/trap type tag */
491535        cpustate->irq_srv = cpustate->irq_req;
492536      if (cpustate->device->type() == Z8001)
493         cpustate->pc =  segmented_addr(RDMEM_L(cpustate, VEC00 + 4 * (cpustate->irq_req & 0xff)));
537         cpustate->pc =  segmented_addr(RDMEM_L(cpustate, AS_PROGRAM, VEC00 + 4 * (cpustate->irq_req & 0xff)));
494538      else
495         cpustate->pc = RDMEM_W(cpustate, VEC00 + 2 * (cpustate->irq_req & 0xff));
539         cpustate->pc = RDMEM_W(cpustate, AS_PROGRAM, VEC00 + 2 * (cpustate->irq_req & 0xff));
496540        cpustate->irq_req &= ~Z8000_VI;
497541        CHANGE_FCW(cpustate, GET_FCW(VI));
498542        //printf ("z8k VI (vec 0x%x)\n", cpustate->irq_req & 0xff);
r19440r19441
504548{
505549   z8000_state *cpustate = get_safe_token(device);
506550
551   memset(cpustate, 0, sizeof(*cpustate));
552
507553   cpustate->irq_callback = irqcallback;
508554   cpustate->device = device;
509555   cpustate->program = &device->space(AS_PROGRAM);
556   /* If the system decodes STn lines to distinguish between data and program memory fetches,
557      install the data space. If it doesn't, install the program memory into data memory space. */
558   if (device->has_space(AS_DATA))
559      cpustate->data = &device->space(AS_DATA);
560   else
561      cpustate->data = &device->space(AS_PROGRAM);
510562   cpustate->direct = &cpustate->program->direct();
511563   cpustate->io = &device->space(AS_IO);
512564
r19440r19441
519571{
520572   z8000_state *cpustate = get_safe_token(device);
521573
574   memset(cpustate, 0, sizeof(*cpustate));
575
522576   cpustate->irq_callback = irqcallback;
523577   cpustate->device = device;
524578   cpustate->program = &device->space(AS_PROGRAM);
579   /* If the system decodes STn lines to distinguish between data and program memory fetches,
580      install the data space. If it doesn't, install the program memory into data memory space. */
581   if (device->has_space(AS_DATA))
582      cpustate->data = &device->space(AS_DATA);
583   else
584      cpustate->data = &device->space(AS_PROGRAM);
525585   cpustate->direct = &cpustate->program->direct();
526586   cpustate->io = &device->space(AS_IO);
527587
r19440r19441
534594{
535595   z8000_state *cpustate = get_safe_token(device);
536596
537   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
538   memset(cpustate, 0, sizeof(*cpustate));
539   cpustate->irq_callback = save_irqcallback;
540   cpustate->device = device;
541   cpustate->program = &device->space(AS_PROGRAM);
542   cpustate->direct = &cpustate->program->direct();
543   cpustate->io = &device->space(AS_IO);
544   cpustate->fcw = RDMEM_W(cpustate,  2); /* get reset cpustate->fcw */
597   cpustate->fcw = RDMEM_W(cpustate, AS_PROGRAM, 2); /* get reset cpustate->fcw */
545598   if(cpustate->fcw & F_SEG)
546599   {
547      cpustate->pc = ((RDMEM_W(cpustate,  4) & 0x0700) << 8) | (RDMEM_W(cpustate, 6) & 0xffff); /* get reset cpustate->pc  */
600      cpustate->pc = ((RDMEM_W(cpustate, AS_PROGRAM, 4) & 0x0700) << 8) | (RDMEM_W(cpustate, AS_PROGRAM, 6) & 0xffff); /* get reset cpustate->pc  */
548601   }
549602   else
550603   {
551      cpustate->pc = RDMEM_W(cpustate,  4); /* get reset cpustate->pc  */
604      cpustate->pc = RDMEM_W(cpustate, AS_PROGRAM, 4); /* get reset cpustate->pc  */
552605   }
553606}
554607
r19440r19441
556609{
557610   z8000_state *cpustate = get_safe_token(device);
558611
559   device_irq_acknowledge_callback save_irqcallback = cpustate->irq_callback;
560   memset(cpustate, 0, sizeof(*cpustate));
561   cpustate->irq_callback = save_irqcallback;
562   cpustate->device = device;
563   cpustate->program = &device->space(AS_PROGRAM);
564   cpustate->direct = &cpustate->program->direct();
565   cpustate->io = &device->space(AS_IO);
566   cpustate->fcw = RDMEM_W(cpustate,  2); /* get reset cpustate->fcw */
567   cpustate->pc = RDMEM_W(cpustate,  4); /* get reset cpustate->pc  */
612   cpustate->fcw = RDMEM_W(cpustate, AS_PROGRAM, 2); /* get reset cpustate->fcw */
613   cpustate->pc = RDMEM_W(cpustate, AS_PROGRAM, 4); /* get reset cpustate->pc  */
568614}
569615
570616static CPU_EXIT( z8000 )
r19440r19441
591637        else
592638        {
593639            Z8000_exec *exec;
640
594641            cpustate->op[0] = RDOP(cpustate);
595642            cpustate->op_valid = 1;
596643            exec = &z8000_exec[cpustate->op[0]];
r19440r19441
839886   {
840887      case CPUINFO_INT_DATABUS_WIDTH + AS_PROGRAM:   info->i = 16;               break;
841888      case CPUINFO_INT_ADDRBUS_WIDTH + AS_PROGRAM: info->i = 20;               break;
889      case CPUINFO_INT_DATABUS_WIDTH + AS_DATA:   info->i = 16;               break;
890      case CPUINFO_INT_ADDRBUS_WIDTH + AS_DATA: info->i = 20;               break;
842891      case CPUINFO_INT_DATABUS_WIDTH + AS_IO:      info->i = 16;               break;
843892      case CPUINFO_INT_ADDRBUS_WIDTH + AS_IO:      info->i = 16;               break;
844893
trunk/src/emu/cpu/z8000/z8000ops.c
r19440r19441
115115   cpustate->RW(regno) -= subtrahend;
116116}
117117
118INLINE void set_pc(z8000_state *cpustate, UINT32 addr)
119{
120   if (segmented_mode(cpustate))
121      cpustate->pc = addr;
122   else
123      cpustate->pc = (cpustate->pc & 0xffff0000) | (addr & 0xffff);
124}
125
118126INLINE void PUSHW(z8000_state *cpustate, UINT8 dst, UINT16 value)
119127{
120128    if (segmented_mode(cpustate))
121129        cpustate->RW(dst | 1) -= 2;
122130    else
123131        cpustate->RW(dst) -= 2;
124   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), value);
132   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), value);
125133}
126134
127135INLINE UINT16 POPW(z8000_state *cpustate, UINT8 src)
128136{
129   UINT16 result = RDMEM_W(cpustate, addr_from_reg(cpustate, src));
137   UINT16 result = RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src));
130138    if (segmented_mode(cpustate))
131139        cpustate->RW(src | 1) += 2;
132140    else
r19440r19441
140148        cpustate->RW(dst | 1) -= 4;
141149    else
142150        cpustate->RW(dst) -= 4;
143   WRMEM_L(cpustate,  addr_from_reg(cpustate, dst), value);
151   WRMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, dst), value);
144152}
145153
146154INLINE UINT32 POPL(z8000_state *cpustate, UINT8 src)
147155{
148   UINT32 result = RDMEM_L(cpustate, addr_from_reg(cpustate, src));
156   UINT32 result = RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src));
149157    if (segmented_mode(cpustate))
150158        cpustate->RW(src | 1) += 4;
151159    else
r19440r19441
12031211{
12041212   GET_DST(OP0,NIB3);
12051213   GET_SRC(OP0,NIB2);
1206   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
1214   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
12071215}
12081216
12091217/******************************************
r19440r19441
12251233{
12261234   GET_DST(OP0,NIB3);
12271235   GET_SRC(OP0,NIB2);
1228   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1236   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
12291237}
12301238
12311239/******************************************
r19440r19441
12471255{
12481256   GET_DST(OP0,NIB3);
12491257   GET_SRC(OP0,NIB2);
1250   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src))); /* EHC */
1258   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src))); /* EHC */
12511259}
12521260
12531261/******************************************
r19440r19441
12691277{
12701278   GET_DST(OP0,NIB3);
12711279   GET_SRC(OP0,NIB2);
1272   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1280   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
12731281}
12741282
12751283/******************************************
r19440r19441
12911299{
12921300   GET_DST(OP0,NIB3);
12931301   GET_SRC(OP0,NIB2);
1294   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
1302   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
12951303}
12961304
12971305/******************************************
r19440r19441
13131321{
13141322   GET_DST(OP0,NIB3);
13151323   GET_SRC(OP0,NIB2);
1316   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1324   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
13171325}
13181326
13191327/******************************************
r19440r19441
13351343{
13361344   GET_DST(OP0,NIB3);
13371345   GET_SRC(OP0,NIB2);
1338   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
1346   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
13391347}
13401348
13411349/******************************************
r19440r19441
13571365{
13581366   GET_DST(OP0,NIB3);
13591367   GET_SRC(OP0,NIB2);
1360   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1368   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
13611369}
13621370
13631371/******************************************
r19440r19441
13791387{
13801388   GET_DST(OP0,NIB3);
13811389   GET_SRC(OP0,NIB2);
1382   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
1390   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
13831391}
13841392
13851393/******************************************
r19440r19441
14011409{
14021410   GET_DST(OP0,NIB3);
14031411   GET_SRC(OP0,NIB2);
1404   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1412   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
14051413}
14061414
14071415/******************************************
r19440r19441
14231431{
14241432   GET_DST(OP0,NIB3);
14251433   GET_SRC(OP0,NIB2);
1426   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
1434   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
14271435}
14281436
14291437/******************************************
r19440r19441
14451453{
14461454   GET_DST(OP0,NIB3);
14471455   GET_SRC(OP0,NIB2);
1448   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate,src)));
1456   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate,src)));
14491457}
14501458
14511459/******************************************
r19440r19441
14561464{
14571465   GET_DST(OP0,NIB3);
14581466   UINT32 addr = addr_from_reg(cpustate, dst);
1459   WRMEM_B(cpustate, addr, COMB(cpustate, RDMEM_B(cpustate, addr)));
1467   WRMEM_B(cpustate, AS_DATA, addr, COMB(cpustate, RDMEM_B(cpustate, AS_DATA, addr)));
14601468}
14611469
14621470/******************************************
r19440r19441
14671475{
14681476   GET_DST(OP0,NIB2);
14691477   GET_IMM8(OP1);
1470   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), imm8); // @@@done
1478   CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), imm8); // @@@done
14711479}
14721480
14731481/******************************************
r19440r19441
14781486{
14791487   GET_DST(OP0,NIB2);
14801488    UINT32 addr = addr_from_reg(cpustate, dst);
1481   WRMEM_B(cpustate,  addr, NEGB(cpustate, RDMEM_B(cpustate, addr)));
1489   WRMEM_B(cpustate, AS_DATA, addr, NEGB(cpustate, RDMEM_B(cpustate, AS_DATA, addr)));
14821490}
14831491
14841492/******************************************
r19440r19441
14881496static void Z0C_ddN0_0100(z8000_state *cpustate)
14891497{
14901498   GET_DST(OP0,NIB2);
1491   TESTB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
1499   TESTB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
14921500}
14931501
14941502/******************************************
r19440r19441
14991507{
15001508   GET_DST(OP0,NIB2);
15011509   GET_IMM8(OP1);
1502   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), imm8);
1510   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), imm8);
15031511}
15041512
15051513/******************************************
r19440r19441
15101518{
15111519   GET_DST(OP0,NIB2);
15121520    UINT32 addr = addr_from_reg(cpustate, dst);
1513    if (RDMEM_B(cpustate, addr) & S08) SET_S; else CLR_S;
1514    WRMEM_B(cpustate, addr, 0xff);
1521    if (RDMEM_B(cpustate, AS_DATA, addr) & S08) SET_S; else CLR_S;
1522    WRMEM_B(cpustate, AS_DATA, addr, 0xff);
15151523}
15161524
15171525/******************************************
r19440r19441
15211529static void Z0C_ddN0_1000(z8000_state *cpustate)
15221530{
15231531   GET_DST(OP0,NIB2);
1524   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), 0);
1532   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), 0);
15251533}
15261534
15271535/******************************************
r19440r19441
15321540{
15331541   GET_DST(OP0,NIB2);
15341542    UINT32 addr = addr_from_reg(cpustate, dst);
1535   WRMEM_W(cpustate, addr, COMW(cpustate, RDMEM_W(cpustate, addr)));
1543   WRMEM_W(cpustate, AS_DATA, addr, COMW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
15361544}
15371545
15381546/******************************************
r19440r19441
15431551{
15441552   GET_DST(OP0,NIB2);
15451553   GET_IMM16(OP1);
1546   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), imm16);
1554   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), imm16);
15471555}
15481556
15491557/******************************************
r19440r19441
15541562{
15551563   GET_DST(OP0,NIB2);
15561564    UINT32 addr = addr_from_reg(cpustate, dst);
1557   WRMEM_W(cpustate, addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
1565   WRMEM_W(cpustate, AS_DATA, addr, NEGW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
15581566}
15591567
15601568/******************************************
r19440r19441
15641572static void Z0D_ddN0_0100(z8000_state *cpustate)
15651573{
15661574   GET_DST(OP0,NIB2);
1567   TESTW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)));
1575   TESTW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
15681576}
15691577
15701578/******************************************
r19440r19441
15751583{
15761584   GET_DST(OP0,NIB2);
15771585   GET_IMM16(OP1);
1578   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), imm16);
1586   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), imm16);
15791587}
15801588
15811589/******************************************
r19440r19441
15861594{
15871595   GET_DST(OP0,NIB2);
15881596    UINT32 addr = addr_from_reg(cpustate, dst);
1589    if (RDMEM_W(cpustate, addr) & S16) SET_S; else CLR_S;
1590    WRMEM_W(cpustate, addr, 0xffff);
1597    if (RDMEM_W(cpustate, AS_DATA, addr) & S16) SET_S; else CLR_S;
1598    WRMEM_W(cpustate, AS_DATA, addr, 0xffff);
15911599}
15921600
15931601/******************************************
r19440r19441
15971605static void Z0D_ddN0_1000(z8000_state *cpustate)
15981606{
15991607   GET_DST(OP0,NIB2);
1600   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), 0);
1608   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), 0);
16011609}
16021610
16031611/******************************************
r19440r19441
16601668{
16611669   GET_DST(OP0,NIB3);
16621670   GET_SRC(OP0,NIB2);
1663   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
1671   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
16641672}
16651673
16661674/******************************************
r19440r19441
16711679{
16721680   GET_SRC(OP0,NIB3);
16731681   GET_DST(OP0,NIB2);
1674   PUSHL(cpustate, dst, RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
1682   PUSHL(cpustate, dst, RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
16751683}
16761684
16771685/******************************************
r19440r19441
16931701{
16941702   GET_DST(OP0,NIB3);
16951703   GET_SRC(OP0,NIB2);
1696   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
1704   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
16971705}
16981706
16991707/******************************************
r19440r19441
17041712{
17051713   GET_SRC(OP0,NIB3);
17061714   GET_DST(OP0,NIB2);
1707   PUSHW(cpustate, dst, RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1715   PUSHW(cpustate, dst, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
17081716}
17091717
17101718/******************************************
r19440r19441
17261734{
17271735   GET_DST(OP0,NIB3);
17281736   GET_SRC(OP0,NIB2);
1729   cpustate->RL(dst) = RDMEM_L(cpustate,  addr_from_reg(cpustate, src));
1737   cpustate->RL(dst) = RDMEM_L(cpustate,  AS_DATA, addr_from_reg(cpustate, src));
17301738}
17311739
17321740/******************************************
r19440r19441
17591767{
17601768   GET_DST(OP0,NIB3);
17611769   GET_SRC(OP0,NIB2);
1762   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
1770   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
17631771}
17641772
17651773/******************************************
r19440r19441
17701778{
17711779   GET_DST(OP0,NIB3);
17721780   GET_SRC(OP0,NIB2);
1773   WRMEM_W(cpustate, addr_from_reg(cpustate, dst), POPW(cpustate, src));
1781   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), POPW(cpustate, src));
17741782}
17751783
17761784/******************************************
r19440r19441
18141822{
18151823   GET_DST(OP0,NIB3);
18161824   GET_SRC(OP0,NIB2);
1817   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1825   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
18181826}
18191827
18201828/******************************************
r19440r19441
18361844{
18371845   GET_DST(OP0,NIB3);
18381846   GET_SRC(OP0,NIB2);
1839   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr_from_reg(cpustate, src)));
1847   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
18401848}
18411849
18421850/******************************************
r19440r19441
18581866{
18591867   GET_DST(OP0,NIB3);
18601868   GET_SRC(OP0,NIB2);
1861   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
1869   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
18621870}
18631871
18641872/******************************************
r19440r19441
18681876static void Z1C_ddN0_1000(z8000_state *cpustate)
18691877{
18701878   GET_DST(OP0,NIB2);
1871   TESTL(cpustate, RDMEM_L(cpustate, addr_from_reg(cpustate, dst)));
1879   TESTL(cpustate, RDMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
18721880}
18731881
18741882/******************************************
r19440r19441
18821890    GET_SRC(OP1,NIB1);
18831891   UINT32 addr = addr_from_reg(cpustate, dst);
18841892    while (cnt-- >= 0) {
1885        WRMEM_W(cpustate, addr, cpustate->RW(src));
1893        WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(src));
18861894      addr = addr_add(cpustate, addr, 2);
18871895      src = (src+1) & 15;
18881896    }
r19440r19441
18991907   GET_DST(OP1,NIB1);
19001908   UINT32 addr = addr_from_reg(cpustate, src);
19011909   while (cnt-- >= 0) {
1902      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
1910      cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr);
19031911      addr = addr_add(cpustate, addr, 2);
19041912      dst = (dst+1) & 15;
19051913    }
r19440r19441
19131921{
19141922   GET_SRC(OP0,NIB3);
19151923   GET_DST(OP0,NIB2);
1916   WRMEM_L(cpustate,  addr_from_reg(cpustate, dst), cpustate->RL(src));
1924   WRMEM_L(cpustate, AS_DATA, addr_from_reg(cpustate, dst), cpustate->RL(src));
19171925}
19181926
19191927/******************************************
r19440r19441
19251933   GET_CCC(OP0,NIB3);
19261934   GET_DST(OP0,NIB2);
19271935   switch (cc) {
1928      case  0: if (CC0) cpustate->pc = addr_from_reg(cpustate, dst); break;
1929      case  1: if (CC1) cpustate->pc = addr_from_reg(cpustate, dst); break;
1930      case  2: if (CC2) cpustate->pc = addr_from_reg(cpustate, dst); break;
1931      case  3: if (CC3) cpustate->pc = addr_from_reg(cpustate, dst); break;
1932      case  4: if (CC4) cpustate->pc = addr_from_reg(cpustate, dst); break;
1933      case  5: if (CC5) cpustate->pc = addr_from_reg(cpustate, dst); break;
1934      case  6: if (CC6) cpustate->pc = addr_from_reg(cpustate, dst); break;
1935      case  7: if (CC7) cpustate->pc = addr_from_reg(cpustate, dst); break;
1936      case  8: if (CC8) cpustate->pc = addr_from_reg(cpustate, dst); break;
1937      case  9: if (CC9) cpustate->pc = addr_from_reg(cpustate, dst); break;
1938      case 10: if (CCA) cpustate->pc = addr_from_reg(cpustate, dst); break;
1939      case 11: if (CCB) cpustate->pc = addr_from_reg(cpustate, dst); break;
1940      case 12: if (CCC) cpustate->pc = addr_from_reg(cpustate, dst); break;
1941      case 13: if (CCD) cpustate->pc = addr_from_reg(cpustate, dst); break;
1942      case 14: if (CCE) cpustate->pc = addr_from_reg(cpustate, dst); break;
1943      case 15: if (CCF) cpustate->pc = addr_from_reg(cpustate, dst); break;
1936      case  0: if (CC0) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1937      case  1: if (CC1) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1938      case  2: if (CC2) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1939      case  3: if (CC3) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1940      case  4: if (CC4) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1941      case  5: if (CC5) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1942      case  6: if (CC6) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1943      case  7: if (CC7) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1944      case  8: if (CC8) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1945      case  9: if (CC9) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1946      case 10: if (CCA) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1947      case 11: if (CCB) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1948      case 12: if (CCC) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1949      case 13: if (CCD) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1950      case 14: if (CCE) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
1951      case 15: if (CCF) set_pc(cpustate, addr_from_reg(cpustate, dst)); break;
19441952   }
19451953}
19461954
r19440r19441
19551963        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
19561964    else
19571965        PUSHW(cpustate, SP, cpustate->pc);
1958    cpustate->pc = addr_from_reg(cpustate, dst);
1966    set_pc(cpustate, addr_from_reg(cpustate, dst));
19591967}
19601968
19611969/******************************************
r19440r19441
19661974{
19671975   GET_DST(OP0,NIB3);
19681976   GET_SRC(OP0,NIB2);
1969    cpustate->RB(dst) = RDMEM_B(cpustate,  addr_from_reg(cpustate, src));
1977    cpustate->RB(dst) = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src));
19701978}
19711979
19721980/******************************************
r19440r19441
19881996{
19891997   GET_DST(OP0,NIB3);
19901998   GET_SRC(OP0,NIB2);
1991   cpustate->RW(dst) = RDMEM_W(cpustate,  addr_from_reg(cpustate, src));
1999   cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src));
19922000}
19932001
19942002/******************************************
r19440r19441
20112019   GET_BIT(OP0);
20122020   GET_DST(OP0,NIB2);
20132021    UINT32 addr = addr_from_reg(cpustate, dst);
2014   WRMEM_B(cpustate, addr, RDMEM_B(cpustate, addr) & ~bit);
2022   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) & ~bit);
20152023}
20162024
20172025/******************************************
r19440r19441
20342042   GET_BIT(OP0);
20352043   GET_DST(OP0,NIB2);
20362044    UINT32 addr = addr_from_reg(cpustate, dst);
2037   WRMEM_W(cpustate, addr, RDMEM_W(cpustate, addr) & ~bit);
2045   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) & ~bit);
20382046}
20392047
20402048/******************************************
r19440r19441
20572065   GET_BIT(OP0);
20582066   GET_DST(OP0,NIB2);
20592067    UINT32 addr = addr_from_reg(cpustate, dst);
2060   WRMEM_B(cpustate, addr, RDMEM_B(cpustate, addr) | bit);
2068   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) | bit);
20612069}
20622070
20632071/******************************************
r19440r19441
20802088   GET_BIT(OP0);
20812089   GET_DST(OP0,NIB2);
20822090    UINT32 addr = addr_from_reg(cpustate, dst);
2083   WRMEM_W(cpustate, addr, RDMEM_W(cpustate, addr) | bit);
2091   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) | bit);
20842092}
20852093
20862094/******************************************
r19440r19441
21022110{
21032111   GET_BIT(OP0);
21042112   GET_DST(OP0,NIB2);
2105   if (RDMEM_B(cpustate, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
2113   if (RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
21062114}
21072115
21082116/******************************************
r19440r19441
21242132{
21252133   GET_BIT(OP0);
21262134   GET_DST(OP0,NIB2);
2127   if (RDMEM_W(cpustate, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
2135   if (RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)) & bit) CLR_Z; else SET_Z;
21282136}
21292137
21302138/******************************************
r19440r19441
21362144   GET_I4M1(OP0,NIB3);
21372145   GET_DST(OP0,NIB2);
21382146    UINT32 addr = addr_from_reg(cpustate, dst);
2139   WRMEM_B(cpustate,  addr, INCB(cpustate, RDMEM_B(cpustate, addr), i4p1));
2147   WRMEM_B(cpustate, AS_DATA, addr, INCB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
21402148}
21412149
21422150/******************************************
r19440r19441
21482156   GET_I4M1(OP0,NIB3);
21492157   GET_DST(OP0,NIB2);
21502158    UINT32 addr = addr_from_reg(cpustate, dst);
2151   WRMEM_W(cpustate, addr, INCW(cpustate, RDMEM_W(cpustate, addr), i4p1));
2159   WRMEM_W(cpustate, AS_DATA, addr, INCW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
21522160}
21532161
21542162/******************************************
r19440r19441
21602168   GET_I4M1(OP0,NIB3);
21612169   GET_DST(OP0,NIB2);
21622170    UINT32 addr = addr_from_reg(cpustate, dst);
2163   WRMEM_B(cpustate, addr, DECB(cpustate, RDMEM_B(cpustate, addr), i4p1));
2171   WRMEM_B(cpustate, AS_DATA, addr, DECB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
21642172}
21652173
21662174/******************************************
r19440r19441
21722180   GET_I4M1(OP0,NIB3);
21732181   GET_DST(OP0,NIB2);
21742182    UINT32 addr = addr_from_reg(cpustate, dst);
2175   WRMEM_W(cpustate, addr, DECW(cpustate, RDMEM_W(cpustate, addr), i4p1));
2183   WRMEM_W(cpustate, AS_DATA, addr, DECW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
21762184}
21772185
21782186/******************************************
r19440r19441
21842192   GET_DST(OP0,NIB3);
21852193   GET_SRC(OP0,NIB2);
21862194    UINT32 addr = addr_from_reg(cpustate, src);
2187   UINT8 tmp = RDMEM_B(cpustate,  addr);
2188   WRMEM_B(cpustate, addr, cpustate->RB(dst));
2195   UINT8 tmp = RDMEM_B(cpustate,  AS_DATA, addr);
2196   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(dst));
21892197   cpustate->RB(dst) = tmp;
21902198}
21912199
r19440r19441
21982206   GET_DST(OP0,NIB3);
21992207   GET_SRC(OP0,NIB2);
22002208    UINT32 addr = addr_from_reg(cpustate, src);
2201   UINT16 tmp = RDMEM_W(cpustate, addr);
2202   WRMEM_W(cpustate, addr, cpustate->RW(dst));
2209   UINT16 tmp = RDMEM_W(cpustate, AS_DATA, addr);
2210   WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(dst));
22032211   cpustate->RW(dst) = tmp;
22042212}
22052213
r19440r19441
22112219{
22122220   GET_SRC(OP0,NIB3);
22132221   GET_DST(OP0,NIB2);
2214   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), cpustate->RB(src));
2222   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), cpustate->RB(src));
22152223}
22162224
22172225/******************************************
r19440r19441
22222230{
22232231   GET_SRC(OP0,NIB3);
22242232   GET_DST(OP0,NIB2);
2225   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), cpustate->RW(src));
2233   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), cpustate->RW(src));
22262234}
22272235
22282236/******************************************
r19440r19441
22332241{
22342242   GET_DST(OP0,NIB3);
22352243   GET_DSP16;
2236   cpustate->RB(dst) = RDMEM_B(cpustate, dsp16);
2244   cpustate->RB(dst) = RDMEM_B(cpustate, AS_PROGRAM, dsp16);
22372245}
22382246
22392247/******************************************
r19440r19441
22462254   GET_SRC(OP0,NIB2);
22472255   GET_IDX16(OP1);
22482256   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2249   cpustate->RB(dst) = RDMEM_B(cpustate,  idx16);
2257   cpustate->RB(dst) = RDMEM_B(cpustate, AS_DATA, idx16);
22502258}
22512259
22522260/******************************************
r19440r19441
22572265{
22582266   GET_DST(OP0,NIB3);
22592267   GET_DSP16;
2260   cpustate->RW(dst) = RDMEM_W(cpustate, dsp16);
2268   cpustate->RW(dst) = RDMEM_W(cpustate, AS_PROGRAM, dsp16);
22612269}
22622270
22632271/******************************************
r19440r19441
22702278   GET_SRC(OP0,NIB2);
22712279   GET_IDX16(OP1);
22722280   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2273   cpustate->RW(dst) = RDMEM_W(cpustate,  idx16);
2281   cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, idx16);
22742282}
22752283
22762284/******************************************
r19440r19441
22812289{
22822290   GET_SRC(OP0,NIB3);
22832291   GET_DSP16;
2284   WRMEM_B(cpustate,  dsp16, cpustate->RB(src));
2292   WRMEM_B(cpustate, AS_PROGRAM, dsp16, cpustate->RB(src));
22852293}
22862294
22872295/******************************************
r19440r19441
22942302   GET_DST(OP0,NIB2);
22952303   GET_IDX16(OP1);
22962304   idx16 = addr_add(cpustate, addr_from_reg(cpustate, dst), idx16);
2297   WRMEM_B(cpustate,  idx16, cpustate->RB(src));
2305   WRMEM_B(cpustate, AS_DATA, idx16, cpustate->RB(src));
22982306}
22992307
23002308/******************************************
r19440r19441
23052313{
23062314   GET_SRC(OP0,NIB3);
23072315   GET_DSP16;
2308   WRMEM_W(cpustate,  dsp16, cpustate->RW(src));
2316   WRMEM_W(cpustate, AS_PROGRAM, dsp16, cpustate->RW(src));
23092317}
23102318
23112319/******************************************
r19440r19441
23182326   GET_DST(OP0,NIB2);
23192327   GET_IDX16(OP1);
23202328   idx16 = addr_add(cpustate, addr_from_reg(cpustate,dst), idx16);
2321   WRMEM_W(cpustate,  idx16, cpustate->RW(src));
2329   WRMEM_W(cpustate, AS_DATA, idx16, cpustate->RW(src));
23222330}
23232331
23242332/******************************************
r19440r19441
23582366{
23592367   GET_DST(OP0,NIB3);
23602368   GET_DSP16;
2361   cpustate->RL(dst) = RDMEM_L(cpustate,  dsp16);
2369   cpustate->RL(dst) = RDMEM_L(cpustate, AS_PROGRAM, dsp16);
23622370}
23632371
23642372/******************************************
r19440r19441
23712379   GET_SRC(OP0,NIB2);
23722380   GET_IDX16(OP1);
23732381   idx16 = addr_add(cpustate, addr_from_reg(cpustate, src), idx16);
2374   cpustate->RL(dst) = RDMEM_L(cpustate,  idx16);
2382   cpustate->RL(dst) = RDMEM_L(cpustate, AS_DATA, idx16);
23752383}
23762384
23772385/******************************************
r19440r19441
24062414{
24072415   GET_SRC(OP0,NIB3);
24082416   GET_DSP16;
2409   WRMEM_L(cpustate,  dsp16, cpustate->RL(src));
2417   WRMEM_L(cpustate, AS_PROGRAM, dsp16, cpustate->RL(src));
24102418}
24112419
24122420/******************************************
r19440r19441
24192427   GET_DST(OP0,NIB2);
24202428   GET_IDX16(OP1);
24212429   idx16 = addr_add(cpustate, addr_from_reg(cpustate, dst), idx16);
2422   WRMEM_L(cpustate,  idx16, cpustate->RL(src));
2430   WRMEM_L(cpustate, AS_DATA, idx16, cpustate->RL(src));
24232431}
24242432
24252433/******************************************
r19440r19441
24472455   UINT16 fcw;
24482456    if (segmented_mode(cpustate)) {
24492457        UINT32 addr = addr_from_reg(cpustate, src);
2450        fcw = RDMEM_W(cpustate,  addr + 2);
2451        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
2458        fcw = RDMEM_W(cpustate, AS_DATA, addr + 2);
2459        set_pc(cpustate, segmented_addr(RDMEM_L(cpustate, AS_DATA, addr + 4)));
24522460    }
24532461    else {
2454        fcw = RDMEM_W(cpustate,  cpustate->RW(src));
2455        cpustate->pc = RDMEM_W(cpustate,  (UINT16)(cpustate->RW(src) + 2));
2462        fcw = RDMEM_W(cpustate, AS_DATA,  cpustate->RW(src));
2463        set_pc(cpustate, RDMEM_W(cpustate, AS_DATA, (UINT16)(cpustate->RW(src) + 2)));
24562464    }
2465   if ((fcw ^ cpustate->fcw) & F_SEG) printf("ldps 1 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", cpustate->pc, (fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-");
24572466   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
24582467}
24592468
r19440r19441
24682477    GET_CNT(OP1,NIB1);
24692478    GET_DST(OP1,NIB2);
24702479    GET_CCC(OP1,NIB3);
2471    WRMEM_B(cpustate, addr_from_reg(cpustate, dst), RDPORT_B(cpustate,  0, cpustate->RW(src)));
2480    WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), RDPORT_B(cpustate,  0, cpustate->RW(src)));
24722481   add_to_addr_reg(cpustate, dst, 1);
24732482   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
24742483}
r19440r19441
24852494    GET_CNT(OP1,NIB1);
24862495    GET_DST(OP1,NIB2);
24872496    GET_CCC(OP1,NIB3);
2488    WRMEM_B(cpustate,  cpustate->RW(dst), RDPORT_B(cpustate,  1, cpustate->RW(src)));
2497    WRMEM_B(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_B(cpustate,  1, cpustate->RW(src)));
24892498    cpustate->RW(dst)++;
24902499    cpustate->RW(src)++;
24912500   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
25032512    GET_CNT(OP1,NIB1);
25042513    GET_DST(OP1,NIB2);
25052514    GET_CCC(OP1,NIB3);
2506    WRPORT_B(cpustate,  0, cpustate->RW(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
2515    WRPORT_B(cpustate,  0, cpustate->RW(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
25072516   add_to_addr_reg(cpustate, src, 1);
25082517   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
25092518}
r19440r19441
25202529    GET_CNT(OP1,NIB1);
25212530    GET_DST(OP1,NIB2);
25222531    GET_CCC(OP1,NIB3);
2523    WRPORT_B(cpustate,  1, cpustate->RW(dst), RDMEM_B(cpustate,  cpustate->RW(src)));
2532    WRPORT_B(cpustate,  1, cpustate->RW(dst), RDMEM_B(cpustate, AS_DATA, cpustate->RW(src)));
25242533    cpustate->RW(dst)++;
25252534    cpustate->RW(src)++;
25262535   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
25862595   GET_CNT(OP1,NIB1);
25872596   GET_DST(OP1,NIB2);
25882597   GET_CCC(OP1,NIB3);
2589   WRMEM_B(cpustate,  cpustate->RW(dst), RDPORT_B(cpustate,  0, cpustate->RW(src)));
2598   WRMEM_B(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_B(cpustate,  0, cpustate->RW(src)));
25902599   cpustate->RW(dst)--;
25912600   cpustate->RW(src)--;
25922601   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26042613   GET_CNT(OP1,NIB1);
26052614   GET_DST(OP1,NIB2);
26062615   GET_CCC(OP1,NIB3);
2607   WRMEM_B(cpustate,  cpustate->RW(dst), RDPORT_B(cpustate,  1, cpustate->RW(src)));
2616   WRMEM_B(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_B(cpustate,  1, cpustate->RW(src)));
26082617   cpustate->RW(dst)--;
26092618   cpustate->RW(src)--;
26102619   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26222631   GET_CNT(OP1,NIB1);
26232632   GET_DST(OP1,NIB2);
26242633   GET_CCC(OP1,NIB3);
2625   WRPORT_B(cpustate,  0, cpustate->RW(dst), RDMEM_B(cpustate,  cpustate->RW(src)));
2634   WRPORT_B(cpustate,  0, cpustate->RW(dst), RDMEM_B(cpustate, AS_DATA, cpustate->RW(src)));
26262635   cpustate->RW(dst)--;
26272636   cpustate->RW(src)--;
26282637   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26402649   GET_CNT(OP1,NIB1);
26412650   GET_DST(OP1,NIB2);
26422651   GET_CCC(OP1,NIB3);
2643   WRPORT_B(cpustate,  1, cpustate->RW(dst), RDMEM_B(cpustate,  cpustate->RW(src)));
2652   WRPORT_B(cpustate,  1, cpustate->RW(dst), RDMEM_B(cpustate, AS_DATA, cpustate->RW(src)));
26442653   cpustate->RW(dst)--;
26452654   cpustate->RW(src)--;
26462655   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26582667    GET_CNT(OP1,NIB1);
26592668   GET_DST(OP1,NIB2);
26602669   GET_CCC(OP1,NIB3);
2661   WRMEM_W(cpustate,  cpustate->RW(dst), RDPORT_W(cpustate,  0, cpustate->RW(src)));
2670   WRMEM_W(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_W(cpustate,  0, cpustate->RW(src)));
26622671   cpustate->RW(dst) += 2;
26632672   cpustate->RW(src) += 2;
26642673   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26762685    GET_CNT(OP1,NIB1);
26772686   GET_DST(OP1,NIB2);
26782687   GET_CCC(OP1,NIB3);
2679   WRMEM_W(cpustate,  cpustate->RW(dst), RDPORT_W(cpustate,  1, cpustate->RW(src)));
2688   WRMEM_W(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_W(cpustate,  1, cpustate->RW(src)));
26802689   cpustate->RW(dst) += 2;
26812690   cpustate->RW(src) += 2;
26822691   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
26942703    GET_CNT(OP1,NIB1);
26952704   GET_DST(OP1,NIB2);
26962705   GET_CCC(OP1,NIB3);
2697   WRPORT_W(cpustate,  0, cpustate->RW(dst), RDMEM_W(cpustate,  cpustate->RW(src)));
2706   WRPORT_W(cpustate,  0, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, cpustate->RW(src)));
26982707   cpustate->RW(dst) += 2;
26992708   cpustate->RW(src) += 2;
27002709   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
27122721    GET_CNT(OP1,NIB1);
27132722   GET_DST(OP1,NIB2);
27142723   GET_CCC(OP1,NIB3);
2715   WRPORT_W(cpustate,  1, cpustate->RW(dst), RDMEM_W(cpustate,  cpustate->RW(src)));
2724   WRPORT_W(cpustate,  1, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, cpustate->RW(src)));
27162725   cpustate->RW(dst) += 2;
27172726   cpustate->RW(src) += 2;
27182727   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
27782787    GET_CNT(OP1,NIB1);
27792788   GET_DST(OP1,NIB2);
27802789   GET_CCC(OP1,NIB3);
2781   WRMEM_W(cpustate,  cpustate->RW(dst), RDPORT_W(cpustate,  0, cpustate->RW(src)));
2790   WRMEM_W(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_W(cpustate,  0, cpustate->RW(src)));
27822791   cpustate->RW(dst) -= 2;
27832792   cpustate->RW(src) -= 2;
27842793   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
27962805    GET_CNT(OP1,NIB1);
27972806   GET_DST(OP1,NIB2);
27982807   GET_CCC(OP1,NIB3);
2799   WRMEM_W(cpustate,  cpustate->RW(dst), RDPORT_W(cpustate,  1, cpustate->RW(src)));
2808   WRMEM_W(cpustate, AS_DATA, cpustate->RW(dst), RDPORT_W(cpustate,  1, cpustate->RW(src)));
28002809   cpustate->RW(dst) -= 2;
28012810   cpustate->RW(src) -= 2;
28022811   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
28142823    GET_CNT(OP1,NIB1);
28152824   GET_DST(OP1,NIB2);
28162825   GET_CCC(OP1,NIB3);
2817   WRPORT_W(cpustate,  0, cpustate->RW(dst), RDMEM_W(cpustate,  cpustate->RW(src)));
2826   WRPORT_W(cpustate,  0, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, cpustate->RW(src)));
28182827   cpustate->RW(dst) -= 2;
28192828   cpustate->RW(src) -= 2;
28202829   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
28322841    GET_CNT(OP1,NIB1);
28332842   GET_DST(OP1,NIB2);
28342843   GET_CCC(OP1,NIB3);
2835   WRPORT_W(cpustate,  1, cpustate->RW(dst), RDMEM_W(cpustate,  cpustate->RW(src)));
2844   WRPORT_W(cpustate,  1, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, cpustate->RW(src)));
28362845   cpustate->RW(dst) -= 2;
28372846   cpustate->RW(src) -= 2;
28382847   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
28942903{
28952904   GET_DST(OP0,NIB3);
28962905   GET_ADDR(OP1);
2897   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
2906   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
28982907}
28992908
29002909/******************************************
r19440r19441
29072916   GET_SRC(OP0,NIB2);
29082917   GET_ADDR(OP1);
29092918   addr = addr_add(cpustate, addr, cpustate->RW(src));
2910   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
2919   cpustate->RB(dst) = ADDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
29112920}
29122921
29132922/******************************************
r19440r19441
29182927{
29192928   GET_DST(OP0,NIB3);
29202929   GET_ADDR(OP1);
2921   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr)); /* EHC */
2930   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr)); /* EHC */
29222931}
29232932
29242933/******************************************
r19440r19441
29312940   GET_SRC(OP0,NIB2);
29322941   GET_ADDR(OP1);
29332942   addr = addr_add(cpustate, addr, cpustate->RW(src));
2934   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));   /* ASG */
2943   cpustate->RW(dst) = ADDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));   /* ASG */
29352944}
29362945
29372946/******************************************
r19440r19441
29422951{
29432952   GET_DST(OP0,NIB3);
29442953   GET_ADDR(OP1);
2945   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr)); /* EHC */
2954   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr)); /* EHC */
29462955}
29472956
29482957/******************************************
r19440r19441
29552964   GET_SRC(OP0,NIB2);
29562965   GET_ADDR(OP1);
29572966   addr = addr_add(cpustate, addr, cpustate->RW(src));
2958   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
2967   cpustate->RB(dst) = SUBB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
29592968}
29602969
29612970/******************************************
r19440r19441
29662975{
29672976   GET_DST(OP0,NIB3);
29682977   GET_ADDR(OP1);
2969   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
2978   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
29702979}
29712980
29722981/******************************************
r19440r19441
29792988   GET_SRC(OP0,NIB2);
29802989   GET_ADDR(OP1);
29812990   addr = addr_add(cpustate, addr, cpustate->RW(src));
2982   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
2991   cpustate->RW(dst) = SUBW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
29832992}
29842993
29852994/******************************************
r19440r19441
29902999{
29913000   GET_DST(OP0,NIB3);
29923001   GET_ADDR(OP1);
2993   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3002   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
29943003}
29953004
29963005/******************************************
r19440r19441
30033012   GET_SRC(OP0,NIB2);
30043013   GET_ADDR(OP1);
30053014   addr = addr_add(cpustate, addr, cpustate->RW(src));
3006   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3015   cpustate->RB(dst) = ORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
30073016}
30083017
30093018/******************************************
r19440r19441
30143023{
30153024   GET_DST(OP0,NIB3);
30163025   GET_ADDR(OP1);
3017   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3026   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
30183027}
30193028
30203029/******************************************
r19440r19441
30273036   GET_SRC(OP0,NIB2);
30283037   GET_ADDR(OP1);
30293038   addr = addr_add(cpustate, addr, cpustate->RW(src));
3030   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3039   cpustate->RW(dst) = ORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
30313040}
30323041
30333042/******************************************
r19440r19441
30383047{
30393048   GET_DST(OP0,NIB3);
30403049   GET_ADDR(OP1);
3041   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3050   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
30423051}
30433052
30443053/******************************************
r19440r19441
30513060   GET_SRC(OP0,NIB2);
30523061   GET_ADDR(OP1);
30533062   addr = addr_add(cpustate, addr, cpustate->RW(src));
3054   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3063   cpustate->RB(dst) = ANDB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
30553064}
30563065
30573066/******************************************
r19440r19441
30623071{
30633072   GET_DST(OP0,NIB3);
30643073   GET_ADDR(OP1);
3065   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3074   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
30663075}
30673076
30683077/******************************************
r19440r19441
30753084   GET_SRC(OP0,NIB2);
30763085   GET_ADDR(OP1);
30773086   addr = addr_add(cpustate, addr, cpustate->RW(src));
3078   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3087   cpustate->RW(dst) = ANDW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
30793088}
30803089
30813090/******************************************
r19440r19441
30863095{
30873096   GET_DST(OP0,NIB3);
30883097   GET_ADDR(OP1);
3089   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3098   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
30903099}
30913100
30923101/******************************************
r19440r19441
30993108   GET_SRC(OP0,NIB2);
31003109   GET_ADDR(OP1);
31013110   addr = addr_add(cpustate, addr, cpustate->RW(src));
3102   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3111   cpustate->RB(dst) = XORB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
31033112}
31043113
31053114/******************************************
r19440r19441
31103119{
31113120   GET_DST(OP0,NIB3);
31123121   GET_ADDR(OP1);
3113   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3122   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
31143123}
31153124
31163125/******************************************
r19440r19441
31233132   GET_SRC(OP0,NIB2);
31243133   GET_ADDR(OP1);
31253134   addr = addr_add(cpustate, addr, cpustate->RW(src));
3126   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3135   cpustate->RW(dst) = XORW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
31273136}
31283137
31293138/******************************************
r19440r19441
31343143{
31353144   GET_DST(OP0,NIB3);
31363145   GET_ADDR(OP1);
3137   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3146   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
31383147}
31393148
31403149/******************************************
r19440r19441
31473156   GET_SRC(OP0,NIB2);
31483157   GET_ADDR(OP1);
31493158   addr = addr_add(cpustate, addr, cpustate->RW(src));
3150   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr));
3159   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr));
31513160}
31523161
31533162/******************************************
r19440r19441
31583167{
31593168   GET_DST(OP0,NIB3);
31603169   GET_ADDR(OP1);
3161   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3170   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
31623171}
31633172
31643173/******************************************
r19440r19441
31713180   GET_SRC(OP0,NIB2);
31723181   GET_ADDR(OP1);
31733182   addr = addr_add(cpustate, addr, cpustate->RW(src));
3174   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr));
3183   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr));
31753184}
31763185
31773186/******************************************
r19440r19441
31813190static void Z4C_0000_0000_addr(z8000_state *cpustate)
31823191{
31833192   GET_ADDR(OP1);
3184   WRMEM_B(cpustate,  addr, COMB(cpustate, RDMEM_W(cpustate, addr)));
3193   WRMEM_B(cpustate, AS_DATA, addr, COMB(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
31853194}
31863195
31873196/******************************************
r19440r19441
31923201{
31933202   GET_ADDR(OP1);
31943203   GET_IMM8(OP2);
3195   CPB(cpustate, RDMEM_B(cpustate, addr), imm8);
3204   CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), imm8);
31963205}
31973206
31983207/******************************************
r19440r19441
32023211static void Z4C_0000_0010_addr(z8000_state *cpustate)
32033212{
32043213   GET_ADDR(OP1);
3205   WRMEM_B(cpustate,  addr, NEGB(cpustate, RDMEM_B(cpustate, addr)));
3214   WRMEM_B(cpustate, AS_DATA, addr, NEGB(cpustate, RDMEM_B(cpustate, AS_DATA, addr)));
32063215}
32073216
32083217/******************************************
r19440r19441
32123221static void Z4C_0000_0100_addr(z8000_state *cpustate)
32133222{
32143223   GET_ADDR(OP1);
3215   TESTB(cpustate, RDMEM_B(cpustate, addr));
3224   TESTB(cpustate, RDMEM_B(cpustate, AS_DATA, addr));
32163225}
32173226
32183227/******************************************
r19440r19441
32233232{
32243233   GET_ADDR(OP1);
32253234   GET_IMM8(OP2);
3226   WRMEM_B(cpustate,  addr, imm8);
3235   WRMEM_B(cpustate, AS_DATA, addr, imm8);
32273236}
32283237
32293238/******************************************
r19440r19441
32333242static void Z4C_0000_0110_addr(z8000_state *cpustate)
32343243{
32353244   GET_ADDR(OP1);
3236    if (RDMEM_B(cpustate, addr) & S08) SET_S; else CLR_S;
3237    WRMEM_B(cpustate, addr, 0xff);
3245    if (RDMEM_B(cpustate, AS_DATA, addr) & S08) SET_S; else CLR_S;
3246    WRMEM_B(cpustate, AS_DATA, addr, 0xff);
32383247}
32393248
32403249/******************************************
r19440r19441
32443253static void Z4C_0000_1000_addr(z8000_state *cpustate)
32453254{
32463255   GET_ADDR(OP1);
3247   WRMEM_B(cpustate,  addr, 0);
3256   WRMEM_B(cpustate, AS_DATA, addr, 0);
32483257}
32493258
32503259/******************************************
r19440r19441
32563265   GET_DST(OP0,NIB2);
32573266   GET_ADDR(OP1);
32583267   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3259   WRMEM_B(cpustate,  addr, COMB(cpustate, RDMEM_B(cpustate, addr)));
3268   WRMEM_B(cpustate, AS_DATA, addr, COMB(cpustate, RDMEM_B(cpustate, AS_DATA, addr)));
32603269}
32613270
32623271/******************************************
r19440r19441
32693278   GET_ADDR(OP1);
32703279   GET_IMM8(OP2);
32713280   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3272   CPB(cpustate, RDMEM_B(cpustate, addr), imm8);
3281   CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), imm8);
32733282}
32743283
32753284/******************************************
r19440r19441
32813290   GET_DST(OP0,NIB2);
32823291   GET_ADDR(OP1);
32833292   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3284   WRMEM_B(cpustate,  addr, NEGB(cpustate, RDMEM_B(cpustate, addr)));
3293   WRMEM_B(cpustate, AS_DATA, addr, NEGB(cpustate, RDMEM_B(cpustate, AS_DATA, addr)));
32853294}
32863295
32873296/******************************************
r19440r19441
32933302   GET_DST(OP0,NIB2);
32943303   GET_ADDR(OP1);
32953304   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3296   TESTB(cpustate, RDMEM_B(cpustate, addr));
3305   TESTB(cpustate, RDMEM_B(cpustate, AS_DATA, addr));
32973306}
32983307
32993308/******************************************
r19440r19441
33063315   GET_ADDR(OP1);
33073316   GET_IMM8(OP2);
33083317   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3309   WRMEM_B(cpustate,  addr, imm8);
3318   WRMEM_B(cpustate, AS_DATA, addr, imm8);
33103319}
33113320
33123321/******************************************
r19440r19441
33183327   GET_DST(OP0,NIB2);
33193328   GET_ADDR(OP1);
33203329   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3321    if (RDMEM_B(cpustate, addr) & S08) SET_S; else CLR_S;
3322    WRMEM_B(cpustate, addr, 0xff);
3330    if (RDMEM_B(cpustate, AS_DATA, addr) & S08) SET_S; else CLR_S;
3331    WRMEM_B(cpustate, AS_DATA, addr, 0xff);
33233332}
33243333
33253334/******************************************
r19440r19441
33313340   GET_DST(OP0,NIB2);
33323341   GET_ADDR(OP1);
33333342   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3334   WRMEM_B(cpustate,  addr, 0);
3343   WRMEM_B(cpustate, AS_DATA, addr, 0);
33353344}
33363345
33373346/******************************************
r19440r19441
33413350static void Z4D_0000_0000_addr(z8000_state *cpustate)
33423351{
33433352   GET_ADDR(OP1);
3344   WRMEM_W(cpustate,  addr, COMW(cpustate, RDMEM_W(cpustate, addr)));
3353   WRMEM_W(cpustate, AS_DATA, addr, COMW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
33453354}
33463355
33473356/******************************************
r19440r19441
33523361{
33533362   GET_ADDR(OP1);
33543363   GET_IMM16(OP2);
3355   CPW(cpustate, RDMEM_W(cpustate, addr), imm16);
3364   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), imm16);
33563365}
33573366
33583367/******************************************
r19440r19441
33623371static void Z4D_0000_0010_addr(z8000_state *cpustate)
33633372{
33643373   GET_ADDR(OP1);
3365   WRMEM_W(cpustate,  addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
3374   WRMEM_W(cpustate, AS_DATA, addr, NEGW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
33663375}
33673376
33683377/******************************************
r19440r19441
33723381static void Z4D_0000_0100_addr(z8000_state *cpustate)
33733382{
33743383   GET_ADDR(OP1);
3375   TESTW(cpustate, RDMEM_W(cpustate, addr));
3384   TESTW(cpustate, RDMEM_W(cpustate, AS_DATA, addr));
33763385}
33773386
33783387/******************************************
r19440r19441
33833392{
33843393   GET_ADDR(OP1);
33853394   GET_IMM16(OP2);
3386   WRMEM_W(cpustate,  addr, imm16);
3395   WRMEM_W(cpustate, AS_DATA, addr, imm16);
33873396}
33883397
33893398/******************************************
r19440r19441
33933402static void Z4D_0000_0110_addr(z8000_state *cpustate)
33943403{
33953404   GET_ADDR(OP1);
3396    if (RDMEM_W(cpustate, addr) & S16) SET_S; else CLR_S;
3397    WRMEM_W(cpustate, addr, 0xffff);
3405    if (RDMEM_W(cpustate, AS_DATA, addr) & S16) SET_S; else CLR_S;
3406    WRMEM_W(cpustate, AS_DATA, addr, 0xffff);
33983407}
33993408
34003409/******************************************
r19440r19441
34043413static void Z4D_0000_1000_addr(z8000_state *cpustate)
34053414{
34063415   GET_ADDR(OP1);
3407   WRMEM_W(cpustate,  addr, 0);
3416   WRMEM_W(cpustate, AS_DATA, addr, 0);
34083417}
34093418
34103419/******************************************
r19440r19441
34163425   GET_DST(OP0,NIB2);
34173426   GET_ADDR(OP1);
34183427   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3419   WRMEM_W(cpustate,  addr, COMW(cpustate, RDMEM_W(cpustate, addr)));
3428   WRMEM_W(cpustate, AS_DATA, addr, COMW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
34203429}
34213430
34223431/******************************************
r19440r19441
34293438   GET_ADDR(OP1);
34303439   GET_IMM16(OP2);
34313440   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3432   CPW(cpustate, RDMEM_W(cpustate, addr), imm16);
3441   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), imm16);
34333442}
34343443
34353444/******************************************
r19440r19441
34413450   GET_DST(OP0,NIB2);
34423451   GET_ADDR(OP1);
34433452   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3444   WRMEM_W(cpustate,  addr, NEGW(cpustate, RDMEM_W(cpustate, addr)));
3453   WRMEM_W(cpustate, AS_DATA, addr, NEGW(cpustate, RDMEM_W(cpustate, AS_DATA, addr)));
34453454}
34463455
34473456/******************************************
r19440r19441
34533462   GET_DST(OP0,NIB2);
34543463   GET_ADDR(OP1);
34553464   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3456   TESTW(cpustate, RDMEM_W(cpustate, addr));
3465   TESTW(cpustate, RDMEM_W(cpustate, AS_DATA, addr));
34573466}
34583467
34593468/******************************************
r19440r19441
34663475   GET_ADDR(OP1);
34673476   GET_IMM16(OP2);
34683477   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3469   WRMEM_W(cpustate,  addr, imm16);
3478   WRMEM_W(cpustate, AS_DATA, addr, imm16);
34703479}
34713480
34723481/******************************************
r19440r19441
34783487   GET_DST(OP0,NIB2);
34793488   GET_ADDR(OP1);
34803489   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3481    if (RDMEM_W(cpustate, addr) & S16) SET_S; else CLR_S;
3482    WRMEM_W(cpustate, addr, 0xffff);
3490    if (RDMEM_W(cpustate, AS_DATA, addr) & S16) SET_S; else CLR_S;
3491    WRMEM_W(cpustate, AS_DATA, addr, 0xffff);
34833492}
34843493
34853494/******************************************
r19440r19441
34913500   GET_DST(OP0,NIB2);
34923501   GET_ADDR(OP1);
34933502   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3494   WRMEM_W(cpustate,  addr, 0);
3503   WRMEM_W(cpustate, AS_DATA, addr, 0);
34953504}
34963505
34973506/******************************************
r19440r19441
35043513   GET_SRC(OP0,NIB3);
35053514   GET_ADDR(OP1);
35063515   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3507   WRMEM_B(cpustate,  addr, cpustate->RB(src));
3516   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(src));
35083517}
35093518
35103519/******************************************
r19440r19441
35153524{
35163525   GET_DST(OP0,NIB3);
35173526   GET_ADDR(OP1);
3518   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3527   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
35193528}
35203529
35213530/******************************************
r19440r19441
35283537   GET_SRC(OP0,NIB2);
35293538   GET_ADDR(OP1);
35303539   addr = addr_add(cpustate, addr, cpustate->RW(src));
3531   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3540   CPL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
35323541}
35333542
35343543/******************************************
r19440r19441
35393548{
35403549   GET_DST(OP0,NIB2);
35413550   GET_ADDR(OP1);
3542   PUSHL(cpustate, dst, RDMEM_L(cpustate, addr));
3551   PUSHL(cpustate, dst, RDMEM_L(cpustate, AS_DATA, addr));
35433552}
35443553
35453554/******************************************
r19440r19441
35523561   GET_DST(OP0,NIB2);
35533562   GET_ADDR(OP1);
35543563   addr = addr_add(cpustate, addr, cpustate->RW(src));
3555   PUSHL(cpustate, dst, RDMEM_L(cpustate, addr));
3564   PUSHL(cpustate, dst, RDMEM_L(cpustate, AS_DATA, addr));
35563565}
35573566
35583567/******************************************
r19440r19441
35633572{
35643573   GET_DST(OP0,NIB3);
35653574   GET_ADDR(OP1);
3566   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3575   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
35673576}
35683577
35693578/******************************************
r19440r19441
35763585   GET_SRC(OP0,NIB2);
35773586   GET_ADDR(OP1);
35783587   addr = addr_add(cpustate, addr, cpustate->RW(src));
3579   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3588   cpustate->RL(dst) = SUBL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
35803589}
35813590
35823591/******************************************
r19440r19441
35873596{
35883597   GET_DST(OP0,NIB2);
35893598   GET_ADDR(OP1);
3590   PUSHW(cpustate, dst, RDMEM_W(cpustate, addr));
3599   PUSHW(cpustate, dst, RDMEM_W(cpustate, AS_DATA, addr));
35913600}
35923601
35933602/******************************************
r19440r19441
36003609   GET_SRC(OP0,NIB3);
36013610   GET_ADDR(OP1);
36023611   addr = addr_add(cpustate, addr, cpustate->RW(src));
3603   PUSHW(cpustate, dst, RDMEM_W(cpustate, addr));
3612   PUSHW(cpustate, dst, RDMEM_W(cpustate, AS_DATA, addr));
36043613}
36053614
36063615/******************************************
r19440r19441
36113620{
36123621   GET_DST(OP0,NIB3);
36133622   GET_ADDR(OP1);
3614   cpustate->RL(dst) = RDMEM_L(cpustate,  addr);
3623   cpustate->RL(dst) = RDMEM_L(cpustate, AS_DATA, addr);
36153624}
36163625
36173626/******************************************
r19440r19441
36243633   GET_SRC(OP0,NIB2);
36253634   GET_ADDR(OP1);
36263635   addr = addr_add(cpustate, addr, cpustate->RW(src));
3627   cpustate->RL(dst) = RDMEM_L(cpustate,  addr);
3636   cpustate->RL(dst) = RDMEM_L(cpustate, AS_DATA, addr);
36283637}
36293638
36303639/******************************************
r19440r19441
36353644{
36363645   GET_SRC(OP0,NIB2);
36373646   GET_ADDR(OP1);
3638   WRMEM_L(cpustate,  addr, POPL(cpustate, src));
3647   WRMEM_L(cpustate, AS_DATA, addr, POPL(cpustate, src));
36393648}
36403649
36413650/******************************************
r19440r19441
36483657   GET_SRC(OP0,NIB2);
36493658   GET_ADDR(OP1);
36503659   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3651   WRMEM_L(cpustate,  addr, POPL(cpustate, src));
3660   WRMEM_L(cpustate, AS_DATA, addr, POPL(cpustate, src));
36523661}
36533662
36543663/******************************************
r19440r19441
36593668{
36603669   GET_DST(OP0,NIB3);
36613670   GET_ADDR(OP1);
3662   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3671   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
36633672}
36643673
36653674/******************************************
r19440r19441
36723681   GET_SRC(OP0,NIB2);
36733682   GET_ADDR(OP1);
36743683   addr = addr_add(cpustate, addr, cpustate->RW(src));
3675   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, addr));
3684   cpustate->RL(dst) = ADDL(cpustate, cpustate->RL(dst), RDMEM_L(cpustate, AS_DATA, addr));
36763685}
36773686
36783687/******************************************
r19440r19441
36833692{
36843693   GET_SRC(OP0,NIB2);
36853694   GET_ADDR(OP1);
3686   WRMEM_W(cpustate,  addr, POPW(cpustate, src));
3695   WRMEM_W(cpustate, AS_DATA, addr, POPW(cpustate, src));
36873696}
36883697
36893698/******************************************
r19440r19441
36963705   GET_SRC(OP0,NIB2);
36973706   GET_ADDR(OP1);
36983707   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3699   WRMEM_W(cpustate,  addr, POPW(cpustate, src));
3708   WRMEM_W(cpustate, AS_DATA, addr, POPW(cpustate, src));
37003709}
37013710
37023711/******************************************
r19440r19441
37073716{
37083717   GET_DST(OP0,NIB3);
37093718   GET_ADDR(OP1);
3710   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
3719   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, AS_DATA, addr));
37113720}
37123721
37133722/******************************************
r19440r19441
37203729   GET_SRC(OP0,NIB2);
37213730   GET_ADDR(OP1);
37223731   addr = addr_add(cpustate, addr, cpustate->RW(src));
3723   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
3732   cpustate->RQ(dst) = MULTL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, AS_DATA, addr));
37243733}
37253734
37263735/******************************************
r19440r19441
37313740{
37323741   GET_DST(OP0,NIB3);
37333742   GET_ADDR(OP1);
3734   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
3743   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr));
37353744}
37363745
37373746/******************************************
r19440r19441
37443753   GET_SRC(OP0,NIB2);
37453754   GET_ADDR(OP1);
37463755   addr = addr_add(cpustate, addr, cpustate->RW(src));
3747   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
3756   cpustate->RL(dst) = MULTW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr));
37483757}
37493758
37503759/******************************************
r19440r19441
37553764{
37563765   GET_DST(OP0,NIB3);
37573766   GET_ADDR(OP1);
3758   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
3767   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, AS_DATA, addr));
37593768}
37603769
37613770/******************************************
r19440r19441
37683777   GET_SRC(OP0,NIB2);
37693778   GET_ADDR(OP1);
37703779   addr = addr_add(cpustate, addr, cpustate->RW(src));
3771   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, addr));
3780   cpustate->RQ(dst) = DIVL(cpustate, cpustate->RQ(dst), RDMEM_L(cpustate, AS_DATA, addr));
37723781}
37733782
37743783/******************************************
r19440r19441
37793788{
37803789   GET_DST(OP0,NIB3);
37813790   GET_ADDR(OP1);
3782   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
3791   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr));
37833792}
37843793
37853794/******************************************
r19440r19441
37923801   GET_SRC(OP0,NIB2);
37933802   GET_ADDR(OP1);
37943803   addr = addr_add(cpustate, addr, cpustate->RW(src));
3795   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, addr));
3804   cpustate->RL(dst) = DIVW(cpustate, cpustate->RL(dst), RDMEM_W(cpustate, AS_DATA, addr));
37963805}
37973806
37983807/******************************************
r19440r19441
38053814   GET_CNT(OP1,NIB3);
38063815   GET_ADDR(OP2);
38073816   while (cnt-- >= 0) {
3808      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
3817      cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr);
38093818      dst = (dst+1) & 15;
38103819        addr = addr_add (cpustate, addr, 2);
38113820   }
r19440r19441
38183827static void Z5C_0000_1000_addr(z8000_state *cpustate)
38193828{
38203829   GET_ADDR(OP1);
3821   TESTL(cpustate, RDMEM_L(cpustate, addr));
3830   TESTL(cpustate, RDMEM_L(cpustate, AS_DATA, addr));
38223831}
38233832
38243833/******************************************
r19440r19441
38313840   GET_CNT(OP1,NIB3);
38323841   GET_ADDR(OP2);
38333842   while (cnt-- >= 0) {
3834      WRMEM_W(cpustate,  addr, cpustate->RW(src));
3843      WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(src));
38353844      src = (src+1) & 15;
38363845        addr = addr_add (cpustate, addr, 2);
38373846   }
r19440r19441
38463855   GET_DST(OP0,NIB2);
38473856   GET_ADDR(OP1);
38483857   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3849   TESTL(cpustate, RDMEM_L(cpustate, addr));
3858   TESTL(cpustate, RDMEM_L(cpustate, AS_DATA, addr));
38503859}
38513860
38523861/******************************************
r19440r19441
38613870   GET_ADDR(OP2);
38623871   addr = addr_add(cpustate, addr, cpustate->RW(dst));
38633872   while (cnt-- >= 0) {
3864      WRMEM_W(cpustate,  addr, cpustate->RW(src));
3873      WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(src));
38653874      src = (src+1) & 15;
38663875      addr = addr_add(cpustate, addr, 2);
38673876   }
r19440r19441
38793888   GET_ADDR(OP2);
38803889   addr = addr_add(cpustate, addr, cpustate->RW(src));
38813890   while (cnt-- >= 0) {
3882      cpustate->RW(dst) = RDMEM_W(cpustate, addr);
3891      cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr);
38833892      dst = (dst+1) & 15;
38843893      addr = addr_add(cpustate, addr, 2);
38853894   }
r19440r19441
38933902{
38943903   GET_SRC(OP0,NIB3);
38953904   GET_ADDR(OP1);
3896   WRMEM_L(cpustate,  addr, cpustate->RL(src));
3905   WRMEM_L(cpustate, AS_DATA, addr, cpustate->RL(src));
38973906}
38983907
38993908/******************************************
r19440r19441
39063915   GET_DST(OP0,NIB2);
39073916   GET_ADDR(OP1);
39083917   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3909   WRMEM_L(cpustate,  addr, cpustate->RL(src));
3918   WRMEM_L(cpustate, AS_DATA, addr, cpustate->RL(src));
39103919}
39113920
39123921/******************************************
r19440r19441
39183927   GET_CCC(OP0,NIB3);
39193928   GET_ADDR(OP1);
39203929   switch (cc) {
3921      case  0: if (CC0) cpustate->pc = addr; break;
3922      case  1: if (CC1) cpustate->pc = addr; break;
3923      case  2: if (CC2) cpustate->pc = addr; break;
3924      case  3: if (CC3) cpustate->pc = addr; break;
3925      case  4: if (CC4) cpustate->pc = addr; break;
3926      case  5: if (CC5) cpustate->pc = addr; break;
3927      case  6: if (CC6) cpustate->pc = addr; break;
3928      case  7: if (CC7) cpustate->pc = addr; break;
3929      case  8: if (CC8) cpustate->pc = addr; break;
3930      case  9: if (CC9) cpustate->pc = addr; break;
3931      case 10: if (CCA) cpustate->pc = addr; break;
3932      case 11: if (CCB) cpustate->pc = addr; break;
3933      case 12: if (CCC) cpustate->pc = addr; break;
3934      case 13: if (CCD) cpustate->pc = addr; break;
3935      case 14: if (CCE) cpustate->pc = addr; break;
3936      case 15: if (CCF) cpustate->pc = addr; break;
3930      case  0: if (CC0) set_pc(cpustate, addr); break;
3931      case  1: if (CC1) set_pc(cpustate, addr); break;
3932      case  2: if (CC2) set_pc(cpustate, addr); break;
3933      case  3: if (CC3) set_pc(cpustate, addr); break;
3934      case  4: if (CC4) set_pc(cpustate, addr); break;
3935      case  5: if (CC5) set_pc(cpustate, addr); break;
3936      case  6: if (CC6) set_pc(cpustate, addr); break;
3937      case  7: if (CC7) set_pc(cpustate, addr); break;
3938      case  8: if (CC8) set_pc(cpustate, addr); break;
3939      case  9: if (CC9) set_pc(cpustate, addr); break;
3940      case 10: if (CCA) set_pc(cpustate, addr); break;
3941      case 11: if (CCB) set_pc(cpustate, addr); break;
3942      case 12: if (CCC) set_pc(cpustate, addr); break;
3943      case 13: if (CCD) set_pc(cpustate, addr); break;
3944      case 14: if (CCE) set_pc(cpustate, addr); break;
3945      case 15: if (CCF) set_pc(cpustate, addr); break;
39373946   }
39383947}
39393948
r19440r19441
39483957   GET_ADDR(OP1);
39493958   addr = addr_add(cpustate, addr, cpustate->RW(dst));
39503959   switch (cc) {
3951      case  0: if (CC0) cpustate->pc = addr; break;
3952      case  1: if (CC1) cpustate->pc = addr; break;
3953      case  2: if (CC2) cpustate->pc = addr; break;
3954      case  3: if (CC3) cpustate->pc = addr; break;
3955      case  4: if (CC4) cpustate->pc = addr; break;
3956      case  5: if (CC5) cpustate->pc = addr; break;
3957      case  6: if (CC6) cpustate->pc = addr; break;
3958      case  7: if (CC7) cpustate->pc = addr; break;
3959      case  8: if (CC8) cpustate->pc = addr; break;
3960      case  9: if (CC9) cpustate->pc = addr; break;
3961      case 10: if (CCA) cpustate->pc = addr; break;
3962      case 11: if (CCB) cpustate->pc = addr; break;
3963      case 12: if (CCC) cpustate->pc = addr; break;
3964      case 13: if (CCD) cpustate->pc = addr; break;
3965      case 14: if (CCE) cpustate->pc = addr; break;
3966      case 15: if (CCF) cpustate->pc = addr; break;
3960      case  0: if (CC0) set_pc(cpustate, addr); break;
3961      case  1: if (CC1) set_pc(cpustate, addr); break;
3962      case  2: if (CC2) set_pc(cpustate, addr); break;
3963      case  3: if (CC3) set_pc(cpustate, addr); break;
3964      case  4: if (CC4) set_pc(cpustate, addr); break;
3965      case  5: if (CC5) set_pc(cpustate, addr); break;
3966      case  6: if (CC6) set_pc(cpustate, addr); break;
3967      case  7: if (CC7) set_pc(cpustate, addr); break;
3968      case  8: if (CC8) set_pc(cpustate, addr); break;
3969      case  9: if (CC9) set_pc(cpustate, addr); break;
3970      case 10: if (CCA) set_pc(cpustate, addr); break;
3971      case 11: if (CCB) set_pc(cpustate, addr); break;
3972      case 12: if (CCC) set_pc(cpustate, addr); break;
3973      case 13: if (CCD) set_pc(cpustate, addr); break;
3974      case 14: if (CCE) set_pc(cpustate, addr); break;
3975      case 15: if (CCF) set_pc(cpustate, addr); break;
39673976   }
39683977}
39693978
r19440r19441
39783987        PUSHL(cpustate, SP, make_segmented_addr(cpustate->pc));
39793988    else
39803989        PUSHW(cpustate, SP, cpustate->pc);
3981   cpustate->pc = addr;
3990   set_pc(cpustate, addr);
39823991}
39833992
39843993/******************************************
r19440r19441
39944003    else
39954004        PUSHW(cpustate, SP, cpustate->pc);
39964005   addr = addr_add(cpustate, addr, cpustate->RW(dst));
3997   cpustate->pc = addr;
4006   set_pc(cpustate, addr);
39984007}
39994008
40004009/******************************************
r19440r19441
40054014{
40064015   GET_DST(OP0,NIB3);
40074016   GET_ADDR(OP1);
4008   cpustate->RB(dst) = RDMEM_B(cpustate, addr);
4017   cpustate->RB(dst) = RDMEM_B(cpustate, AS_DATA, addr);
40094018}
40104019
40114020/******************************************
r19440r19441
40184027   GET_SRC(OP0,NIB2);
40194028   GET_ADDR(OP1);
40204029   addr = addr_add(cpustate, addr, cpustate->RW(src));
4021   cpustate->RB(dst) = RDMEM_B(cpustate, addr);
4030   cpustate->RB(dst) = RDMEM_B(cpustate, AS_DATA, addr);
40224031}
40234032
40244033/******************************************
r19440r19441
40294038{
40304039   GET_DST(OP0,NIB3);
40314040   GET_ADDR(OP1);
4032   cpustate->RW(dst) = RDMEM_W(cpustate, addr);
4041   cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr);
40334042}
40344043
40354044/******************************************
r19440r19441
40424051   GET_SRC(OP0,NIB2);
40434052   GET_ADDR(OP1);
40444053   addr = addr_add(cpustate, addr, cpustate->RW(src));
4045   cpustate->RW(dst) = RDMEM_W(cpustate, addr);
4054   cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr);
40464055}
40474056
40484057/******************************************
r19440r19441
40534062{
40544063   GET_BIT(OP0);
40554064   GET_ADDR(OP1);
4056   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) & ~bit);
4065   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) & ~bit);
40574066}
40584067
40594068/******************************************
r19440r19441
40664075   GET_DST(OP0,NIB2);
40674076   GET_ADDR(OP1);
40684077   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4069   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) & ~bit);
4078   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) & ~bit);
40704079}
40714080
40724081/******************************************
r19440r19441
40774086{
40784087   GET_BIT(OP0);
40794088   GET_ADDR(OP1);
4080   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) & ~bit);
4089   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) & ~bit);
40814090}
40824091
40834092/******************************************
r19440r19441
40904099   GET_DST(OP0,NIB2);
40914100   GET_ADDR(OP1);
40924101   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4093   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) & ~bit);
4102   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) & ~bit);
40944103}
40954104
40964105/******************************************
r19440r19441
41014110{
41024111   GET_BIT(OP0);
41034112   GET_ADDR(OP1);
4104   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) | bit);
4113   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) | bit);
41054114}
41064115
41074116/******************************************
r19440r19441
41144123   GET_DST(OP0,NIB2);
41154124   GET_ADDR(OP1);
41164125   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4117   WRMEM_B(cpustate,  addr, RDMEM_B(cpustate, addr) | bit);
4126   WRMEM_B(cpustate, AS_DATA, addr, RDMEM_B(cpustate, AS_DATA, addr) | bit);
41184127}
41194128
41204129/******************************************
r19440r19441
41254134{
41264135   GET_BIT(OP0);
41274136   GET_ADDR(OP1);
4128   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) | bit);
4137   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) | bit);
41294138}
41304139
41314140/******************************************
r19440r19441
41384147   GET_DST(OP0,NIB2);
41394148   GET_ADDR(OP1);
41404149   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4141   WRMEM_W(cpustate,  addr, RDMEM_W(cpustate, addr) | bit);
4150   WRMEM_W(cpustate, AS_DATA, addr, RDMEM_W(cpustate, AS_DATA, addr) | bit);
41424151}
41434152
41444153/******************************************
r19440r19441
41494158{
41504159   GET_BIT(OP0);
41514160   GET_ADDR(OP1);
4152   if (RDMEM_B(cpustate, addr) & bit) CLR_Z; else SET_Z;
4161   if (RDMEM_B(cpustate, AS_DATA, addr) & bit) CLR_Z; else SET_Z;
41534162}
41544163
41554164/******************************************
r19440r19441
41624171   GET_DST(OP0,NIB2);
41634172   GET_ADDR(OP1);
41644173   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4165    if (RDMEM_B(cpustate, addr) & bit) CLR_Z; else SET_Z;
4174    if (RDMEM_B(cpustate, AS_DATA, addr) & bit) CLR_Z; else SET_Z;
41664175}
41674176
41684177/******************************************
r19440r19441
41734182{
41744183   GET_BIT(OP0);
41754184   GET_ADDR(OP1);
4176   if (RDMEM_W(cpustate, addr) & bit) CLR_Z; else SET_Z;
4185   if (RDMEM_W(cpustate, AS_DATA, addr) & bit) CLR_Z; else SET_Z;
41774186}
41784187
41794188/******************************************
r19440r19441
41864195   GET_DST(OP0,NIB2);
41874196   GET_ADDR(OP1);
41884197   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4189   if (RDMEM_W(cpustate, addr) & bit) CLR_Z; else SET_Z;
4198   if (RDMEM_W(cpustate, AS_DATA, addr) & bit) CLR_Z; else SET_Z;
41904199}
41914200
41924201/******************************************
r19440r19441
41974206{
41984207   GET_I4M1(OP0,NIB3);
41994208   GET_ADDR(OP1);
4200   WRMEM_B(cpustate,  addr, INCB(cpustate, RDMEM_B(cpustate, addr), i4p1));
4209   WRMEM_B(cpustate, AS_DATA, addr, INCB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
42014210}
42024211
42034212/******************************************
r19440r19441
42104219   GET_DST(OP0,NIB2);
42114220   GET_ADDR(OP1);
42124221   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4213   WRMEM_B(cpustate,  addr, INCB(cpustate, RDMEM_B(cpustate, addr), i4p1));
4222   WRMEM_B(cpustate, AS_DATA, addr, INCB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
42144223}
42154224
42164225/******************************************
r19440r19441
42214230{
42224231   GET_I4M1(OP0,NIB3);
42234232   GET_ADDR(OP1);
4224   WRMEM_W(cpustate,  addr, INCW(cpustate, RDMEM_W(cpustate, addr), i4p1));
4233   WRMEM_W(cpustate, AS_DATA, addr, INCW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
42254234}
42264235
42274236/******************************************
r19440r19441
42344243   GET_DST(OP0,NIB2);
42354244   GET_ADDR(OP1);
42364245   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4237   WRMEM_W(cpustate,  addr, INCW(cpustate, RDMEM_W(cpustate, addr), i4p1));
4246   WRMEM_W(cpustate, AS_DATA, addr, INCW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
42384247}
42394248
42404249/******************************************
r19440r19441
42454254{
42464255   GET_I4M1(OP0,NIB3);
42474256   GET_ADDR(OP1);
4248   WRMEM_B(cpustate,  addr, DECB(cpustate, RDMEM_B(cpustate, addr), i4p1));
4257   WRMEM_B(cpustate, AS_DATA, addr, DECB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
42494258}
42504259
42514260/******************************************
r19440r19441
42584267   GET_DST(OP0,NIB2);
42594268   GET_ADDR(OP1);
42604269   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4261   WRMEM_B(cpustate,  addr, DECB(cpustate, RDMEM_B(cpustate, addr), i4p1));
4270   WRMEM_B(cpustate, AS_DATA, addr, DECB(cpustate, RDMEM_B(cpustate, AS_DATA, addr), i4p1));
42624271}
42634272
42644273/******************************************
r19440r19441
42694278{
42704279   GET_I4M1(OP0,NIB3);
42714280   GET_ADDR(OP1);
4272   WRMEM_W(cpustate,  addr, DECW(cpustate, RDMEM_W(cpustate, addr), i4p1));
4281   WRMEM_W(cpustate, AS_DATA, addr, DECW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
42734282}
42744283
42754284/******************************************
r19440r19441
42824291   GET_DST(OP0,NIB2);
42834292   GET_ADDR(OP1);
42844293   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4285   WRMEM_W(cpustate,  addr, DECW(cpustate, RDMEM_W(cpustate, addr), i4p1));
4294   WRMEM_W(cpustate, AS_DATA, addr, DECW(cpustate, RDMEM_W(cpustate, AS_DATA, addr), i4p1));
42864295}
42874296
42884297/******************************************
r19440r19441
42934302{
42944303   GET_DST(OP0,NIB3);
42954304   GET_ADDR(OP1);
4296   UINT8 tmp = RDMEM_B(cpustate, addr);
4297   WRMEM_B(cpustate, addr, cpustate->RB(dst));
4305   UINT8 tmp = RDMEM_B(cpustate, AS_DATA, addr);
4306   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(dst));
42984307   cpustate->RB(dst) = tmp;
42994308}
43004309
r19440r19441
43094318   GET_ADDR(OP1);
43104319   UINT8 tmp;
43114320   addr = addr_add(cpustate, addr, cpustate->RW(src));
4312   tmp = RDMEM_B(cpustate, addr);
4313   WRMEM_B(cpustate, addr, cpustate->RB(dst));
4321   tmp = RDMEM_B(cpustate, AS_DATA, addr);
4322   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(dst));
43144323    cpustate->RB(dst) = tmp;
43154324}
43164325
r19440r19441
43224331{
43234332   GET_DST(OP0,NIB3);
43244333   GET_ADDR(OP1);
4325   UINT16 tmp = RDMEM_W(cpustate, addr);
4326   WRMEM_W(cpustate,  addr, cpustate->RW(dst));
4334   UINT16 tmp = RDMEM_W(cpustate, AS_DATA, addr);
4335   WRMEM_W(cpustate, AS_DATA,  addr, cpustate->RW(dst));
43274336   cpustate->RW(dst) = tmp;
43284337}
43294338
r19440r19441
43384347   GET_ADDR(OP1);
43394348   UINT16 tmp;
43404349   addr = addr_add(cpustate, addr, cpustate->RW(src));
4341   tmp = RDMEM_W(cpustate, addr);
4342   WRMEM_W(cpustate,  addr, cpustate->RW(dst));
4350   tmp = RDMEM_W(cpustate, AS_DATA, addr);
4351   WRMEM_W(cpustate, AS_DATA,  addr, cpustate->RW(dst));
43434352    cpustate->RW(dst) = tmp;
43444353}
43454354
r19440r19441
43514360{
43524361   GET_SRC(OP0,NIB3);
43534362   GET_ADDR(OP1);
4354   WRMEM_B(cpustate,  addr, cpustate->RB(src));
4363   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(src));
43554364}
43564365
43574366/******************************************
r19440r19441
43644373   GET_DST(OP0,NIB2);
43654374   GET_ADDR(OP1);
43664375   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4367   WRMEM_B(cpustate,  addr, cpustate->RB(src));
4376   WRMEM_B(cpustate, AS_DATA, addr, cpustate->RB(src));
43684377}
43694378
43704379/******************************************
r19440r19441
43754384{
43764385   GET_SRC(OP0,NIB3);
43774386   GET_ADDR(OP1);
4378   WRMEM_W(cpustate,  addr, cpustate->RW(src));
4387   WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(src));
43794388}
43804389
43814390/******************************************
r19440r19441
43884397   GET_DST(OP0,NIB2);
43894398   GET_ADDR(OP1);
43904399   addr = addr_add(cpustate, addr, cpustate->RW(dst));
4391   WRMEM_W(cpustate,  addr, cpustate->RW(src));
4400   WRMEM_W(cpustate, AS_DATA, addr, cpustate->RW(src));
43924401}
43934402
43944403/******************************************
r19440r19441
44004409   GET_DST(OP0,NIB3);
44014410   GET_SRC(OP0,NIB2);
44024411   GET_IDX(OP1,NIB1);
4403   cpustate->RB(dst) = RDMEM_B(cpustate, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
4412   cpustate->RB(dst) = RDMEM_B(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
44044413}
44054414
44064415/******************************************
r19440r19441
44124421   GET_DST(OP0,NIB3);
44134422   GET_SRC(OP0,NIB2);
44144423   GET_IDX(OP1,NIB1);
4415   cpustate->RW(dst) = RDMEM_W(cpustate, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
4424   cpustate->RW(dst) = RDMEM_W(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
44164425}
44174426
44184427/******************************************
r19440r19441
44244433   GET_SRC(OP0,NIB3);
44254434   GET_DST(OP0,NIB2);
44264435   GET_IDX(OP1,NIB1);
4427   WRMEM_B(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RB(src));
4436   WRMEM_B(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RB(src));
44284437}
44294438
44304439/******************************************
r19440r19441
44364445   GET_SRC(OP0,NIB3);
44374446   GET_DST(OP0,NIB2);
44384447   GET_IDX(OP1,NIB1);
4439   WRMEM_W(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RW(src));
4448   WRMEM_W(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RW(src));
44404449}
44414450
44424451/******************************************
r19440r19441
44664475   GET_DST(OP0,NIB3);
44674476   GET_SRC(OP0,NIB2);
44684477   GET_IDX(OP1,NIB1);
4469   cpustate->RL(dst) = RDMEM_L(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
4478   cpustate->RL(dst) = RDMEM_L(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, src), cpustate->RW(idx)));
44704479}
44714480
44724481/******************************************
r19440r19441
45124521   GET_SRC(OP0,NIB3);
45134522   GET_DST(OP0,NIB2);
45144523   GET_IDX(OP1,NIB1);
4515   WRMEM_L(cpustate,  addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RL(src));
4524   WRMEM_L(cpustate, AS_DATA, addr_add(cpustate, addr_from_reg(cpustate, dst), cpustate->RW(idx)), cpustate->RL(src));
45164525}
45174526
45184527/******************************************
r19440r19441
45384547    CHECK_PRIVILEGED_INSTR();
45394548   GET_ADDR(OP1);
45404549   UINT16 fcw;
4541    //printf("LDPS from 0x%x: old pc: 0x%x\n", addr, cpustate->pc);
4550    printf("LDPS from 0x%x: old pc: 0x%x\n", addr, cpustate->pc);
45424551    if (segmented_mode(cpustate)) {
4543        fcw = RDMEM_W(cpustate,  addr + 2);
4544        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
4552        fcw = RDMEM_W(cpustate, AS_DATA,  addr + 2);
4553        set_pc(cpustate, segmented_addr(RDMEM_L(cpustate, AS_DATA, addr + 4)));
45454554    }
45464555    else {
4547        fcw = RDMEM_W(cpustate, addr);
4548        cpustate->pc = RDMEM_W(cpustate, (UINT16)(addr + 2));
4556        fcw = RDMEM_W(cpustate, AS_DATA, addr);
4557        set_pc(cpustate, RDMEM_W(cpustate, AS_DATA, (UINT16)(addr + 2)));
45494558    }
4559   if ((fcw ^ cpustate->fcw) & F_SEG) printf("ldps 2 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", cpustate->pc, (fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-");
45504560   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
45514561    //printf("LDPS: new pc: 0x%x\n", cpustate->pc);
45524562}
r19440r19441
45634573   UINT16 fcw;
45644574   addr = addr_add(cpustate, addr, cpustate->RW(src));
45654575    if (segmented_mode(cpustate)) {
4566        fcw = RDMEM_W(cpustate,  addr + 2);
4567        cpustate->pc = segmented_addr(RDMEM_L(cpustate, addr + 4));
4576        fcw = RDMEM_W(cpustate, AS_DATA,  addr + 2);
4577        set_pc(cpustate, segmented_addr(RDMEM_L(cpustate, AS_DATA, addr + 4)));
45684578    }
45694579    else {
4570        fcw = RDMEM_W(cpustate, addr);
4571        cpustate->pc   = RDMEM_W(cpustate, (UINT16)(addr + 2));
4580        fcw = RDMEM_W(cpustate, AS_DATA, addr);
4581        cpustate->pc   = RDMEM_W(cpustate, AS_DATA, (UINT16)(addr + 2));
45724582    }
4583   if ((fcw ^ cpustate->fcw) & F_SEG) printf("ldps 3 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", cpustate->pc, (fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-");
45734584   CHANGE_FCW(cpustate, fcw); /* check for user/system mode change */
45744585}
45754586
r19440r19441
45954606   tag = POPW(cpustate, SP);   /* get type tag */
45964607   fcw = POPW(cpustate, SP);   /* get cpustate->fcw  */
45974608    if (segmented_mode(cpustate))
4598        cpustate->pc = segmented_addr(POPL(cpustate, SP));
4609        set_pc(cpustate, segmented_addr(POPL(cpustate, SP)));
45994610    else
46004611        cpustate->pc   = POPW(cpustate, SP);   /* get cpustate->pc   */
46014612    cpustate->irq_srv &= ~tag;    /* remove IRQ serviced flag */
r19440r19441
52535264   GET_CCC(OP0,NIB3);
52545265    if (segmented_mode(cpustate))
52555266        switch (cc) {
5256            case  0: if (CC0) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5257            case  1: if (CC1) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5258            case  2: if (CC2) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5259            case  3: if (CC3) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5260            case  4: if (CC4) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5261            case  5: if (CC5) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5262            case  6: if (CC6) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5263            case  7: if (CC7) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5264            case  8: if (CC8) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5265            case  9: if (CC9) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5266            case 10: if (CCA) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5267            case 11: if (CCB) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5268            case 12: if (CCC) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5269            case 13: if (CCD) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5270            case 14: if (CCE) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5271            case 15: if (CCF) cpustate->pc = segmented_addr(POPL(cpustate, SP)); break;
5267         case  0: if (CC0) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5268         case  1: if (CC1) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5269         case  2: if (CC2) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5270         case  3: if (CC3) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5271         case  4: if (CC4) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5272         case  5: if (CC5) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5273         case  6: if (CC6) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5274         case  7: if (CC7) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5275         case  8: if (CC8) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5276         case  9: if (CC9) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5277         case 10: if (CCA) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5278         case 11: if (CCB) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5279         case 12: if (CCC) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5280         case 13: if (CCD) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5281         case 14: if (CCE) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
5282         case 15: if (CCF) set_pc(cpustate, segmented_addr(POPL(cpustate, SP))); break;
52725283        }
52735284    else
52745285        switch (cc) {
5275          case  0: if (CC0) cpustate->pc = POPW(cpustate, SP); break;
5276          case  1: if (CC1) cpustate->pc = POPW(cpustate, SP); break;
5277          case  2: if (CC2) cpustate->pc = POPW(cpustate, SP); break;
5278          case  3: if (CC3) cpustate->pc = POPW(cpustate, SP); break;
5279          case  4: if (CC4) cpustate->pc = POPW(cpustate, SP); break;
5280          case  5: if (CC5) cpustate->pc = POPW(cpustate, SP); break;
5281          case  6: if (CC6) cpustate->pc = POPW(cpustate, SP); break;
5282          case  7: if (CC7) cpustate->pc = POPW(cpustate, SP); break;
5283          case  8: if (CC8) cpustate->pc = POPW(cpustate, SP); break;
5284          case  9: if (CC9) cpustate->pc = POPW(cpustate, SP); break;
5285          case 10: if (CCA) cpustate->pc = POPW(cpustate, SP); break;
5286          case 11: if (CCB) cpustate->pc = POPW(cpustate, SP); break;
5287          case 12: if (CCC) cpustate->pc = POPW(cpustate, SP); break;
5288          case 13: if (CCD) cpustate->pc = POPW(cpustate, SP); break;
5289          case 14: if (CCE) cpustate->pc = POPW(cpustate, SP); break;
5290          case 15: if (CCF) cpustate->pc = POPW(cpustate, SP); break;
5286         case  0: if (CC0) set_pc(cpustate, POPW(cpustate, SP)); break;
5287         case  1: if (CC1) set_pc(cpustate, POPW(cpustate, SP)); break;
5288         case  2: if (CC2) set_pc(cpustate, POPW(cpustate, SP)); break;
5289         case  3: if (CC3) set_pc(cpustate, POPW(cpustate, SP)); break;
5290         case  4: if (CC4) set_pc(cpustate, POPW(cpustate, SP)); break;
5291         case  5: if (CC5) set_pc(cpustate, POPW(cpustate, SP)); break;
5292         case  6: if (CC6) set_pc(cpustate, POPW(cpustate, SP)); break;
5293         case  7: if (CC7) set_pc(cpustate, POPW(cpustate, SP)); break;
5294         case  8: if (CC8) set_pc(cpustate, POPW(cpustate, SP)); break;
5295         case  9: if (CC9) set_pc(cpustate, POPW(cpustate, SP)); break;
5296         case 10: if (CCA) set_pc(cpustate, POPW(cpustate, SP)); break;
5297         case 11: if (CCB) set_pc(cpustate, POPW(cpustate, SP)); break;
5298         case 12: if (CCC) set_pc(cpustate, POPW(cpustate, SP)); break;
5299         case 13: if (CCD) set_pc(cpustate, POPW(cpustate, SP)); break;
5300         case 14: if (CCE) set_pc(cpustate, POPW(cpustate, SP)); break;
5301         case 15: if (CCF) set_pc(cpustate, POPW(cpustate, SP)); break;
52915302        }
52925303}
52935304
r19440r19441
58775888   GET_DST(OP0,NIB2);
58785889   GET_SRC(OP1,NIB2);
58795890   GET_CNT(OP1,NIB1);
5880   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5891   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
58815892   cpustate->RB(1) = xlt;   /* load RH1 */
58825893   if (xlt) CLR_Z; else SET_Z;
58835894   add_to_addr_reg(cpustate, dst, 1);
r19440r19441
58935904   GET_DST(OP0,NIB2);
58945905   GET_SRC(OP1,NIB2);
58955906   GET_CNT(OP1,NIB1);
5896   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5907   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
58975908   cpustate->RB(1) = xlt;   /* load RH1 */
58985909   if (xlt) CLR_Z; else SET_Z;
58995910   add_to_addr_reg(cpustate, dst, 1);
r19440r19441
59145925   GET_DST(OP0,NIB2);
59155926   GET_SRC(OP1,NIB2);
59165927   GET_CNT(OP1,NIB1);
5917   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5928   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
59185929   cpustate->RB(1) = xlt;   /* load RH1 */
59195930   if (xlt) CLR_Z; else SET_Z;
59205931   sub_from_addr_reg(cpustate, dst, 1);
r19440r19441
59305941   GET_DST(OP0,NIB2);
59315942   GET_SRC(OP1,NIB2);
59325943   GET_CNT(OP1,NIB1);
5933   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5944   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
59345945   cpustate->RB(1) = xlt;   /* load RH1 */
59355946   if (xlt) CLR_Z; else SET_Z;
59365947   sub_from_addr_reg(cpustate, dst, 1);
r19440r19441
59515962   GET_DST(OP0,NIB2);
59525963   GET_SRC(OP1,NIB2);
59535964   GET_CNT(OP1,NIB1);
5954   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5955   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
5965   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
5966   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), xlt);
59565967   cpustate->RB(1) = xlt;   /* destroy RH1 */
59575968   add_to_addr_reg(cpustate, dst, 1);
59585969   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
r19440r19441
59675978   GET_DST(OP0,NIB2);
59685979   GET_SRC(OP1,NIB2);
59695980   GET_CNT(OP1,NIB1);
5970   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5971   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
5981   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
5982   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), xlt);
59725983   cpustate->RB(1) = xlt;   /* destroy RH1 */
59735984   add_to_addr_reg(cpustate, dst, 1);
59745985   if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V;
r19440r19441
59835994   GET_DST(OP0,NIB2);
59845995   GET_SRC(OP1,NIB2);
59855996   GET_CNT(OP1,NIB1);
5986   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
5987   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
5997   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
5998   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), xlt);
59885999   cpustate->RB(1) = xlt;   /* destroy RH1 */
59896000   sub_from_addr_reg(cpustate, dst, 1);
59906001   if (--cpustate->RW(cnt)) CLR_V; else SET_V;
r19440r19441
59996010   GET_DST(OP0,NIB2);
60006011   GET_SRC(OP1,NIB2);
60016012   GET_CNT(OP1,NIB1);
6002   UINT8 xlt = RDMEM_B(cpustate, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, addr_from_reg(cpustate, dst)));
6003   WRMEM_B(cpustate, addr_from_reg(cpustate, dst), xlt);
6013   UINT8 xlt = RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src) + RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)));
6014   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), xlt);
60046015   cpustate->RB(1) = xlt;   /* destroy RH1 */
60056016   sub_from_addr_reg(cpustate, dst, 1);
60066017   if (--cpustate->RW(cnt)) { CLR_V; cpustate->pc -= 4; } else SET_V;
r19440r19441
60316042   GET_CCC(OP1,NIB3);
60326043   GET_DST(OP1,NIB2);
60336044   GET_CNT(OP1,NIB1);
6034   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6045   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
60356046   switch (cc) {
60366047      case  0: if (CC0) SET_Z; else CLR_Z; break;
60376048      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
60656076    GET_CNT(OP1,NIB1);
60666077   GET_DST(OP1,NIB2);
60676078   GET_CCC(OP1,NIB3);   /* repeat? */
6068    WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6079    WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
60696080   add_to_addr_reg(cpustate, src, 1);
60706081   add_to_addr_reg(cpustate, dst, 1);
60716082   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
60816092   GET_CCC(OP1,NIB3);
60826093   GET_DST(OP1,NIB2);
60836094   GET_CNT(OP1,NIB1);
6084   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6095   CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
60856096   switch (cc) {
60866097      case  0: if (CC0) SET_Z; else CLR_Z; break;
60876098      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
61156126   GET_CCC(OP1,NIB3);
61166127   GET_DST(OP1,NIB2);
61176128   GET_CNT(OP1,NIB1);
6118   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6129   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
61196130   switch (cc) {
61206131      case  0: if (CC0) SET_Z; else CLR_Z; break;
61216132      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
61486159   GET_CCC(OP1,NIB3);
61496160   GET_DST(OP1,NIB2);
61506161   GET_CNT(OP1,NIB1);
6151   CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6162   CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
61526163   switch (cc) {
61536164      case  0: if (CC0) SET_Z; else CLR_Z; break;
61546165      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
61826193   GET_CCC(OP1,NIB3);
61836194   GET_DST(OP1,NIB2);
61846195   GET_CNT(OP1,NIB1);
6185    CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6196    CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
61866197    switch (cc) {
61876198      case  0: if (CC0) SET_Z; else CLR_Z; break;
61886199      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
62166227    GET_CNT(OP1,NIB1);
62176228   GET_DST(OP1,NIB2);
62186229   GET_CCC(OP1,NIB3);
6219   WRMEM_B(cpustate,  addr_from_reg(cpustate, dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6230   WRMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
62206231   sub_from_addr_reg(cpustate, src, 1);
62216232   sub_from_addr_reg(cpustate, dst, 1);
62226233   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
62326243   GET_CCC(OP1,NIB3);
62336244   GET_DST(OP1,NIB2);
62346245   GET_CNT(OP1,NIB1);
6235    CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6246    CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
62366247   switch (cc) {
62376248      case  0: if (CC0) SET_Z; else CLR_Z; break;
62386249      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
62666277   GET_CCC(OP1,NIB3);
62676278   GET_DST(OP1,NIB2);
62686279   GET_CNT(OP1,NIB1);
6269   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6280   CPB(cpustate, cpustate->RB(dst), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
62706281   switch (cc) {
62716282      case  0: if (CC0) SET_Z; else CLR_Z; break;
62726283      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
62996310   GET_CCC(OP1,NIB3);
63006311   GET_DST(OP1,NIB2);
63016312   GET_CNT(OP1,NIB1);
6302    CPB(cpustate, RDMEM_B(cpustate, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, addr_from_reg(cpustate, src)));
6313    CPB(cpustate, RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_B(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
63036314   switch (cc) {
63046315      case  0: if (CC0) SET_Z; else CLR_Z; break;
63056316      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
63336344   GET_CCC(OP1,NIB3);
63346345   GET_DST(OP1,NIB2);
63356346   GET_CNT(OP1,NIB1);
6336   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6347   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
63376348    switch (cc) {
63386349      case  0: if (CC0) SET_Z; else CLR_Z; break;
63396350      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
63676378    GET_CNT(OP1,NIB1);
63686379   GET_DST(OP1,NIB2);
63696380   GET_CCC(OP1,NIB3);
6370   WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6381   WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
63716382   add_to_addr_reg(cpustate, src, 2);
63726383   add_to_addr_reg(cpustate, dst, 2);
63736384   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
63836394   GET_CCC(OP1,NIB3);
63846395   GET_DST(OP1,NIB2);
63856396   GET_CNT(OP1,NIB1);
6386   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6397   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
63876398   switch (cc) {
63886399      case  0: if (CC0) SET_Z; else CLR_Z; break;
63896400      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
64176428   GET_CCC(OP1,NIB3);
64186429   GET_DST(OP1,NIB2);
64196430   GET_CNT(OP1,NIB1);
6420   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6431   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
64216432   switch (cc) {
64226433      case  0: if (CC0) SET_Z; else CLR_Z; break;
64236434      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
64506461   GET_CCC(OP1,NIB3);
64516462   GET_DST(OP1,NIB2);
64526463   GET_CNT(OP1,NIB1);
6453   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6464   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
64546465   switch (cc) {
64556466      case  0: if (CC0) SET_Z; else CLR_Z; break;
64566467      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
64846495   GET_CCC(OP1,NIB3);
64856496   GET_DST(OP1,NIB2);
64866497   GET_CNT(OP1,NIB1);
6487   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6498   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
64886499    switch (cc) {
64896500      case  0: if (CC0) SET_Z; else CLR_Z; break;
64906501      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
65186529    GET_CNT(OP1,NIB1);
65196530    GET_DST(OP1,NIB2);
65206531   GET_CCC(OP1,NIB3);
6521    WRMEM_W(cpustate,  addr_from_reg(cpustate, dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6532    WRMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
65226533   sub_from_addr_reg(cpustate, src, 2);
65236534   sub_from_addr_reg(cpustate, dst, 2);
65246535   if (--cpustate->RW(cnt)) { CLR_V; if (cc == 0) cpustate->pc -= 4; } else SET_V;
r19440r19441
65346545   GET_CCC(OP1,NIB3);
65356546   GET_DST(OP1,NIB2);
65366547   GET_CNT(OP1,NIB1);
6537   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6548   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
65386549   switch (cc) {
65396550      case  0: if (CC0) SET_Z; else CLR_Z; break;
65406551      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
65686579   GET_CCC(OP1,NIB3);
65696580   GET_DST(OP1,NIB2);
65706581   GET_CNT(OP1,NIB1);
6571   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6582   CPW(cpustate, cpustate->RW(dst), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
65726583   switch (cc) {
65736584      case  0: if (CC0) SET_Z; else CLR_Z; break;
65746585      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
66016612   GET_CCC(OP1,NIB3);
66026613   GET_DST(OP1,NIB2);
66036614   GET_CNT(OP1,NIB1);
6604   CPW(cpustate, RDMEM_W(cpustate, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, addr_from_reg(cpustate, src)));
6615   CPW(cpustate, RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, dst)), RDMEM_W(cpustate, AS_DATA, addr_from_reg(cpustate, src)));
66056616   switch (cc) {
66066617      case  0: if (CC0) SET_Z; else CLR_Z; break;
66076618      case  1: if (CC1) SET_Z; else CLR_Z; break;
r19440r19441
67026713    else
67036714        PUSHW(cpustate, SP, cpustate->pc);
67046715   dsp12 = (dsp12 & 2048) ? 4096 - 2 * (dsp12 & 2047) : -2 * (dsp12 & 2047);
6705   cpustate->pc = addr_add(cpustate, cpustate->pc, dsp12);
6716   set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp12));
67066717}
67076718
67086719/******************************************
r19440r19441
67146725   GET_DSP8;
67156726   GET_CCC(OP0,NIB1);
67166727   switch (cc) {
6717      case  0: if (CC0) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6718      case  1: if (CC1) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6719      case  2: if (CC2) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6720      case  3: if (CC3) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6721      case  4: if (CC4) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6722      case  5: if (CC5) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6723      case  6: if (CC6) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6724      case  7: if (CC7) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6725      case  8: if (CC8) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6726      case  9: if (CC9) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6727      case  10: if (CCA) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6728      case  11: if (CCB) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6729      case  12: if (CCC) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6730      case  13: if (CCD) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6731      case  14: if (CCE) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6732      case  15: if (CCF) cpustate->pc = addr_add(cpustate, cpustate->pc, dsp8 * 2); break;
6728      case  0: if (CC0) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6729      case  1: if (CC1) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6730      case  2: if (CC2) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6731      case  3: if (CC3) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6732      case  4: if (CC4) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6733      case  5: if (CC5) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6734      case  6: if (CC6) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6735      case  7: if (CC7) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6736      case  8: if (CC8) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6737      case  9: if (CC9) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6738      case  10: if (CCA) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6739      case  11: if (CCB) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6740      case  12: if (CCC) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6741      case  13: if (CCD) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6742      case  14: if (CCE) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
6743      case  15: if (CCF) set_pc(cpustate, addr_add(cpustate, cpustate->pc, dsp8 * 2)); break;
67336744   }
67346745}
67356746
r19440r19441
67436754    GET_DSP7;
67446755    cpustate->RB(dst) -= 1;
67456756    if (cpustate->RB(dst)) {
6746        cpustate->pc = addr_sub(cpustate, cpustate->pc, 2 * dsp7);
6757        set_pc(cpustate, addr_sub(cpustate, cpustate->pc, 2 * dsp7));
67476758    }
67486759}
67496760
r19440r19441
67576768   GET_DSP7;
67586769   cpustate->RW(dst) -= 1;
67596770   if (cpustate->RW(dst)) {
6760        cpustate->pc = addr_sub(cpustate, cpustate->pc, 2 * dsp7);
6771        set_pc(cpustate, addr_sub(cpustate, cpustate->pc, 2 * dsp7));
67616772   }
67626773}
trunk/src/mess/drivers/m20.c
r19440r19441
290290         3   Screen bitmap
291291         4   Diagnostics and Bootstrap
292292*/
293#if 0
293294static ADDRESS_MAP_START(m20_mem, AS_PROGRAM, 16, m20_state)
294295   ADDRESS_MAP_UNMAP_HIGH
295296   AM_RANGE( 0x00000, 0x01fff ) AM_RAM AM_SHARE("mainram")
r19440r19441
309310    AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM
310311//  AM_RANGE( 0x34000, 0x37fff ) AM_RAM //extra vram for color mode
311312ADDRESS_MAP_END
313#endif
312314
315static ADDRESS_MAP_START(m20_program_mem, AS_PROGRAM, 16, m20_state)
316   ADDRESS_MAP_UNMAP_HIGH
317  AM_RANGE( 0x00000, 0x03fff ) AM_RAM AM_SHARE("dram0_4000") //AM_SHARE("mainram")
318  AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram0_8000")
319  AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram0_c000")
320  AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram0_10000")
321
322  AM_RANGE( 0x10000, 0x13fff ) AM_RAM AM_SHARE("dram0_8000")
323  AM_RANGE( 0x14000, 0x17fff ) AM_RAM AM_SHARE("dram0_c000")
324  AM_RANGE( 0x18000, 0x1bfff ) AM_RAM AM_SHARE("dram0_10000")
325//AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram0_10000")
326
327  AM_RANGE( 0x20000, 0x23fff ) AM_RAM AM_SHARE("dram0_14000")
328  AM_RANGE( 0x24000, 0x27fff ) AM_RAM AM_SHARE("dram0_18000")
329  AM_RANGE( 0x28000, 0x2bfff ) AM_RAM AM_SHARE("dram0_1c000")
330  AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000")
331
332  AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram")
333
334AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000)
335//AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_SHARE("maincpu")
336
337  AM_RANGE( 0x60000, 0x63fff ) AM_RAM AM_SHARE("dram0_8000")
338  AM_RANGE( 0x64000, 0x67fff ) AM_RAM AM_SHARE("dram0_c000")
339  AM_RANGE( 0x68000, 0x6bfff ) AM_RAM AM_SHARE("dram0_10000")
340
341  AM_RANGE( 0x80000, 0x83fff ) AM_RAM AM_SHARE("dram0_8000")
342  AM_RANGE( 0x84000, 0x87fff ) AM_RAM AM_SHARE("dram0_c000")
343  AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram1_4000")
344  AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram2_0000")
345
346  AM_RANGE( 0x90000, 0x93fff ) AM_RAM AM_SHARE("dram0_18000")
347  AM_RANGE( 0x94000, 0x97fff ) AM_RAM AM_SHARE("dram0_1c000")
348  AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000")
349  AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000")
350
351  AM_RANGE( 0xa0000, 0xa3fff ) AM_RAM AM_SHARE("dram0_8000")
352  AM_RANGE( 0xa4000, 0xa7fff ) AM_RAM AM_SHARE("dram0_c000")
353  AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000")
354  AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000")
355
356  AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000")
357
358ADDRESS_MAP_END
359
360static ADDRESS_MAP_START(m20_data_mem, AS_DATA, 16, m20_state)
361   ADDRESS_MAP_UNMAP_HIGH
362
363  AM_RANGE( 0x00000, 0x03fff ) AM_RAM AM_SHARE("dram0_4000")
364  AM_RANGE( 0x04000, 0x07fff ) AM_RAM AM_SHARE("dram1_4000")
365  AM_RANGE( 0x08000, 0x0bfff ) AM_RAM AM_SHARE("dram2_0000")
366  AM_RANGE( 0x0c000, 0x0ffff ) AM_RAM AM_SHARE("dram2_4000")
367
368  AM_RANGE( 0x10000, 0x13fff ) AM_RAM AM_SHARE("dram0_14000")
369  AM_RANGE( 0x14000, 0x17fff ) AM_RAM AM_SHARE("dram0_18000")
370  AM_RANGE( 0x18000, 0x1bfff ) AM_RAM AM_SHARE("dram0_1c000")
371  AM_RANGE( 0x1c000, 0x1ffff ) AM_RAM AM_SHARE("dram1_0000")
372
373  AM_RANGE( 0x20000, 0x23fff ) AM_RAM AM_SHARE("dram0_14000")
374  AM_RANGE( 0x24000, 0x27fff ) AM_RAM AM_SHARE("dram0_18000")
375  AM_RANGE( 0x28000, 0x2bfff ) AM_RAM AM_SHARE("dram0_1c000")
376  AM_RANGE( 0x2c000, 0x2ffff ) AM_RAM AM_SHARE("dram1_0000")
377
378  AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_SHARE("p_videoram")
379
380//AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_SHARE("maincpu")
381  AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu", 0x00000)
382
383  AM_RANGE( 0x44000, 0x47fff ) AM_RAM AM_SHARE("dram3_0000")
384  AM_RANGE( 0x48000, 0x4bfff ) AM_RAM AM_SHARE("dram3_4000")
385
386  AM_RANGE( 0x50000, 0x53fff ) AM_RAM AM_SHARE("dram0_8000")
387  AM_RANGE( 0x54000, 0x57fff ) AM_RAM AM_SHARE("dram0_c000")
388  AM_RANGE( 0x58000, 0x5bfff ) AM_RAM AM_SHARE("dram0_10000")
389
390  AM_RANGE( 0x60000, 0x63fff ) AM_RAM AM_SHARE("dram0_8000")
391  AM_RANGE( 0x64000, 0x67fff ) AM_RAM AM_SHARE("dram0_c000")
392  AM_RANGE( 0x68000, 0x6bfff ) AM_RAM AM_SHARE("dram0_10000")
393
394  AM_RANGE( 0x80000, 0x83fff ) AM_RAM AM_SHARE("dram0_18000")
395  AM_RANGE( 0x84000, 0x87fff ) AM_RAM AM_SHARE("dram0_1c000")
396  AM_RANGE( 0x88000, 0x8bfff ) AM_RAM AM_SHARE("dram2_4000")
397  AM_RANGE( 0x8c000, 0x8ffff ) AM_RAM AM_SHARE("dram3_0000")
398
399  AM_RANGE( 0x90000, 0x93fff ) AM_RAM AM_SHARE("dram0_18000")
400  AM_RANGE( 0x94000, 0x97fff ) AM_RAM AM_SHARE("dram0_1c000")
401  AM_RANGE( 0x98000, 0x9bfff ) AM_RAM AM_SHARE("dram2_4000")
402  AM_RANGE( 0x9c000, 0x9ffff ) AM_RAM AM_SHARE("dram3_0000")
403
404  AM_RANGE( 0xa0000, 0xa3fff ) AM_RAM AM_SHARE("dram0_8000")
405  AM_RANGE( 0xa4000, 0xa7fff ) AM_RAM AM_SHARE("dram0_c000")
406  AM_RANGE( 0xa8000, 0xabfff ) AM_RAM AM_SHARE("dram1_4000")
407  AM_RANGE( 0xac000, 0xaffff ) AM_RAM AM_SHARE("dram2_0000")
408
409  AM_RANGE( 0xb0000, 0xb3fff ) AM_RAM AM_SHARE("dram3_4000")
410
411  AM_RANGE( 0xc0000, 0xc3fff ) AM_RAM AM_SHARE("dram3_4000")
412
413ADDRESS_MAP_END
414
313415static ADDRESS_MAP_START(m20_io, AS_IO, 16, m20_state)
314416   ADDRESS_MAP_UNMAP_HIGH
315417
r19440r19441
373475void m20_state::machine_reset()
374476{
375477   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
376   UINT8 *RAM = (UINT8 *)machine().root_device().memshare("mainram")->ptr();
478        //   UINT8 *RAM = (UINT8 *)machine().root_device().memshare("mainram")->ptr();
479   UINT8 *RAM = (UINT8 *)machine().root_device().memshare("dram0_4000")->ptr();
377480
378    ROM += 0x10000; // don't know why they load at an offset, but let's go with it
481        //ROM += 0x10000; // don't know why they load at an offset, but let's go with it
379482
380483   m_port21 = 0xff;
381484
r19440r19441
521624static MACHINE_CONFIG_START( m20, m20_state )
522625   /* basic machine hardware */
523626   MCFG_CPU_ADD("maincpu", Z8001, MAIN_CLOCK)
524   MCFG_CPU_PROGRAM_MAP(m20_mem)
627   MCFG_CPU_PROGRAM_MAP(m20_program_mem)
628   MCFG_CPU_DATA_MAP(m20_data_mem)
525629   MCFG_CPU_IO_MAP(m20_io)
526630
527631#if 0
r19440r19441
556660MACHINE_CONFIG_END
557661
558662ROM_START(m20)
559   ROM_REGION(0x12000,"maincpu", 0)
663   ROM_REGION(0x2000,"maincpu", 0)
664//ROM_REGION(0x12000,"maincpu", 0)
560665   ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" )
666   ROMX_LOAD("m20.bin", 0x0000, 0x2000, CRC(5c93d931) SHA1(d51025e087a94c55529d7ee8fd18ff4c46d93230), ROM_BIOS(1))
667   ROM_SYSTEM_BIOS( 1, "m20-20d", "M20 2.0d" )
668   ROMX_LOAD("m20-20d.bin", 0x0000, 0x2000, CRC(cbe265a6) SHA1(c7cb9d9900b7b5014fcf1ceb2e45a66a91c564d0), ROM_BIOS(2))
669   ROM_SYSTEM_BIOS( 2, "m20-20f", "M20 2.0f" )
670   ROMX_LOAD("m20-20f.bin", 0x0000, 0x2000, CRC(db7198d8) SHA1(149d8513867081d31c73c2965dabb36d5f308041), ROM_BIOS(3))
671
672ROM_END
673
674#if 0
675ROM_START(m20)
676   ROM_REGION(0x2000,"maincpu", 0)
677//ROM_REGION(0x12000,"maincpu", 0)
678   ROM_SYSTEM_BIOS( 0, "m20", "M20 1.0" )
561679   ROMX_LOAD("m20.bin", 0x10000, 0x2000, CRC(5c93d931) SHA1(d51025e087a94c55529d7ee8fd18ff4c46d93230), ROM_BIOS(1))
562680   ROM_SYSTEM_BIOS( 1, "m20-20d", "M20 2.0d" )
563681   ROMX_LOAD("m20-20d.bin", 0x10000, 0x2000, CRC(cbe265a6) SHA1(c7cb9d9900b7b5014fcf1ceb2e45a66a91c564d0), ROM_BIOS(2))
r19440r19441
567685   ROM_REGION(0x4000,"apb_bios", 0) // Processor board with 8086
568686   ROM_LOAD( "apb-1086-2.0.bin", 0x0000, 0x4000, CRC(8c05be93) SHA1(2bb424afd874cc6562e9642780eaac2391308053))
569687ROM_END
688#endif
570689
571690ROM_START(m40)
572691   ROM_REGION(0x14000,"maincpu", 0)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team