diff --git a/src/mame/drivers/atari_s2.c b/src/mame/drivers/atari_s2.c index 711b71e7eea..a9be03a9cae 100644 --- a/src/mame/drivers/atari_s2.c +++ b/src/mame/drivers/atari_s2.c @@ -23,8 +23,14 @@ public: m_samples(*this, "samples") { } + DECLARE_WRITE8_HANDLER(sound0_w) { }; + DECLARE_WRITE8_HANDLER(sound1_w) { }; + DECLARE_WRITE8_HANDLER(lamp_w) { }; + DECLARE_WRITE8_HANDLER(sol0_w) { }; + DECLARE_WRITE8_HANDLER(sol1_w) { }; DECLARE_WRITE8_HANDLER(intack_w); - + DECLARE_WRITE8_HANDLER(display_w); + DECLARE_READ8_MEMBER(switch_r); TIMER_DEVICE_CALLBACK_MEMBER(irq); protected: @@ -37,6 +43,7 @@ protected: virtual void machine_reset(); private: UINT8 m_t_c; + UINT8 m_segment[7]; }; @@ -44,51 +51,140 @@ static ADDRESS_MAP_START( atari_s2_map, AS_PROGRAM, 8, atari_s2_state ) ADDRESS_MAP_GLOBAL_MASK(0x3fff) AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x0700) AM_RAM AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x0700) AM_RAM AM_SHARE("nvram") // battery backed - //AM_RANGE(0x1000, 0x1007) AM_MIRROR(0x07F8) AM_READ(sw_r) - //AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x071F) AM_WRITE(sound0_w) - //AM_RANGE(0x1820, 0x1820) AM_MIRROR(0x071F) AM_WRITE(sound1_w) - //AM_RANGE(0x1840, 0x1847) AM_MIRROR(0x0718) AM_WRITE(disp_w) - //AM_RANGE(0x1860, 0x1867) AM_MIRROR(0x0718) AM_WRITE(lamp_w) - //AM_RANGE(0x1880, 0x1880) AM_MIRROR(0x071F) AM_WRITE(sol0_w) - //AM_RANGE(0x18a0, 0x18a7) AM_MIRROR(0x0718) AM_WRITE(sol1_w) + AM_RANGE(0x1000, 0x1007) AM_MIRROR(0x07F8) AM_READ(switch_r) + AM_RANGE(0x1800, 0x1800) AM_MIRROR(0x071F) AM_WRITE(sound0_w) + AM_RANGE(0x1820, 0x1820) AM_MIRROR(0x071F) AM_WRITE(sound1_w) + AM_RANGE(0x1840, 0x1847) AM_MIRROR(0x0718) AM_WRITE(display_w) + AM_RANGE(0x1860, 0x1867) AM_MIRROR(0x0718) AM_WRITE(lamp_w) + AM_RANGE(0x1880, 0x1880) AM_MIRROR(0x071F) AM_WRITE(sol0_w) + AM_RANGE(0x18a0, 0x18a7) AM_MIRROR(0x0718) AM_WRITE(sol1_w) AM_RANGE(0x18c0, 0x18c0) AM_MIRROR(0x071F) AM_WRITE(watchdog_reset_w) AM_RANGE(0x18e0, 0x18e0) AM_MIRROR(0x071F) AM_WRITE(intack_w) - //AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x07FC) AM_READWRITE(dip_r,dip_w) + AM_RANGE(0x2000, 0x2000) AM_MIRROR(0x07FC) AM_READ_PORT("DSW0") + AM_RANGE(0x2001, 0x2001) AM_MIRROR(0x07FC) AM_READ_PORT("DSW1") + AM_RANGE(0x2002, 0x2002) AM_MIRROR(0x07FC) AM_READ_PORT("DSW2") + AM_RANGE(0x2003, 0x2003) AM_MIRROR(0x07FC) AM_READ_PORT("DSW3") AM_RANGE(0x2800, 0x3fff) AM_ROM ADDRESS_MAP_END static INPUT_PORTS_START( atari_s2 ) + // dipswitches still to be described + PORT_START("DSW0") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW1") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW2") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW3") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X0") // 1000 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Test") PORT_CODE(KEYCODE_0) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X1") // 1001 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Q) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X2") // 1002 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_E) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_R) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X3") // 1003 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_O) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X4") // 1004 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_J) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_K) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X5") // 1005 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X6") // 1006 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("X7") // 1007 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_V) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_B) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END +WRITE8_MEMBER( atari_s2_state::display_w ) +{ + static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0, 0, 0, 0, 0, 0 }; // 4511 + if (offset<7) + m_segment[offset] = patterns[data&15]; + else + { + data &= 7; + for (UINT8 i = 0; i < 7; i++) + output_set_digit_value(i * 10 + data, m_segment[i]); + } +} + WRITE8_MEMBER( atari_s2_state::intack_w ) { m_maincpu->set_input_line(M6800_IRQ_LINE, CLEAR_LINE); } +READ8_MEMBER( atari_s2_state::switch_r ) +{ + char kbdrow[8]; + sprintf(kbdrow,"X%X",offset); + return ioport(kbdrow)->read(); +} + TIMER_DEVICE_CALLBACK_MEMBER( atari_s2_state::irq ) { -// static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0, 0, 0, 0, 0, 0 }; // 4511 -// m_bit6++; if (m_t_c > 0x40) m_maincpu->set_input_line(M6800_IRQ_LINE, HOLD_LINE); else m_t_c++; - -// m_out_offs++; -// m_out_offs &= 0x1f; -// if ((m_out_offs & 3) == 3) -// { -// // Player number -// char wordnum[8]; -// sprintf(wordnum,"text%d",m_out_offs>>2); -// output_set_value(wordnum, !BIT(patterns[m_p_ram[m_out_offs]&15], 6)); // uses 'g' segment -// } -// else -// { -// // Digits -// output_set_digit_value(m_out_offs << 1, patterns[m_p_ram[m_out_offs]>>4]); -// output_set_digit_value((m_out_offs << 1)+1, patterns[m_p_ram[m_out_offs]&15]); -// } } void atari_s2_state::machine_reset() diff --git a/src/mame/layout/atari_s2.lay b/src/mame/layout/atari_s2.lay index 0ffde5da27b..3d422e31523 100644 --- a/src/mame/layout/atari_s2.lay +++ b/src/mame/layout/atari_s2.lay @@ -34,102 +34,102 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +