Various cleanups:

Isolated the speedup code in the Eolith base state, so eolith16 and
vegaeo aren't inheriting a pile of stuff they don't need.

nichibutsu/jangou.cpp: Split into derived classes so all object finders
are required and device_remove isn't necessary.  Also use the data
pending callback on latches as it's there.

taito/taito_l.cpp: Use normal start/reset handlers rather than an
elaborate maze of indirection.

vsystem/aerofgt.cpp: Split the driver class up a little.  It's still a
mess.

Got rid of a few of the remaining MCFG macros.
This commit is contained in:
Vas Crabb 2023-03-04 12:34:11 +11:00
parent 22ddfb06ac
commit fcb4f01dfb
19 changed files with 1425 additions and 1502 deletions

View File

@ -101,16 +101,148 @@
*********************************************************************/
#include "emu.h"
#include "eolith.h"
#include "eolith_speedup.h"
#include "cpu/e132xs/e132xs.h"
#include "cpu/mcs51/mcs51.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/eepromser.h"
#include "machine/gen_latch.h"
#include "sound/qs1000.h"
#include "speaker.h"
namespace {
class eolith_state : public eolith_state_base
{
public:
eolith_state(const machine_config &mconfig, device_type type, const char *tag)
: eolith_state_base(mconfig, type, tag)
, m_soundcpu(*this, "soundcpu")
, m_qs1000(*this, "qs1000")
, m_eepromoutport(*this, "EEPROMOUT")
, m_in0(*this, "IN0")
, m_led(*this, "led0")
, m_sndbank(*this, "sound_bank")
{
}
void eolith45(machine_config &config) ATTR_COLD;
void eolith50(machine_config &config) ATTR_COLD;
void ironfort(machine_config &config) ATTR_COLD;
void init_eolith() ATTR_COLD;
void init_landbrk() ATTR_COLD;
void init_hidctch2() ATTR_COLD;
void init_hidnc2k() ATTR_COLD;
void init_landbrka() ATTR_COLD;
void init_landbrkb() ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
virtual void video_start() override ATTR_COLD;
void eolith_map(address_map &map) ATTR_COLD;
private:
uint32_t eolith_custom_r();
void systemcontrol_w(uint32_t data);
void eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t eolith_vram_r(offs_t offset);
void sound_p1_w(uint8_t data);
uint8_t qs1000_p1_r();
void qs1000_p1_w(uint8_t data);
void soundcpu_to_qs1000(uint8_t data);
uint32_t screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void sound_io_map(address_map &map) ATTR_COLD;
void sound_prg_map(address_map &map) ATTR_COLD;
void patch_mcu_protection(uint32_t address) ATTR_COLD;
required_device<i8032_device> m_soundcpu;
required_device<qs1000_device> m_qs1000;
required_ioport m_eepromoutport;
required_ioport m_in0;
output_finder<> m_led;
required_memory_bank m_sndbank;
int m_coin_counter_bit = 0;
std::unique_ptr<uint16_t[]> m_vram;
int m_buffer = 0;
};
class hidctch3_state : public eolith_state
{
public:
hidctch3_state(const machine_config &mconfig, device_type type, const char *tag)
: eolith_state(mconfig, type, tag)
, m_penxport(*this, "PEN_X_P%u", 1)
, m_penyport(*this, "PEN_Y_P%u", 1)
{
}
void hidctch3(machine_config &config) ATTR_COLD;
private:
template <int Player> uint32_t hidctch3_pen_r();
void hidctch3_map(address_map &map) ATTR_COLD;
required_ioport_array<2> m_penxport;
required_ioport_array<2> m_penyport;
};
void eolith_state::eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if ((mem_mask == 0xffff) && (~data & 0x8000))
{
// candy needs this to always write to RAM (verified that certain glitches, for example the high score table, don't occur on real hw)
// other games clearly don't.
// is there a cpu bug, or is there more to this logic / a flag which disables it?
COMBINE_DATA(&m_vram[offset+(0x40000/2)*m_buffer]);
}
}
uint16_t eolith_state::eolith_vram_r(offs_t offset)
{
return m_vram[offset+(0x40000/2)*m_buffer];
}
void eolith_state::video_start()
{
eolith_state_base::video_start();
m_vram = std::make_unique<uint16_t[]>(0x40000);
save_pointer(NAME(m_vram), 0x40000);
save_item(NAME(m_buffer));
m_buffer = 0;
}
uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int y = 0; y < 240; y++)
{
for (int x = 0; x < 320; x++)
{
bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff;
}
}
return 0;
}
/*************************************
*
* Control
@ -119,7 +251,19 @@
void eolith_state::machine_start()
{
eolith_state_base::machine_start();
m_led.resolve();
// Configure the sound ROM banking
m_sndbank->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
}
void eolith_state::machine_reset()
{
eolith_state_base::machine_reset();
m_soundcpu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
}
uint32_t eolith_state::eolith_custom_r()
@ -148,8 +292,8 @@ void eolith_state::systemcontrol_w(uint32_t data)
// bit 0x100 and 0x040 ?
}
template<int Player>
uint32_t eolith_state::hidctch3_pen_r()
template <int Player>
uint32_t hidctch3_state::hidctch3_pen_r()
{
//320 x 240
int xpos = m_penxport[Player]->read();
@ -236,13 +380,14 @@ void eolith_state::eolith_map(address_map &map)
map(0xfff80000, 0xffffffff).rom().region("maincpu", 0);
}
void eolith_state::hidctch3_map(address_map &map)
void hidctch3_state::hidctch3_map(address_map &map)
{
eolith_map(map);
map(0xfc200000, 0xfc200003).nopw(); // this generates pens vibration
// It is not clear why the first reads are needed too
map(0xfce00000, 0xfce00003).mirror(0x00080000).r(FUNC(eolith_state::hidctch3_pen_r<0>));
map(0xfcf00000, 0xfcf00003).mirror(0x00080000).r(FUNC(eolith_state::hidctch3_pen_r<1>));
map(0xfce00000, 0xfce00003).mirror(0x00080000).r(FUNC(hidctch3_state::hidctch3_pen_r<0>));
map(0xfcf00000, 0xfcf00003).mirror(0x00080000).r(FUNC(hidctch3_state::hidctch3_pen_r<1>));
}
@ -551,8 +696,6 @@ void eolith_state::eolith45(machine_config &config)
m_soundcpu->port_out_cb<1>().set(FUNC(eolith_state::sound_p1_w));
m_soundcpu->serial_tx_cb().set(FUNC(eolith_state::soundcpu_to_qs1000)); // Sound CPU -> QS1000 CPU serial link
MCFG_MACHINE_RESET_OVERRIDE(eolith_state,eolith)
EEPROM_93C66_8BIT(config, "eeprom")
.erase_time(attotime::from_usec(250))
.write_time(attotime::from_usec(250));
@ -578,12 +721,12 @@ void eolith_state::eolith45(machine_config &config)
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_soundcpu, MCS51_INT0_LINE);
qs1000_device &qs1000(QS1000(config, "qs1000", XTAL(24'000'000)));
qs1000.set_external_rom(true);
qs1000.p1_in().set(FUNC(eolith_state::qs1000_p1_r));
qs1000.p1_out().set(FUNC(eolith_state::qs1000_p1_w));
qs1000.add_route(0, "lspeaker", 1.0);
qs1000.add_route(1, "rspeaker", 1.0);
QS1000(config, m_qs1000, XTAL(24'000'000));
m_qs1000->set_external_rom(true);
m_qs1000->p1_in().set(FUNC(eolith_state::qs1000_p1_r));
m_qs1000->p1_out().set(FUNC(eolith_state::qs1000_p1_w));
m_qs1000->add_route(0, "lspeaker", 1.0);
m_qs1000->add_route(1, "rspeaker", 1.0);
}
void eolith_state::eolith50(machine_config &config)
@ -598,10 +741,10 @@ void eolith_state::ironfort(machine_config &config)
m_maincpu->set_clock(44900000); /* Normally 45MHz??? but PCB actually had a 44.9MHz OSC, so it's value is used */
}
void eolith_state::hidctch3(machine_config &config)
void hidctch3_state::hidctch3(machine_config &config)
{
eolith50(config);
m_maincpu->set_addrmap(AS_PROGRAM, &eolith_state::hidctch3_map);
m_maincpu->set_addrmap(AS_PROGRAM, &hidctch3_state::hidctch3_map);
}
@ -1551,17 +1694,9 @@ ROM_START( hidctch3 )
ROM_END
MACHINE_RESET_MEMBER(eolith_state,eolith)
{
m_soundcpu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
}
void eolith_state::init_eolith()
{
init_speedup();
// Configure the sound ROM banking
m_sndbank->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
}
void eolith_state::init_landbrk()
@ -1617,133 +1752,7 @@ void eolith_state::init_hidnc2k()
init_eolith();
}
/* Eolith Speedup Handling */
/*
This uses triggers and a scanline counter to speed up the eolith games a bit
in some cases this results in a 100% speedup
e.g hidden catch 25% -> 50% speed ingame
this could probably be done a bit better using timers
*/
void eolith_state::speedup_read()
{
/* for debug */
//if ((m_maincpu->pc()!=m_speedup_address) && (m_speedup_vblank!=1) )
// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank);
if (m_speedup_vblank==0 && m_speedup_scanline < m_speedup_resume_scanline)
{
int pc = m_maincpu->pc();
if ((pc==m_speedup_address) || (pc==m_speedup_address2))
{
m_maincpu->spin_until_trigger(1000);
}
}
}
static const struct
{
const char *s_name;
int speedup_address;
int speedup_address2;
int speedup_resume_scanline;
} eolith_speedup_table[] =
{
/* eolith.cpp */
{ "linkypip", 0x4000825c, -1,/*0x4000ABAE,*/ 240 }, // 2nd address is used on the planet cutscene between but idle skipping between levels, but seems too aggressive
{ "ironfort", 0x40020854, -1, 240 },
{ "ironfortc",0x40020234, -1, 240 },
{ "hidnctch", 0x4000bba0, -1, 240 },
{ "hidnctcha",0x4000bba0, -1, 240 },
{ "raccoon", 0x40008204, -1, 240 },
{ "puzzlekg", 0x40029458, -1, 240 },
{ "hidctch2", 0x40009524, -1, 240 },
{ "hidctch2a",0x40029B58, -1, 240 },
{ "landbrk", 0x40023574, -1, 240 },
{ "landbrka", 0x4002446c, -1, 240 },
{ "landbrkb", 0x40023B28, -1, 240 },
{ "nhidctch", 0x40012778, -1, 240 },
{ "hidctch3", 0x4001f6a0, -1, 240 },
{ "fort2b", 0x000081e0, -1, 240 },
{ "fort2ba", 0x000081e0, -1, 240 },
{ "penfan", 0x4001FA66, -1, 240 },
{ "penfana", 0x4001FAb6, -1, 240 },
{ "candy", 0x4001990C, -1, 240 },
{ "hidnc2k", 0x40016824, -1, 240 },
/* eolith16.cpp */
{ "klondkp", 0x0001a046, -1, 240 },
/* vegaeo.cpp */
{ "crazywar", 0x00008cf8, -1, 240 },
{ nullptr, 0, 0 }
};
void eolith_state::init_speedup()
{
int n_game = 0;
m_speedup_address = 0;
m_speedup_address2 = 0;
m_speedup_resume_scanline = 0;
m_speedup_vblank = 0;
m_speedup_scanline = 0;
while( eolith_speedup_table[ n_game ].s_name != nullptr )
{
if( strcmp( machine().system().name, eolith_speedup_table[ n_game ].s_name ) == 0 )
{
m_speedup_address = eolith_speedup_table[ n_game ].speedup_address;
m_speedup_address2 = eolith_speedup_table[ n_game ].speedup_address2;
m_speedup_resume_scanline = eolith_speedup_table[ n_game ].speedup_resume_scanline;
}
n_game++;
}
save_item(NAME(m_speedup_vblank));
save_item(NAME(m_speedup_scanline));
}
/* todo, use timers instead! */
TIMER_DEVICE_CALLBACK_MEMBER(eolith_state::eolith_speedup)
{
if (param==0)
{
m_speedup_vblank = 0;
}
if (param==m_speedup_resume_scanline)
{
machine().scheduler().trigger(1000);
}
if (param==240)
{
m_speedup_vblank = 1;
}
}
READ_LINE_MEMBER(eolith_state::speedup_vblank_r)
{
// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank);
return (m_screen->vpos() >= 240);
}
// StealSee doesn't use interrupts, just the vblank
READ_LINE_MEMBER(eolith_state::stealsee_speedup_vblank_r)
{
int pc = m_maincpu->pc();
if (pc==0x400081ec)
if(!m_speedup_vblank)
m_maincpu->eat_cycles(500);
return (m_screen->vpos() >= 240);
}
} // anonymous namespace
/*************************************
@ -1752,24 +1761,24 @@ READ_LINE_MEMBER(eolith_state::stealsee_speedup_vblank_r)
*
*************************************/
GAME( 1998, linkypip, 0, eolith45, linkypip, eolith_state, init_eolith, ROT0, "Eolith", "Linky Pipe", MACHINE_SUPPORTS_SAVE )
GAME( 1998, ironfort, 0, ironfort, ironfort, eolith_state, init_eolith, ROT0, "Eolith", "Iron Fortress", MACHINE_SUPPORTS_SAVE )
GAME( 1998, ironfortc, ironfort, ironfort, ironfortc, eolith_state, init_eolith, ROT0, "Eolith (Excellent Competence Ltd. license)", "Gongtit Jiucoi Iron Fortress (Hong Kong)", MACHINE_SUPPORTS_SAVE ) // Licensed/Distributed to Hong Kong company Excellent Competence Ltd.
GAME( 1998, hidnctch, 0, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.03)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98
GAME( 1998, hidnctcha, hidnctch, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98
GAME( 1998, raccoon, 0, eolith45, raccoon, eolith_state, init_eolith, ROT0, "Eolith", "Raccoon World", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1998, puzzlekg, 0, eolith45, puzzlekg, eolith_state, init_eolith, ROT0, "Eolith", "Puzzle King (Dance & Puzzle)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, candy, 0, eolith50, candy, eolith_state, init_eolith, ROT0, "Eolith", "Candy Candy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidctch2, 0, eolith50, hidctch2, eolith_state, init_hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03) (Kor/Eng) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidctch2a, hidctch2, eolith50, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 1.00) (Kor/Eng/Jpn/Chi)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidnc2k, 0, eolith50, hidctch2, eolith_state, init_hidnc2k, ROT0, "Eolith", "Hidden Catch 2000 (AT89c52 protected)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, landbrk, 0, eolith45, landbrk, eolith_state, init_landbrk, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, landbrka, landbrk, eolith45, landbrk, eolith_state, init_landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, landbrkb, landbrk, eolith45, landbrk, eolith_state, init_landbrkb, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 1.0) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, nhidctch, 0, eolith45, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "New Hidden Catch (World) / New Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or New Teurrin Geurim Chajgi '98
GAME( 1999, penfan, 0, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 1)", MACHINE_SUPPORTS_SAVE ) // alt title of Ribbon
GAME( 1999, penfana, penfan, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 2000, stealsee, 0, eolith45, stealsee, eolith_state, init_eolith, ROT0, "Moov Generation / Eolith", "Steal See", MACHINE_SUPPORTS_SAVE )
GAME( 2000, hidctch3, 0, hidctch3, hidctch3, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 3 (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE )
GAME( 2001, fort2b, 0, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (World) (ver 1.01 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // Language selection is greyed out in Service Mode
GAME( 2001, fort2ba, fort2b, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (Korea) (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // ^^
GAME( 1998, linkypip, 0, eolith45, linkypip, eolith_state, init_eolith, ROT0, "Eolith", "Linky Pipe", MACHINE_SUPPORTS_SAVE )
GAME( 1998, ironfort, 0, ironfort, ironfort, eolith_state, init_eolith, ROT0, "Eolith", "Iron Fortress", MACHINE_SUPPORTS_SAVE )
GAME( 1998, ironfortc, ironfort, ironfort, ironfortc, eolith_state, init_eolith, ROT0, "Eolith (Excellent Competence Ltd. license)", "Gongtit Jiucoi Iron Fortress (Hong Kong)", MACHINE_SUPPORTS_SAVE ) // Licensed/Distributed to Hong Kong company Excellent Competence Ltd.
GAME( 1998, hidnctch, 0, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.03)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98
GAME( 1998, hidnctcha, hidnctch, eolith45, hidnctch, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch (World) / Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Teurrin Geurim Chajgi '98
GAME( 1998, raccoon, 0, eolith45, raccoon, eolith_state, init_eolith, ROT0, "Eolith", "Raccoon World", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING )
GAME( 1998, puzzlekg, 0, eolith45, puzzlekg, eolith_state, init_eolith, ROT0, "Eolith", "Puzzle King (Dance & Puzzle)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, candy, 0, eolith50, candy, eolith_state, init_eolith, ROT0, "Eolith", "Candy Candy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidctch2, 0, eolith50, hidctch2, eolith_state, init_hidctch2, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 3.03) (Kor/Eng) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidctch2a, hidctch2, eolith50, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "Hidden Catch 2 (pcb ver 1.00) (Kor/Eng/Jpn/Chi)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, hidnc2k, 0, eolith50, hidctch2, eolith_state, init_hidnc2k, ROT0, "Eolith", "Hidden Catch 2000 (AT89c52 protected)", MACHINE_SUPPORTS_SAVE )
GAME( 1999, landbrk, 0, eolith45, landbrk, eolith_state, init_landbrk, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, landbrka, landbrk, eolith45, landbrk, eolith_state, init_landbrka, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 3.03) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, landbrkb, landbrk, eolith45, landbrk, eolith_state, init_landbrkb, ROT0, "Eolith", "Land Breaker (World) / Miss Tang Ja Ru Gi (Korea) (pcb ver 1.0) (AT89c52 protected)", MACHINE_SUPPORTS_SAVE ) // or Miss Ttang Jjareugi
GAME( 1999, nhidctch, 0, eolith45, hidctch2, eolith_state, init_eolith, ROT0, "Eolith", "New Hidden Catch (World) / New Tul Lin Gu Lim Chat Ki '98 (Korea) (pcb ver 3.02)", MACHINE_SUPPORTS_SAVE ) // or New Teurrin Geurim Chajgi '98
GAME( 1999, penfan, 0, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 1)", MACHINE_SUPPORTS_SAVE ) // alt title of Ribbon
GAME( 1999, penfana, penfan, eolith45, penfan, eolith_state, init_eolith, ROT0, "Eolith", "Penfan Girls - Step1. Mild Mind (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 2000, stealsee, 0, eolith45, stealsee, eolith_state, init_eolith, ROT0, "Moov Generation / Eolith", "Steal See", MACHINE_SUPPORTS_SAVE )
GAME( 2000, hidctch3, 0, hidctch3, hidctch3, hidctch3_state, init_eolith, ROT0, "Eolith", "Hidden Catch 3 (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE )
GAME( 2001, fort2b, 0, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (World) (ver 1.01 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // Language selection is greyed out in Service Mode
GAME( 2001, fort2ba, fort2b, eolith50, common, eolith_state, init_eolith, ROT0, "Eolith", "Fortress 2 Blue Arcade (Korea) (ver 1.00 / pcb ver 3.05)", MACHINE_SUPPORTS_SAVE ) // ^^

View File

@ -1,102 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli
#include "cpu/mcs51/mcs51.h"
#include "machine/timer.h"
#include "sound/qs1000.h"
#include "emupal.h"
#include "screen.h"
class eolith_state : public driver_device
{
public:
eolith_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_screen(*this, "screen")
, m_palette(*this, "palette")
, m_qs1000(*this, "qs1000")
, m_eepromoutport(*this, "EEPROMOUT")
, m_soundcpu(*this, "soundcpu")
, m_in0(*this, "IN0")
, m_penxport(*this, "PEN_X_P%u", 1)
, m_penyport(*this, "PEN_Y_P%u", 1)
, m_led(*this, "led0")
, m_sndbank(*this, "sound_bank")
{
}
void ironfort(machine_config &config);
void eolith50(machine_config &config);
void eolith45(machine_config &config);
void hidctch3(machine_config &config);
void init_eolith();
void init_landbrk();
void init_hidctch2();
void init_hidnc2k();
void init_landbrka();
void init_landbrkb();
DECLARE_READ_LINE_MEMBER(speedup_vblank_r);
DECLARE_READ_LINE_MEMBER(stealsee_speedup_vblank_r);
void speedup_read();
void init_speedup();
protected:
virtual void video_start() override;
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
optional_device<qs1000_device> m_qs1000;
optional_ioport m_eepromoutport;
TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup);
private:
uint32_t eolith_custom_r();
void systemcontrol_w(uint32_t data);
template<int Player> uint32_t hidctch3_pen_r();
void eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t eolith_vram_r(offs_t offset);
void sound_p1_w(uint8_t data);
uint8_t qs1000_p1_r();
void qs1000_p1_w(uint8_t data);
void soundcpu_to_qs1000(uint8_t data);
DECLARE_MACHINE_RESET(eolith);
uint32_t screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void eolith_map(address_map &map);
void hidctch3_map(address_map &map);
void sound_io_map(address_map &map);
void sound_prg_map(address_map &map);
virtual void machine_start() override;
// shared with eolith16.cpp, vegaeo.cpp
void patch_mcu_protection(uint32_t address);
optional_device<i8032_device> m_soundcpu;
optional_ioport m_in0; // klondkp doesn't have it
optional_ioport_array<2> m_penxport;
optional_ioport_array<2> m_penyport;
output_finder<> m_led;
optional_memory_bank m_sndbank;
int m_coin_counter_bit = 0;
std::unique_ptr<uint16_t[]> m_vram;
int m_buffer = 0;
// speedups - see machine/eolithsp.c
int m_speedup_address = 0;
int m_speedup_address2 = 0;
int m_speedup_resume_scanline = 0;
int m_speedup_vblank = 0;
int m_speedup_scanline = 0;
};

View File

@ -12,7 +12,7 @@
**********************************************************************/
#include "emu.h"
#include "eolith.h"
#include "eolith_speedup.h"
#include "cpu/e132xs/e132xs.h"
#include "machine/eepromser.h"
@ -24,36 +24,38 @@
namespace {
class eolith16_state : public eolith_state
class eolith16_state : public eolith_state_base
{
public:
eolith16_state(const machine_config &mconfig, device_type type, const char *tag)
: eolith_state(mconfig, type, tag)
: eolith_state_base(mconfig, type, tag)
, m_special_io(*this, "SPECIAL")
, m_eepromoutport(*this, "EEPROMOUT")
, m_vram(*this, "vram", 0x20000, ENDIANNESS_BIG)
, m_vrambank(*this, "vrambank")
{
}
void eolith16(machine_config &config);
void eolith16(machine_config &config) ATTR_COLD;
void init_eolith16();
void init_eolith16() ATTR_COLD;
protected:
virtual void video_start() override;
virtual void video_start() override ATTR_COLD;
private:
required_ioport m_special_io;
required_ioport m_eepromoutport;
memory_share_creator<uint8_t> m_vram;
required_memory_bank m_vrambank;
void eeprom_w(uint16_t data);
uint16_t eolith16_custom_r();
void eolith16_palette(palette_device &palette) const;
void eolith16_palette(palette_device &palette) const ATTR_COLD;
uint32_t screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void eolith16_map(address_map &map);
void eolith16_map(address_map &map) ATTR_COLD;
};
@ -121,6 +123,8 @@ INPUT_PORTS_END
void eolith16_state::video_start()
{
eolith_state_base::video_start();
m_vrambank->configure_entries(0, 2, memshare("vram")->ptr(), 0x10000);
m_vrambank->set_entry(0);
}

View File

@ -0,0 +1,126 @@
// license:BSD-3-Clause
// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli
#include "emu.h"
#include "eolith_speedup.h"
/* Eolith Speedup Handling */
/*
This uses triggers and a scanline counter to speed up the eolith games a bit
in some cases this results in a 100% speedup
e.g hidden catch 25% -> 50% speed ingame
this could probably be done a bit better using timers
*/
void eolith_state_base::speedup_read()
{
/* for debug */
//if ((m_maincpu->pc()!=m_speedup_address) && (m_speedup_vblank!=1) )
// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank);
if (m_speedup_vblank==0 && m_speedup_scanline < m_speedup_resume_scanline)
{
int pc = m_maincpu->pc();
if ((pc==m_speedup_address) || (pc==m_speedup_address2))
{
m_maincpu->spin_until_trigger(1000);
}
}
}
static const struct
{
const char *s_name;
int speedup_address;
int speedup_address2;
int speedup_resume_scanline;
} eolith_speedup_table[] =
{
/* eolith.cpp */
{ "linkypip", 0x4000825c, -1,/*0x4000ABAE,*/ 240 }, // 2nd address is used on the planet cutscene between but idle skipping between levels, but seems too aggressive
{ "ironfort", 0x40020854, -1, 240 },
{ "ironfortc",0x40020234, -1, 240 },
{ "hidnctch", 0x4000bba0, -1, 240 },
{ "hidnctcha",0x4000bba0, -1, 240 },
{ "raccoon", 0x40008204, -1, 240 },
{ "puzzlekg", 0x40029458, -1, 240 },
{ "hidctch2", 0x40009524, -1, 240 },
{ "hidctch2a",0x40029B58, -1, 240 },
{ "landbrk", 0x40023574, -1, 240 },
{ "landbrka", 0x4002446c, -1, 240 },
{ "landbrkb", 0x40023B28, -1, 240 },
{ "nhidctch", 0x40012778, -1, 240 },
{ "hidctch3", 0x4001f6a0, -1, 240 },
{ "fort2b", 0x000081e0, -1, 240 },
{ "fort2ba", 0x000081e0, -1, 240 },
{ "penfan", 0x4001FA66, -1, 240 },
{ "penfana", 0x4001FAb6, -1, 240 },
{ "candy", 0x4001990C, -1, 240 },
{ "hidnc2k", 0x40016824, -1, 240 },
/* eolith16.cpp */
{ "klondkp", 0x0001a046, -1, 240 },
/* vegaeo.cpp */
{ "crazywar", 0x00008cf8, -1, 240 },
{ nullptr, 0, 0 }
};
void eolith_state_base::init_speedup()
{
m_speedup_address = 0;
m_speedup_address2 = 0;
m_speedup_resume_scanline = 0;
m_speedup_vblank = 0;
m_speedup_scanline = 0;
for (const auto &speedups : eolith_speedup_table)
{
if (strcmp(machine().system().name, speedups.s_name) == 0)
{
m_speedup_address = speedups.speedup_address;
m_speedup_address2 = speedups.speedup_address2;
m_speedup_resume_scanline = speedups.speedup_resume_scanline;
break;
}
}
save_item(NAME(m_speedup_vblank));
save_item(NAME(m_speedup_scanline));
}
/* todo, use timers instead! */
TIMER_DEVICE_CALLBACK_MEMBER(eolith_state_base::eolith_speedup)
{
if (param == 0)
m_speedup_vblank = 0;
if (param == m_speedup_resume_scanline)
machine().scheduler().trigger(1000);
if (param == 240)
m_speedup_vblank = 1;
}
READ_LINE_MEMBER(eolith_state_base::speedup_vblank_r)
{
// printf("%s:eolith speedup_read data %02x\n",machine().describe_context().c_str(), m_speedup_vblank);
return (m_screen->vpos() >= 240);
}
// StealSee doesn't use interrupts, just the vblank
READ_LINE_MEMBER(eolith_state_base::stealsee_speedup_vblank_r)
{
int pc = m_maincpu->pc();
if (pc == 0x400081ec)
if (!m_speedup_vblank)
m_maincpu->eat_cycles(500);
return (m_screen->vpos() >= 240);
}

View File

@ -0,0 +1,46 @@
// license:BSD-3-Clause
// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli
#ifndef MAME_EOLITH_EOLITH_SPEEDUP_H
#define MAME_EOLITH_EOLITH_SPEEDUP_H
#pragma once
#include "machine/timer.h"
#include "emupal.h"
#include "screen.h"
class eolith_state_base : public driver_device
{
public:
eolith_state_base(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_screen(*this, "screen")
, m_palette(*this, "palette")
{
}
DECLARE_READ_LINE_MEMBER(speedup_vblank_r);
DECLARE_READ_LINE_MEMBER(stealsee_speedup_vblank_r);
protected:
void speedup_read();
void init_speedup() ATTR_COLD;
TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup);
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
private:
// speedups - see eolith/eolith_speedup.cpp
int m_speedup_address = 0;
int m_speedup_address2 = 0;
int m_speedup_resume_scanline = 0;
int m_speedup_vblank = 0;
int m_speedup_scanline = 0;
};
#endif // MAME_EOLITH_EOLITH_SPEEDUP_H

View File

@ -1,44 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Tomasz Slanina,Pierpaolo Prazzoli
#include "emu.h"
#include "eolith.h"
void eolith_state::eolith_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if ((mem_mask == 0xffff) && (~data & 0x8000))
{
// candy needs this to always write to RAM (verified that certain glitches, for example the high score table, don't occur on real hw)
// other games clearly don't.
// is there a cpu bug, or is there more to this logic / a flag which disables it?
COMBINE_DATA(&m_vram[offset+(0x40000/2)*m_buffer]);
}
}
uint16_t eolith_state::eolith_vram_r(offs_t offset)
{
return m_vram[offset+(0x40000/2)*m_buffer];
}
void eolith_state::video_start()
{
m_vram = std::make_unique<uint16_t[]>(0x40000);
save_pointer(NAME(m_vram), 0x40000);
save_item(NAME(m_buffer));
m_buffer = 0;
}
uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int y = 0; y < 240; y++)
{
for (int x = 0; x < 320; x++)
{
bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff;
}
}
return 0;
}

View File

@ -57,6 +57,7 @@ ToDo: verify QS1000 hook-up
*/
#include "emu.h"
#include "cpu/arm7/arm7.h"
#include "cpu/arm7/arm7core.h"
#include "machine/gen_latch.h"
@ -64,6 +65,7 @@ ToDo: verify QS1000 hook-up
//#include "machine/smartmed.h"
#include "machine/i2cmem.h"
#include "sound/qs1000.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
@ -104,16 +106,16 @@ public:
{
}
void ghosteo(machine_config &config);
void touryuu(machine_config &config);
void bballoon(machine_config &config);
void ghosteo(machine_config &config) ATTR_COLD;
void touryuu(machine_config &config) ATTR_COLD;
void bballoon(machine_config &config) ATTR_COLD;
void init_touryuu();
void init_bballoon();
void init_touryuu() ATTR_COLD;
void init_bballoon() ATTR_COLD;
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
private:
required_device<cpu_device> m_maincpu;
@ -146,8 +148,8 @@ private:
DECLARE_WRITE_LINE_MEMBER(s3c2410_i2c_scl_w );
DECLARE_READ_LINE_MEMBER(s3c2410_i2c_sda_r );
DECLARE_WRITE_LINE_MEMBER(s3c2410_i2c_sda_w );
void bballoon_map(address_map &map);
void touryuu_map(address_map &map);
void bballoon_map(address_map &map) ATTR_COLD;
void touryuu_map(address_map &map) ATTR_COLD;
};

View File

@ -14,37 +14,40 @@
*********************************************************************/
#include "emu.h"
#include "eolith.h"
#include "eolith_speedup.h"
#include "cpu/e132xs/e132xs.h"
#include "machine/at28c16.h"
#include "machine/gen_latch.h"
#include "sound/qs1000.h"
#include "speaker.h"
namespace {
class vegaeo_state : public eolith_state
class vegaeo_state : public eolith_state_base
{
public:
vegaeo_state(const machine_config &mconfig, device_type type, const char *tag)
: eolith_state(mconfig, type, tag)
: eolith_state_base(mconfig, type, tag)
, m_soundlatch(*this, "soundlatch")
, m_qs1000(*this, "qs1000")
, m_system_io(*this, "SYSTEM")
, m_qs1000_bank(*this, "qs1000_bank")
{
}
void vega(machine_config &config);
void vega(machine_config &config) ATTR_COLD;
void init_vegaeo();
void init_vegaeo() ATTR_COLD;
protected:
virtual void video_start() override;
virtual void video_start() override ATTR_COLD;
private:
required_device<generic_latch_8_device> m_soundlatch;
required_device<qs1000_device> m_qs1000;
required_ioport m_system_io;
memory_bank_creator m_qs1000_bank;
@ -60,7 +63,7 @@ private:
void qs1000_p3_w(uint8_t data);
uint32_t screen_update_vega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void vega_map(address_map &map);
void vega_map(address_map &map) ATTR_COLD;
};
void vegaeo_state::qs1000_p1_w(uint8_t data)
@ -160,6 +163,8 @@ INPUT_PORTS_END
void vegaeo_state::video_start()
{
eolith_state_base::video_start();
m_vram = std::make_unique<uint8_t[]>(0x14000*2);
save_pointer(NAME(m_vram), 0x14000*2);
save_item(NAME(m_vbuffer));

View File

@ -464,7 +464,7 @@ static INPUT_PORTS_START( bucky )
INPUT_PORTS_END
MACHINE_START_MEMBER(moo_state,moo)
void moo_state::machine_start()
{
save_item(NAME(m_cur_control2));
save_item(NAME(m_alpha_enabled));
@ -476,7 +476,7 @@ MACHINE_START_MEMBER(moo_state,moo)
m_dmaend_timer = timer_alloc(FUNC(moo_state::dmaend_callback), this);
}
MACHINE_RESET_MEMBER(moo_state,moo)
void moo_state::machine_reset()
{
int i;
@ -504,9 +504,6 @@ void moo_state::moo(machine_config &config)
Z80(config, m_soundcpu, XTAL(32'000'000)/4); // 8MHz verified
m_soundcpu->set_addrmap(AS_PROGRAM, &moo_state::sound_map);
MCFG_MACHINE_START_OVERRIDE(moo_state,moo)
MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo)
EEPROM_ER5911_8BIT(config, "eeprom");
K053252(config, m_k053252, XTAL(32'000'000)/4); // 8MHz
@ -561,9 +558,6 @@ void moo_state::moobl(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &moo_state::moobl_map);
m_maincpu->set_vblank_int("screen", FUNC(moo_state::moobl_interrupt));
MCFG_MACHINE_START_OVERRIDE(moo_state,moo)
MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo)
EEPROM_ER5911_8BIT(config, "eeprom");
/* video hardware */

View File

@ -44,9 +44,13 @@ public:
m_k054321(*this, "k054321")
{ }
void bucky(machine_config &config);
void moo(machine_config &config);
void moobl(machine_config &config);
void bucky(machine_config &config) ATTR_COLD;
void moo(machine_config &config) ATTR_COLD;
void moobl(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
private:
/* memory pointers */
@ -85,8 +89,6 @@ private:
void sound_bankswitch_w(uint8_t data);
void moo_prot_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void moobl_oki_bank_w(uint16_t data);
DECLARE_MACHINE_START(moo);
DECLARE_MACHINE_RESET(moo);
DECLARE_VIDEO_START(moo);
DECLARE_VIDEO_START(bucky);
uint32_t screen_update_moo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);

View File

@ -47,99 +47,147 @@ namespace {
#define MASTER_CLOCK XTAL(19'968'000)
class jangou_state : public driver_device
class cntrygrl_state : public driver_device
{
public:
jangou_state(const machine_config &mconfig, device_type type, const char *tag)
cntrygrl_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_cpu_0(*this, "cpu0")
, m_cpu_1(*this, "cpu1")
, m_nsc(*this, "nsc")
, m_msm(*this, "msm")
, m_cvsd(*this, "cvsd")
, m_palette(*this, "palette")
, m_blitter(*this, "blitter")
, m_palette(*this, "palette")
, m_keymatrix(*this, { "PL1_1", "PL1_2", "PL2_1", "PL2_2", "PL1_3", "PL2_3" })
{
}
void cntrygrl(machine_config &config) ATTR_COLD;
void roylcrdn(machine_config &config) ATTR_COLD;
void luckygrl(machine_config &config) ATTR_COLD;
protected:
required_device<cpu_device> m_cpu_0;
required_device<jangou_blitter_device> m_blitter;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
void mux_w(uint8_t data);
void output_w(uint8_t data);
private:
required_device<palette_device> m_palette;
required_ioport_array<6> m_keymatrix;
std::unique_ptr<bitmap_ind16> m_tmp_bitmap;
/* misc */
uint8_t m_mux_data = 0;
uint8_t input_mux_r();
void init_palette(palette_device &palette) const ATTR_COLD;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void cntrygrl_cpu0_map(address_map &map) ATTR_COLD;
void cntrygrl_cpu0_io(address_map &map) ATTR_COLD;
void roylcrdn_cpu0_map(address_map &map) ATTR_COLD;
void roylcrdn_cpu0_io(address_map &map) ATTR_COLD;
void luckygrl_cpu0_map(address_map &map) ATTR_COLD;
void decrypted_opcodes_map(address_map &map) ATTR_COLD;
};
class jangou_state_base : public cntrygrl_state
{
protected:
jangou_state_base(const machine_config &mconfig, device_type type, const char *tag)
: cntrygrl_state(mconfig, type, tag)
, m_cpu_1(*this, "cpu1")
, m_soundlatch(*this, "soundlatch")
{
}
void jngolady(machine_config &config);
void roylcrdn(machine_config &config);
void cntrygrl(machine_config &config);
void jangou(machine_config &config);
void luckygrl(machine_config &config);
void init_jngolady();
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
required_device<cpu_device> m_cpu_1;
required_device<generic_latch_8_device> m_soundlatch;
void jangou_base(machine_config &config) ATTR_COLD;
private:
void jangou_cpu0_io(address_map &map) ATTR_COLD;
};
class jangou_state : public jangou_state_base
{
public:
jangou_state(const machine_config &mconfig, device_type type, const char *tag)
: jangou_state_base(mconfig, type, tag)
, m_cvsd(*this, "cvsd")
{
}
void jangou(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
private:
required_device<hc55516_device> m_cvsd;
/* sound-related */
// Jangou CVSD Sound
emu_timer *m_cvsd_bit_timer = nullptr;
uint8_t m_cvsd_shiftreg = 0;
int m_cvsd_shift_cnt = 0;
// Jangou Lady ADPCM Sound
uint8_t m_adpcm_byte = 0;
int m_msm5205_vclk_toggle = 0;
emu_timer *m_cvsd_bit_timer = nullptr;
uint8_t m_cvsd_shiftreg = 0;
int m_cvsd_shift_cnt = 0;
void cvsd_w(uint8_t data);
TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback);
void jangou_cpu0_map(address_map &map) ATTR_COLD;
void jangou_cpu1_map(address_map &map) ATTR_COLD;
void jangou_cpu1_io(address_map &map) ATTR_COLD;
};
class jngolady_state : public jangou_state_base
{
public:
jngolady_state(const machine_config &mconfig, device_type type, const char *tag)
: jangou_state_base(mconfig, type, tag)
, m_nsc(*this, "nsc")
, m_nsclatch(*this, "nsclatch")
, m_msm(*this, "msm")
{
}
void jngolady(machine_config &config) ATTR_COLD;
void init_jngolady() ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
private:
required_device<cpu_device> m_nsc;
required_device<generic_latch_8_device> m_nsclatch;
required_device<msm5205_device> m_msm;
/* sound-related */
uint8_t m_adpcm_byte = 0;
int m_msm5205_vclk_toggle = 0;
/* misc */
uint8_t m_mux_data = 0;
uint8_t m_nsc_latch = 0;
uint8_t m_z80_latch = 0;
uint8_t m_z80_latch = 0;
std::unique_ptr<bitmap_ind16> m_tmp_bitmap;
/* devices */
required_device<cpu_device> m_cpu_0;
optional_device<cpu_device> m_cpu_1;
optional_device<cpu_device> m_nsc;
optional_device<msm5205_device> m_msm;
optional_device<hc55516_device> m_cvsd;
required_device<palette_device> m_palette;
required_device<jangou_blitter_device> m_blitter;
optional_device<generic_latch_8_device> m_soundlatch;
/* video-related */
void mux_w(uint8_t data);
void output_w(uint8_t data);
void sound_latch_w(uint8_t data);
uint8_t sound_latch_r();
void cvsd_w(uint8_t data);
void adpcm_w(uint8_t data);
uint8_t master_com_r();
void master_com_w(uint8_t data);
uint8_t slave_com_r();
void slave_com_w(uint8_t data);
uint8_t jngolady_rng_r();
uint8_t input_mux_r();
uint8_t rng_r();
void jangou_palette(palette_device &palette) const;
DECLARE_MACHINE_START(jngolady);
DECLARE_MACHINE_RESET(jngolady);
DECLARE_MACHINE_START(common);
DECLARE_MACHINE_RESET(common);
uint32_t screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback);
DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb);
DECLARE_WRITE_LINE_MEMBER(vclk_cb);
void cntrygrl_cpu0_io(address_map &map);
void cntrygrl_cpu0_map(address_map &map);
void cpu0_io(address_map &map);
void cpu0_map(address_map &map);
void cpu1_io(address_map &map);
void cpu1_map(address_map &map);
void jngolady_cpu0_map(address_map &map);
void jngolady_cpu1_io(address_map &map);
void jngolady_cpu1_map(address_map &map);
void nsc_map(address_map &map);
void roylcrdn_cpu0_io(address_map &map);
void roylcrdn_cpu0_map(address_map &map);
void luckygrl_cpu0_map(address_map &map);
void decrypted_opcodes_map(address_map &map);
};
@ -150,7 +198,7 @@ private:
*************************************/
// guess: use the same resistor values as Crazy Climber (needs checking on the real hardware)
void jangou_state::jangou_palette(palette_device &palette) const
void cntrygrl_state::init_palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
static constexpr int resistances_rg[3] = { 1000, 470, 220 };
@ -188,12 +236,7 @@ void jangou_state::jangou_palette(palette_device &palette) const
}
}
void jangou_state::video_start()
{
m_tmp_bitmap = std::make_unique<bitmap_ind16>(256, 256);
}
uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t cntrygrl_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int y = cliprect.min_y; y <= cliprect.max_y; ++y)
{
@ -220,12 +263,12 @@ uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16
*
*************************************/
void jangou_state::mux_w(uint8_t data)
void cntrygrl_state::mux_w(uint8_t data)
{
m_mux_data = ~data;
m_mux_data = data;
}
void jangou_state::output_w(uint8_t data)
void cntrygrl_state::output_w(uint8_t data)
{
/*
--x- ---- ? (polls between high and low in irq routine, most likely irq mask)
@ -238,19 +281,15 @@ void jangou_state::output_w(uint8_t data)
// machine().bookkeeping().coin_lockout_w(0, ~data & 0x20);
}
uint8_t jangou_state::input_mux_r()
uint8_t cntrygrl_state::input_mux_r()
{
switch(m_mux_data)
uint8_t result = 0xff;
for (unsigned i = 0; m_keymatrix.size() > i; ++i)
{
case 0x01: return ioport("PL1_1")->read();
case 0x02: return ioport("PL1_2")->read();
case 0x04: return ioport("PL2_1")->read();
case 0x08: return ioport("PL2_2")->read();
case 0x10: return ioport("PL1_3")->read();
case 0x20: return ioport("PL2_3")->read();
if (!BIT(m_mux_data, i))
result &= m_keymatrix[i]->read();
}
return ioport("IN_NOMUX")->read();
return result;
}
@ -260,18 +299,6 @@ uint8_t jangou_state::input_mux_r()
*
*************************************/
void jangou_state::sound_latch_w(uint8_t data)
{
m_soundlatch->write(data & 0xff);
m_cpu_1->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
uint8_t jangou_state::sound_latch_r()
{
m_cpu_1->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
return m_soundlatch->read();
}
/* Jangou HC-55516 CVSD */
void jangou_state::cvsd_w(uint8_t data)
{
@ -281,7 +308,7 @@ void jangou_state::cvsd_w(uint8_t data)
TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback)
{
/* Data is shifted out at the MSB */
m_cvsd->digit_w((m_cvsd_shiftreg >> 7) & 1);
m_cvsd->digit_w(BIT(m_cvsd_shiftreg, 7));
m_cvsd_shiftreg <<= 1;
/* Trigger an IRQ for every 8 shifted bits */
@ -291,15 +318,17 @@ TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback)
/* Jangou Lady MSM5218 (MSM5205-compatible) ADPCM */
void jangou_state::adpcm_w(uint8_t data)
void jngolady_state::adpcm_w(uint8_t data)
{
m_adpcm_byte = data;
}
WRITE_LINE_MEMBER(jangou_state::jngolady_vclk_cb)
WRITE_LINE_MEMBER(jngolady_state::vclk_cb)
{
if (m_msm5205_vclk_toggle == 0)
if (!m_msm5205_vclk_toggle)
{
m_msm->data_w(m_adpcm_byte >> 4);
}
else
{
m_msm->data_w(m_adpcm_byte & 0xf);
@ -316,63 +345,120 @@ WRITE_LINE_MEMBER(jangou_state::jngolady_vclk_cb)
*
*************************************/
uint8_t jangou_state::master_com_r()
uint8_t jngolady_state::master_com_r()
{
return m_z80_latch;
}
void jangou_state::master_com_w(uint8_t data)
{
m_nsc->set_input_line(0, ASSERT_LINE);
m_nsc_latch = data;
}
uint8_t jangou_state::slave_com_r()
{
m_nsc->set_input_line(0, CLEAR_LINE);
return m_nsc_latch;
}
void jangou_state::slave_com_w(uint8_t data)
void jngolady_state::slave_com_w(uint8_t data)
{
m_z80_latch = data;
}
/*************************************
*
* Country Girl Memory Map
*
*************************************/
void cntrygrl_state::cntrygrl_cpu0_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
// map(0xc000, 0xc7ff).ram();
map(0xe000, 0xefff).ram();
}
void cntrygrl_state::cntrygrl_cpu0_io(address_map &map)
{
map.global_mask(0xff);
map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
map(0x10, 0x10).portr("DSW"); //dsw + blitter busy flag
map(0x10, 0x10).w(FUNC(cntrygrl_state::output_w));
map(0x11, 0x11).w(FUNC(cntrygrl_state::mux_w));
map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs));
map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w));
map(0x30, 0x30).nopw(); //? polls 0x03 continuously
}
/*************************************
*
* Royal Card Memory Map
*
*************************************/
void cntrygrl_state::roylcrdn_cpu0_map(address_map &map)
{
map(0x0000, 0x2fff).rom();
map(0x7000, 0x77ff).ram().share("nvram"); /* MK48Z02B-15 ZEROPOWER RAM */
}
void cntrygrl_state::roylcrdn_cpu0_io(address_map &map)
{
map.global_mask(0xff);
map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
map(0x10, 0x10).portr("DSW"); /* DSW + blitter busy flag */
map(0x10, 0x10).nopw(); /* Writes continuosly 0's in attract mode, and 1's in game */
map(0x11, 0x11).w(FUNC(cntrygrl_state::mux_w));
map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs));
map(0x13, 0x13).nopr(); /* Often reads bit7 with unknown purposes */
map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w));
map(0x30, 0x30).nopw(); /* Seems to write 0x10 on each sound event */
}
/*************************************
*
* Lucky Girl Memory Map
*
*************************************/
void cntrygrl_state::luckygrl_cpu0_map(address_map &map)
{
map(0x0000, 0x4fff).rom();
map(0xc000, 0xc7ff).ram();
}
void cntrygrl_state::decrypted_opcodes_map(address_map &map)
{
map(0x0000, 0x4fff).rom().share("decrypted_opcodes");
}
/*************************************
*
* Jangou Memory Map
*
*************************************/
void jangou_state::cpu0_map(address_map &map)
void jangou_state::jangou_cpu0_map(address_map &map)
{
map(0x0000, 0x9fff).rom();
map(0xc000, 0xc7ff).ram();
}
void jangou_state::cpu0_io(address_map &map)
void jangou_state_base::jangou_cpu0_io(address_map &map)
{
map.global_mask(0xff);
map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
map(0x10, 0x10).portr("DSW").w(FUNC(jangou_state::output_w)); //dsw + blitter busy flag
map(0x11, 0x11).w(FUNC(jangou_state::mux_w));
map(0x10, 0x10).portr("DSW").w(FUNC(jangou_state_base::output_w)); //dsw + blitter busy flag
map(0x11, 0x11).w(FUNC(jangou_state_base::mux_w));
map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs));
map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w));
map(0x30, 0x30).nopw(); //? polls 0x03 continuously
map(0x31, 0x31).w(FUNC(jangou_state::sound_latch_w));
map(0x31, 0x31).w(m_soundlatch, FUNC(generic_latch_8_device::write));
}
void jangou_state::cpu1_map(address_map &map)
void jangou_state::jangou_cpu1_map(address_map &map)
{
map(0x0000, 0x7fff).rom().nopw();
}
void jangou_state::cpu1_io(address_map &map)
void jangou_state::jangou_cpu1_io(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).r(FUNC(jangou_state::sound_latch_r));
map(0x00, 0x00).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x01, 0x01).w(FUNC(jangou_state::cvsd_w));
map(0x02, 0x02).nopw(); // Echoes sound command - acknowledge?
}
@ -384,106 +470,36 @@ void jangou_state::cpu1_io(address_map &map)
*
*************************************/
void jangou_state::jngolady_cpu0_map(address_map &map)
void jngolady_state::jngolady_cpu0_map(address_map &map)
{
map(0x0000, 0x9fff).rom();
map(0xc000, 0xc7ff).ram().share("share1");
map(0xe000, 0xe000).rw(FUNC(jangou_state::master_com_r), FUNC(jangou_state::master_com_w));
map(0xe000, 0xe000).r(FUNC(jngolady_state::master_com_r)).w(m_nsclatch, FUNC(generic_latch_8_device::write));
}
void jangou_state::jngolady_cpu1_map(address_map &map)
void jngolady_state::jngolady_cpu1_map(address_map &map)
{
map(0x0000, 0x7fff).rom().nopw();
}
void jangou_state::jngolady_cpu1_io(address_map &map)
void jngolady_state::jngolady_cpu1_io(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).r(FUNC(jangou_state::sound_latch_r));
map(0x01, 0x01).w(FUNC(jangou_state::adpcm_w));
map(0x00, 0x00).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x01, 0x01).w(FUNC(jngolady_state::adpcm_w));
map(0x02, 0x02).nopw();
}
void jangou_state::nsc_map(address_map &map)
void jngolady_state::nsc_map(address_map &map)
{
map(0x8000, 0x8000).nopw(); //write-only,irq related?
map(0x9000, 0x9000).rw(FUNC(jangou_state::slave_com_r), FUNC(jangou_state::slave_com_w));
map(0x8000, 0x8000).nopw(); //write-only, IRQ-related?
map(0x9000, 0x9000).r(m_nsclatch, FUNC(generic_latch_8_device::read)).w(FUNC(jngolady_state::slave_com_w));
map(0xc000, 0xc7ff).ram().share("share1");
map(0xf000, 0xffff).rom();
}
/*************************************
*
* Country Girl Memory Map
*
*************************************/
void jangou_state::cntrygrl_cpu0_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
// map(0xc000, 0xc7ff).ram();
map(0xe000, 0xefff).ram();
}
void jangou_state::cntrygrl_cpu0_io(address_map &map)
{
map.global_mask(0xff);
map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
map(0x10, 0x10).portr("DSW"); //dsw + blitter busy flag
map(0x10, 0x10).w(FUNC(jangou_state::output_w));
map(0x11, 0x11).w(FUNC(jangou_state::mux_w));
map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs));
map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w));
map(0x30, 0x30).nopw(); //? polls 0x03 continuously
// map(0x31, 0x31).w(FUNC(jangou_state::sound_latch_w));
}
/*************************************
*
* Lucky Girl Memory Map
*
*************************************/
void jangou_state::luckygrl_cpu0_map(address_map &map)
{
map(0x0000, 0x4fff).rom();
map(0xc000, 0xc7ff).ram();
}
void jangou_state::decrypted_opcodes_map(address_map &map)
{
map(0x0000, 0x4fff).rom().share("decrypted_opcodes");
}
/*************************************
*
* Royal Card Memory Map
*
*************************************/
void jangou_state::roylcrdn_cpu0_map(address_map &map)
{
map(0x0000, 0x2fff).rom();
map(0x7000, 0x77ff).ram().share("nvram"); /* MK48Z02B-15 ZEROPOWER RAM */
}
void jangou_state::roylcrdn_cpu0_io(address_map &map)
{
map.global_mask(0xff);
map(0x01, 0x01).r("aysnd", FUNC(ay8910_device::data_r));
map(0x02, 0x03).w("aysnd", FUNC(ay8910_device::data_address_w));
map(0x10, 0x10).portr("DSW"); /* DSW + blitter busy flag */
map(0x10, 0x10).nopw(); /* Writes continuosly 0's in attract mode, and 1's in game */
map(0x11, 0x11).w(FUNC(jangou_state::mux_w));
map(0x12, 0x17).m(m_blitter, FUNC(jangou_blitter_device::blit_v1_regs));
map(0x13, 0x13).nopr(); /* Often reads bit7 with unknown purposes */
map(0x20, 0x2f).w(m_blitter, FUNC(jangou_blitter_device::vregs_w));
map(0x30, 0x30).nopw(); /* Seems to write 0x10 on each sound event */
}
/*************************************
*
@ -555,9 +571,6 @@ static INPUT_PORTS_START( jangou )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN_NOMUX")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
/* there's a bank of 6 dip-switches in there*/
PORT_START("DSW")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2")
@ -583,7 +596,11 @@ INPUT_PORTS_END
static INPUT_PORTS_START( macha )
PORT_START("PL1_1")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P A")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P B")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P C")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("PL1_2")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
@ -600,13 +617,6 @@ static INPUT_PORTS_START( macha )
PORT_START("PL2_3")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN_NOMUX")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P A") PORT_CODE(KEYCODE_Z)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P B") PORT_CODE(KEYCODE_X)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P C") PORT_CODE(KEYCODE_C)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
/*The "unknown" bits for this port might be actually unused*/
PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
@ -725,9 +735,6 @@ static INPUT_PORTS_START( cntrygrl )
PORT_DIPSETTING( 0x40, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x00, "1 Coin / 10 Credits" )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r)
PORT_START("IN_NOMUX")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( jngolady )
@ -739,7 +746,7 @@ static INPUT_PORTS_START( jngolady )
PORT_MODIFY("PL2_3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Start / P2 Mahjong Flip Flop")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("P2 Ready")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2) PORT_NAME("P2 Ready")
PORT_MODIFY("SYSTEM")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no service switch
@ -825,9 +832,6 @@ static INPUT_PORTS_START( roylcrdn )
PORT_START("DSW")
PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r)
PORT_START("IN_NOMUX")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( luckygrl )
@ -894,9 +898,6 @@ static INPUT_PORTS_START( luckygrl )
PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW1:6")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("blitter", jangou_blitter_device, status_r)
PORT_START("IN_NOMUX")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
@ -906,169 +907,158 @@ INPUT_PORTS_END
*
*************************************/
MACHINE_START_MEMBER(jangou_state,common)
void cntrygrl_state::machine_start()
{
save_item(NAME(m_mux_data));
m_tmp_bitmap = std::make_unique<bitmap_ind16>(256, 256);
}
void jangou_state::machine_start()
{
MACHINE_START_CALL_MEMBER(common);
jangou_state_base::machine_start();
save_item(NAME(m_cvsd_shiftreg));
save_item(NAME(m_cvsd_shift_cnt));
/* Create a timer to feed the CVSD DAC with sample bits */
// Create a timer to feed the CVSD DAC with sample bits
m_cvsd_bit_timer = timer_alloc(FUNC(jangou_state::cvsd_bit_timer_callback), this);
m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024));
}
MACHINE_START_MEMBER(jangou_state,jngolady)
void jngolady_state::machine_start()
{
MACHINE_START_CALL_MEMBER(common);
jangou_state_base::machine_start();
save_item(NAME(m_adpcm_byte));
save_item(NAME(m_msm5205_vclk_toggle));
save_item(NAME(m_nsc_latch));
save_item(NAME(m_z80_latch));
}
MACHINE_RESET_MEMBER(jangou_state,common)
void cntrygrl_state::machine_reset()
{
m_mux_data = 0;
m_mux_data = 0xff;
}
void jangou_state::machine_reset()
{
MACHINE_RESET_CALL_MEMBER(common);
jangou_state_base::machine_reset();
m_cvsd_shiftreg = 0;
m_cvsd_shift_cnt = 0;
}
MACHINE_RESET_MEMBER(jangou_state,jngolady)
void jngolady_state::machine_reset()
{
MACHINE_RESET_CALL_MEMBER(common);
jangou_state_base::machine_reset();
m_adpcm_byte = 0;
m_msm5205_vclk_toggle = 0;
m_nsc_latch = 0;
m_z80_latch = 0;
}
/* Note: All frequencies and dividers are unverified */
void jangou_state::jangou(machine_config &config)
void cntrygrl_state::cntrygrl(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_cpu_0, MASTER_CLOCK / 8);
m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::cpu0_map);
m_cpu_0->set_addrmap(AS_IO, &jangou_state::cpu0_io);
m_cpu_0->set_addrmap(AS_PROGRAM, &cntrygrl_state::cntrygrl_cpu0_map);
m_cpu_0->set_addrmap(AS_IO, &cntrygrl_state::cntrygrl_cpu0_io);
m_cpu_0->set_vblank_int("screen", FUNC(jangou_state::irq0_line_hold));
Z80(config, m_cpu_1, MASTER_CLOCK / 8);
m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::cpu1_map);
m_cpu_1->set_addrmap(AS_IO, &jangou_state::cpu1_io);
JANGOU_BLITTER(config, "blitter", MASTER_CLOCK/4);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(MASTER_CLOCK/4,320,0,256,264,16,240); // assume same as nightgal.cpp
screen.set_screen_update(FUNC(jangou_state::screen_update_jangou));
screen.set_screen_update(FUNC(cntrygrl_state::screen_update));
screen.set_palette(m_palette);
PALETTE(config, m_palette, FUNC(jangou_state::jangou_palette), 32);
PALETTE(config, m_palette, FUNC(cntrygrl_state::init_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
ay8910_device &aysnd(AY8910(config, "aysnd", MASTER_CLOCK / 16));
aysnd.port_a_read_callback().set(FUNC(jangou_state::input_mux_r));
aysnd.port_b_read_callback().set_ioport("SYSTEM");
aysnd.add_route(ALL_OUTPUTS, "mono", 0.40);
}
void cntrygrl_state::roylcrdn(machine_config &config)
{
cntrygrl(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_PROGRAM, &cntrygrl_state::roylcrdn_cpu0_map);
m_cpu_0->set_addrmap(AS_IO, &cntrygrl_state::roylcrdn_cpu0_io);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
}
void cntrygrl_state::luckygrl(machine_config &config)
{
cntrygrl(config);
sega_315_spat_device &maincpu(SEGA_315_SPAT(config.replace(), m_cpu_0, MASTER_CLOCK / 8)); // actually Falcon 03155096 encrypted Z80
maincpu.set_addrmap(AS_PROGRAM, &cntrygrl_state::luckygrl_cpu0_map);
maincpu.set_addrmap(AS_IO, &cntrygrl_state::cntrygrl_cpu0_io);
maincpu.set_addrmap(AS_OPCODES, &cntrygrl_state::decrypted_opcodes_map);
maincpu.set_decrypted_tag(":decrypted_opcodes");
maincpu.set_size(0x5000);
maincpu.set_vblank_int("screen", FUNC(cntrygrl_state::irq0_line_hold));
}
void jangou_state_base::jangou_base(machine_config &config)
{
cntrygrl(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_IO, &jangou_state::jangou_cpu0_io);
Z80(config, m_cpu_1, MASTER_CLOCK / 8);
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_cpu_1, INPUT_LINE_NMI);
}
void jangou_state::jangou(machine_config &config)
{
jangou_base(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::jangou_cpu0_map);
m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::jangou_cpu1_map);
m_cpu_1->set_addrmap(AS_IO, &jangou_state::jangou_cpu1_io);
HC55516(config, m_cvsd, MASTER_CLOCK / 1024);
m_cvsd->add_route(ALL_OUTPUTS, "mono", 0.60);
}
void jangou_state::jngolady(machine_config &config)
void jngolady_state::jngolady(machine_config &config)
{
jangou(config);
jangou_base(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::jngolady_cpu0_map);
m_cpu_0->set_addrmap(AS_PROGRAM, &jngolady_state::jngolady_cpu0_map);
m_cpu_1->set_addrmap(AS_PROGRAM, &jangou_state::jngolady_cpu1_map);
m_cpu_1->set_addrmap(AS_IO, &jangou_state::jngolady_cpu1_io);
m_cpu_1->set_addrmap(AS_PROGRAM, &jngolady_state::jngolady_cpu1_map);
m_cpu_1->set_addrmap(AS_IO, &jngolady_state::jngolady_cpu1_io);
NSC8105(config, m_nsc, MASTER_CLOCK / 8);
m_nsc->set_addrmap(AS_PROGRAM, &jangou_state::nsc_map);
m_nsc->set_addrmap(AS_PROGRAM, &jngolady_state::nsc_map);
MCFG_MACHINE_START_OVERRIDE(jangou_state,jngolady)
MCFG_MACHINE_RESET_OVERRIDE(jangou_state,jngolady)
GENERIC_LATCH_8(config, m_nsclatch);
m_nsclatch->data_pending_callback().set_inputline(m_nsc, 0);
/* sound hardware */
config.device_remove("cvsd");
MSM5205(config, m_msm, XTAL(400'000));
m_msm->vck_legacy_callback().set(FUNC(jangou_state::jngolady_vclk_cb));
m_msm->vck_legacy_callback().set(FUNC(jngolady_state::vclk_cb));
m_msm->set_prescaler_selector(msm5205_device::S96_4B);
m_msm->add_route(ALL_OUTPUTS, "mono", 0.80);
}
void jangou_state::cntrygrl(machine_config &config)
{
jangou(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::cntrygrl_cpu0_map);
m_cpu_0->set_addrmap(AS_IO, &jangou_state::cntrygrl_cpu0_io);
config.device_remove("cpu1");
MCFG_MACHINE_START_OVERRIDE(jangou_state,common)
MCFG_MACHINE_RESET_OVERRIDE(jangou_state,common)
/* sound hardware */
config.device_remove("cvsd");
config.device_remove("soundlatch");
}
void jangou_state::roylcrdn(machine_config &config)
{
jangou(config);
/* basic machine hardware */
m_cpu_0->set_addrmap(AS_PROGRAM, &jangou_state::roylcrdn_cpu0_map);
m_cpu_0->set_addrmap(AS_IO, &jangou_state::roylcrdn_cpu0_io);
config.device_remove("cpu1");
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MCFG_MACHINE_START_OVERRIDE(jangou_state,common)
MCFG_MACHINE_RESET_OVERRIDE(jangou_state,common)
/* sound hardware */
config.device_remove("cvsd");
config.device_remove("soundlatch");
}
void jangou_state::luckygrl(machine_config &config)
{
cntrygrl(config);
sega_315_spat_device &maincpu(SEGA_315_SPAT(config.replace(), m_cpu_0, MASTER_CLOCK / 8)); // actually Falcon 03155096 encrypted Z80
maincpu.set_addrmap(AS_PROGRAM, &jangou_state::luckygrl_cpu0_map);
maincpu.set_addrmap(AS_IO, &jangou_state::cntrygrl_cpu0_io);
maincpu.set_addrmap(AS_OPCODES, &jangou_state::decrypted_opcodes_map);
maincpu.set_decrypted_tag(":decrypted_opcodes");
maincpu.set_size(0x5000);
maincpu.set_vblank_int("screen", FUNC(jangou_state::irq0_line_hold));
}
/*************************************
*
@ -1364,15 +1354,10 @@ ROM_END
*
*************************************/
/*Temporary kludge to make the RNG work*/
uint8_t jangou_state::jngolady_rng_r()
// Temporary kludge to make the RNG work
void jngolady_state::init_jngolady()
{
return machine().rand();
}
void jangou_state::init_jngolady()
{
m_nsc->space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8smo_delegate(*this, FUNC(jangou_state::jngolady_rng_r)));
m_nsc->space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8smo_delegate(*this, NAME([this] () { return u8(machine().rand()); })));
}
} // anonymous namespace
@ -1384,15 +1369,15 @@ void jangou_state::init_jngolady()
*
*************************************/
GAME( 1983, jangou, 0, jangou, jangou, jangou_state, empty_init, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, macha, 0, jangou, macha, jangou_state, empty_init, ROT0, "Logitec", "Monoshiri Quiz Osyaberi Macha (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, jngolady, 0, jngolady, jngolady, jangou_state, init_jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, jangou_state, empty_init, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, jangou_state, empty_init, ROT0, "Amusement", "Royal Card (Nichibutsu HW)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, roylcrdna, roylcrdn, roylcrdn, roylcrdn, jangou_state, empty_init, ROT0, "Miki Corp.", "Royal Card Part-Two (Nichibutsu HW, Ver. 1.02)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, luckygrl, 0, luckygrl, luckygrl, jangou_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Girl (Wing)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, jangou, 0, jangou, jangou, jangou_state, empty_init, ROT0, "Nichibutsu", "Jangou [BET] (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, macha, 0, jangou, macha, jangou_state, empty_init, ROT0, "Logitec", "Monoshiri Quiz Oshaberi Macha (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, jngolady, 0, jngolady, jngolady, jngolady_state, init_jngolady, ROT0, "Nichibutsu", "Jangou Lady (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, cntrygrl, 0, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Royal Denshi", "Country Girl (Japan set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, cntrygrla, cntrygrl, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Nichibutsu", "Country Girl (Japan set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1984, fruitbun, cntrygrl, cntrygrl, cntrygrl, cntrygrl_state, empty_init, ROT0, "Nichibutsu", "Fruits & Bunny (World?)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, roylcrdn, 0, roylcrdn, roylcrdn, cntrygrl_state, empty_init, ROT0, "Amusement", "Royal Card (Nichibutsu HW)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, roylcrdna, roylcrdn, roylcrdn, roylcrdn, cntrygrl_state, empty_init, ROT0, "Miki Corp.", "Royal Card Part-Two (Nichibutsu HW, Ver. 1.02)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, luckygrl, 0, luckygrl, luckygrl, cntrygrl_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Girl (Wing)", MACHINE_SUPPORTS_SAVE )
/*
Some other games that might run on this HW:

View File

@ -72,59 +72,45 @@ puzznici note
#include "speaker.h"
void taitol_state::state_register()
void taitol_state::machine_start()
{
save_item(NAME(m_last_irq_level));
}
void taitol_2cpu_state::state_register()
void taitol_2cpu_state::machine_start()
{
taitol_state::machine_start();
if (m_audio_bnk.found())
m_audio_bnk->configure_entries(0, m_audio_prg->bytes()/0x4000, m_audio_prg->base(), 0x4000);
taitol_state::state_register();
}
void fhawk_state::state_register()
void fhawk_state::machine_start()
{
taitol_2cpu_state::machine_start();
m_slave_bnk->configure_entries(0, m_slave_prg->bytes()/0x4000, m_slave_prg->base(), 0x4000);
taitol_2cpu_state::state_register();
save_item(NAME(m_slave_rombank));
}
void champwr_state::state_register()
void champwr_state::machine_start()
{
fhawk_state::state_register();
fhawk_state::machine_start();
save_item(NAME(m_adpcm_pos));
save_item(NAME(m_adpcm_data));
}
void taitol_1cpu_state::state_register()
{
taitol_state::state_register();
}
MACHINE_START_MEMBER(taitol_state, taito_l)
{
state_register();
}
void taitol_state::taito_machine_reset()
void taitol_state::machine_reset()
{
m_last_irq_level = 0;
}
void taitol_2cpu_state::taito_machine_reset()
void fhawk_state::machine_reset()
{
taitol_state::taito_machine_reset();
}
void fhawk_state::taito_machine_reset()
{
taitol_2cpu_state::taito_machine_reset();
taitol_2cpu_state::machine_reset();
m_slave_rombank = 0;
m_slave_bnk->set_entry(m_slave_rombank);
@ -132,25 +118,14 @@ void fhawk_state::taito_machine_reset()
m_audio_bnk->set_entry(1);
}
void champwr_state::taito_machine_reset()
void champwr_state::machine_reset()
{
fhawk_state::taito_machine_reset();
fhawk_state::machine_reset();
m_adpcm_pos = 0;
m_adpcm_data = -1;
}
void taitol_1cpu_state::taito_machine_reset()
{
taitol_state::taito_machine_reset();
}
MACHINE_RESET_MEMBER(taitol_state, taito_l)
{
taito_machine_reset();
}
IRQ_CALLBACK_MEMBER(taitol_state::irq_callback)
{
@ -1309,9 +1284,6 @@ void fhawk_state::fhawk(machine_config &config)
tc0220ioc.write_4_callback().set(FUNC(taitol_state::coin_control_w));
tc0220ioc.read_7_callback().set_ioport("IN2");
MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l)
MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l)
/* video hardware */
l_system_video(config);
@ -1376,9 +1348,6 @@ void taitol_2cpu_state::raimais(machine_config &config)
MB8421(config, "dpram");
MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l)
MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l)
/* video hardware */
l_system_video(config);
@ -1419,9 +1388,6 @@ void taitol_2cpu_state::kurikint(machine_config &config)
MB8421(config, "dpram");
MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l)
MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l)
/* video hardware */
l_system_video(config);
@ -1453,9 +1419,6 @@ void taitol_1cpu_state::base(machine_config &config)
m_main_cpu->set_addrmap(AS_PROGRAM, &taitol_1cpu_state::plotting_map);
m_main_cpu->set_irq_acknowledge_callback(FUNC(taitol_state::irq_callback));
MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l)
MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l)
/* video hardware */
l_system_video(config);
@ -1495,11 +1458,15 @@ void taitol_1cpu_state::puzznici(machine_config &config)
void horshoes_state::machine_start()
{
taitol_1cpu_state::machine_start();
save_item(NAME(m_horshoes_gfxbank));
}
void horshoes_state::machine_reset()
{
taitol_1cpu_state::machine_reset();
m_horshoes_gfxbank = 0;
}
@ -1565,9 +1532,6 @@ void taitol_2cpu_state::evilston(machine_config &config)
mb8421_device &dpram(MB8421(config, "dpram"));
dpram.intl_callback().set_inputline("audiocpu", INPUT_LINE_NMI);
MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l)
MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l)
/* video hardware */
l_system_video(config);

