/[gxemul]/trunk/src/devices/dev_colorplanemask.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_colorplanemask.c

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

revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_colorplanemask.c,v 1.11 2005/11/13 00:14:08 debug Exp $   *  $Id: dev_colorplanemask.c,v 1.14 2007/06/15 18:44:19 debug Exp $
29   *     *  
30   *  Color plane mask used by DECstation 3100.   *  COMMENT: Color plane mask, used in the DECstation 3100 machine
31   *   *
32   *  Just a one-byte thingy, but the way things work now this has to   *  Just a one-byte thingy, but the way things work now this has to
33   *  be a separate device. :-/   *  be a separate device. :-/
# Line 47  struct colorplanemask_data { Line 47  struct colorplanemask_data {
47  };  };
48    
49    
50  /*  DEVICE_ACCESS(colorplanemask)
  *  dev_colorplanemask_access():  
  */  
 int dev_colorplanemask_access(struct cpu *cpu, struct memory *mem,  
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
51  {  {
52          struct colorplanemask_data *d = (struct colorplanemask_data *) extra;          struct colorplanemask_data *d = extra;
53    
54          switch (relative_addr) {          switch (relative_addr) {
55    
56          case 0x00:          case 0x00:
57                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
58                          *d->color_plane_mask = data[0];                          *d->color_plane_mask = data[0];
# Line 66  int dev_colorplanemask_access(struct cpu Line 62  int dev_colorplanemask_access(struct cpu
62                          data[0] = *d->color_plane_mask;                          data[0] = *d->color_plane_mask;
63                  }                  }
64                  break;                  break;
65    
66          default:          default:
67                  if (writeflag == MEM_WRITE) {                  if (writeflag == MEM_WRITE) {
68                          debug("[ colorplanemask: unimplemented write "                          debug("[ colorplanemask: unimplemented write "
# Line 88  int dev_colorplanemask_access(struct cpu Line 85  int dev_colorplanemask_access(struct cpu
85  void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,  void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,
86          unsigned char *color_plane_mask)          unsigned char *color_plane_mask)
87  {  {
88          struct colorplanemask_data *d =          struct colorplanemask_data *d;
89              malloc(sizeof(struct colorplanemask_data));  
90          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct colorplanemask_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
91          memset(d, 0, sizeof(struct colorplanemask_data));          memset(d, 0, sizeof(struct colorplanemask_data));
92    
93          d->color_plane_mask = color_plane_mask;          d->color_plane_mask = color_plane_mask;
94    
95          memory_device_register(mem, "colorplanemask", baseaddr,          memory_device_register(mem, "colorplanemask", baseaddr,

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

  ViewVC Help
Powered by ViewVC 1.1.26