mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
balsente.cpp: Use 8253 device and clean up names (nw)
This commit is contained in:
parent
00a261513d
commit
a408d66ce3
@ -249,24 +249,24 @@ DIP locations verified for:
|
||||
void balsente_state::cpu1_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x07ff).ram().share("spriteram");
|
||||
map(0x0800, 0x7fff).ram().w(FUNC(balsente_state::balsente_videoram_w)).share("videoram");
|
||||
map(0x8000, 0x8fff).ram().w(FUNC(balsente_state::balsente_paletteram_w)).share("paletteram");
|
||||
map(0x9000, 0x9007).w(FUNC(balsente_state::balsente_adc_select_w));
|
||||
map(0x9400, 0x9401).r(FUNC(balsente_state::balsente_adc_data_r));
|
||||
map(0x0800, 0x7fff).ram().w(FUNC(balsente_state::videoram_w)).share("videoram");
|
||||
map(0x8000, 0x8fff).ram().w(FUNC(balsente_state::paletteram_w)).share("paletteram");
|
||||
map(0x9000, 0x9007).w(FUNC(balsente_state::adc_select_w));
|
||||
map(0x9400, 0x9401).r(FUNC(balsente_state::adc_data_r));
|
||||
map(0x9800, 0x981f).mirror(0x0060).lw8("outlatch_w",
|
||||
[this](address_space &space, offs_t offset, u8 data, u8 mem_mask) {
|
||||
m_outlatch->write_d7(space, offset >> 2, data, mem_mask);
|
||||
});
|
||||
map(0x9880, 0x989f).w(FUNC(balsente_state::balsente_random_reset_w));
|
||||
map(0x98a0, 0x98bf).w(FUNC(balsente_state::balsente_rombank_select_w));
|
||||
map(0x98c0, 0x98df).w(FUNC(balsente_state::balsente_palette_select_w));
|
||||
map(0x9880, 0x989f).w(FUNC(balsente_state::random_reset_w));
|
||||
map(0x98a0, 0x98bf).w(FUNC(balsente_state::rombank_select_w));
|
||||
map(0x98c0, 0x98df).w(FUNC(balsente_state::palette_select_w));
|
||||
map(0x98e0, 0x98ff).w("watchdog", FUNC(watchdog_timer_device::reset_w));
|
||||
map(0x9900, 0x9900).portr("SWH");
|
||||
map(0x9901, 0x9901).portr("SWG");
|
||||
map(0x9902, 0x9902).portr("IN0");
|
||||
map(0x9903, 0x9903).portr("IN1").nopw();
|
||||
map(0x9a00, 0x9a03).r(FUNC(balsente_state::balsente_random_num_r));
|
||||
map(0x9a04, 0x9a05).rw(FUNC(balsente_state::balsente_m6850_r), FUNC(balsente_state::balsente_m6850_w));
|
||||
map(0x9a00, 0x9a03).r(FUNC(balsente_state::random_num_r));
|
||||
map(0x9a04, 0x9a05).rw(FUNC(balsente_state::m6850_r), FUNC(balsente_state::m6850_w));
|
||||
map(0x9b00, 0x9cff).ram().share("nvram"); /* system+cart NOVRAM */
|
||||
map(0xa000, 0xbfff).bankr("bank1");
|
||||
map(0xc000, 0xffff).bankr("bank2");
|
||||
@ -284,20 +284,20 @@ void balsente_state::cpu2_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x1fff).rom();
|
||||
map(0x2000, 0x5fff).ram();
|
||||
map(0x6000, 0x7fff).w(FUNC(balsente_state::balsente_m6850_sound_w));
|
||||
map(0xe000, 0xffff).r(FUNC(balsente_state::balsente_m6850_sound_r));
|
||||
map(0x6000, 0x7fff).w(FUNC(balsente_state::m6850_sound_w));
|
||||
map(0xe000, 0xffff).r(FUNC(balsente_state::m6850_sound_r));
|
||||
}
|
||||
|
||||
|
||||
void balsente_state::cpu2_io_map(address_map &map)
|
||||
{
|
||||
map.global_mask(0xff);
|
||||
map(0x00, 0x03).rw(FUNC(balsente_state::balsente_counter_8253_r), FUNC(balsente_state::balsente_counter_8253_w));
|
||||
map(0x08, 0x0f).r(FUNC(balsente_state::balsente_counter_state_r));
|
||||
map(0x08, 0x09).w(FUNC(balsente_state::balsente_counter_control_w));
|
||||
map(0x0a, 0x0b).w(FUNC(balsente_state::balsente_dac_data_w));
|
||||
map(0x0c, 0x0d).w(FUNC(balsente_state::balsente_register_addr_w));
|
||||
map(0x0e, 0x0f).w(FUNC(balsente_state::balsente_chip_select_w));
|
||||
map(0x00, 0x03).rw("pit", FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||
map(0x08, 0x0f).r(FUNC(balsente_state::counter_state_r));
|
||||
map(0x08, 0x09).w(FUNC(balsente_state::counter_control_w));
|
||||
map(0x0a, 0x0b).w(FUNC(balsente_state::dac_data_w));
|
||||
map(0x0c, 0x0d).w(FUNC(balsente_state::register_addr_w));
|
||||
map(0x0e, 0x0f).w(FUNC(balsente_state::chip_select_w));
|
||||
}
|
||||
|
||||
|
||||
@ -1295,11 +1295,11 @@ INPUT_PORTS_END
|
||||
MACHINE_CONFIG_START(balsente_state::balsente)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_DEVICE_ADD("maincpu", MC6809E, XTAL(20'000'000)/16) /* xtal verified but not speed */
|
||||
MCFG_DEVICE_ADD("maincpu", MC6809E, 20_MHz_XTAL / 16) /* xtal verified but not speed */
|
||||
MCFG_DEVICE_PROGRAM_MAP(cpu1_map)
|
||||
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", balsente_state, balsente_update_analog_inputs)
|
||||
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", balsente_state, update_analog_inputs)
|
||||
|
||||
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(8'000'000)/2) /* xtal verified but not speed */
|
||||
MCFG_DEVICE_ADD("audiocpu", Z80, 8_MHz_XTAL / 2) /* xtal verified but not speed */
|
||||
MCFG_DEVICE_PROGRAM_MAP(cpu2_map)
|
||||
MCFG_DEVICE_IO_MAP(cpu2_io_map)
|
||||
|
||||
@ -1309,10 +1309,14 @@ MACHINE_CONFIG_START(balsente_state::balsente)
|
||||
|
||||
MCFG_WATCHDOG_ADD("watchdog")
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD("scan_timer", balsente_state, balsente_interrupt_timer)
|
||||
MCFG_TIMER_DRIVER_ADD("8253_0_timer", balsente_state, balsente_clock_counter_0_ff)
|
||||
MCFG_TIMER_DRIVER_ADD("8253_1_timer", balsente_state, balsente_counter_callback)
|
||||
MCFG_TIMER_DRIVER_ADD("8253_2_timer", balsente_state, balsente_counter_callback)
|
||||
MCFG_TIMER_DRIVER_ADD("scan_timer", balsente_state, interrupt_timer)
|
||||
MCFG_TIMER_DRIVER_ADD("8253_0_timer", balsente_state, clock_counter_0_ff)
|
||||
|
||||
MCFG_DEVICE_ADD("pit", PIT8253, 0)
|
||||
MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, balsente_state, counter_0_set_out))
|
||||
MCFG_PIT8253_OUT2_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_IRQ0))
|
||||
MCFG_PIT8253_CLK1(8_MHz_XTAL / 4)
|
||||
MCFG_PIT8253_CLK2(8_MHz_XTAL / 4)
|
||||
|
||||
MCFG_DEVICE_ADD("outlatch", LS259, 0) // U9H
|
||||
// these outputs are generally used to control the various lamps
|
||||
@ -2350,32 +2354,32 @@ void balsente_state::init_toggle() { expand_roms(EXPAND_ALL); config_shooter
|
||||
void balsente_state::init_nametune()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::rombank2_select_w),this));
|
||||
expand_roms(EXPAND_NONE | SWAP_HALVES); config_shooter_adc(false, 0 /* noanalog */);
|
||||
}
|
||||
void balsente_state::init_nstocker()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::rombank2_select_w),this));
|
||||
expand_roms(EXPAND_NONE | SWAP_HALVES); config_shooter_adc(true, 1);
|
||||
}
|
||||
void balsente_state::init_sfootbal()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::rombank2_select_w),this));
|
||||
expand_roms(EXPAND_ALL | SWAP_HALVES); config_shooter_adc(false, 0);
|
||||
}
|
||||
void balsente_state::init_spiker()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
space.install_readwrite_handler(0x9f80, 0x9f8f, read8_delegate(FUNC(balsente_state::spiker_expand_r),this), write8_delegate(FUNC(balsente_state::spiker_expand_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::rombank2_select_w),this));
|
||||
expand_roms(EXPAND_ALL | SWAP_HALVES); config_shooter_adc(false, 1);
|
||||
}
|
||||
void balsente_state::init_stompin()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
|
||||
space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::rombank2_select_w),this));
|
||||
expand_roms(0x0c | SWAP_HALVES); config_shooter_adc(false, 32);
|
||||
}
|
||||
void balsente_state::init_rescraid() { expand_roms(EXPAND_NONE); config_shooter_adc(false, 0 /* noanalog */); }
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "machine/pit8253.h"
|
||||
#include "machine/timer.h"
|
||||
#include "machine/74259.h"
|
||||
#include "sound/cem3394.h"
|
||||
@ -35,28 +36,126 @@ class balsente_state : public driver_device
|
||||
{
|
||||
public:
|
||||
balsente_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_scanline_timer(*this, "scan_timer"),
|
||||
m_counter_0_timer(*this, "8253_0_timer"),
|
||||
m_cem1(*this, "cem1"),
|
||||
m_cem2(*this, "cem2"),
|
||||
m_cem3(*this, "cem3"),
|
||||
m_cem4(*this, "cem4"),
|
||||
m_cem5(*this, "cem5"),
|
||||
m_cem6(*this, "cem6") ,
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_shrike_io(*this, "shrike_io"),
|
||||
m_shrike_shared(*this, "shrike_shared"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_68k(*this, "68k"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_outlatch(*this, "outlatch"),
|
||||
m_generic_paletteram_8(*this, "paletteram") { }
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_scanline_timer(*this, "scan_timer")
|
||||
, m_pit(*this, "pit")
|
||||
, m_counter_0_timer(*this, "8253_0_timer")
|
||||
, m_cem_device(*this, "cem%u", 1U)
|
||||
, m_spriteram(*this, "spriteram")
|
||||
, m_videoram(*this, "videoram")
|
||||
, m_shrike_io(*this, "shrike_io")
|
||||
, m_shrike_shared(*this, "shrike_shared")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_audiocpu(*this, "audiocpu")
|
||||
, m_68k(*this, "68k")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
, m_outlatch(*this, "outlatch")
|
||||
, m_generic_paletteram_8(*this, "paletteram")
|
||||
{ }
|
||||
|
||||
void shrike(machine_config &config);
|
||||
void balsente(machine_config &config);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(nstocker_bits_r);
|
||||
void init_otwalls();
|
||||
void init_triviaes();
|
||||
void init_nstocker();
|
||||
void init_sentetst();
|
||||
void init_rescraid();
|
||||
void init_minigolf();
|
||||
void init_stompin();
|
||||
void init_snakepit();
|
||||
void init_spiker();
|
||||
void init_hattrick();
|
||||
void init_teamht();
|
||||
void init_toggle();
|
||||
void init_snakjack();
|
||||
void init_grudge();
|
||||
void init_sfootbal();
|
||||
void init_triviag2();
|
||||
void init_cshift();
|
||||
void init_gimeabrk();
|
||||
void init_stocker();
|
||||
void init_triviag1();
|
||||
void init_shrike();
|
||||
void init_minigolf2();
|
||||
void init_nametune();
|
||||
void init_gghost();
|
||||
|
||||
private:
|
||||
DECLARE_WRITE8_MEMBER(random_reset_w);
|
||||
DECLARE_READ8_MEMBER(random_num_r);
|
||||
DECLARE_WRITE8_MEMBER(rombank_select_w);
|
||||
DECLARE_WRITE8_MEMBER(rombank2_select_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out0_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out1_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out3_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out4_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out5_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out6_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(nvrecall_w);
|
||||
DECLARE_READ8_MEMBER(m6850_r);
|
||||
DECLARE_WRITE8_MEMBER(m6850_w);
|
||||
DECLARE_READ8_MEMBER(m6850_sound_r);
|
||||
DECLARE_WRITE8_MEMBER(m6850_sound_w);
|
||||
DECLARE_READ8_MEMBER(adc_data_r);
|
||||
DECLARE_WRITE8_MEMBER(adc_select_w);
|
||||
DECLARE_READ8_MEMBER(counter_state_r);
|
||||
DECLARE_WRITE8_MEMBER(counter_control_w);
|
||||
DECLARE_WRITE8_MEMBER(chip_select_w);
|
||||
DECLARE_WRITE8_MEMBER(dac_data_w);
|
||||
DECLARE_WRITE8_MEMBER(register_addr_w);
|
||||
DECLARE_WRITE8_MEMBER(spiker_expand_w);
|
||||
DECLARE_READ8_MEMBER(spiker_expand_r);
|
||||
DECLARE_READ8_MEMBER(grudge_steering_r);
|
||||
DECLARE_READ8_MEMBER(shrike_shared_6809_r);
|
||||
DECLARE_WRITE8_MEMBER(shrike_shared_6809_w);
|
||||
DECLARE_WRITE16_MEMBER(shrike_io_68k_w);
|
||||
DECLARE_READ16_MEMBER(shrike_io_68k_r);
|
||||
DECLARE_READ8_MEMBER(teamht_extra_r);
|
||||
DECLARE_WRITE8_MEMBER(teamht_multiplex_select_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(counter_0_set_out);
|
||||
|
||||
void update_counter_0_timer();
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(palette_select_w);
|
||||
DECLARE_WRITE8_MEMBER(paletteram_w);
|
||||
DECLARE_WRITE8_MEMBER(shrike_sprite_select_w);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_balsente(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(update_analog_inputs);
|
||||
TIMER_CALLBACK_MEMBER(irq_off);
|
||||
TIMER_CALLBACK_MEMBER(m6850_data_ready_callback);
|
||||
TIMER_CALLBACK_MEMBER(m6850_w_callback);
|
||||
TIMER_CALLBACK_MEMBER(adc_finished);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(interrupt_timer);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(clock_counter_0_ff);
|
||||
void draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *sprite);
|
||||
void poly17_init();
|
||||
void m6850_update_io();
|
||||
DECLARE_WRITE_LINE_MEMBER(set_counter_0_ff);
|
||||
void update_grudge_steering();
|
||||
void expand_roms(uint8_t cd_rom_mask);
|
||||
inline void config_shooter_adc(uint8_t shooter, uint8_t adc_shift);
|
||||
inline void noise_gen_chip(int chip, int count, short *buffer);
|
||||
CEM3394_EXT_INPUT(noise_gen_0);
|
||||
CEM3394_EXT_INPUT(noise_gen_1);
|
||||
CEM3394_EXT_INPUT(noise_gen_2);
|
||||
CEM3394_EXT_INPUT(noise_gen_3);
|
||||
CEM3394_EXT_INPUT(noise_gen_4);
|
||||
CEM3394_EXT_INPUT(noise_gen_5);
|
||||
|
||||
void cpu1_map(address_map &map);
|
||||
void cpu2_io_map(address_map &map);
|
||||
void cpu2_map(address_map &map);
|
||||
void shrike68k_map(address_map &map);
|
||||
|
||||
required_device<timer_device> m_scanline_timer;
|
||||
required_device<pit8253_device> m_pit;
|
||||
|
||||
/* global data */
|
||||
uint8_t m_shooter;
|
||||
@ -64,26 +163,12 @@ public:
|
||||
uint8_t m_shooter_y;
|
||||
uint8_t m_adc_shift;
|
||||
|
||||
/* 8253 counter state */
|
||||
struct
|
||||
{
|
||||
timer_device *timer;
|
||||
uint8_t timer_active;
|
||||
int32_t initial;
|
||||
int32_t count;
|
||||
uint8_t gate;
|
||||
uint8_t out;
|
||||
uint8_t mode;
|
||||
uint8_t readbyte;
|
||||
uint8_t writebyte;
|
||||
} m_counter[3];
|
||||
|
||||
|
||||
/* manually clocked counter 0 states */
|
||||
uint8_t m_counter_control;
|
||||
uint8_t m_counter_0_ff;
|
||||
bool m_counter_0_ff;
|
||||
bool m_counter_0_out;
|
||||
required_device<timer_device> m_counter_0_timer;
|
||||
uint8_t m_counter_0_timer_active;
|
||||
bool m_counter_0_timer_active;
|
||||
|
||||
/* random number generator states */
|
||||
uint8_t m_poly17[POLY17_SIZE + 1];
|
||||
@ -113,13 +198,7 @@ public:
|
||||
|
||||
/* noise generator states */
|
||||
uint32_t m_noise_position[6];
|
||||
required_device<cem3394_device> m_cem1;
|
||||
required_device<cem3394_device> m_cem2;
|
||||
required_device<cem3394_device> m_cem3;
|
||||
required_device<cem3394_device> m_cem4;
|
||||
required_device<cem3394_device> m_cem5;
|
||||
required_device<cem3394_device> m_cem6;
|
||||
cem3394_device *m_cem_device[6];
|
||||
required_device_array<cem3394_device, 6> m_cem_device;
|
||||
|
||||
/* game-specific states */
|
||||
uint8_t m_nstocker_bits;
|
||||
@ -142,103 +221,6 @@ public:
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
optional_shared_ptr<uint16_t> m_shrike_io;
|
||||
optional_shared_ptr<uint16_t> m_shrike_shared;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(balsente_random_reset_w);
|
||||
DECLARE_READ8_MEMBER(balsente_random_num_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_rombank_select_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_rombank2_select_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out0_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out1_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out2_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out3_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out4_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out5_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(out6_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(nvrecall_w);
|
||||
DECLARE_READ8_MEMBER(balsente_m6850_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_m6850_w);
|
||||
DECLARE_READ8_MEMBER(balsente_m6850_sound_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_m6850_sound_w);
|
||||
DECLARE_READ8_MEMBER(balsente_adc_data_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_adc_select_w);
|
||||
DECLARE_READ8_MEMBER(balsente_counter_8253_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_counter_8253_w);
|
||||
DECLARE_READ8_MEMBER(balsente_counter_state_r);
|
||||
DECLARE_WRITE8_MEMBER(balsente_counter_control_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_chip_select_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_dac_data_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_register_addr_w);
|
||||
DECLARE_WRITE8_MEMBER(spiker_expand_w);
|
||||
DECLARE_READ8_MEMBER(spiker_expand_r);
|
||||
DECLARE_READ8_MEMBER(grudge_steering_r);
|
||||
DECLARE_READ8_MEMBER(shrike_shared_6809_r);
|
||||
DECLARE_WRITE8_MEMBER(shrike_shared_6809_w);
|
||||
DECLARE_WRITE16_MEMBER(shrike_io_68k_w);
|
||||
DECLARE_READ16_MEMBER(shrike_io_68k_r);
|
||||
DECLARE_READ8_MEMBER(teamht_extra_r);
|
||||
DECLARE_WRITE8_MEMBER(teamht_multiplex_select_w);
|
||||
|
||||
void counter_set_out(int which, int out);
|
||||
void counter_start(int which);
|
||||
void counter_stop( int which);
|
||||
void counter_update_count(int which);
|
||||
void counter_set_gate(int which, int gate);
|
||||
void update_counter_0_timer();
|
||||
DECLARE_WRITE8_MEMBER(balsente_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_palette_select_w);
|
||||
DECLARE_WRITE8_MEMBER(balsente_paletteram_w);
|
||||
DECLARE_WRITE8_MEMBER(shrike_sprite_select_w);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(nstocker_bits_r);
|
||||
void init_otwalls();
|
||||
void init_triviaes();
|
||||
void init_nstocker();
|
||||
void init_sentetst();
|
||||
void init_rescraid();
|
||||
void init_minigolf();
|
||||
void init_stompin();
|
||||
void init_snakepit();
|
||||
void init_spiker();
|
||||
void init_hattrick();
|
||||
void init_teamht();
|
||||
void init_toggle();
|
||||
void init_snakjack();
|
||||
void init_grudge();
|
||||
void init_sfootbal();
|
||||
void init_triviag2();
|
||||
void init_cshift();
|
||||
void init_gimeabrk();
|
||||
void init_stocker();
|
||||
void init_triviag1();
|
||||
void init_shrike();
|
||||
void init_minigolf2();
|
||||
void init_nametune();
|
||||
void init_gghost();
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_balsente(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(balsente_update_analog_inputs);
|
||||
TIMER_CALLBACK_MEMBER(irq_off);
|
||||
TIMER_CALLBACK_MEMBER(m6850_data_ready_callback);
|
||||
TIMER_CALLBACK_MEMBER(m6850_w_callback);
|
||||
TIMER_CALLBACK_MEMBER(adc_finished);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_interrupt_timer);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_counter_callback);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_clock_counter_0_ff);
|
||||
void draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *sprite);
|
||||
void poly17_init();
|
||||
void m6850_update_io();
|
||||
void set_counter_0_ff(timer_device &timer, int newstate);
|
||||
void update_grudge_steering();
|
||||
void expand_roms(uint8_t cd_rom_mask);
|
||||
inline void config_shooter_adc(uint8_t shooter, uint8_t adc_shift);
|
||||
inline void noise_gen_chip(int chip, int count, short *buffer);
|
||||
CEM3394_EXT_INPUT(noise_gen_0);
|
||||
CEM3394_EXT_INPUT(noise_gen_1);
|
||||
CEM3394_EXT_INPUT(noise_gen_2);
|
||||
CEM3394_EXT_INPUT(noise_gen_3);
|
||||
CEM3394_EXT_INPUT(noise_gen_4);
|
||||
CEM3394_EXT_INPUT(noise_gen_5);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<cpu_device> m_68k;
|
||||
@ -246,12 +228,6 @@ public:
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<ls259_device> m_outlatch;
|
||||
required_shared_ptr<uint8_t> m_generic_paletteram_8;
|
||||
void shrike(machine_config &config);
|
||||
void balsente(machine_config &config);
|
||||
void cpu1_map(address_map &map);
|
||||
void cpu2_io_map(address_map &map);
|
||||
void cpu2_map(address_map &map);
|
||||
void shrike68k_map(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ TIMER_CALLBACK_MEMBER(balsente_state::irq_off)
|
||||
}
|
||||
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::balsente_interrupt_timer)
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::interrupt_timer)
|
||||
{
|
||||
/* next interrupt after scanline 256 is scanline 64 */
|
||||
if (param == 256)
|
||||
@ -69,33 +69,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::balsente_interrupt_timer)
|
||||
|
||||
void balsente_state::machine_start()
|
||||
{
|
||||
int i;
|
||||
|
||||
m_cem_device[0] = m_cem1;
|
||||
m_cem_device[1] = m_cem2;
|
||||
m_cem_device[2] = m_cem3;
|
||||
m_cem_device[3] = m_cem4;
|
||||
m_cem_device[4] = m_cem5;
|
||||
m_cem_device[5] = m_cem6;
|
||||
|
||||
/* create the polynomial tables */
|
||||
poly17_init();
|
||||
|
||||
/* register for saving */
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
save_item(m_counter[i].timer_active, "8253counter[i].timer_active", i);
|
||||
save_item(m_counter[i].initial, "8253counter[i].initial", i);
|
||||
save_item(m_counter[i].count, "8253counter[i].count", i);
|
||||
save_item(m_counter[i].gate, "8253counter[i].gate", i);
|
||||
save_item(m_counter[i].out, "8253counter[i].out", i);
|
||||
save_item(m_counter[i].mode, "8253counter[i].mode", i);
|
||||
save_item(m_counter[i].readbyte, "8253counter[i].readbyte", i);
|
||||
save_item(m_counter[i].writebyte, "8253counter[i].writebyte", i);
|
||||
}
|
||||
|
||||
save_item(NAME(m_counter_control));
|
||||
save_item(NAME(m_counter_0_ff));
|
||||
save_item(NAME(m_counter_0_out));
|
||||
save_item(NAME(m_counter_0_timer_active));
|
||||
|
||||
save_item(NAME(m_analog_input_data));
|
||||
@ -132,16 +111,11 @@ void balsente_state::machine_reset()
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
int numbanks;
|
||||
|
||||
/* reset counters; counter 2's gate is tied high */
|
||||
memset(m_counter, 0, sizeof(m_counter));
|
||||
m_counter[1].timer = machine().device<timer_device>("8253_1_timer");
|
||||
m_counter[2].timer = machine().device<timer_device>("8253_2_timer");
|
||||
m_counter[2].gate = 1;
|
||||
|
||||
/* reset the manual counter 0 clock */
|
||||
m_counter_control = 0x00;
|
||||
m_counter_0_ff = 0;
|
||||
m_counter_0_timer_active = 0;
|
||||
m_counter_0_ff = false;
|
||||
m_counter_0_out = false;
|
||||
m_counter_0_timer_active = false;
|
||||
|
||||
/* reset the ADC states */
|
||||
m_adc_value = 0;
|
||||
@ -155,8 +129,8 @@ void balsente_state::machine_reset()
|
||||
m_grudge_steering_result = 0;
|
||||
|
||||
/* reset the 6850 chips */
|
||||
balsente_m6850_w(space, 0, 3);
|
||||
balsente_m6850_sound_w(space, 0, 3);
|
||||
m6850_w(space, 0, 3);
|
||||
m6850_sound_w(space, 0, 3);
|
||||
|
||||
/* reset the noise generator */
|
||||
memset(m_noise_position, 0, sizeof(m_noise_position));
|
||||
@ -236,13 +210,13 @@ CEM3394_EXT_INPUT(balsente_state::noise_gen_5) { noise_gen_chip(5, count, buffer
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_random_reset_w)
|
||||
WRITE8_MEMBER(balsente_state::random_reset_w)
|
||||
{
|
||||
/* reset random number generator */
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_random_num_r)
|
||||
READ8_MEMBER(balsente_state::random_num_r)
|
||||
{
|
||||
uint32_t cc;
|
||||
|
||||
@ -262,7 +236,7 @@ READ8_MEMBER(balsente_state::balsente_random_num_r)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_rombank_select_w)
|
||||
WRITE8_MEMBER(balsente_state::rombank_select_w)
|
||||
{
|
||||
/* the bank number comes from bits 4-6 */
|
||||
membank("bank1")->set_entry((data >> 4) & 7);
|
||||
@ -270,7 +244,7 @@ WRITE8_MEMBER(balsente_state::balsente_rombank_select_w)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_rombank2_select_w)
|
||||
WRITE8_MEMBER(balsente_state::rombank2_select_w)
|
||||
{
|
||||
/* Night Stocker and Name that Tune only so far.... */
|
||||
int bank = data & 7;
|
||||
@ -441,7 +415,7 @@ void balsente_state::m6850_update_io()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_m6850_r)
|
||||
READ8_MEMBER(balsente_state::m6850_r)
|
||||
{
|
||||
int result;
|
||||
|
||||
@ -486,7 +460,7 @@ TIMER_CALLBACK_MEMBER(balsente_state::m6850_w_callback)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_m6850_w)
|
||||
WRITE8_MEMBER(balsente_state::m6850_w)
|
||||
{
|
||||
/* control register is at offset 0 */
|
||||
if (offset == 0)
|
||||
@ -510,7 +484,7 @@ WRITE8_MEMBER(balsente_state::balsente_m6850_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_m6850_sound_r)
|
||||
READ8_MEMBER(balsente_state::m6850_sound_r)
|
||||
{
|
||||
int result;
|
||||
|
||||
@ -534,7 +508,7 @@ READ8_MEMBER(balsente_state::balsente_m6850_sound_r)
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_m6850_sound_w)
|
||||
WRITE8_MEMBER(balsente_state::m6850_sound_w)
|
||||
{
|
||||
/* control register is at offset 0 */
|
||||
if (offset == 0)
|
||||
@ -559,7 +533,7 @@ WRITE8_MEMBER(balsente_state::balsente_m6850_sound_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INTERRUPT_GEN_MEMBER(balsente_state::balsente_update_analog_inputs)
|
||||
INTERRUPT_GEN_MEMBER(balsente_state::update_analog_inputs)
|
||||
{
|
||||
int i;
|
||||
static const char *const analog[] = { "AN0", "AN1", "AN2", "AN3" };
|
||||
@ -607,14 +581,14 @@ TIMER_CALLBACK_MEMBER(balsente_state::adc_finished)
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_adc_data_r)
|
||||
READ8_MEMBER(balsente_state::adc_data_r)
|
||||
{
|
||||
/* just return the last value read */
|
||||
return m_adc_value;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_adc_select_w)
|
||||
WRITE8_MEMBER(balsente_state::adc_select_w)
|
||||
{
|
||||
/* set a timer to go off and read the value after 50us */
|
||||
/* it's important that we do this for Mini Golf */
|
||||
@ -647,230 +621,6 @@ WRITE8_MEMBER(balsente_state::teamht_multiplex_select_w)
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* 8253-5 timer utilities
|
||||
*
|
||||
* NOTE: this is far from complete!
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void balsente_state::counter_start(int which)
|
||||
{
|
||||
/* don't start a timer for channel 0; it is clocked manually */
|
||||
if (which != 0)
|
||||
{
|
||||
/* only start a timer if we're gated and there is none already */
|
||||
if (m_counter[which].gate && !m_counter[which].timer_active)
|
||||
{
|
||||
m_counter[which].timer_active = 1;
|
||||
m_counter[which].timer->adjust(attotime::from_hz(2000000) * m_counter[which].count, which);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void balsente_state::counter_stop( int which)
|
||||
{
|
||||
/* only stop the timer if it exists */
|
||||
if (m_counter[which].timer_active)
|
||||
m_counter[which].timer->reset();
|
||||
m_counter[which].timer_active = 0;
|
||||
}
|
||||
|
||||
|
||||
void balsente_state::counter_update_count(int which)
|
||||
{
|
||||
/* only update if the timer is running */
|
||||
if (m_counter[which].timer_active)
|
||||
{
|
||||
/* determine how many 2MHz cycles are remaining */
|
||||
int count = (m_counter[which].timer->time_left() * 2000000).as_double();
|
||||
m_counter[which].count = (count < 0) ? 0 : count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* 8253-5 timer internals
|
||||
*
|
||||
* NOTE: this is far from complete!
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void balsente_state::counter_set_gate(int which, int gate)
|
||||
{
|
||||
int oldgate = m_counter[which].gate;
|
||||
|
||||
/* remember the gate state */
|
||||
m_counter[which].gate = gate;
|
||||
|
||||
/* if the counter is being halted, update the count and remove the system timer */
|
||||
if (!gate && oldgate)
|
||||
{
|
||||
counter_update_count(which);
|
||||
counter_stop(which);
|
||||
}
|
||||
|
||||
/* if the counter is being started, create the timer */
|
||||
else if (gate && !oldgate)
|
||||
{
|
||||
/* mode 1 waits for the gate to trigger the counter */
|
||||
if (m_counter[which].mode == 1)
|
||||
{
|
||||
counter_set_out(which, 0);
|
||||
|
||||
/* add one to the count; technically, OUT goes low on the next clock pulse */
|
||||
/* and then starts counting down; it's important that we don't count the first one */
|
||||
m_counter[which].count = m_counter[which].initial + 1;
|
||||
}
|
||||
|
||||
/* start the counter */
|
||||
counter_start(which);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void balsente_state::counter_set_out(int which, int out)
|
||||
{
|
||||
/* OUT on counter 2 is hooked to the /INT line on the Z80 */
|
||||
if (which == 2)
|
||||
m_audiocpu->set_input_line(0, out ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
/* OUT on counter 0 is hooked to the GATE line on counter 1 */
|
||||
else if (which == 0)
|
||||
counter_set_gate(1, !out);
|
||||
|
||||
/* remember the out state */
|
||||
m_counter[which].out = out;
|
||||
}
|
||||
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::balsente_counter_callback)
|
||||
{
|
||||
/* reset the counter and the count */
|
||||
m_counter[param].timer_active = 0;
|
||||
m_counter[param].count = 0;
|
||||
|
||||
/* set the state of the OUT line */
|
||||
/* mode 0 and 1: when firing, transition OUT to high */
|
||||
if (m_counter[param].mode == 0 || m_counter[param].mode == 1)
|
||||
counter_set_out(param, 1);
|
||||
|
||||
/* no other modes handled currently */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* 8253-5 timer handlers
|
||||
*
|
||||
* NOTE: this is far from complete!
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_counter_8253_r)
|
||||
{
|
||||
int which;
|
||||
|
||||
switch (offset & 3)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
/* warning: assumes LSB/MSB addressing and no latching! */
|
||||
which = offset & 3;
|
||||
|
||||
/* update the count */
|
||||
counter_update_count(which);
|
||||
|
||||
/* return the LSB */
|
||||
if (m_counter[which].readbyte == 0)
|
||||
{
|
||||
m_counter[which].readbyte = 1;
|
||||
return m_counter[which].count & 0xff;
|
||||
}
|
||||
|
||||
/* write the MSB and reset the counter */
|
||||
else
|
||||
{
|
||||
m_counter[which].readbyte = 0;
|
||||
return (m_counter[which].count >> 8) & 0xff;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_counter_8253_w)
|
||||
{
|
||||
int which;
|
||||
|
||||
switch (offset & 3)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
/* warning: assumes LSB/MSB addressing and no latching! */
|
||||
which = offset & 3;
|
||||
|
||||
/* if the counter is in mode 0, a write here will reset the OUT state */
|
||||
if (m_counter[which].mode == 0)
|
||||
counter_set_out(which, 0);
|
||||
|
||||
/* write the LSB */
|
||||
if (m_counter[which].writebyte == 0)
|
||||
{
|
||||
m_counter[which].count = (m_counter[which].count & 0xff00) | (data & 0x00ff);
|
||||
m_counter[which].initial = (m_counter[which].initial & 0xff00) | (data & 0x00ff);
|
||||
m_counter[which].writebyte = 1;
|
||||
}
|
||||
|
||||
/* write the MSB and reset the counter */
|
||||
else
|
||||
{
|
||||
m_counter[which].count = (m_counter[which].count & 0x00ff) | ((data << 8) & 0xff00);
|
||||
m_counter[which].initial = (m_counter[which].initial & 0x00ff) | ((data << 8) & 0xff00);
|
||||
m_counter[which].writebyte = 0;
|
||||
|
||||
/* treat 0 as $10000 */
|
||||
if (m_counter[which].count == 0) m_counter[which].count = m_counter[which].initial = 0x10000;
|
||||
|
||||
/* remove any old timer and set a new one */
|
||||
counter_stop(which);
|
||||
|
||||
/* note that in mode 1, we have to wait for a rising edge of a gate */
|
||||
if (m_counter[which].mode == 0)
|
||||
counter_start(which);
|
||||
|
||||
/* if the counter is in mode 1, a write here will set the OUT state */
|
||||
if (m_counter[which].mode == 1)
|
||||
counter_set_out(which, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* determine which counter */
|
||||
which = data >> 6;
|
||||
if (which == 3) break;
|
||||
|
||||
/* if the counter was in mode 0, a write here will reset the OUT state */
|
||||
if (((m_counter[which].mode >> 1) & 7) == 0)
|
||||
counter_set_out(which, 0);
|
||||
|
||||
/* set the mode */
|
||||
m_counter[which].mode = (data >> 1) & 7;
|
||||
|
||||
/* if the counter is in mode 0, a write here will reset the OUT state */
|
||||
if (m_counter[which].mode == 0)
|
||||
counter_set_out(which, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -879,29 +629,30 @@ WRITE8_MEMBER(balsente_state::balsente_counter_8253_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void balsente_state::set_counter_0_ff(timer_device &timer, int newstate)
|
||||
WRITE_LINE_MEMBER(balsente_state::counter_0_set_out)
|
||||
{
|
||||
/* the flip/flop output is inverted, so if we went high to low, that's a clock */
|
||||
if (m_counter_0_ff && !newstate)
|
||||
{
|
||||
/* only count if gated and non-zero */
|
||||
if (m_counter[0].count > 0 && m_counter[0].gate)
|
||||
{
|
||||
m_counter[0].count--;
|
||||
if (m_counter[0].count == 0)
|
||||
balsente_counter_callback(timer, nullptr, 0);
|
||||
}
|
||||
}
|
||||
/* OUT on counter 0 is hooked to the GATE line on counter 1 through an inverter */
|
||||
m_pit->write_gate1(!state);
|
||||
|
||||
/* remember the new state */
|
||||
m_counter_0_ff = newstate;
|
||||
/* remember the out state */
|
||||
m_counter_0_out = state;
|
||||
}
|
||||
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::balsente_clock_counter_0_ff)
|
||||
WRITE_LINE_MEMBER(balsente_state::set_counter_0_ff)
|
||||
{
|
||||
/* the flip/flop output is inverted, so if we went high to low, that's a clock */
|
||||
m_pit->write_clk0(!state);
|
||||
|
||||
/* remember the new state */
|
||||
m_counter_0_ff = state;
|
||||
}
|
||||
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(balsente_state::clock_counter_0_ff)
|
||||
{
|
||||
/* clock the D value through the flip-flop */
|
||||
set_counter_0_ff(timer, (m_counter_control >> 3) & 1);
|
||||
set_counter_0_ff(BIT(m_counter_control, 3));
|
||||
}
|
||||
|
||||
|
||||
@ -913,7 +664,7 @@ void balsente_state::update_counter_0_timer()
|
||||
/* if there's already a timer, remove it */
|
||||
if (m_counter_0_timer_active)
|
||||
m_counter_0_timer->reset();
|
||||
m_counter_0_timer_active = 0;
|
||||
m_counter_0_timer_active = false;
|
||||
|
||||
/* find the counter with the maximum frequency */
|
||||
/* this is used to calibrate the timers at startup */
|
||||
@ -936,7 +687,7 @@ void balsente_state::update_counter_0_timer()
|
||||
/* reprime the timer */
|
||||
if (maxfreq > 0.0)
|
||||
{
|
||||
m_counter_0_timer_active = 1;
|
||||
m_counter_0_timer_active = true;
|
||||
m_counter_0_timer->adjust(attotime::from_hz(maxfreq), 0, attotime::from_hz(maxfreq));
|
||||
}
|
||||
}
|
||||
@ -949,19 +700,19 @@ void balsente_state::update_counter_0_timer()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER(balsente_state::balsente_counter_state_r)
|
||||
READ8_MEMBER(balsente_state::counter_state_r)
|
||||
{
|
||||
/* bit D0 is the inverse of the flip-flop state */
|
||||
int result = !m_counter_0_ff;
|
||||
|
||||
/* bit D1 is the OUT value from counter 0 */
|
||||
if (m_counter[0].out) result |= 0x02;
|
||||
if (m_counter_0_out) result |= 0x02;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_counter_control_w)
|
||||
WRITE8_MEMBER(balsente_state::counter_control_w)
|
||||
{
|
||||
uint8_t diff_counter_control = m_counter_control ^ data;
|
||||
|
||||
@ -969,32 +720,37 @@ WRITE8_MEMBER(balsente_state::balsente_counter_control_w)
|
||||
m_counter_control = data;
|
||||
|
||||
/* bit D0 enables/disables audio */
|
||||
if (diff_counter_control & 0x01)
|
||||
if (BIT(diff_counter_control, 0))
|
||||
{
|
||||
for (auto & elem : m_cem_device)
|
||||
elem->set_output_gain(0, (data & 0x01) ? 1.0 : 0);
|
||||
elem->set_output_gain(0, BIT(data, 0) ? 1.0 : 0);
|
||||
}
|
||||
|
||||
/* bit D1 is hooked to counter 0's gate */
|
||||
/* if we gate on, start a pulsing timer to clock it */
|
||||
if (!m_counter[0].gate && (data & 0x02) && !m_counter_0_timer_active)
|
||||
if (BIT(diff_counter_control, 1))
|
||||
{
|
||||
update_counter_0_timer();
|
||||
/* if we gate on, start a pulsing timer to clock it */
|
||||
if (BIT(data, 1) && !m_counter_0_timer_active)
|
||||
{
|
||||
update_counter_0_timer();
|
||||
}
|
||||
|
||||
/* if we gate off, remove the timer */
|
||||
else if (!BIT(data, 1) && m_counter_0_timer_active)
|
||||
{
|
||||
m_counter_0_timer->reset();
|
||||
m_counter_0_timer_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we gate off, remove the timer */
|
||||
else if (m_counter[0].gate && !(data & 0x02) && m_counter_0_timer_active)
|
||||
{
|
||||
m_counter_0_timer->reset();
|
||||
m_counter_0_timer_active = 0;
|
||||
}
|
||||
|
||||
/* set the actual gate afterwards, since we need to know the old value above */
|
||||
counter_set_gate(0, (data >> 1) & 1);
|
||||
/* set the actual gate */
|
||||
m_pit->write_gate0(BIT(data, 1));
|
||||
|
||||
/* bits D2 and D4 control the clear/reset flags on the flip-flop that feeds counter 0 */
|
||||
if (!(data & 0x04)) set_counter_0_ff(*m_counter_0_timer, 1);
|
||||
if (!(data & 0x10)) set_counter_0_ff(*m_counter_0_timer, 0);
|
||||
if (!BIT(data, 4))
|
||||
set_counter_0_ff(0);
|
||||
else if (!BIT(data, 2))
|
||||
set_counter_0_ff(1);
|
||||
|
||||
/* bit 5 clears the NMI interrupt; recompute the I/O state now */
|
||||
m6850_update_io();
|
||||
@ -1008,7 +764,7 @@ WRITE8_MEMBER(balsente_state::balsente_counter_control_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_chip_select_w)
|
||||
WRITE8_MEMBER(balsente_state::chip_select_w)
|
||||
{
|
||||
static constexpr uint8_t register_map[8] =
|
||||
{
|
||||
@ -1071,7 +827,7 @@ WRITE8_MEMBER(balsente_state::balsente_chip_select_w)
|
||||
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_dac_data_w)
|
||||
WRITE8_MEMBER(balsente_state::dac_data_w)
|
||||
{
|
||||
/* LSB or MSB? */
|
||||
if (offset & 1)
|
||||
@ -1083,13 +839,13 @@ WRITE8_MEMBER(balsente_state::balsente_dac_data_w)
|
||||
if ((m_chip_select & 0x3f) != 0x3f)
|
||||
{
|
||||
uint8_t temp = m_chip_select;
|
||||
balsente_chip_select_w(space, 0, 0x3f);
|
||||
balsente_chip_select_w(space, 0, temp);
|
||||
chip_select_w(space, 0, 0x3f);
|
||||
chip_select_w(space, 0, temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_register_addr_w)
|
||||
WRITE8_MEMBER(balsente_state::register_addr_w)
|
||||
{
|
||||
m_dac_register = data & 7;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void balsente_state::video_start()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_videoram_w)
|
||||
WRITE8_MEMBER(balsente_state::videoram_w)
|
||||
{
|
||||
/* expand the two pixel values into two bytes */
|
||||
m_videoram[offset] = data;
|
||||
@ -59,7 +59,7 @@ WRITE8_MEMBER(balsente_state::balsente_videoram_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_palette_select_w)
|
||||
WRITE8_MEMBER(balsente_state::palette_select_w)
|
||||
{
|
||||
/* only update if changed */
|
||||
if (m_palettebank_vis != (data & 3))
|
||||
@ -80,7 +80,7 @@ WRITE8_MEMBER(balsente_state::balsente_palette_select_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(balsente_state::balsente_paletteram_w)
|
||||
WRITE8_MEMBER(balsente_state::paletteram_w)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user