View File

@ -26,15 +26,15 @@ public:
{
}
DECLARE_MACHINE_START(taito_l);
DECLARE_MACHINE_RESET(taito_l);
IRQ_CALLBACK_MEMBER(irq_callback);
void coin_control_w(u8 data);
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
/* misc */
int m_last_irq_level;
void irq_enable_w(u8 data);
void mcu_control_w(u8 data);
@ -42,12 +42,11 @@ protected:
DECLARE_WRITE_LINE_MEMBER(screen_vblank_taitol);
TIMER_DEVICE_CALLBACK_MEMBER(vbl_interrupt);
void l_system_video(machine_config &config);
void l_system_video(machine_config &config) ATTR_COLD;
void common_banks_map(address_map &map);
void common_banks_map(address_map &map) ATTR_COLD;
virtual void state_register();
virtual void taito_machine_reset();
int m_last_irq_level;
required_device<tc0090lvc_device> m_main_cpu;
optional_device<upd4701_device> m_upd4701;
@ -68,21 +67,20 @@ public:
void sound_bankswitch_w(u8 data);
void kurikint(machine_config &config);
void evilston(machine_config &config);
void raimais(machine_config &config);
void kurikint(machine_config &config) ATTR_COLD;
void evilston(machine_config &config) ATTR_COLD;
void raimais(machine_config &config) ATTR_COLD;
protected:
virtual void state_register() override;
virtual void taito_machine_reset() override;
virtual void machine_start() override ATTR_COLD;
void evilston_2_map(address_map &map);
void evilston_map(address_map &map);
void kurikint_2_map(address_map &map);
void kurikint_map(address_map &map);
void raimais_2_map(address_map &map);
void raimais_3_map(address_map &map);
void raimais_map(address_map &map);
void evilston_2_map(address_map &map) ATTR_COLD;
void evilston_map(address_map &map) ATTR_COLD;
void kurikint_2_map(address_map &map) ATTR_COLD;
void kurikint_map(address_map &map) ATTR_COLD;
void raimais_2_map(address_map &map) ATTR_COLD;
void raimais_3_map(address_map &map) ATTR_COLD;
void raimais_map(address_map &map) ATTR_COLD;
required_device<cpu_device> m_audio_cpu;
required_memory_region m_audio_prg;
@ -105,15 +103,15 @@ public:
u8 slave_rombank_r();
void portA_w(u8 data);
void fhawk(machine_config &config);
void fhawk(machine_config &config) ATTR_COLD;
protected:
virtual void state_register() override;
virtual void taito_machine_reset() override;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
void fhawk_2_map(address_map &map);
void fhawk_3_map(address_map &map);
void fhawk_map(address_map &map);
void fhawk_2_map(address_map &map) ATTR_COLD;
void fhawk_3_map(address_map &map) ATTR_COLD;
void fhawk_map(address_map &map) ATTR_COLD;
required_memory_region m_slave_prg;
required_memory_bank m_slave_bnk;
@ -142,15 +140,15 @@ public:
void msm5205_stop_w(u8 data);
void msm5205_volume_w(u8 data);
void champwr(machine_config &config);
void champwr(machine_config &config) ATTR_COLD;
protected:
virtual void state_register() override;
virtual void taito_machine_reset() override;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
void champwr_2_map(address_map &map);
void champwr_3_map(address_map &map);
void champwr_map(address_map &map);
void champwr_2_map(address_map &map) ATTR_COLD;
void champwr_3_map(address_map &map) ATTR_COLD;
void champwr_map(address_map &map) ATTR_COLD;
required_device<msm5205_device> m_msm;
required_region_ptr<u8> m_adpcm_rgn;
@ -172,29 +170,21 @@ public:
u8 extport_select_and_ym2203_r(offs_t offset);
void init_plottinga();
void init_plottinga() ATTR_COLD;
DECLARE_MACHINE_RESET(plotting);
DECLARE_MACHINE_RESET(puzznic);
DECLARE_MACHINE_RESET(palamed);
DECLARE_MACHINE_RESET(cachat);
void base(machine_config &config);
void add_muxes(machine_config &config);
void palamed(machine_config &config);
void plotting(machine_config &config);
void puzznici(machine_config &config);
void cachat(machine_config &config);
void puzznic(machine_config &config);
void base(machine_config &config) ATTR_COLD;
void add_muxes(machine_config &config) ATTR_COLD;
void palamed(machine_config &config) ATTR_COLD;
void plotting(machine_config &config) ATTR_COLD;
void puzznici(machine_config &config) ATTR_COLD;
void cachat(machine_config &config) ATTR_COLD;
void puzznic(machine_config &config) ATTR_COLD;
protected:
virtual void state_register() override;
virtual void taito_machine_reset() override;
void palamed_map(address_map &map);
void plotting_map(address_map &map);
void puzznic_map(address_map &map);
void puzznici_map(address_map &map);
void palamed_map(address_map &map) ATTR_COLD;
void plotting_map(address_map &map) ATTR_COLD;
void puzznic_map(address_map &map) ATTR_COLD;
void puzznici_map(address_map &map) ATTR_COLD;
required_device<ym2203_device> m_ymsnd;
optional_device_array<ls157_x2_device, 2> m_mux;
@ -209,11 +199,11 @@ public:
{
}
void horshoes(machine_config &config);
void horshoes(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
private:
void horshoes_tile_cb(u32 &code);

View File

@ -88,50 +88,35 @@ public:
, m_tms9980a(*this, "maincpu")
, m_speaker(*this, "speaker")
, m_cass(*this, "cassette")
, m_tms9918(*this, "tms9918")
, m_tms9901_usr(*this, TMS9901_0_TAG)
, m_tms9901_sys(*this, TMS9901_1_TAG)
, m_tms9902(*this, "tms9902")
, m_digits(*this, "digit%u", 0U)
, m_leds(*this, "led%u", 0U)
{ }
{
}
void tm990_189_v(machine_config &config);
void tm990_189(machine_config &config);
void tm990_189(machine_config &config) ATTR_COLD;
DECLARE_INPUT_CHANGED_MEMBER( load_interrupt );
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
required_device<tms9980a_device> m_tms9980a;
private:
virtual void machine_reset() override;
uint8_t video_vdp_r(offs_t offset);
void video_vdp_w(offs_t offset, uint8_t data);
uint8_t video_joy_r();
void video_joy_w(uint8_t data);
void external_operation(offs_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER(usr9901_led0_w);
DECLARE_WRITE_LINE_MEMBER(usr9901_led1_w);
DECLARE_WRITE_LINE_MEMBER(usr9901_led2_w);
DECLARE_WRITE_LINE_MEMBER(usr9901_led3_w);
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(usr9901_led_w) { led_set(N, state); }
DECLARE_WRITE_LINE_MEMBER(usr9901_interrupt_callback);
DECLARE_WRITE_LINE_MEMBER(sys9901_interrupt_callback);
uint8_t sys9901_r(offs_t offset);
DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel0_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel1_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel2_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel3_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment0_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment1_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment2_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment3_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment4_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment5_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment6_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_segment7_w);
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(sys9901_digitsel_w) { digitsel(N, state); }
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(sys9901_segment_w) { segment_set(N, state); }
DECLARE_WRITE_LINE_MEMBER(sys9901_dsplytrgr_w);
DECLARE_WRITE_LINE_MEMBER(sys9901_shiftlight_w);
@ -139,14 +124,11 @@ private:
DECLARE_WRITE_LINE_MEMBER(sys9901_tapewdata_w);
void xmit_callback(uint8_t data);
DECLARE_MACHINE_START(tm990_189);
DECLARE_MACHINE_START(tm990_189_v);
emu_timer *m_load_timer = nullptr;
void tm990_189_cru_map(address_map &map);
void tm990_189_memmap(address_map &map);
void tm990_189_v_memmap(address_map &map);
void tm990_189_cru_map(address_map &map) ATTR_COLD;
void tm990_189_memmap(address_map &map) ATTR_COLD;
void draw_digit(void);
void led_set(int number, bool state);
@ -157,10 +139,8 @@ private:
TIMER_CALLBACK_MEMBER(clear_load);
void hold_load();
required_device<tms9980a_device> m_tms9980a;
required_device<speaker_sound_device> m_speaker;
required_device<cassette_image_device> m_cass;
optional_device<tms9918_device> m_tms9918;
required_device<tms9901_device> m_tms9901_usr;
required_device<tms9901_device> m_tms9901_sys;
@ -176,19 +156,50 @@ private:
uint8_t m_segment_state[10]{};
uint8_t m_old_segment_state[10]{};
uint8_t m_LED_state = 0U;
emu_timer *m_joy1x_timer = 0;
emu_timer *m_joy1y_timer = 0;
emu_timer *m_joy2x_timer = 0;
emu_timer *m_joy2y_timer = 0;
device_image_interface *m_rs232_fp = 0;
//uint8_t m_rs232_rts;
};
class tm990189_v_state : public tm990189_state
{
public:
tm990189_v_state(const machine_config &mconfig, device_type type, const char *tag)
: tm990189_state(mconfig, type, tag)
, m_tms9918(*this, "tms9918")
, m_buttons(*this, "BUTTONS")
, m_axes(*this, { "JOY1_X", "JOY1_Y", "JOY2_X", "JOY2_Y" })
{
}
void tm990_189_v(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
uint8_t video_vdp_r(offs_t offset);
void video_vdp_w(offs_t offset, uint8_t data);
uint8_t video_joy_r();
void video_joy_w(uint8_t data);
void tm990_189_v_memmap(address_map &map) ATTR_COLD;
required_device<tms9918_device> m_tms9918;
required_ioport m_buttons;
required_ioport_array<4> m_axes;
emu_timer *m_joy1x_timer = nullptr;
emu_timer *m_joy1y_timer = nullptr;
emu_timer *m_joy2x_timer = nullptr;
emu_timer *m_joy2y_timer = nullptr;
uint8_t m_bogus_read_save = 0U;
};
#define displayena_duration attotime::from_usec(4500) /* Can anyone confirm this? 74LS123 connected to C=0.1uF and R=100kOhm */
MACHINE_START_MEMBER(tm990189_state,tm990_189)
void tm990189_state::machine_start()
{
m_digits.resolve();
m_leds.resolve();
@ -200,9 +211,9 @@ MACHINE_START_MEMBER(tm990189_state,tm990_189)
m_load_timer = timer_alloc(FUNC(tm990189_state::clear_load), this);
}
MACHINE_START_MEMBER(tm990189_state,tm990_189_v)
void tm990189_v_state::machine_start()
{
MACHINE_START_CALL_MEMBER(tm990_189);
tm990189_state::machine_start();
m_joy1x_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
m_joy1y_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
@ -295,26 +306,6 @@ void tm990189_state::led_set(int offset, bool state)
m_LED_state &= ~(1 << offset);
}
WRITE_LINE_MEMBER( tm990189_state::usr9901_led0_w )
{
led_set(0, state);
}
WRITE_LINE_MEMBER( tm990189_state::usr9901_led1_w )
{
led_set(1, state);
}
WRITE_LINE_MEMBER( tm990189_state::usr9901_led2_w )
{
led_set(2, state);
}
WRITE_LINE_MEMBER( tm990189_state::usr9901_led3_w )
{
led_set(3, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_interrupt_callback )
{
// TODO: Check this
@ -368,23 +359,6 @@ void tm990189_state::digitsel(int offset, bool state)
m_digitsel &= ~ (1 << offset);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel0_w )
{
digitsel(0, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel1_w )
{
digitsel(1, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel2_w )
{
digitsel(2, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_digitsel3_w )
{
digitsel(3, state);
}
void tm990189_state::segment_set(int offset, bool state)
{
@ -398,38 +372,6 @@ void tm990189_state::segment_set(int offset, bool state)
}
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment0_w )
{
segment_set(0, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment1_w )
{
segment_set(1, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment2_w )
{
segment_set(2, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment3_w )
{
segment_set(3, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment4_w )
{
segment_set(4, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment5_w )
{
segment_set(5, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment6_w )
{
segment_set(6, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_segment7_w )
{
segment_set(7, state);
}
WRITE_LINE_MEMBER( tm990189_state::sys9901_dsplytrgr_w )
{
@ -581,7 +523,7 @@ void tm990189_state::external_operation(offs_t offset, uint8_t data)
Video Board handling
*/
uint8_t tm990189_state::video_vdp_r(offs_t offset)
uint8_t tm990189_v_state::video_vdp_r(offs_t offset)
{
int reply = 0;
@ -612,7 +554,7 @@ uint8_t tm990189_state::video_vdp_r(offs_t offset)
return reply;
}
void tm990189_state::video_vdp_w(offs_t offset, uint8_t data)
void tm990189_v_state::video_vdp_w(offs_t offset, uint8_t data)
{
if (offset & 1)
{
@ -623,9 +565,9 @@ void tm990189_state::video_vdp_w(offs_t offset, uint8_t data)
}
}
uint8_t tm990189_state::video_joy_r()
uint8_t tm990189_v_state::video_joy_r()
{
uint8_t data = ioport("BUTTONS")->read();
uint8_t data = m_buttons->read();
if (m_joy1x_timer->remaining() < attotime::zero)
data |= 0x01;
@ -642,12 +584,12 @@ uint8_t tm990189_state::video_joy_r()
return data;
}
void tm990189_state::video_joy_w(uint8_t data)
void tm990189_v_state::video_joy_w(uint8_t data)
{
m_joy1x_timer->reset(attotime::from_usec(ioport("JOY1_X")->read()*28+28));
m_joy1y_timer->reset(attotime::from_usec(ioport("JOY1_Y")->read()*28+28));
m_joy2x_timer->reset(attotime::from_usec(ioport("JOY2_X")->read()*28+28));
m_joy2y_timer->reset(attotime::from_usec(ioport("JOY2_Y")->read()*28+28));
m_joy1x_timer->reset(attotime::from_usec(m_axes[0]->read()*28+28));
m_joy1y_timer->reset(attotime::from_usec(m_axes[1]->read()*28+28));
m_joy2x_timer->reset(attotime::from_usec(m_axes[2]->read()*28+28));
m_joy2y_timer->reset(attotime::from_usec(m_axes[3]->read()*28+28));
}
/*
@ -661,10 +603,10 @@ static const tms9901_interface usr9901reset_param =
// write handlers
{
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led0_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led1_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led2_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led3_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<0>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<1>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<2>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, usr9901_led_w<3>),
DEVCB_NOOP,
DEVCB_NOOP,
DEVCB_NOOP,
@ -695,18 +637,18 @@ static const tms9901_interface sys9901reset_param =
// write handlers
{
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel0_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel1_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel2_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel3_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment0_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment1_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment2_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment3_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment4_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment5_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment6_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment7_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<0>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<1>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<2>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_digitsel_w<3>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<0>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<1>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<2>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<3>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<4>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<5>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<6>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_segment_w<7>),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_dsplytrgr_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_shiftlight_w),
DEVCB_DRIVER_LINE_MEMBER(tm990189_state, sys9901_spkrdrive_w),
@ -748,23 +690,23 @@ static const tms9901_interface sys9901reset_param =
void tm990189_state::tm990_189_memmap(address_map &map)
{
map(0x0000, 0x07ff).ram(); /* RAM */
map(0x0800, 0x0fff).rom(); /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */
map(0x1000, 0x2fff).noprw(); /* reserved for expansion (RAM and/or tms9918 video controller) */
map(0x3000, 0x3fff).rom(); /* main ROM - unibug or university basic */
map(0x0000, 0x07ff).ram(); // RAM
map(0x0800, 0x0fff).rom(); // extra ROM - application programs with unibug, remaining 2kb of program for university basic
map(0x1000, 0x2fff).noprw(); // reserved for expansion (RAM and/or tms9918 video controller)
map(0x3000, 0x3fff).rom(); // main ROM - unibug or university basic
}
void tm990189_state::tm990_189_v_memmap(address_map &map)
void tm990189_v_state::tm990_189_v_memmap(address_map &map)
{
map(0x0000, 0x07ff).ram(); /* RAM */
map(0x0800, 0x0fff).rom(); /* extra ROM - application programs with unibug, remaining 2kb of program for university basic */
map(0x0000, 0x07ff).ram(); // RAM
map(0x0800, 0x0fff).rom(); // extra ROM - application programs with unibug, remaining 2kb of program for university basic
map(0x1000, 0x17ff).rom().nopw(); /* video board ROM 1 */
map(0x1800, 0x1fff).rom().w(FUNC(tm990189_state::video_joy_w)); /* video board ROM 2 and joystick write port*/
map(0x2000, 0x27ff).r(FUNC(tm990189_state::video_vdp_r)).nopw(); /* video board tms9918 read ports (bogus) */
map(0x2800, 0x2fff).rw(FUNC(tm990189_state::video_joy_r), FUNC(tm990189_state::video_vdp_w)); /* video board joystick read port and tms9918 write ports */
map(0x1000, 0x17ff).rom().nopw(); // video board ROM 1
map(0x1800, 0x1fff).rom().w(FUNC(tm990189_v_state::video_joy_w)); // video board ROM 2 and joystick write port
map(0x2000, 0x27ff).r(FUNC(tm990189_v_state::video_vdp_r)).nopw(); // video board TMS9918 read ports (bogus)
map(0x2800, 0x2fff).rw(FUNC(tm990189_v_state::video_joy_r), FUNC(tm990189_v_state::video_vdp_w)); // video board joystick read port and TMS9918 write ports
map(0x3000, 0x3fff).rom(); /* main ROM - unibug or university basic */
map(0x3000, 0x3fff).rom(); // main ROM - unibug or university basic
}
/*
@ -838,8 +780,6 @@ void tm990189_state::tm990_189(machine_config &config)
m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map);
m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation));
MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189 )
/* Video hardware */
config.set_default_layout(layout_tm990189);
@ -851,26 +791,26 @@ void tm990189_state::tm990_189(machine_config &config)
CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25);
TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4);
m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w));
m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w));
m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w));
m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w));
m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led_w<0>));
m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led_w<1>));
m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led_w<2>));
m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led_w<3>));
m_tms9901_usr->intreq_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback));
TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4);
m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r));
m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w));
m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w));
m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w));
m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w));
m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w));
m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w));
m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w));
m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w));
m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w));
m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w));
m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w));
m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w));
m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel_w<0>));
m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel_w<1>));
m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel_w<2>));
m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel_w<3>));
m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment_w<0>));
m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment_w<1>));
m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment_w<2>));
m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment_w<3>));
m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment_w<4>));
m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment_w<5>));
m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment_w<6>));
m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment_w<7>));
m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w));
m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w));
m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w));
@ -888,65 +828,21 @@ void tm990189_state::tm990_189(machine_config &config)
display_timer.set_start_delay(attotime::from_msec(150));
}
void tm990189_state::tm990_189_v(machine_config &config)
void tm990189_v_state::tm990_189_v(machine_config &config)
{
/* basic machine hardware */
TMS9980A(config, m_tms9980a, 8_MHz_XTAL);
m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_state::tm990_189_v_memmap);
m_tms9980a->set_addrmap(AS_IO, &tm990189_state::tm990_189_cru_map);
m_tms9980a->extop_cb().set(FUNC(tm990189_state::external_operation));
tm990_189(config);
MCFG_MACHINE_START_OVERRIDE(tm990189_state, tm990_189_v )
/* basic machine hardware */
m_tms9980a->set_addrmap(AS_PROGRAM, &tm990189_v_state::tm990_189_v_memmap);
/* video hardware */
tms9918_device &vdp(TMS9918(config, "tms9918", XTAL(10'738'635)));
vdp.set_screen("screen");
vdp.set_vram_size(0x4000);
TMS9918(config, m_tms9918, XTAL(10'738'635));
m_tms9918->set_screen("screen");
m_tms9918->set_vram_size(0x4000);
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
config.set_default_layout(layout_tm990189v);
/* sound hardware */
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* one two-level buzzer */
/* Devices */
CASSETTE(config, "cassette", 0).add_route(ALL_OUTPUTS, "mono", 0.25);
TMS9901(config, m_tms9901_usr, 8_MHz_XTAL / 4);
m_tms9901_usr->p_out_cb(0).set(FUNC(tm990189_state::usr9901_led0_w));
m_tms9901_usr->p_out_cb(1).set(FUNC(tm990189_state::usr9901_led1_w));
m_tms9901_usr->p_out_cb(2).set(FUNC(tm990189_state::usr9901_led2_w));
m_tms9901_usr->p_out_cb(3).set(FUNC(tm990189_state::usr9901_led3_w));
m_tms9901_usr->intreq_cb().set(FUNC(tm990189_state::usr9901_interrupt_callback));
TMS9901(config, m_tms9901_sys, 8_MHz_XTAL / 4);
m_tms9901_sys->read_cb().set(FUNC(tm990189_state::sys9901_r));
m_tms9901_sys->p_out_cb(0).set(FUNC(tm990189_state::sys9901_digitsel0_w));
m_tms9901_sys->p_out_cb(1).set(FUNC(tm990189_state::sys9901_digitsel1_w));
m_tms9901_sys->p_out_cb(2).set(FUNC(tm990189_state::sys9901_digitsel2_w));
m_tms9901_sys->p_out_cb(3).set(FUNC(tm990189_state::sys9901_digitsel3_w));
m_tms9901_sys->p_out_cb(4).set(FUNC(tm990189_state::sys9901_segment0_w));
m_tms9901_sys->p_out_cb(5).set(FUNC(tm990189_state::sys9901_segment1_w));
m_tms9901_sys->p_out_cb(6).set(FUNC(tm990189_state::sys9901_segment2_w));
m_tms9901_sys->p_out_cb(7).set(FUNC(tm990189_state::sys9901_segment3_w));
m_tms9901_sys->p_out_cb(8).set(FUNC(tm990189_state::sys9901_segment4_w));
m_tms9901_sys->p_out_cb(9).set(FUNC(tm990189_state::sys9901_segment5_w));
m_tms9901_sys->p_out_cb(10).set(FUNC(tm990189_state::sys9901_segment6_w));
m_tms9901_sys->p_out_cb(11).set(FUNC(tm990189_state::sys9901_segment7_w));
m_tms9901_sys->p_out_cb(12).set(FUNC(tm990189_state::sys9901_dsplytrgr_w));
m_tms9901_sys->p_out_cb(13).set(FUNC(tm990189_state::sys9901_shiftlight_w));
m_tms9901_sys->p_out_cb(14).set(FUNC(tm990189_state::sys9901_spkrdrive_w));
m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w));
m_tms9901_sys->intreq_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback));
TMS9902(config, m_tms9902, 8_MHz_XTAL / 4);
m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted;
TM990_189_RS232(config, "rs232", 0, m_tms9902);
timer_device &display_timer(TIMER(config, "display_timer"));
display_timer.configure_periodic(FUNC(tm990189_state::display_callback), attotime::from_hz(30));
display_timer.set_start_delay(attotime::from_msec(150));
}
@ -1073,6 +969,7 @@ static INPUT_PORTS_START(tm990_189)
PORT_BIT( 0x3ff, 0x1aa, IPT_AD_STICK_Y) PORT_SENSITIVITY(JOYSTICK_SENSITIVITY) PORT_KEYDELTA(JOYSTICK_DELTA) PORT_MINMAX(0xd2,0x282 ) PORT_PLAYER(2) PORT_REVERSE
INPUT_PORTS_END
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer", 0 )
COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface", 0 )
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
COMP( 1978, 990189, 0, 0, tm990_189, tm990_189, tm990189_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer", 0 )
COMP( 1980, 990189v, 990189, 0, tm990_189_v, tm990_189, tm990189_v_state, empty_init, "Texas Instruments", "TM 990/189 University Board microcomputer with Video Board Interface", 0 )

View File

@ -1045,9 +1045,6 @@ void omegaf_state::omegaf(machine_config &config)
m_soundcpu->set_addrmap(AS_PROGRAM, &omegaf_state::ninjakid_nopcm_sound_cpu);
// MCFG_MACHINE_START_OVERRIDE(ninjakd2_state,omegaf)
// MCFG_MACHINE_RESET_OVERRIDE(ninjakd2_state,omegaf)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(omegaf_state,omegaf)

View File

@ -126,7 +126,6 @@ private:
TILE_GET_INFO_MEMBER(mnight_get_bg_tile_info);
DECLARE_VIDEO_START(mnight);
DECLARE_VIDEO_START(arkarea);
};
class robokid_state : public mnight_state

