diff options
author | 2008-11-14 16:43:46 +0000 | |
---|---|---|
committer | 2008-11-14 16:43:46 +0000 | |
commit | 537c9becf66a98da8e06673f0d3623be809e7bcf (patch) | |
tree | 4f7eb26b449269a216449320a61682f2b89387bc /src/emu/machine/6821pia.c | |
parent | 9c085ae0fa18df54f9cb8356ebbf2ae8bc8099bd (diff) |
WARNING: this compiles, but not fully cleanly, and a number of drivers
are broken.
Changed READ/WRITE handlers to accept an address_space * instead of a
machine *. The address_space object was enhanced to contain a machine
and a pointer to the relevant CPU object.
Fixed a number of errors found by the compiler, mostly in the core and
CPU/sound handlers, but there is a lot remaining to fix.
Added new function cpu_get_address_space() to fetch the address space
for calling in manually to these functions. In some instances, code
which should eventually be converted to a device is hard-coding fetching
the program space of CPU #0 in order to have something valid to pass.
Diffstat (limited to 'src/emu/machine/6821pia.c')
-rw-r--r-- | src/emu/machine/6821pia.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index f195f0a7f6d..be6010b40cc 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -243,13 +243,15 @@ static void update_interrupts(running_machine *machine, pia6821 *p) static UINT8 get_in_a_value(running_machine *machine, int which) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; UINT8 port_a_data = 0; UINT8 ret; /* update the input */ if (p->intf->in_a_func) - port_a_data = p->intf->in_a_func(machine, 0); + port_a_data = p->intf->in_a_func(space, 0); else { if (p->in_a_pushed) @@ -280,6 +282,8 @@ static UINT8 get_in_a_value(running_machine *machine, int which) static UINT8 get_in_b_value(running_machine *machine, int which) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; UINT8 ret; @@ -292,7 +296,7 @@ static UINT8 get_in_b_value(running_machine *machine, int which) /* update the input */ if (p->intf->in_b_func) - port_b_data = p->intf->in_b_func(machine, 0); + port_b_data = p->intf->in_b_func(space, 0); else { if (p->in_b_pushed) @@ -360,6 +364,8 @@ static UINT8 get_out_b_value(int which) static void set_out_ca2(running_machine *machine, int which, int data) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; if (data != p->out_ca2) @@ -368,7 +374,7 @@ static void set_out_ca2(running_machine *machine, int which, int data) /* send to output function */ if (p->intf->out_ca2_func) - p->intf->out_ca2_func(machine, 0, p->out_ca2); + p->intf->out_ca2_func(space, 0, p->out_ca2); else { if (p->out_ca2_needs_pulled) @@ -382,6 +388,8 @@ static void set_out_ca2(running_machine *machine, int which, int data) static void set_out_cb2(running_machine *machine, int which, int data) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; int z = pia_get_output_cb2_z(which); @@ -393,7 +401,7 @@ static void set_out_cb2(running_machine *machine, int which, int data) /* send to output function */ if (p->intf->out_cb2_func) - p->intf->out_cb2_func(machine, 0, p->out_cb2); + p->intf->out_cb2_func(space, 0, p->out_cb2); else { if (p->out_cb2_needs_pulled) @@ -490,12 +498,14 @@ static UINT8 ddr_b_r(running_machine *machine, int which) static UINT8 control_a_r(running_machine *machine, int which) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; UINT8 ret; /* update CA1 & CA2 if callback exists, these in turn may update IRQ's */ if (p->intf->in_ca1_func) - pia_set_input_ca1(which, p->intf->in_ca1_func(machine, 0)); + pia_set_input_ca1(which, p->intf->in_ca1_func(space, 0)); else if (!p->logged_ca1_not_connected && (!p->in_ca1_pushed)) { logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA1 read handler. Assuming pin not connected\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); @@ -503,7 +513,7 @@ static UINT8 control_a_r(running_machine *machine, int which) } if (p->intf->in_ca2_func) - pia_set_input_ca2(which, p->intf->in_ca2_func(machine, 0)); + pia_set_input_ca2(which, p->intf->in_ca2_func(space, 0)); else if ( !p->logged_ca2_not_connected && C2_INPUT(p->ctl_a) && !p->in_ca2_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA2 read handler. Assuming pin not connected\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); @@ -528,12 +538,14 @@ static UINT8 control_a_r(running_machine *machine, int which) static UINT8 control_b_r(running_machine *machine, int which) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; UINT8 ret; /* update CB1 & CB2 if callback exists, these in turn may update IRQ's */ if (p->intf->in_cb1_func) - pia_set_input_cb1(which, p->intf->in_cb1_func(machine, 0)); + pia_set_input_cb1(which, p->intf->in_cb1_func(space, 0)); else if (!p->logged_cb1_not_connected && !p->in_cb1_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Error! no CB1 read handler. Three-state pin is undefined\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); @@ -541,7 +553,7 @@ static UINT8 control_b_r(running_machine *machine, int which) } if (p->intf->in_cb2_func) - pia_set_input_cb2(which, p->intf->in_cb2_func(machine, 0)); + pia_set_input_cb2(which, p->intf->in_cb2_func(space, 0)); else if (!p->logged_cb2_not_connected && C2_INPUT(p->ctl_b) && !p->in_cb2_pushed) { logerror("cpu #%d (PC=%08X): PIA #%d: Error! No CB2 read handler. Three-state pin is undefined\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); @@ -622,6 +634,8 @@ UINT8 pia_get_port_b_z_mask(int which) static void send_to_out_a_func(running_machine *machine, int which, const char* message) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; /* input pins are pulled high */ @@ -630,7 +644,7 @@ static void send_to_out_a_func(running_machine *machine, int which, const char* LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, message, data)); if (p->intf->out_a_func) - p->intf->out_a_func(machine, 0, data); + p->intf->out_a_func(space, 0, data); else { if (p->out_a_needs_pulled) @@ -643,6 +657,8 @@ static void send_to_out_a_func(running_machine *machine, int which, const char* static void send_to_out_b_func(running_machine *machine, int which, const char* message) { + /* temporary hack until this is converted to a device */ + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); pia6821 *p = &pias[which]; /* input pins are high-impedance - we just send them as zeros for backwards compatibility */ @@ -651,7 +667,7 @@ static void send_to_out_b_func(running_machine *machine, int which, const char* LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, message, data)); if (p->intf->out_b_func) - p->intf->out_b_func(machine, 0, data); + p->intf->out_b_func(space, 0, data); else { if (p->out_b_needs_pulled) |