mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
Merge pull request #2382 from npwoods/coco_misc_hygiene_2
[CoCo] Miscellaneous code cleanups/hygiene (nw)
This commit is contained in:
commit
aa3bd3f779
@ -10,8 +10,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __COCO12__
|
||||
#define __COCO12__
|
||||
#ifndef MAME_INCLUDES_COCO12_H
|
||||
#define MAME_INCLUDES_COCO12_H
|
||||
|
||||
|
||||
#include "includes/coco.h"
|
||||
@ -37,31 +37,31 @@ class coco12_state : public coco_state
|
||||
{
|
||||
public:
|
||||
coco12_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: coco_state(mconfig, type, tag),
|
||||
m_sam(*this, SAM_TAG),
|
||||
m_vdg(*this, VDG_TAG)
|
||||
: coco_state(mconfig, type, tag)
|
||||
, m_sam(*this, SAM_TAG)
|
||||
, m_vdg(*this, VDG_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
required_device<sam6883_device> m_sam;
|
||||
required_device<mc6847_base_device> m_vdg;
|
||||
|
||||
DECLARE_READ8_MEMBER( sam_read );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( horizontal_sync );
|
||||
DECLARE_WRITE_LINE_MEMBER( field_sync );
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void update_cart_base(uint8_t *cart_base) override;
|
||||
|
||||
/* PIA1 */
|
||||
// PIA1
|
||||
virtual void pia1_pb_changed(uint8_t data) override;
|
||||
|
||||
private:
|
||||
sam6883_device &sam() { return *m_sam; }
|
||||
|
||||
private:
|
||||
void configure_sam(void);
|
||||
|
||||
required_device<sam6883_device> m_sam;
|
||||
required_device<mc6847_base_device> m_vdg;
|
||||
};
|
||||
|
||||
|
||||
#endif /* __COCO12__ */
|
||||
#endif // MAME_INCLUDES_COCO12_H
|
||||
|
@ -10,15 +10,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __COCO3__
|
||||
#define __COCO3__
|
||||
#ifndef MAME_INCLUDES_COCO3_H
|
||||
#define MAME_INCLUDES_COCO3_H
|
||||
|
||||
|
||||
#include "includes/coco12.h"
|
||||
#include "video/gime.h"
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS / CONSTANTS
|
||||
//**************************************************************************
|
||||
@ -38,10 +37,8 @@ class coco3_state : public coco_state
|
||||
{
|
||||
public:
|
||||
coco3_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: coco_state(mconfig, type, tag),
|
||||
m_gime(*this, GIME_TAG) { }
|
||||
|
||||
required_device<gime_base_device> m_gime;
|
||||
: coco_state(mconfig, type, tag)
|
||||
, m_gime(*this, GIME_TAG) { }
|
||||
|
||||
virtual DECLARE_WRITE8_MEMBER( ff20_write ) override;
|
||||
virtual DECLARE_READ8_MEMBER( ff40_read ) override;
|
||||
@ -55,13 +52,16 @@ public:
|
||||
protected:
|
||||
virtual void update_cart_base(uint8_t *cart_base) override;
|
||||
|
||||
/* interrupts */
|
||||
// interrupts
|
||||
virtual bool firq_get_line(void) override;
|
||||
virtual bool irq_get_line(void) override;
|
||||
|
||||
/* miscellaneous */
|
||||
// miscellaneous
|
||||
virtual void update_keyboard_input(uint8_t value, uint8_t z) override;
|
||||
virtual void cart_w(bool line) override;
|
||||
|
||||
private:
|
||||
required_device<gime_base_device> m_gime;
|
||||
};
|
||||
|
||||
#endif // __COCO3__
|
||||
#endif // MAME_INCLUDES_COCO3_H
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAGON__
|
||||
#define __DRAGON__
|
||||
#ifndef MAME_INCLUDES_DRAGON_H
|
||||
#define MAME_INCLUDES_DRAGON_H
|
||||
|
||||
|
||||
#include "includes/coco12.h"
|
||||
@ -37,46 +37,48 @@ class dragon_state : public coco12_state
|
||||
{
|
||||
public:
|
||||
dragon_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: coco12_state(mconfig, type, tag),
|
||||
m_printer(*this, PRINTER_TAG)
|
||||
: coco12_state(mconfig, type, tag)
|
||||
, m_printer(*this, PRINTER_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
required_device<printer_image_device> m_printer;
|
||||
|
||||
protected:
|
||||
virtual void pia1_pa_changed(uint8_t data) override;
|
||||
|
||||
private:
|
||||
required_device<printer_image_device> m_printer;
|
||||
};
|
||||
|
||||
|
||||
/* dragon64 has an ACIA chip */
|
||||
// dragon64 has an ACIA chip
|
||||
class dragon64_state : public dragon_state
|
||||
{
|
||||
public:
|
||||
dragon64_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: dragon_state(mconfig, type, tag),
|
||||
m_acia(*this, ACIA_TAG)
|
||||
: dragon_state(mconfig, type, tag)
|
||||
, m_acia(*this, ACIA_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
required_device<mos6551_device> m_acia;
|
||||
|
||||
protected:
|
||||
virtual DECLARE_READ8_MEMBER( ff00_read ) override;
|
||||
virtual DECLARE_WRITE8_MEMBER( ff00_write ) override;
|
||||
|
||||
virtual void pia1_pb_changed(uint8_t data) override;
|
||||
void page_rom(bool romswitch);
|
||||
|
||||
private:
|
||||
required_device<mos6551_device> m_acia;
|
||||
};
|
||||
|
||||
|
||||
/* dragon200e has a character generator */
|
||||
// dragon200e has a character generator
|
||||
class dragon200e_state : public dragon64_state
|
||||
{
|
||||
public:
|
||||
dragon200e_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: dragon64_state(mconfig, type, tag),
|
||||
m_char_rom(*this, "chargen")
|
||||
: dragon64_state(mconfig, type, tag)
|
||||
, m_char_rom(*this, "chargen")
|
||||
{
|
||||
}
|
||||
|
||||
@ -87,15 +89,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/* d64plus has a HD6845 and character generator */
|
||||
// d64plus has a HD6845 and character generator
|
||||
class d64plus_state : public dragon64_state
|
||||
{
|
||||
public:
|
||||
d64plus_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: dragon64_state(mconfig, type, tag),
|
||||
m_hd6845(*this, "hd6845"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_char_rom(*this, "chargen")
|
||||
: dragon64_state(mconfig, type, tag)
|
||||
, m_hd6845(*this, "hd6845")
|
||||
, m_videoram(*this, "videoram")
|
||||
, m_char_rom(*this, "chargen")
|
||||
{
|
||||
}
|
||||
|
||||
@ -107,4 +109,4 @@ private:
|
||||
required_memory_region m_char_rom;
|
||||
};
|
||||
|
||||
#endif /* __DRAGON__ */
|
||||
#endif // MAME_INCLUDES_DRAGON_H
|
||||
|
@ -72,24 +72,24 @@ DEFINE_DEVICE_TYPE(SAM6883, sam6883_device, "sam6883", "MC6883 SAM")
|
||||
//-------------------------------------------------
|
||||
|
||||
sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SAM6883, tag, owner, clock),
|
||||
m_cpu_tag(nullptr),
|
||||
m_cpu_space_ref(AS_PROGRAM),
|
||||
m_read_res(*this),
|
||||
m_space_0000(*this),
|
||||
m_space_8000(*this),
|
||||
m_space_A000(*this),
|
||||
m_space_C000(*this),
|
||||
m_space_FF00(*this),
|
||||
m_space_FF20(*this),
|
||||
m_space_FF40(*this),
|
||||
m_space_FF60(*this),
|
||||
m_space_FFE0(*this)
|
||||
: device_t(mconfig, SAM6883, tag, owner, clock)
|
||||
, m_cpu_tag(nullptr)
|
||||
, m_cpu_space_ref(AS_PROGRAM)
|
||||
, m_cpu_space(nullptr)
|
||||
, m_read_res(*this)
|
||||
, m_space_0000(*this)
|
||||
, m_space_8000(*this)
|
||||
, m_space_A000(*this)
|
||||
, m_space_C000(*this)
|
||||
, m_space_FF00(*this)
|
||||
, m_space_FF20(*this)
|
||||
, m_space_FF40(*this)
|
||||
, m_space_FF60(*this)
|
||||
, m_space_FFE0(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -115,7 +115,6 @@ void sam6883_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// configure_bank - bank configuration
|
||||
//-------------------------------------------------
|
||||
@ -126,7 +125,6 @@ void sam6883_device::configure_bank(int bank, uint8_t *memory, uint32_t memory_s
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// configure_bank - bank configuration
|
||||
//-------------------------------------------------
|
||||
@ -137,7 +135,6 @@ void sam6883_device::configure_bank(int bank, read8_delegate rhandler, write8_de
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// configure_bank - bank configuration
|
||||
//-------------------------------------------------
|
||||
@ -155,19 +152,19 @@ void sam6883_device::configure_bank(int bank, uint8_t *memory, uint32_t memory_s
|
||||
switch(bank)
|
||||
{
|
||||
case 4:
|
||||
m_space_FF00.point(&m_banks[4], 0x0000);
|
||||
m_space_FF00.point(m_banks[4], 0x0000);
|
||||
break;
|
||||
case 5:
|
||||
m_space_FF20.point(&m_banks[5], 0x0000);
|
||||
m_space_FF20.point(m_banks[5], 0x0000);
|
||||
break;
|
||||
case 6:
|
||||
m_space_FF40.point(&m_banks[6], 0x0000);
|
||||
m_space_FF40.point(m_banks[6], 0x0000);
|
||||
break;
|
||||
case 7:
|
||||
m_space_FF60.point(&m_banks[7], 0x0000);
|
||||
m_space_FF60.point(m_banks[7], 0x0000);
|
||||
break;
|
||||
case 2:
|
||||
m_space_FFE0.point(&m_banks[2], 0x1FE0);
|
||||
m_space_FFE0.point(m_banks[2], 0x1FE0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -248,14 +245,14 @@ void sam6883_device::update_memory(void)
|
||||
{
|
||||
case 0:
|
||||
// 4K mode
|
||||
m_space_0000.point(&m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_space_0000.point(m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_counter_mask = 0x0FFF;
|
||||
m_counter_or = 0x0000;
|
||||
break;
|
||||
|
||||
case SAM_STATE_M0:
|
||||
// 16K mode
|
||||
m_space_0000.point(&m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_space_0000.point(m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_counter_mask = 0x3FFF;
|
||||
m_counter_or = 0x0000;
|
||||
break;
|
||||
@ -266,10 +263,10 @@ void sam6883_device::update_memory(void)
|
||||
if (m_sam_state & SAM_STATE_TY)
|
||||
{
|
||||
// full 64k RAM
|
||||
m_space_0000.point(&m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_space_8000.point(&m_banks[0], 0x8000);
|
||||
m_space_A000.point(&m_banks[0], 0xA000);
|
||||
m_space_C000.point(&m_banks[0], 0xC000);
|
||||
m_space_0000.point(m_banks[0], 0x0000, m_banks[0].m_memory_size);
|
||||
m_space_8000.point(m_banks[0], 0x8000);
|
||||
m_space_A000.point(m_banks[0], 0xA000);
|
||||
m_space_C000.point(m_banks[0], 0xC000);
|
||||
m_counter_mask = 0xFFFF;
|
||||
m_counter_or = 0x0000;
|
||||
setup_rom = false;
|
||||
@ -278,7 +275,7 @@ void sam6883_device::update_memory(void)
|
||||
{
|
||||
// ROM/RAM
|
||||
uint16_t ram_base = (m_sam_state & SAM_STATE_P1) ? 0x8000 : 0x0000;
|
||||
m_space_0000.point(&m_banks[0], ram_base, m_banks[0].m_memory_size);
|
||||
m_space_0000.point(m_banks[0], ram_base, m_banks[0].m_memory_size);
|
||||
m_counter_mask = 0x7FFF;
|
||||
m_counter_or = ram_base;
|
||||
}
|
||||
@ -287,13 +284,13 @@ void sam6883_device::update_memory(void)
|
||||
|
||||
if (setup_rom)
|
||||
{
|
||||
m_space_8000.point(&m_banks[1], m_banks[1].m_memory_offset);
|
||||
m_space_A000.point(&m_banks[2], m_banks[2].m_memory_offset);
|
||||
m_space_C000.point(&m_banks[3], m_banks[3].m_memory_offset);
|
||||
m_space_8000.point(m_banks[1], m_banks[1].m_memory_offset);
|
||||
m_space_A000.point(m_banks[2], m_banks[2].m_memory_offset);
|
||||
m_space_C000.point(m_banks[3], m_banks[3].m_memory_offset);
|
||||
}
|
||||
|
||||
// update $FFE0-$FFFF
|
||||
m_space_FFE0.point(&m_banks[2], m_banks[2].m_memory_offset + 0x1FE0);
|
||||
m_space_FFE0.point(m_banks[2], m_banks[2].m_memory_offset + 0x1FE0);
|
||||
}
|
||||
|
||||
|
||||
@ -475,7 +472,7 @@ address_space &sam6883_device::sam_space<_addrstart, _addrend>::cpu_space() cons
|
||||
//-------------------------------------------------
|
||||
|
||||
template<uint16_t _addrstart, uint16_t _addrend>
|
||||
void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank *bank, uint16_t offset, uint32_t length)
|
||||
void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank &bank, uint16_t offset, uint32_t length)
|
||||
{
|
||||
if (LOG_SAM)
|
||||
{
|
||||
@ -484,8 +481,8 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank *bank
|
||||
(unsigned) _addrend,
|
||||
(unsigned) offset,
|
||||
(unsigned)length,
|
||||
bank->m_memory,
|
||||
bank->m_memory_read_only ? "true" : "false");
|
||||
bank.m_memory,
|
||||
bank.m_memory_read_only ? "true" : "false");
|
||||
}
|
||||
|
||||
point_specific_bank(bank, offset, length, m_read_bank, _addrstart, _addrend, false);
|
||||
@ -498,9 +495,9 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point(const sam_bank *bank
|
||||
// sam_space::point_specific_bank
|
||||
//-------------------------------------------------
|
||||
template<uint16_t _addrstart, uint16_t _addrend>
|
||||
void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const sam_bank *bank, uint32_t offset, uint32_t length, memory_bank *&memory_bank, uint32_t addrstart, uint32_t addrend, bool is_write)
|
||||
void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const sam_bank &bank, uint32_t offset, uint32_t length, memory_bank *&memory_bank, uint32_t addrstart, uint32_t addrend, bool is_write)
|
||||
{
|
||||
if (bank->m_memory != nullptr)
|
||||
if (bank.m_memory != nullptr)
|
||||
{
|
||||
// this bank is a memory bank - first lets adjust the length as per the offset; as
|
||||
// passed to this method, the length is from offset zero
|
||||
@ -543,10 +540,10 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const
|
||||
// point the bank
|
||||
if (memory_bank != nullptr)
|
||||
{
|
||||
if (is_write && bank->m_memory_read_only)
|
||||
if (is_write && bank.m_memory_read_only)
|
||||
memory_bank->set_base(m_owner.m_dummy);
|
||||
else
|
||||
memory_bank->set_base(bank->m_memory + offset);
|
||||
memory_bank->set_base(bank.m_memory + offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -557,13 +554,13 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const
|
||||
|
||||
if (is_write)
|
||||
{
|
||||
if (!bank->m_whandler.isnull())
|
||||
cpu_space().install_write_handler(addrstart, addrend, bank->m_whandler);
|
||||
if (!bank.m_whandler.isnull())
|
||||
cpu_space().install_write_handler(addrstart, addrend, bank.m_whandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bank->m_rhandler.isnull())
|
||||
cpu_space().install_read_handler(addrstart, addrend, bank->m_rhandler);
|
||||
if (!bank.m_rhandler.isnull())
|
||||
cpu_space().install_read_handler(addrstart, addrend, bank.m_rhandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ private:
|
||||
{
|
||||
public:
|
||||
sam_space(sam6883_device &owner);
|
||||
void point(const sam_bank *bank, uint16_t offset, uint32_t length = ~0);
|
||||
void point(const sam_bank &bank, uint16_t offset, uint32_t length = ~0);
|
||||
|
||||
private:
|
||||
sam6883_device & m_owner;
|
||||
@ -165,7 +165,7 @@ private:
|
||||
uint32_t m_length;
|
||||
|
||||
address_space &cpu_space() const;
|
||||
void point_specific_bank(const sam_bank *bank, uint32_t offset, uint32_t mask, memory_bank *&memory_bank, uint32_t addrstart, uint32_t addrend, bool is_write);
|
||||
void point_specific_bank(const sam_bank &bank, uint32_t offset, uint32_t mask, memory_bank *&memory_bank, uint32_t addrstart, uint32_t addrend, bool is_write);
|
||||
};
|
||||
|
||||
const char * m_cpu_tag;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/***************************************************************************
|
||||
|
||||
coco12.c
|
||||
coco12.cpp
|
||||
|
||||
TRS-80 Radio Shack Color Computer 1/2 Family
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/***************************************************************************
|
||||
|
||||
coco3.c
|
||||
coco3.cpp
|
||||
|
||||
TRS-80 Radio Shack Color Computer 3
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nathan Woods
|
||||
/***************************************************************************
|
||||
|
||||
dragon.h
|
||||
dragon.cpp
|
||||
|
||||
Dragon Family
|
||||
|
||||
@ -149,6 +149,6 @@ void dragon64_state::page_rom(bool romswitch)
|
||||
offs_t offset = romswitch
|
||||
? 0x0000 // This is the 32k mode basic(64)/boot rom(alpha)
|
||||
: 0x8000; // This is the 64k mode basic(64)/basic rom(alpha)
|
||||
m_sam->set_bank_offset(1, offset); // 0x8000-0x9FFF
|
||||
m_sam->set_bank_offset(2, offset); // 0xA000-0xBFFF
|
||||
sam().set_bank_offset(1, offset); // 0x8000-0x9FFF
|
||||
sam().set_bank_offset(2, offset); // 0xA000-0xBFFF
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user