summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Robbbert <Robbbert@users.noreply.github.com>2019-07-16 21:51:30 +1000
committerGravatarGravatar Robbbert <Robbbert@users.noreply.github.com>2019-07-16 21:51:30 +1000
commit09e733878d74041622d53d1bd51e66ff114607ff (patch) (github)
tree107536408faf46fc57c2e6aa6715f35bda3960bb
parent2d8207f9178b01f45fec6c08ffd35bc7dafa5772 (diff)
downloadmame-09e733878d74041622d53d1bd51e66ff114607ff.tar.bz2
mame-09e733878d74041622d53d1bd51e66ff114607ff.zip
(nw) binbug: fix it so you can save without console going crazy
-rw-r--r--src/mame/drivers/binbug.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mame/drivers/binbug.cpp b/src/mame/drivers/binbug.cpp
index d8d00b8849a..1708f5db5f1 100644
--- a/src/mame/drivers/binbug.cpp
+++ b/src/mame/drivers/binbug.cpp
@@ -41,12 +41,9 @@
Status:
- DG640 is completely emulated, even though BINBUG doesn't use most
of its features.
- - BINBUG works except that the cassette interface isn't the same as
- real hardware. But you can save, and load it back.
ToDo:
- Need dumps of 4.4 and 5.2.
- - Fix cassette
****************************************************************************/
@@ -119,6 +116,9 @@ WRITE8_MEMBER( binbug_state::binbug_ctrl_w )
WRITE_LINE_MEMBER( binbug_state::kansas_w )
{
+ if ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_RECORD)
+ return;
+
u8 twobit = m_cass_data[3] & 15;
if (state)
@@ -145,6 +145,9 @@ TIMER_DEVICE_CALLBACK_MEMBER( binbug_state::kansas_r )
m_cassinbit = 1;
}
+ if ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_PLAY)
+ return;
+
/* cassette - turn 1200/2400Hz to a bit */
uint8_t cass_ws = (m_cass->input() > +0.04) ? 1 : 0;
@@ -165,7 +168,6 @@ READ_LINE_MEMBER( binbug_state::binbug_serial_r )
WRITE_LINE_MEMBER( binbug_state::binbug_serial_w )
{
- m_cassinbit = 1;
m_cassoutbit = state;
}
@@ -470,8 +472,6 @@ ToDo:
- dips
- leds
- need schematic to find out what else is missing
-- cassette
-- ctc / clock
*/
{ color: #a848a8 } /* Literal.String.Other */ .highlight .sr { color: #a848a8 } /* Literal.String.Regex */ .highlight .s1 { color: #b83838 } /* Literal.String.Single */ .highlight .ss { color: #b83838 } /* Literal.String.Symbol */ .highlight .bp { color: #388038; font-style: italic } /* Name.Builtin.Pseudo */ .highlight .fm { color: #b85820 } /* Name.Function.Magic */ .highlight .vc { color: #b04040 } /* Name.Variable.Class */ .highlight .vg { color: #908828 } /* Name.Variable.Global */ .highlight .vi { color: #b04040 } /* Name.Variable.Instance */ .highlight .vm { color: #b85820 } /* Name.Variable.Magic */ .highlight .il { color: #444444 } /* Literal.Number.Integer.Long */
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_MACHINE_NEXTKBD_H
#define MAME_MACHINE_NEXTKBD_H

#pragma once


class nextkbd_device : public device_t {
public:
	nextkbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	auto int_change_wr_callback() { return int_change_cb.bind(); }
	auto int_power_wr_callback() { return int_power_cb.bind(); }
	auto int_nmi_wr_callback() { return int_nmi_cb.bind(); }

	void amap(address_map &map);

	DECLARE_READ8_MEMBER(status_snd_r);
	DECLARE_READ8_MEMBER(status_kms_r);
	DECLARE_READ8_MEMBER(status_dma_r);
	DECLARE_READ8_MEMBER(status_cmd_r);
	DECLARE_READ32_MEMBER(cdata_r);
	DECLARE_READ32_MEMBER(kmdata_r);

	DECLARE_WRITE8_MEMBER(ctrl_snd_w);
	DECLARE_WRITE8_MEMBER(ctrl_kms_w);
	DECLARE_WRITE8_MEMBER(ctrl_dma_w);
	DECLARE_WRITE8_MEMBER(ctrl_cmd_w);
	DECLARE_WRITE32_MEMBER(cdata_w);
	DECLARE_WRITE32_MEMBER(kmdata_w);

	DECLARE_INPUT_CHANGED_MEMBER(update);

protected:
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
	virtual ioport_constructor device_input_ports() const override;

private:
	// Big thanks to the previous emulator for that information
	enum {
		C_SOUND_OUT_ENABLE    = 0x80, // rw
		C_SOUND_OUT_REQUEST   = 0x40, // r
		C_SOUND_OUT_UNDERRUN  = 0x20, // rw
		C_SOUND_IN_ENABLE     = 0x08, // rw
		C_SOUND_IN_REQUEST    = 0x04, // r
		C_SOUND_IN_OVERRUN    = 0x02, // rw
		C_SOUND_WMASK         = 0xaa,

		C_KBD_INTERRUPT       = 0x80, // r
		C_KBD_DATA            = 0x40, // r
		C_KBD_OVERRUN         = 0x20, // rw
		C_KBD_NMI             = 0x10, // rw?
		C_KMS_INTERRUPT       = 0x08, // r
		C_KMS_DATA            = 0x04, // r
		C_KMS_OVERRUN         = 0x02, // rw
		C_KMS_WMASK           = 0x22,

		C_SDMA_OUT_PENDING    = 0x80, // r
		C_SDMA_OUT_RUNNING    = 0x40, // r
		C_CDMA_PENDING        = 0x20, // r
		C_CDMA_RUNNING        = 0x10, // r
		C_KMS_ENABLE          = 0x02, // rw
		C_LOOPBACK            = 0x01, // rw
		C_WMASK               = 0x03,

		D_ERROR               = 0x40000000,
		D_USER                = 0x20000000,
		D_MASTER              = 0x10000000,
		D_SECONDARY           = 0x01000000,
		D_VERSION_OLD         = 0x00000000,
		D_VERSION_NEW         = 0x00010000,
		D_VERSION_DIGITAL     = 0x00020000,

		D_KBD_VALID           = 0x00008000,
		D_KBD_KEYDOWN         = 0x00000080
	};

	enum { FIFO_SIZE = 32 };

	devcb_write_line int_change_cb, int_power_cb, int_nmi_cb;
	required_ioport mousex;
	required_ioport mousey;
	required_ioport mousebtn;

	emu_timer *poll_timer;
	bool nmi_active;

	uint32_t cdata, kmdata, fifo_ir, fifo_iw, fifo_size;
	uint32_t fifo[FIFO_SIZE];
	uint32_t km_address;
	uint32_t prev_mousex, prev_mousey, prev_mousebtn;
	uint16_t modifiers_state;
	uint8_t ctrl_snd, ctrl_kms, ctrl_dma, ctrl_cmd;

	void fifo_push(uint32_t val);
	uint32_t fifo_pop();
	bool fifo_empty() const;

	void update_mouse(bool force_update);
	void send();
	void handle_fifo_command();
	void handle_kbd_command();
	void handle_command();
};

DECLARE_DEVICE_TYPE(NEXTKBD, nextkbd_device)

#endif // MAME_MACHINE_NEXTKBD_H