Previous 199869 Revisions Next

r18448 Thursday 11th October, 2012 at 14:19:58 UTC by Miodrag Milanović
made rsp core use callbacks (no whatsnew)
[src/emu/cpu/rsp]rsp.c rsp.h rspdrc.c
[src/mame/machine]n64.c

trunk/src/mame/machine/n64.c
r18447r18448
553553   }
554554}
555555
556static void sp_set_status(device_t *device, UINT32 status)
556static WRITE32_DEVICE_HANDLER(sp_set_status)
557557{
558   device->machine().device<n64_periphs>("rcp")->sp_set_status(status);
558   device->machine().device<n64_periphs>("rcp")->sp_set_status(data);
559559}
560560
561561void n64_periphs::sp_set_status(UINT32 status)
r18447r18448
991991
992992const rsp_config n64_rsp_config =
993993{
994   n64_dp_reg_r,
995   n64_dp_reg_w,
996   n64_sp_reg_r,
997   n64_sp_reg_w,
998   sp_set_status
994   DEVCB_DEVICE_HANDLER("rcp",n64_dp_reg_r),
995   DEVCB_DEVICE_HANDLER("rcp",n64_dp_reg_w),
996   DEVCB_DEVICE_HANDLER("rcp",n64_sp_reg_r),
997   DEVCB_DEVICE_HANDLER("rcp",n64_sp_reg_w),
998   DEVCB_DEVICE_HANDLER("rcp",sp_set_status)
999999};
10001000
10011001TIMER_CALLBACK_MEMBER(n64_periphs::vi_scanline_callback)
trunk/src/emu/cpu/rsp/rsp.h
r18447r18448
6868    STRUCTURES
6969***************************************************************************/
7070
71typedef void (*rsp_set_status_func)(device_t *device, UINT32 status);
72
7371struct rsp_config
7472{
75   read32_device_func dp_reg_r;
76   write32_device_func dp_reg_w;
77   read32_device_func sp_reg_r;
78   write32_device_func sp_reg_w;
79   rsp_set_status_func sp_set_status;
73   devcb_read32 dp_reg_r_cb;
74   devcb_write32 dp_reg_w_cb;
75   devcb_read32 sp_reg_r_cb;
76   devcb_write32 sp_reg_w_cb;
77   devcb_write32 sp_set_status_cb;
8078};
8179
8280
r18447r18448
156154struct rspimp_state;
157155struct rsp_state
158156{
159   const rsp_config *config;
160157   FILE *exec_output;
161158
162159   UINT32 pc;
r18447r18448
191188   UINT8 *imem8;
192189
193190   rspimp_state* impstate;
191   
192   devcb_resolved_read32 dp_reg_r_func;
193   devcb_resolved_write32 dp_reg_w_func;
194   devcb_resolved_read32 sp_reg_r_func;
195   devcb_resolved_write32 sp_reg_w_func;
196   devcb_resolved_write32 sp_set_status_func;   
194197};
195198
196199DECLARE_LEGACY_CPU_DEVICE(RSP, rsp);
trunk/src/emu/cpu/rsp/rspdrc.c
r18447r18448
472472   {
473473      if(dest)
474474      {
475         rsp->r[dest] = (rsp->config->sp_reg_r)(rsp->device, *rsp->program, reg, 0x00000000);
475         rsp->r[dest] = (rsp->sp_reg_r_func)(reg, 0x00000000);
476476      }
477477   }
478478   else if (reg >= 8 && reg < 16)
479479   {
480480      if(dest)
481481      {
482         rsp->r[dest] = (rsp->config->dp_reg_r)(rsp->device, *rsp->program, reg - 8, 0x00000000);
482         rsp->r[dest] = (rsp->dp_reg_r_func)(reg - 8, 0x00000000);
483483      }
484484   }
485485   else
r18447r18448
496496
497497   if (reg >= 0 && reg < 8)
498498   {
499      (rsp->config->sp_reg_w)(rsp->device, *rsp->program, reg, data, 0x00000000);
499      (rsp->sp_reg_w_func)(reg, data, 0x00000000);
500500   }
501501   else if (reg >= 8 && reg < 16)
502502   {
503      (rsp->config->dp_reg_w)(rsp->device, *rsp->program, reg - 8, data, 0x00000000);
503      (rsp->dp_reg_w_func)(reg - 8, data, 0x00000000);
504504   }
505505   else
506506   {
r18447r18448
585585
586586   memset(rsp, 0, sizeof(*rsp));
587587
588   rsp->config = (const rsp_config *)device->static_config();
588   const rsp_config *config = (const rsp_config *)device->static_config();
589   // resolve callbacks
590   rsp->dp_reg_r_func.resolve(config->dp_reg_r_cb, *device);
591   rsp->dp_reg_w_func.resolve(config->dp_reg_w_cb, *device);
592   rsp->sp_reg_r_func.resolve(config->sp_reg_r_cb, *device);
593   rsp->sp_reg_w_func.resolve(config->sp_reg_w_cb, *device);
594   rsp->sp_set_status_func.resolve(config->sp_set_status_cb, *device);
595   
589596   rsp->irq_callback = irqcallback;
590597   rsp->device = device;
591598   rsp->program = &device->space(AS_PROGRAM);
r18447r18448
33713378static void cfunc_sp_set_status_cb(void *param)
33723379{
33733380   rsp_state *rsp = (rsp_state*)param;
3374   (rsp->config->sp_set_status)(rsp->device, rsp->impstate->arg0);
3381   (rsp->sp_set_status_func)(0, rsp->impstate->arg0);
33753382}
33763383
33773384static CPU_EXECUTE( rsp )
trunk/src/emu/cpu/rsp/rsp.c
r18447r18448
182182   reg &= 0xf;
183183   if (reg < 8)
184184   {
185      return (rsp->config->sp_reg_r)(rsp->device, reg, 0x00000000);
185      return (rsp->sp_reg_r_func)(reg, 0x00000000);
186186   }
187187   else if (reg >= 8 && reg < 16)
188188   {
189      return (rsp->config->dp_reg_r)(rsp->device, reg - 8, 0x00000000);
189      return (rsp->dp_reg_r_func)(reg - 8, 0x00000000);
190190   }
191191
192192   return 0;
r18447r18448
197197   reg &= 0xf;
198198   if (reg < 8)
199199   {
200      (rsp->config->sp_reg_w)(rsp->device, reg, data, 0x00000000);
200      (rsp->sp_reg_w_func)(reg, data, 0x00000000);
201201   }
202202   else if (reg >= 8 && reg < 16)
203203   {
204      (rsp->config->dp_reg_w)(rsp->device, reg - 8, data, 0x00000000);
204      (rsp->dp_reg_w_func)(reg - 8, data, 0x00000000);
205205   }
206206}
207207
r18447r18448
274274   rsp_state *rsp = get_safe_token(device);
275275   int regIdx;
276276   int accumIdx;
277   rsp->config = (const rsp_config *)device->static_config();
277   const rsp_config *config = (const rsp_config *)device->static_config();
278   // resolve callbacks
279   rsp->dp_reg_r_func.resolve(config->dp_reg_r_cb, *device);
280   rsp->dp_reg_w_func.resolve(config->dp_reg_w_cb, *device);
281   rsp->sp_reg_r_func.resolve(config->sp_reg_r_cb, *device);
282   rsp->sp_reg_w_func.resolve(config->sp_reg_w_cb, *device);
283   rsp->sp_set_status_func.resolve(config->sp_set_status_cb, *device);
278284
279285   if (LOG_INSTRUCTION_EXECUTION)
280286      rsp->exec_output = fopen("rsp_execute.txt", "wt");
r18447r18448
27152721               case 0x09:   /* JALR */      JUMP_PC_L(RSVAL, RDREG); break;
27162722               case 0x0d:   /* BREAK */
27172723               {
2718                  (rsp->config->sp_set_status)(rsp->device, 0x3);
2724                  (rsp->sp_set_status_func)(0, 0x3);
27192725                  rsp->icount = MIN(rsp->icount, 1);
27202726
27212727                  if (LOG_INSTRUCTION_EXECUTION) fprintf(rsp->exec_output, "\n---------- break ----------\n\n");

Previous 199869 Revisions Next


© 1997-2024 The MAME Team