mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
(nw) jtc, mcb216: small cleanup
This commit is contained in:
parent
673a9020b2
commit
8e9e248e7b
@ -47,38 +47,33 @@ public:
|
||||
, m_video_ram(*this, "videoram")
|
||||
{ }
|
||||
|
||||
virtual void machine_start() override;
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void p2_w(uint8_t data);
|
||||
uint8_t p3_r();
|
||||
void p3_w(uint8_t data);
|
||||
void es40_palette(palette_device &palette) const;
|
||||
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
|
||||
|
||||
int m_centronics_busy;
|
||||
DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
|
||||
void basic(machine_config &config);
|
||||
void jtc(machine_config &config);
|
||||
void jtc_mem(address_map &map);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
void p2_w(u8 data);
|
||||
u8 p3_r();
|
||||
void p3_w(u8 data);
|
||||
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
|
||||
int m_centronics_busy;
|
||||
DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
|
||||
required_device<z8_device> m_maincpu;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<centronics_device> m_centronics;
|
||||
optional_shared_ptr<uint8_t> m_video_ram;
|
||||
};
|
||||
optional_shared_ptr<u8> m_video_ram;
|
||||
|
||||
private:
|
||||
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void jtc_mem(address_map &map);
|
||||
};
|
||||
|
||||
class jtces88_state : public jtc_state
|
||||
{
|
||||
public:
|
||||
jtces88_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: jtc_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
using jtc_state::jtc_state;
|
||||
void jtces88(machine_config &config);
|
||||
};
|
||||
|
||||
@ -86,13 +81,10 @@ public:
|
||||
class jtces23_state : public jtc_state
|
||||
{
|
||||
public:
|
||||
jtces23_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: jtc_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
using jtc_state::jtc_state;
|
||||
void jtces23(machine_config &config);
|
||||
private:
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void jtc_es23_mem(address_map &map);
|
||||
};
|
||||
|
||||
@ -100,30 +92,26 @@ private:
|
||||
class jtces40_state : public jtc_state
|
||||
{
|
||||
public:
|
||||
jtces40_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: jtc_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
using jtc_state::jtc_state;
|
||||
void jtces40(machine_config &config);
|
||||
private:
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
uint8_t videoram_r(offs_t offset);
|
||||
void videoram_w(offs_t offset, uint8_t data);
|
||||
void banksel_w(uint8_t data);
|
||||
|
||||
uint8_t m_video_bank;
|
||||
std::unique_ptr<uint8_t[]> m_color_ram_r;
|
||||
std::unique_ptr<uint8_t[]> m_color_ram_g;
|
||||
std::unique_ptr<uint8_t[]> m_color_ram_b;
|
||||
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
u8 videoram_r(offs_t offset);
|
||||
void videoram_w(offs_t offset, u8 data);
|
||||
void banksel_w(u8 data);
|
||||
u8 m_video_bank;
|
||||
std::unique_ptr<u8[]> m_color_ram_r;
|
||||
std::unique_ptr<u8[]> m_color_ram_g;
|
||||
std::unique_ptr<u8[]> m_color_ram_b;
|
||||
void jtc_es40_mem(address_map &map);
|
||||
void es40_palette(palette_device &palette) const;
|
||||
};
|
||||
|
||||
|
||||
/* Read/Write Handlers */
|
||||
|
||||
void jtc_state::p2_w(uint8_t data)
|
||||
void jtc_state::p2_w(u8 data)
|
||||
{
|
||||
/*
|
||||
|
||||
@ -148,7 +136,7 @@ DECLARE_WRITE_LINE_MEMBER( jtc_state::write_centronics_busy )
|
||||
m_centronics_busy = state;
|
||||
}
|
||||
|
||||
uint8_t jtc_state::p3_r()
|
||||
u8 jtc_state::p3_r()
|
||||
{
|
||||
/*
|
||||
|
||||
@ -161,7 +149,7 @@ uint8_t jtc_state::p3_r()
|
||||
|
||||
*/
|
||||
|
||||
uint8_t data = 0;
|
||||
u8 data = 0;
|
||||
|
||||
data |= ((m_cassette)->input() < 0.0) ? 1 : 0;
|
||||
data |= m_centronics_busy << 3;
|
||||
@ -169,7 +157,7 @@ uint8_t jtc_state::p3_r()
|
||||
return data;
|
||||
}
|
||||
|
||||
void jtc_state::p3_w(uint8_t data)
|
||||
void jtc_state::p3_w(u8 data)
|
||||
{
|
||||
/*
|
||||
|
||||
@ -190,9 +178,9 @@ void jtc_state::p3_w(uint8_t data)
|
||||
m_speaker->level_w(BIT(data, 6));
|
||||
}
|
||||
|
||||
uint8_t jtces40_state::videoram_r(offs_t offset)
|
||||
u8 jtces40_state::videoram_r(offs_t offset)
|
||||
{
|
||||
uint8_t data = 0;
|
||||
u8 data = 0;
|
||||
|
||||
if (BIT(m_video_bank, 7)) data |= m_color_ram_r[offset];
|
||||
if (BIT(m_video_bank, 6)) data |= m_color_ram_g[offset];
|
||||
@ -202,7 +190,7 @@ uint8_t jtces40_state::videoram_r(offs_t offset)
|
||||
return data;
|
||||
}
|
||||
|
||||
void jtces40_state::videoram_w(offs_t offset, uint8_t data)
|
||||
void jtces40_state::videoram_w(offs_t offset, u8 data)
|
||||
{
|
||||
if (BIT(m_video_bank, 7)) m_color_ram_r[offset] = data;
|
||||
if (BIT(m_video_bank, 6)) m_color_ram_g[offset] = data;
|
||||
@ -210,7 +198,7 @@ void jtces40_state::videoram_w(offs_t offset, uint8_t data)
|
||||
if (BIT(m_video_bank, 4)) m_video_ram[offset] = data;
|
||||
}
|
||||
|
||||
void jtces40_state::banksel_w(uint8_t data)
|
||||
void jtces40_state::banksel_w(u8 data)
|
||||
{
|
||||
m_video_bank = data;
|
||||
}
|
||||
@ -593,7 +581,7 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb)
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
u16 i, quick_addr, quick_length;
|
||||
std::vector<uint8_t> quick_data;
|
||||
std::vector<u8> quick_data;
|
||||
image_init_result result = image_init_result::FAIL;
|
||||
|
||||
quick_length = image.length();
|
||||
@ -679,7 +667,7 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb)
|
||||
|
||||
/* Video */
|
||||
|
||||
uint32_t jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
u8 i, y, sx;
|
||||
|
||||
@ -697,7 +685,7 @@ uint32_t jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
u8 i, y, sx;
|
||||
|
||||
@ -715,7 +703,7 @@ uint32_t jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
|
||||
return 0;
|
||||
}
|
||||
|
||||
void jtc_state::es40_palette(palette_device &palette) const
|
||||
void jtces40_state::es40_palette(palette_device &palette) const
|
||||
{
|
||||
for (u8 i = 8; i < 16; i++)
|
||||
palette.set_pen_color(i, rgb_t(BIT(i, 0) ? 0xc0 : 0, BIT(i, 1) ? 0xc0 : 0, BIT(i, 2) ? 0xc0 : 0));
|
||||
@ -725,9 +713,9 @@ void jtces40_state::video_start()
|
||||
{
|
||||
/* allocate memory */
|
||||
m_video_ram.allocate(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_r = std::make_unique<uint8_t[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_g = std::make_unique<uint8_t[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_b = std::make_unique<uint8_t[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_r = std::make_unique<u8[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_g = std::make_unique<u8[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
m_color_ram_b = std::make_unique<u8[]>(JTC_ES40_VIDEORAM_SIZE);
|
||||
|
||||
/* register for state saving */
|
||||
save_item(NAME(m_video_bank));
|
||||
@ -738,7 +726,7 @@ void jtces40_state::video_start()
|
||||
save_item(NAME(m_centronics_busy));
|
||||
}
|
||||
|
||||
uint32_t jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
u16 ma = 0;
|
||||
|
||||
@ -898,7 +886,7 @@ void jtces40_state::jtces40(machine_config &config)
|
||||
screen.set_palette("palette");
|
||||
|
||||
GFXDECODE(config, "gfxdecode", "palette", gfx_jtces40);
|
||||
PALETTE(config, "palette", FUNC(jtc_state::es40_palette), 16);
|
||||
PALETTE(config, "palette", FUNC(jtces40_state::es40_palette), 16);
|
||||
|
||||
/* internal ram */
|
||||
RAM(config, RAM_TAG).set_default_size("8K").set_extra_options("16K,32K");
|
||||
|
@ -5,8 +5,6 @@
|
||||
2013-12-01 Driver for Cromemco MCB-216 SCC (Single Card Computer),
|
||||
and also the earlier CB-308.
|
||||
|
||||
TODO:
|
||||
- Confirm cpu clock speed
|
||||
|
||||
Memory allocation
|
||||
- 0000 to 0FFF - standard roms
|
||||
@ -47,25 +45,30 @@ public:
|
||||
{ }
|
||||
|
||||
void mcb216(machine_config &config);
|
||||
|
||||
protected:
|
||||
u8 tms5501_status_r();
|
||||
IRQ_CALLBACK_MEMBER(irq_callback);
|
||||
void mcb216_io(address_map &map);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<tms5501_device> m_tms5501;
|
||||
|
||||
private:
|
||||
void mcb216_mem(address_map &map);
|
||||
};
|
||||
|
||||
class cb308_state : public mcb216_state
|
||||
{
|
||||
public:
|
||||
using mcb216_state::mcb216_state;
|
||||
void cb308(machine_config &config);
|
||||
|
||||
private:
|
||||
uint8_t tms5501_status_r();
|
||||
|
||||
DECLARE_MACHINE_RESET(mcb216);
|
||||
DECLARE_MACHINE_RESET(cb308);
|
||||
|
||||
IRQ_CALLBACK_MEMBER(irq_callback);
|
||||
|
||||
void cb308_mem(address_map &map);
|
||||
void mcb216_io(address_map &map);
|
||||
void mcb216_mem(address_map &map);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<tms5501_device> m_tms5501;
|
||||
void machine_reset() override;
|
||||
};
|
||||
|
||||
uint8_t mcb216_state::tms5501_status_r()
|
||||
u8 mcb216_state::tms5501_status_r()
|
||||
{
|
||||
// D7 D6 D5 D4 D3 D2 D1 D0
|
||||
// TBE RDA IPG TBE RDA SRV ORE FME
|
||||
@ -75,7 +78,7 @@ uint8_t mcb216_state::tms5501_status_r()
|
||||
void mcb216_state::mcb216_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0x0fff).rom().region("roms", 0);
|
||||
map(0x0000, 0x1fff).rom().region("roms", 0); // SCC board has space for 2k of roms
|
||||
map(0x2000, 0x23ff).ram();
|
||||
map(0x2400, 0xffff).ram();
|
||||
}
|
||||
@ -92,7 +95,7 @@ void mcb216_state::mcb216_io(address_map &map)
|
||||
map(0x05, 0x09).w(m_tms5501, FUNC(tms5501_device::tmr_w));
|
||||
}
|
||||
|
||||
void mcb216_state::cb308_mem(address_map &map)
|
||||
void cb308_state::cb308_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0x1fff).ram();
|
||||
@ -110,11 +113,7 @@ IRQ_CALLBACK_MEMBER(mcb216_state::irq_callback)
|
||||
return m_tms5501->get_vector();
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER( mcb216_state, mcb216 )
|
||||
{
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER( mcb216_state, cb308 )
|
||||
void cb308_state::machine_reset()
|
||||
{
|
||||
m_maincpu->set_state_int(Z80_PC, 0xe000);
|
||||
}
|
||||
@ -127,8 +126,6 @@ void mcb216_state::mcb216(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_IO, &mcb216_state::mcb216_io);
|
||||
m_maincpu->set_irq_acknowledge_callback(FUNC(mcb216_state::irq_callback));
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, mcb216)
|
||||
|
||||
TMS5501(config, m_tms5501, 8_MHz_XTAL / 4);
|
||||
m_tms5501->xmt_callback().set("rs232", FUNC(rs232_port_device::write_txd));
|
||||
m_tms5501->int_callback().set_inputline(m_maincpu, 0);
|
||||
@ -137,27 +134,15 @@ void mcb216_state::mcb216(machine_config &config)
|
||||
rs232.rxd_handler().set(m_tms5501, FUNC(tms5501_device::rcv_w));
|
||||
}
|
||||
|
||||
void mcb216_state::cb308(machine_config &config)
|
||||
void cb308_state::cb308(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
Z80(config, m_maincpu, 8_MHz_XTAL / 2);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &mcb216_state::cb308_mem);
|
||||
m_maincpu->set_addrmap(AS_IO, &mcb216_state::mcb216_io);
|
||||
m_maincpu->set_irq_acknowledge_callback(FUNC(mcb216_state::irq_callback));
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(mcb216_state, cb308)
|
||||
|
||||
TMS5501(config, m_tms5501, 8_MHz_XTAL / 4);
|
||||
m_tms5501->xmt_callback().set("rs232", FUNC(rs232_port_device::write_txd));
|
||||
m_tms5501->int_callback().set_inputline(m_maincpu, 0);
|
||||
|
||||
rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal"));
|
||||
rs232.rxd_handler().set(m_tms5501, FUNC(tms5501_device::rcv_w));
|
||||
mcb216(config);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &cb308_state::cb308_mem);
|
||||
}
|
||||
|
||||
/* ROM definition */
|
||||
ROM_START( mcb216 )
|
||||
ROM_REGION(0x1000, "roms", 0)
|
||||
ROM_REGION(0x2000, "roms", 0)
|
||||
ROM_LOAD( "mcb216r0", 0x0000, 0x0800, CRC(86d20cea) SHA1(9fb8fdbcb8d31bd3304a0b3339c7f423188e9d37) )
|
||||
ROM_LOAD( "mcb216r1", 0x0800, 0x0800, CRC(68a25b2c) SHA1(3eadd4a5d65726f767742deb4b51a97df813f37d) )
|
||||
|
||||
@ -166,7 +151,7 @@ ROM_START( mcb216 )
|
||||
ROM_END
|
||||
|
||||
ROM_START( cb308 )
|
||||
ROM_REGION(0x1000, "roms", 0)
|
||||
ROM_REGION(0x2000, "roms", 0)
|
||||
ROM_LOAD( "cb308r0", 0x0000, 0x0400, CRC(62f50531) SHA1(3071e2ab7fc6b2ca889e4fb5cf7cc9ee8fbe53d3) )
|
||||
ROM_LOAD( "cb308r1", 0x0400, 0x0400, CRC(03191ac1) SHA1(84665dfc797c9f51bb659291b18399986ed846fb) )
|
||||
ROM_LOAD( "cb308r2", 0x0800, 0x0400, CRC(695ea521) SHA1(efe36a712e2a038ee804e556c5ebe05443cf798e) )
|
||||
@ -179,5 +164,5 @@ ROM_END
|
||||
/* Driver */
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
|
||||
COMP( 1979, mcb216, 0, 0, mcb216, mcb216, mcb216_state, empty_init, "Cromemco", "MCB-216", MACHINE_NO_SOUND_HW )
|
||||
COMP( 1977, cb308, mcb216, 0, cb308, mcb216, mcb216_state, empty_init, "Cromemco", "CB-308", MACHINE_NO_SOUND_HW )
|
||||
COMP( 1979, mcb216, 0, 0, mcb216, mcb216, mcb216_state, empty_init, "Cromemco", "MCB-216", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE )
|
||||
COMP( 1977, cb308, mcb216, 0, cb308, mcb216, cb308_state, empty_init, "Cromemco", "CB-308", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE )
|
||||
|
Loading…
Reference in New Issue
Block a user