File diff suppressed because it is too large Load Diff

View File

@ -5,14 +5,17 @@
#pragma once
#include "machine/gen_latch.h"
#include "vsystem_spr.h"
#include "vsystem_spr2.h"
#include "machine/gen_latch.h"
#include "sound/okim6295.h"
#include "sound/upd7759.h"
#include "emupal.h"
#include "tilemap.h"
class aerofgt_state : public driver_device
{
public:
@ -25,19 +28,18 @@ public:
, m_spriteram(*this, "spriteram")
, m_tx_tilemap_ram(*this, "tx_tilemap_ram")
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
, m_oki(*this, "oki")
, m_upd7759(*this, "upd")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_spr(*this, "vsystem_spr")
, m_spr_old(*this, "vsystem_spr_old%u", 1)
, m_soundlatch(*this, "soundlatch")
, m_sprlookuprom(*this, "sprlookuprom")
, m_soundbank(*this, "soundbank")
, m_okibank(*this, "okibank")
{ }
void pspikesb(machine_config &config) ATTR_COLD;
void pspikesc(machine_config &config) ATTR_COLD;
void aerfboo2(machine_config &config) ATTR_COLD;
protected:
/* memory pointers */
optional_shared_ptr_array<uint16_t, 2> m_vram;
optional_shared_ptr<uint16_t> m_rasterram;
@ -48,18 +50,11 @@ public:
/* devices referenced above */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki;
optional_device<upd7759_device> m_upd7759; // karatblzbl
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
optional_device<vsystem_spr_device> m_spr; // only the aerofgt parent uses this chip
optional_device_array<vsystem_spr2_device, 2> m_spr_old; // every other (non-bootleg) uses this or a pair of them..
optional_device<generic_latch_8_device> m_soundlatch;
optional_region_ptr<uint16_t> m_sprlookuprom;
optional_memory_bank m_soundbank;
optional_memory_bank m_okibank;
/* video-related */
tilemap_t *m_tilemap[2]{};
@ -68,27 +63,16 @@ public:
uint16_t m_scrollx[2]{};
uint16_t m_scrolly[2]{};
bool m_flip_screen = false;
uint16_t m_wbbc97_bitmap_enable = 0;
int m_charpalettebank = 0;
int m_spritepalettebank = 0;
int m_sprite_gfx = 0;
int m_spikes91_lookup = 0;
uint32_t aerofgt_tile_callback( uint32_t code );
uint32_t aerofgt_old_tile_callback( uint32_t code );
uint32_t aerofgt_ol2_tile_callback( uint32_t code );
uint32_t spinbrk_tile_callback( uint32_t code );
uint32_t aerofgt_old_tile_callback(uint32_t code);
/* handlers */
void karatblzbl_soundlatch_w(uint8_t data);
uint8_t pending_command_r();
void aerofgt_sh_bankswitch_w(uint8_t data);
void spinlbrk_sh_bankswitch_w(uint8_t data);
void aerfboot_okim6295_banking_w(uint8_t data);
template<int Layer> void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void pspikes_gfxbank_w(uint8_t data);
void pspikesb_gfxbank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void spikes91_lookup_w(uint16_t data);
void karatblz_gfxbank_w(uint8_t data);
void spinlbrk_gfxbank_w(uint8_t data);
void kickball_gfxbank_w(uint8_t data);
@ -97,86 +81,155 @@ public:
template<int Layer> void scrollx_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
template<int Layer> void scrolly_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void pspikes_palette_bank_w(uint8_t data);
void spinlbrk_flip_screen_w(uint8_t data);
void turbofrc_flip_screen_w(uint8_t data);
void wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void pspikesb_oki_banking_w(uint16_t data);
void aerfboo2_okim6295_banking_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void karatblzbl_d7759_write_port_0_w(uint8_t data);
void karatblzbl_d7759_reset_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_pspikes_tile_info);
template<int Layer> TILE_GET_INFO_MEMBER(karatblz_tile_info);
template<int Layer> TILE_GET_INFO_MEMBER(spinlbrk_tile_info);
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_MACHINE_START(aerofgt);
DECLARE_MACHINE_START(spinlbrk);
DECLARE_MACHINE_RESET(aerofgt);
DECLARE_VIDEO_START(pspikes);
DECLARE_MACHINE_START(common);
DECLARE_MACHINE_RESET(common);
DECLARE_VIDEO_START(karatblz);
DECLARE_VIDEO_START(spinlbrk);
DECLARE_VIDEO_START(turbofrc);
DECLARE_VIDEO_START(wbbc97);
void init_banked_oki();
void init_kickball();
DECLARE_VIDEO_START(pspikes) ATTR_COLD;
DECLARE_VIDEO_START(karatblz) ATTR_COLD;
DECLARE_VIDEO_START(turbofrc) ATTR_COLD;
uint32_t screen_update_pspikes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_aerfboot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_aerfboo2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void aerofgt_register_state_globals( );
void setbank( int layer, int num, int bank );
void aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri );
void pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void wbbc97_draw_bitmap( bitmap_rgb32 &bitmap );
void spinlbrk(machine_config &config);
void aerofgt(machine_config &config);
void karatblz(machine_config &config);
void pspikesb(machine_config &config);
void aerfboo2(machine_config &config);
void pspikes(machine_config &config);
void wbbc97(machine_config &config);
void aerfboot(machine_config &config);
void pspikesc(machine_config &config);
void karatblzbl(machine_config &config);
void spikes91(machine_config &config);
void aerofgtb(machine_config &config);
void turbofrc(machine_config &config);
void kickball(machine_config &config);
void aerfboo2_map(address_map &map);
void aerfboot_map(address_map &map);
void aerfboot_sound_map(address_map &map);
void aerofgt_map(address_map &map);
void aerofgt_sound_portmap(address_map &map);
void aerofgtb_map(address_map &map);
void karatblz_map(address_map &map);
void karatblzbl_map(address_map &map);
void karatblzbl_sound_map(address_map &map);
void karatblzbl_sound_portmap(address_map &map);
void kickball_map(address_map &map);
void kickball_sound_map(address_map &map);
void kickball_sound_portmap(address_map &map);
void oki_map(address_map &map);
void pspikes_map(address_map &map);
void pspikesb_map(address_map &map);
void pspikesc_map(address_map &map);
void sound_map(address_map &map);
void pspikesb_map(address_map &map) ATTR_COLD;
void pspikesc_map(address_map &map) ATTR_COLD;
void aerfboo2_map(address_map &map) ATTR_COLD;
};
class aerofgt_sound_cpu_state : public aerofgt_state
{
public:
aerofgt_sound_cpu_state(const machine_config &mconfig, device_type type, const char *tag)
: aerofgt_state(mconfig, type, tag)
, m_audiocpu(*this, "audiocpu")
, m_upd7759(*this, "upd")
, m_soundlatch(*this, "soundlatch")
, m_okibank(*this, "okibank")
, m_sprlookuprom(*this, "sprlookuprom")
{
}
void init_banked_oki() ATTR_COLD;
void init_kickball() ATTR_COLD;
void spikes91(machine_config &config) ATTR_COLD;
void kickball(machine_config &config) ATTR_COLD;
void karatblzbl(machine_config &config) ATTR_COLD;
void aerfboot(machine_config &config) ATTR_COLD;
void wbbc97(machine_config &config) ATTR_COLD;
protected:
required_device<cpu_device> m_audiocpu;
optional_device<upd7759_device> m_upd7759; // karatblzbl
required_device<generic_latch_8_device> m_soundlatch;
optional_memory_bank m_okibank;
optional_region_ptr<uint16_t> m_sprlookuprom;
virtual void machine_start() override ATTR_COLD;
DECLARE_VIDEO_START(wbbc97);
uint8_t pending_command_r();
void spinlbrk_flip_screen_w(uint8_t data);
uint32_t aerofgt_ol2_tile_callback(uint32_t code);
uint32_t screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
private:
uint16_t m_spikes91_lookup = 0;
uint16_t m_wbbc97_bitmap_enable = 0;
void spikes91_lookup_w(uint16_t data);
void wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void aerfboot_okim6295_banking_w(uint8_t data);
void karatblzbl_soundlatch_w(uint8_t data);
void karatblzbl_d7759_write_port_0_w(uint8_t data);
void karatblzbl_d7759_reset_w(uint8_t data);
uint32_t screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void spikes91_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void wbbc97_draw_bitmap(bitmap_rgb32 &bitmap);
void spikes91_map(address_map &map);
void spikes91_sound_map(address_map &map);
void spinlbrk_map(address_map &map);
void spinlbrk_sound_portmap(address_map &map);
void turbofrc_map(address_map &map);
void turbofrc_sound_portmap(address_map &map);
void kickball_map(address_map &map);
void karatblzbl_map(address_map &map);
void aerfboot_map(address_map &map);
void aerfboot_sound_map(address_map &map);
void wbbc97_map(address_map &map);
void wbbc97_sound_map(address_map &map);
void karatblzbl_sound_map(address_map &map);
void karatblzbl_sound_portmap(address_map &map);
void kickball_sound_map(address_map &map);
void kickball_sound_portmap(address_map &map);
void spikes91_sound_map(address_map &map);
void oki_map(address_map &map);
};
class aerofgt_banked_sound_state : public aerofgt_sound_cpu_state
{
public:
aerofgt_banked_sound_state(const machine_config &mconfig, device_type type, const char *tag)
: aerofgt_sound_cpu_state(mconfig, type, tag)
, m_soundbank(*this, "soundbank")
{
}
void pspikes(machine_config &config) ATTR_COLD;
void karatblz(machine_config &config) ATTR_COLD;
void spinlbrk(machine_config &config) ATTR_COLD;
void turbofrc(machine_config &config) ATTR_COLD;
void aerofgtb(machine_config &config) ATTR_COLD;
void aerofgt(machine_config &config) ATTR_COLD;
protected:
required_memory_bank m_soundbank;
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
DECLARE_VIDEO_START(spinlbrk);
private:
uint32_t aerofgt_tile_callback( uint32_t code );
uint32_t spinbrk_tile_callback(uint32_t code);
void sh_bankswitch_w(uint8_t data);
uint32_t screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void pspikes_map(address_map &map);
void karatblz_map(address_map &map);
void spinlbrk_map(address_map &map) ATTR_COLD;
void turbofrc_map(address_map &map) ATTR_COLD;
void aerofgtb_map(address_map &map);
void aerofgt_map(address_map &map);
void sound_map(address_map &map);
void spinlbrk_sound_portmap(address_map &map) ATTR_COLD;
void turbofrc_sound_portmap(address_map &map) ATTR_COLD;
void aerofgt_sound_portmap(address_map &map) ATTR_COLD;
};
#endif // MAME_VSYSTEM_AEROFGT_H

