Previous 15994 Revisions Next

r4226 Wednesday 4th February, 2009 at 11:13:45 UTC by Curt Coder
Imported from MAME.
[src/emu]devcb.c devcb.h

src/emu/devcb.c
r4225r4226
9898   (*resolved->real.writedevice)(resolved->realtarget, 0, state);
9999}
100100
101static WRITE_LINE_DEVICE_HANDLER( trampoline_writecpu_to_write_line )
102{
103   const devcb_resolved_write_line *resolved = (const devcb_resolved_write_line *)device;
104   const device_config *cpu = resolved->realtarget;
105   cpu_set_input_line(cpu, resolved->real.writeline, state ? ASSERT_LINE : CLEAR_LINE);
106}
107
101108void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, const device_config *device)
102109{
103110   /* reset the resolved structure */
r4225r4226
119126      resolved->real.writespace = config->writespace;
120127   }
121128
129   /* cpu line handlers */
130   else if (config->type >= DEVCB_TYPE_CPU_LINE(0) && config->type < DEVCB_TYPE_CPU_LINE(MAX_INPUT_LINES))
131   {
132      FPTR line = (FPTR)config->type - (FPTR)DEVCB_TYPE_CPU_LINE(0);
133      const device_config *cpu = cputag_get_cpu(device->machine, config->tag);
134
135      if (cpu == NULL)
136         fatalerror("devcb_resolve_write_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag);
137      resolved->target = resolved;
138      resolved->write = trampoline_writecpu_to_write_line;
139      resolved->realtarget = cpu;
140      resolved->real.writeline = (int) line;
141   }
142
122143   /* device handlers */
123144   else if (config->type != NULL && (config->writeline != NULL || config->writedevice != NULL))
124145   {
src/emu/devcb.h
r4225r4226
2424    The adapted callback types supported are:
2525
2626        input port              (port)
27      cpu input line         (cpu input line)
2728        read_line_device_func:  (device)
2829        write_line_device_func: (device, data)
2930        read8_device_func:      (device, offset)
r4225r4226
4950#define DEVCB_TYPE_SELF            ((device_type)1)
5051#define DEVCB_TYPE_INPUT         ((device_type)2)
5152#define DEVCB_TYPE_MEMORY(space)   ((device_type)(4 + (space)))
53#define DEVCB_TYPE_CPU_LINE(line)   ((device_type)(4 + ADDRESS_SPACES + (line)))
5254
5355
5456
r4225r4226
7274/* read handlers for an I/O port by tag */
7375#define DEVCB_INPUT_PORT(tag)            { DEVCB_TYPE_INPUT, (tag), NULL, NULL, NULL }
7476
77/* write handlers for a CPU input line */
78#define DEVCB_CPU_INPUT_LINE(tag,line)      { DEVCB_TYPE_CPU_LINE(line), (tag), NULL, NULL, NULL }
7579
80
7681/* macros for defining read_line/write_line functions */
7782#define READ_LINE_DEVICE_HANDLER(name)       int  name(ATTR_UNUSED const device_config *device)
7883#define WRITE_LINE_DEVICE_HANDLER(name)    void name(ATTR_UNUSED const device_config *device, ATTR_UNUSED int state)
r4225r4226
134139   {
135140      write8_device_func   writedevice;
136141      write8_space_func   writespace;
142      int               writeline;
137143   } real;                           /* real write function for stubs */
138144};
139145

Previous 15994 Revisions Next


© 1998-2018 The MESS Team