mirror of
https://github.com/libretro/mame.git
synced 2026-11-07 04:16:06 -10:00
mm1kb: use beep_device for the beeper and remove power switch sample
This commit is contained in:
1 parent
c093bd1d5f
commit
24f5bb810b
5 files changed
+15
-57
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -527,7 +527,7 @@ void mm1_state::common(machine_config &config)
|
||||
I8085A(config, m_maincpu, 6.144_MHz_XTAL);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &mm1_state::mm1_map);
|
||||
m_maincpu->in_sid_func().set(FUNC(mm1_state::dsra_r));
|
||||
m_maincpu->out_sod_func().set(KB_TAG, FUNC(mm1_keyboard_device::bell_w));
|
||||
m_maincpu->out_sod_func().set(KB_TAG, FUNC(mm1_keyboard_device::bell_w)).invert();
|
||||
|
||||
config.set_perfect_quantum(m_maincpu);
|
||||
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "mm1kb.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
#include "utf8.h"
|
||||
|
||||
#include "speaker.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@@ -40,20 +38,6 @@ const tiny_rom_entry *mm1_keyboard_device::device_rom_region() const
|
||||
return ROM_NAME( mm1_keyboard );
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// sampled sounds from MM1 keyboard beeper
|
||||
//-------------------------------------------------
|
||||
|
||||
static const char *const mm1_kb_sample_names[] =
|
||||
{
|
||||
"*MM1_keyboard",
|
||||
"beep", // beep at 2.6 kHz
|
||||
"power_switch", // not actually on the keyboard, but close enough :)
|
||||
nullptr
|
||||
};
|
||||
|
||||
bool mm1_keyboard_device::first_time = true;
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
@@ -61,10 +45,8 @@ bool mm1_keyboard_device::first_time = true;
|
||||
void mm1_keyboard_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SAMPLES(config, m_samples);
|
||||
m_samples->set_channels(2);
|
||||
m_samples->set_samples_names(mm1_kb_sample_names);
|
||||
m_samples->add_route(ALL_OUTPUTS, "mono", 0.7);
|
||||
BEEP(config, m_beeper, 2600);
|
||||
m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +108,7 @@ INPUT_PORTS_START( mm1_keyboard )
|
||||
PORT_START("Y5")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') PORT_CHAR('?')
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(U'´','\'') PORT_CHAR('`')
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2196") // ↖
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2196") // U+2196 = ↖
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':')
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
||||
@@ -136,17 +118,17 @@ INPUT_PORTS_START( mm1_keyboard )
|
||||
PORT_START("Y6")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('<') PORT_CHAR('>')
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2190") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) // U+2190 = ←
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('~') PORT_CHAR('^')
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2193") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // U+2193 = ↓
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LF")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('@') PORT_CHAR('*')
|
||||
|
||||
PORT_START("Y7")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2192") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // U+2190 = →
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
|
||||
@@ -156,7 +138,7 @@ INPUT_PORTS_START( mm1_keyboard )
|
||||
PORT_START("Y8")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CAPS LOCK") PORT_CODE(KEYCODE_CAPSLOCK)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(u8"\u2191") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // U+2191 = ↑
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(U'ä') PORT_CHAR(U'Ä')
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
||||
@@ -202,7 +184,7 @@ ioport_constructor mm1_keyboard_device::device_input_ports() const
|
||||
mm1_keyboard_device::mm1_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, MM1_KEYBOARD, tag, owner, clock),
|
||||
m_write_kbst(*this),
|
||||
m_samples(*this, "keyboard_and_chassis_sounds"),
|
||||
m_beeper(*this, "beeper"),
|
||||
m_rom(*this, "keyboard"),
|
||||
m_y(*this, "Y%u", 0),
|
||||
m_special(*this, "SPECIAL"),
|
||||
@@ -222,20 +204,12 @@ void mm1_keyboard_device::device_start()
|
||||
m_scan_timer = timer_alloc(FUNC(mm1_keyboard_device::scan_keyboard), this);
|
||||
m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
|
||||
|
||||
// add notification request for system shut down (to play back the power switch sound once more)
|
||||
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&mm1_keyboard_device::shut_down_mm1, this));
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_sense));
|
||||
save_item(NAME(m_drive));
|
||||
save_item(NAME(m_data));
|
||||
}
|
||||
|
||||
void mm1_keyboard_device::shut_down_mm1()
|
||||
{
|
||||
m_samples->start(1, 1); // pretty useless this, as far as there is no way to delay the shut down process...
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// scan_keyboard
|
||||
//-------------------------------------------------
|
||||
|
||||
+5
-21
@@ -10,8 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "sound/samples.h"
|
||||
#include "sound/beep.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
// ======================> mm1_keyboard_device
|
||||
|
||||
class mm1_keyboard_device : public device_t
|
||||
class mm1_keyboard_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
@@ -30,20 +29,7 @@ public:
|
||||
|
||||
uint8_t read() { return m_data; }
|
||||
|
||||
void bell_w(int state)
|
||||
{
|
||||
if (state == 1)
|
||||
{
|
||||
if (first_time)
|
||||
{
|
||||
m_samples->start(1, 1); // power switch
|
||||
first_time = false;
|
||||
}
|
||||
if (!m_samples->playing(0)) m_samples->start(0, 0); // beep; during boot, the second beep is in real HW very short (just before floppy seeks) but that's NYI
|
||||
}
|
||||
else if (m_samples->playing(0)) m_samples->stop(0); // happens only once during boot, no effect on output
|
||||
}
|
||||
void shut_down_mm1();
|
||||
void bell_w(int state) { m_beeper->set_state(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@@ -59,7 +45,7 @@ protected:
|
||||
private:
|
||||
devcb_write_line m_write_kbst;
|
||||
|
||||
required_device<samples_device> m_samples;
|
||||
required_device<beep_device> m_beeper;
|
||||
required_memory_region m_rom;
|
||||
required_ioport_array<10> m_y;
|
||||
required_ioport m_special;
|
||||
@@ -68,8 +54,7 @@ private:
|
||||
int m_drive;
|
||||
uint8_t m_data;
|
||||
|
||||
static bool first_time; // for power switch sound
|
||||
emu_timer *m_scan_timer; // scan timer
|
||||
emu_timer *m_scan_timer; // scan timer
|
||||
};
|
||||
|
||||
|
||||
@@ -77,5 +62,4 @@ private:
|
||||
DECLARE_DEVICE_TYPE(MM1_KEYBOARD, mm1_keyboard_device)
|
||||
|
||||
|
||||
|
||||
#endif // MAME_NOKIA_MM1KB_H
|
||||
Reference in new issue
Block a user