[CoCo] Miscellaneous cleanups/hygiene (nw)

1.  Changed '#ifndef __COCO__' ==> '#ifndef MAME_INCLUDES_COCO_H'
2.  Moved device declarations to be private, added accessors when necessary
This commit is contained in:
Nathan Woods 2017-06-12 06:41:09 -04:00 committed by Vas Crabb
parent 72423541d2
commit 195999b14d
5 changed files with 43 additions and 38 deletions

View File

@ -10,8 +10,8 @@
#pragma once
#ifndef __COCO__
#define __COCO__
#ifndef MAME_INCLUDES_COCO_H
#define MAME_INCLUDES_COCO_H
#include "imagedev/cassette.h"
@ -90,22 +90,6 @@ class coco_state : public driver_device, public device_cococart_host_interface
public:
coco_state(const machine_config &mconfig, device_type type, const char *tag);
required_device<cpu_device> m_maincpu;
required_device<pia6821_device> m_pia_0;
required_device<pia6821_device> m_pia_1;
required_device<dac_byte_interface> m_dac;
required_device<dac_1bit_device> m_sbs;
required_device<wave_device> m_wave;
required_device<cococart_slot_device> m_cococart;
required_device<ram_device> m_ram;
required_device<cassette_image_device> m_cassette;
required_device<address_map_bank_device> m_floating;
optional_device<rs232_port_device> m_rs232;
optional_device<coco_vhd_image_device> m_vhd_0;
optional_device<coco_vhd_image_device> m_vhd_1;
optional_device<beckerport_device> m_beckerport;
optional_ioport m_beckerportconfig;
// driver update handlers
DECLARE_INPUT_CHANGED_MEMBER(keyboard_changed);
DECLARE_INPUT_CHANGED_MEMBER(joystick_mode_changed);
@ -167,6 +151,13 @@ protected:
virtual void pia1_pa_changed(uint8_t data);
virtual void pia1_pb_changed(uint8_t data);
// accessors
cpu_device &maincpu() { return *m_maincpu; }
pia6821_device &pia_0() { return *m_pia_0; }
pia6821_device &pia_1() { return *m_pia_1; }
cococart_slot_device &cococart() { return *m_cococart; }
ram_device &ram() { return *m_ram; }
// miscellaneous
virtual void update_keyboard_input(uint8_t value, uint8_t z);
virtual void cart_w(bool state);
@ -234,10 +225,27 @@ private:
bool snden(void) { return m_pia_1->cb2_output() ? true : false; }
// VHD selection
coco_vhd_image_device *current_vhd(void);
coco_vhd_image_device *current_vhd();
// floating bus
uint8_t floating_bus_read(void);
uint8_t floating_bus_read();
// devices
required_device<cpu_device> m_maincpu;
required_device<pia6821_device> m_pia_0;
required_device<pia6821_device> m_pia_1;
required_device<dac_byte_interface> m_dac;
required_device<dac_1bit_device> m_sbs;
required_device<wave_device> m_wave;
required_device<cococart_slot_device> m_cococart;
required_device<ram_device> m_ram;
required_device<cassette_image_device> m_cassette;
required_device<address_map_bank_device> m_floating;
optional_device<rs232_port_device> m_rs232;
optional_device<coco_vhd_image_device> m_vhd_0;
optional_device<coco_vhd_image_device> m_vhd_1;
optional_device<beckerport_device> m_beckerport;
optional_ioport m_beckerportconfig;
// input ports
required_ioport_array<7> m_keyboard;
@ -276,4 +284,4 @@ private:
bool m_in_floating_bus_read;
};
#endif // __COCO__
#endif // MAME_INCLUDES_COCO_H

View File

@ -251,7 +251,7 @@ void coco_state::device_timer(emu_timer &timer, device_timer_id id, int param, v
// CoCo 1/2 you should get $F627 instead.
//-------------------------------------------------
uint8_t coco_state::floating_bus_read(void)
uint8_t coco_state::floating_bus_read()
{
uint8_t result;
@ -1133,7 +1133,7 @@ void coco_state::poll_hires_joystick(void)
// current_vhd
//-------------------------------------------------
coco_vhd_image_device *coco_state::current_vhd(void)
coco_vhd_image_device *coco_state::current_vhd()
{
switch(m_vhd_select)
{

View File

@ -29,16 +29,13 @@ void coco12_state::device_start()
void coco12_state::configure_sam()
{
cococart_slot_device *cart = m_cococart;
uint8_t *ram = m_ram->pointer();
uint32_t ram_size = m_ram->size();
uint8_t *rom = memregion(MAINCPU_TAG)->base();
uint8_t *cart_rom = cart->get_cart_base();
uint8_t *cart_rom = cococart().get_cart_base();
m_sam->configure_bank(0, ram, ram_size, false); // $0000-$7FFF
m_sam->configure_bank(1, &rom[0x0000], 0x2000, true); // $8000-$9FFF
m_sam->configure_bank(2, &rom[0x2000], 0x2000, true); // $A000-$BFFF
m_sam->configure_bank(3, cart_rom, 0x4000, true); // $C000-$FEFF
m_sam->configure_bank(0, ram().pointer(), ram().size(), false); // $0000-$7FFF
m_sam->configure_bank(1, &rom[0x0000], 0x2000, true); // $8000-$9FFF
m_sam->configure_bank(2, &rom[0x2000], 0x2000, true); // $A000-$BFFF
m_sam->configure_bank(3, cart_rom, 0x4000, true); // $C000-$FEFF
// $FF00-$FF1F
m_sam->configure_bank(4, read8_delegate(FUNC(coco12_state::ff00_read), this), write8_delegate(FUNC(coco12_state::ff00_write), this));
@ -60,7 +57,7 @@ void coco12_state::configure_sam()
WRITE_LINE_MEMBER( coco12_state::horizontal_sync )
{
m_pia_0->ca1_w(state);
pia_0().ca1_w(state);
m_sam->hs_w(state);
}
@ -72,7 +69,7 @@ WRITE_LINE_MEMBER( coco12_state::horizontal_sync )
WRITE_LINE_MEMBER( coco12_state::field_sync )
{
m_pia_0->cb1_w(state);
pia_0().cb1_w(state);
}
@ -83,7 +80,7 @@ WRITE_LINE_MEMBER( coco12_state::field_sync )
READ8_MEMBER( coco12_state::sam_read )
{
uint8_t data = m_ram->read(offset);
uint8_t data = ram().read(offset);
m_vdg->as_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE);
m_vdg->inv_w(data & 0x40 ? ASSERT_LINE : CLEAR_LINE);
return data;

View File

@ -355,12 +355,12 @@ WRITE_LINE_MEMBER( dragon_alpha_state::fdc_intrq_w )
else
{
if (m_pia_2->ca2_output_z())
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
maincpu().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
}
else
{
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
maincpu().set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
}

View File

@ -57,7 +57,7 @@ void dragon_state::pia1_pa_changed(uint8_t data)
/* if strobe bit is high send data from pia0 port b to dragon parallel printer */
if (data & 0x02)
{
uint8_t output = m_pia_1->b_output();
uint8_t output = pia_1().b_output();
m_printer->output(output);
}
}
@ -118,7 +118,7 @@ void dragon64_state::pia1_pb_changed(uint8_t data)
{
dragon_state::pia1_pb_changed(data);
uint8_t ddr = ~m_pia_1->port_b_z_mask();
uint8_t ddr = ~pia_1().port_b_z_mask();
/* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */
/* to control the paging of the 32k and 64k basic roms */