c2color: Hook up CPU and quick hack to load cartridges (nw)

This commit is contained in:
AJR 2019-09-24 18:07:12 -04:00
parent 97d29e7220
commit 5a9d0bb8de

View File

@ -26,6 +26,8 @@
#include "emu.h"
#include "cpu/mcs51/mcs51.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"
@ -39,6 +41,7 @@ class c2_color_state : public driver_device
public:
c2_color_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_cart(*this, "cartslot")
, m_cart_region(nullptr)
, m_palette(*this, "palette")
@ -56,6 +59,12 @@ private:
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load);
u8 cart_r(offs_t offset);
void prog_map(address_map &map);
void ext_map(address_map &map);
required_device<mcs51_cpu_device> m_maincpu;
required_device<generic_slot_device> m_cart;
memory_region *m_cart_region;
required_device<palette_device> m_palette;
@ -94,12 +103,30 @@ DEVICE_IMAGE_LOAD_MEMBER(c2_color_state::cart_load)
return image_init_result::PASS;
}
u8 c2_color_state::cart_r(offs_t offset)
{
// skip past 32-byte header
return m_cart->read_rom(offset + 32);
}
void c2_color_state::prog_map(address_map &map)
{
map(0x0000, 0xffff).r(FUNC(c2_color_state::cart_r));
}
void c2_color_state::ext_map(address_map &map)
{
map(0x2400, 0x2400).nopr();
}
static INPUT_PORTS_START( c2_color )
INPUT_PORTS_END
void c2_color_state::c2_color(machine_config &config)
{
// unknown CPU
I8032(config, m_maincpu, 12'000'000); // exact type and clock unknown
m_maincpu->set_addrmap(AS_PROGRAM, &c2_color_state::prog_map);
m_maincpu->set_addrmap(AS_IO, &c2_color_state::ext_map);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);