View File

@ -77,11 +77,9 @@ VIDEO_START_MEMBER(aerofgt_state,pspikes)
/* no bg2 in this game */
m_sprite_gfx = 1;
m_spikes91_lookup = 0;
m_charpalettebank = 0;
aerofgt_register_state_globals();
save_item(NAME(m_spikes91_lookup));
}
VIDEO_START_MEMBER(aerofgt_state,karatblz)
@ -96,10 +94,10 @@ VIDEO_START_MEMBER(aerofgt_state,karatblz)
aerofgt_register_state_globals();
}
VIDEO_START_MEMBER(aerofgt_state,spinlbrk)
VIDEO_START_MEMBER(aerofgt_banked_sound_state,spinlbrk)
{
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::spinlbrk_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::karatblz_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_banked_sound_state::spinlbrk_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_banked_sound_state::karatblz_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
m_tilemap[1]->set_transparent_pen(15);
@ -126,24 +124,24 @@ VIDEO_START_MEMBER(aerofgt_state,turbofrc)
/* new hw type */
uint32_t aerofgt_state::aerofgt_tile_callback( uint32_t code )
uint32_t aerofgt_banked_sound_state::aerofgt_tile_callback(uint32_t code)
{
return m_sprlookupram[0][code&0x7fff];
}
/* old hw type */
uint32_t aerofgt_state::aerofgt_old_tile_callback( uint32_t code )
uint32_t aerofgt_state::aerofgt_old_tile_callback(uint32_t code)
{
return m_sprlookupram[0][code % (m_sprlookupram[0].bytes()/2)];
}
uint32_t aerofgt_state::aerofgt_ol2_tile_callback( uint32_t code )
uint32_t aerofgt_sound_cpu_state::aerofgt_ol2_tile_callback(uint32_t code)
{
return m_sprlookupram[1][code % (m_sprlookupram[1].bytes()/2)];
}
uint32_t aerofgt_state::spinbrk_tile_callback( uint32_t code )
uint32_t aerofgt_banked_sound_state::spinbrk_tile_callback(uint32_t code)
{
/* enemy sprites use ROM instead of RAM */
return m_sprlookuprom[code % m_sprlookuprom.length()];
@ -221,7 +219,7 @@ void aerofgt_state::pspikes_palette_bank_w(uint8_t data)
m_tilemap[0]->set_flip(m_flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
}
void aerofgt_state::spinlbrk_flip_screen_w(uint8_t data)
void aerofgt_sound_cpu_state::spinlbrk_flip_screen_w(uint8_t data)
{
m_flip_screen = BIT(data, 7);
m_tilemap[0]->set_flip(m_flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
@ -264,7 +262,7 @@ uint32_t aerofgt_state::screen_update_pspikes(screen_device &screen, bitmap_ind1
}
uint32_t aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_sound_cpu_state::screen_update_karatblz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilemap[0]->set_scrollx(0, m_scrollx[0] - 8);
m_tilemap[0]->set_scrolly(0, m_scrolly[0]);
@ -282,16 +280,15 @@ uint32_t aerofgt_state::screen_update_karatblz(screen_device &screen, bitmap_ind
m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen);
m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen);
return 0;
}
uint32_t aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_banked_sound_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
m_tilemap[0]->set_scroll_rows(512);
scrolly = 0;
for (i = 0; i < 256; i++)
int scrolly = 0;
for (int i = 0; i < 256; i++)
m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 8);
// m_tilemap[0]->set_scrolly(0, m_scrolly[0]);
m_tilemap[1]->set_scrollx(0, m_scrollx[1] - 4);
@ -308,16 +305,15 @@ uint32_t aerofgt_state::screen_update_spinlbrk(screen_device &screen, bitmap_ind
m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen);
m_spr_old[1]->turbofrc_draw_sprites(m_spriteram+0x200,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen);
return 0;
}
uint32_t aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_banked_sound_state::screen_update_turbofrc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
m_tilemap[0]->set_scroll_rows(512);
scrolly = m_scrolly[0] + 2;
for (i = 0; i < 256; i++)
int scrolly = m_scrolly[0] + 2;
for (int i = 0; i < 256; i++)
// m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[i] - 11);
m_tilemap[0]->set_scrollx((i + scrolly) & 0x1ff, m_rasterram[7] - 11 - (m_flip_screen ? 188 : 0));
m_tilemap[0]->set_scrolly(0, scrolly - (m_flip_screen ? 2 : 0));
@ -335,10 +331,11 @@ uint32_t aerofgt_state::screen_update_turbofrc(screen_device &screen, bitmap_ind
m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 1, m_flip_screen); //enemy
m_spr_old[0]->turbofrc_draw_sprites(m_spriteram+0x000,m_spriteram.bytes()/2,m_spritepalettebank, bitmap, cliprect, screen.priority(), 0, m_flip_screen); //enemy
return 0;
}
uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_banked_sound_state::screen_update_aerofgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilemap[0]->set_scrollx(0, m_rasterram[0x0000] - 18);
m_tilemap[0]->set_scrolly(0, m_scrolly[0]);
@ -356,6 +353,7 @@ uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind1
m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x02);
m_spr->draw_sprites(m_spriteram, m_spriteram.bytes(), screen, bitmap, cliprect, 0x03, 0x03);
return 0;
}
@ -367,9 +365,9 @@ uint32_t aerofgt_state::screen_update_aerofgt(screen_device &screen, bitmap_ind1
***************************************************************************/
// BOOTLEG
VIDEO_START_MEMBER(aerofgt_state,wbbc97)
VIDEO_START_MEMBER(aerofgt_sound_cpu_state,wbbc97)
{
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_state::get_pspikes_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(aerofgt_sound_cpu_state::get_pspikes_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
/* no bg2 in this game */
m_tilemap[0]->set_transparent_pen(15);
@ -391,13 +389,13 @@ void aerofgt_state::pspikesb_gfxbank_w(offs_t offset, uint16_t data, uint16_t me
}
// BOOTLEG
void aerofgt_state::spikes91_lookup_w(uint16_t data)
void aerofgt_sound_cpu_state::spikes91_lookup_w(uint16_t data)
{
m_spikes91_lookup = data & 1;
}
// BOOTLEG
void aerofgt_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
void aerofgt_sound_cpu_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_wbbc97_bitmap_enable);
}
@ -405,66 +403,59 @@ void aerofgt_state::wbbc97_bitmap_enable_w(offs_t offset, uint16_t data, uint16_
// BOOTLEG
void aerofgt_state::aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, int chip_disabled_pri )
{
int attr_start, base, first;
int base, first;
base = chip * 0x0200;
// first = 4 * m_spriteram[0x1fe + base];
first = 0;
for (attr_start = base + 0x0200 - 4; attr_start >= first + base; attr_start -= 4)
for (int attr_start = base + 0x0200 - 4; attr_start >= first + base; attr_start -= 4)
{
int map_start;
int ox, oy, x, y, xsize, ysize, zoomx, zoomy, flipx, flipy, color, pri;
// some other drivers still use this wrong table, they have to be upgraded
// int zoomtable[16] = { 0,7,14,20,25,30,34,38,42,46,49,52,54,57,59,61 };
if (!(m_spriteram[attr_start + 2] & 0x0080))
continue;
pri = m_spriteram[attr_start + 2] & 0x0010;
const int pri = m_spriteram[attr_start + 2] & 0x0010;
if ( chip_disabled_pri && !pri)
if (chip_disabled_pri && !pri)
continue;
if ((!chip_disabled_pri) && (pri >> 4))
continue;
ox = m_spriteram[attr_start + 1] & 0x01ff;
xsize = (m_spriteram[attr_start + 2] & 0x0700) >> 8;
zoomx = (m_spriteram[attr_start + 1] & 0xf000) >> 12;
oy = m_spriteram[attr_start + 0] & 0x01ff;
ysize = (m_spriteram[attr_start + 2] & 0x7000) >> 12;
zoomy = (m_spriteram[attr_start + 0] & 0xf000) >> 12;
flipx = m_spriteram[attr_start + 2] & 0x0800;
flipy = m_spriteram[attr_start + 2] & 0x8000;
color = (m_spriteram[attr_start + 2] & 0x000f) + 16 * m_spritepalettebank;
const int ox = m_spriteram[attr_start + 1] & 0x01ff;
const int xsize = (m_spriteram[attr_start + 2] & 0x0700) >> 8;
const int zoomx = 32 - ((m_spriteram[attr_start + 1] & 0xf000) >> 12);
const int oy = m_spriteram[attr_start + 0] & 0x01ff;
const int ysize = (m_spriteram[attr_start + 2] & 0x7000) >> 12;
const int zoomy = 32 - ((m_spriteram[attr_start + 0] & 0xf000) >> 12);
const int flipx = m_spriteram[attr_start + 2] & 0x0800;
const int flipy = m_spriteram[attr_start + 2] & 0x8000;
const int color = (m_spriteram[attr_start + 2] & 0x000f) + 16 * m_spritepalettebank;
map_start = m_spriteram[attr_start + 3];
int map_start = m_spriteram[attr_start + 3];
// aerofgt has this adjustment, but doing it here would break turbo force title screen
// ox += (xsize*zoomx+2)/4;
// oy += (ysize*zoomy+2)/4;
// ox += (xsize*(32 - zoomx)+2)/4;
// oy += (ysize*(32 - zoomy)+2)/4;
zoomx = 32 - zoomx;
zoomy = 32 - zoomy;
for (y = 0; y <= ysize; y++)
for (int y = 0; y <= ysize; y++)
{
int sx, sy;
int sy;
if (flipy)
sy = ((oy + zoomy * (ysize - y)/2 + 16) & 0x1ff) - 16;
else
sy = ((oy + zoomy * y / 2 + 16) & 0x1ff) - 16;
for (x = 0; x <= xsize; x++)
for (int x = 0; x <= xsize; x++)
{
int code;
int sx;
if (flipx)
sx = ((ox + zoomx * (xsize - x) / 2 + 16) & 0x1ff) - 16;
else
sx = ((ox + zoomx * x / 2 + 16) & 0x1ff) - 16;
code = m_sprlookupram[chip][map_start % (m_sprlookupram[chip].bytes()/2)];
const int code = m_sprlookupram[chip][map_start % (m_sprlookupram[chip].bytes()/2)];
m_gfxdecode->gfx(m_sprite_gfx + chip)->prio_zoom_transpen(bitmap,cliprect,
code,
@ -487,9 +478,7 @@ void aerofgt_state::aerfboo2_draw_sprites( screen_device &screen, bitmap_ind16 &
// BOOTLEG
void aerofgt_state::pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int i;
for (i = 4; i < m_spriteram.bytes() / 2; i += 4)
for (int i = 4; i < m_spriteram.bytes() / 2; i += 4)
{
int xpos, ypos, color, flipx, flipy, code;
@ -520,12 +509,11 @@ void aerofgt_state::pspikesb_draw_sprites( screen_device &screen, bitmap_ind16 &
}
// BOOTLEG
void aerofgt_state::spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
void aerofgt_sound_cpu_state::spikes91_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int i;
m_spritepalettebank = 1;
for (i = m_spriteram.bytes() / 2 - 4; i >= 4; i -= 4)
for (int i = m_spriteram.bytes() / 2 - 4; i >= 4; i -= 4)
{
int xpos, ypos, color, flipx, flipy, code;
@ -642,16 +630,16 @@ void aerofgt_state::aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 &
}
// BOOTLEG
void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap )
void aerofgt_sound_cpu_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap )
{
int count = 16; // weird, the bitmap doesn't start at 0?
for (int y = 0; y < 256; y++)
for (int x = 0; x < 512; x++)
{
int color = m_bitmapram[count] >> 1;
const int color = m_bitmapram[count] >> 1;
/* data is GRB; convert to RGB */
rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f));
const rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f));
bitmap.pix(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen;
count++;
@ -674,17 +662,14 @@ uint32_t aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind
}
// BOOTLEG
uint32_t aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_sound_cpu_state::screen_update_spikes91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
int y, x;
int count;
gfx_element *gfx = m_gfxdecode->gfx(0);
gfx_element *const gfx = m_gfxdecode->gfx(0);
m_tilemap[0]->set_scroll_rows(256);
scrolly = m_scrolly[0];
const int scrolly = m_scrolly[0];
for (i = 0; i < 256; i++)
for (int i = 0; i < 256; i++)
m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i + 0x01f0 / 2] + 0x96 + 0x16);
m_tilemap[0]->set_scrolly(0, scrolly);
@ -692,10 +677,10 @@ uint32_t aerofgt_state::screen_update_spikes91(screen_device &screen, bitmap_ind
spikes91_draw_sprites(screen, bitmap, cliprect);
/* we could use a tilemap, but it's easier to just do it here */
count = 0;
for (y = 0; y < 32; y++)
int count = 0;
for (int y = 0; y < 32; y++)
{
for (x = 0; x < 64; x++)
for (int x = 0; x < 64; x++)
{
uint16_t tileno = m_tx_tilemap_ram[count] & 0x1fff;
uint16_t colour = m_tx_tilemap_ram[count] & 0xe000;
@ -764,13 +749,11 @@ uint32_t aerofgt_state::screen_update_aerfboo2(screen_device &screen, bitmap_ind
}
// BOOTLEG (still uses original sprite type)
uint32_t aerofgt_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
uint32_t aerofgt_sound_cpu_state::screen_update_wbbc97(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int i, scrolly;
m_tilemap[0]->set_scroll_rows(256);
scrolly = m_scrolly[0];
for (i = 0; i < 256; i++)
const int scrolly = m_scrolly[0];
for (int i = 0; i < 256; i++)
m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i]);
m_tilemap[0]->set_scrolly(0, scrolly);