/[gxemul]/trunk/src/devices/dev_dreamcast_maple.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_dreamcast_maple.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon Oct 8 16:22:11 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_dreamcast_maple.c,v 1.15 2007/04/28 09:19:51 debug Exp $   *  $Id: dev_dreamcast_maple.c,v 1.17 2007/06/15 19:11:15 debug Exp $
29   *     *  
30   *  Dreamcast "Maple" bus controller.   *  COMMENT: Dreamcast Maple bus controller
31   *   *
32   *  The Maple bus has 4 ports (A-D), and each port has up to 6 possible "units"   *  The Maple bus has 4 ports (A-D), and each port has up to 6 possible "units"
33   *  (where unit 0 is the main unit). Communication is done using DMA; each   *  (where unit 0 is the main unit). Communication is done using DMA; each
# Line 538  void maple_do_dma_xfer(struct cpu *cpu, Line 538  void maple_do_dma_xfer(struct cpu *cpu,
538    
539  DEVICE_ACCESS(dreamcast_maple)  DEVICE_ACCESS(dreamcast_maple)
540  {  {
541          struct dreamcast_maple_data *d = (struct dreamcast_maple_data *) extra;          struct dreamcast_maple_data *d = extra;
542          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
543    
544          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
# Line 624  DEVICE_ACCESS(dreamcast_maple) Line 624  DEVICE_ACCESS(dreamcast_maple)
624    
625  DEVINIT(dreamcast_maple)  DEVINIT(dreamcast_maple)
626  {  {
627          struct machine *machine = devinit->machine;          struct dreamcast_maple_data *d;
628          struct dreamcast_maple_data *d =  
629              malloc(sizeof(struct dreamcast_maple_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct dreamcast_maple_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
630          memset(d, 0, sizeof(struct dreamcast_maple_data));          memset(d, 0, sizeof(struct dreamcast_maple_data));
631    
632          memory_device_register(machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,
633              0x5f6c00, 0x100, dev_dreamcast_maple_access, d, DM_DEFAULT, NULL);              0x5f6c00, 0x100, dev_dreamcast_maple_access, d, DM_DEFAULT, NULL);
634    
635          /*  Devices connected to port A..D:  */          /*  Devices connected to port A..D:  */
# Line 642  DEVINIT(dreamcast_maple) Line 638  DEVINIT(dreamcast_maple)
638          d->device[2] = &maple_device_keyboard;          d->device[2] = &maple_device_keyboard;
639          d->device[3] = NULL;    /*  TODO:  &maple_device_mouse;  */          d->device[3] = NULL;    /*  TODO:  &maple_device_mouse;  */
640    
641          d->console_handle = console_start_slave_inputonly(machine, "maple", 1);          d->console_handle = console_start_slave_inputonly(
642          machine->main_console_handle = d->console_handle;              devinit->machine, "maple", 1);
643            devinit->machine->main_console_handle = d->console_handle;
644    
645          machine_add_tickfunction(devinit->machine, dev_maple_tick, d,          machine_add_tickfunction(devinit->machine, dev_maple_tick, d,
646              MAPLE_TICK_SHIFT, 0.0);              MAPLE_TICK_SHIFT);
647    
648          return 1;          return 1;
649  }  }

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26