summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/adb/adbhle.cpp
blob: 369595ef14345b81493da43c4fa81d93b40d71e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// license:BSD-3-Clause
// copyright-holders: Olivier Galibert

// ADB - Apple Desktop Bus
//
// Generic HLE

#include "emu.h"
#include "adbhle.h"

DEFINE_DEVICE_TYPE(ADB_HLE, adb_hle_device, "adbhle", "ADB HLE")

adb_hle_device::adb_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	adb_device(mconfig, ADB_HLE, tag, owner, clock),
	adb_slot_card_interface(mconfig, *this, DEVICE_SELF)
{
}

void adb_hle_device::device_start()
{
	adb_device::device_start();

	save_item(NAME(m_last_state));
	save_item(NAME(m_last_state_time));
}

void adb_hle_device::device_reset()
{
	adb_device::device_reset();
	m_last_state = true;
	m_last_state_time = machine().time();
}

void adb_hle_device::adb_w(int state)
{
	if(m_last_state != state) {
		attotime delta = machine().time() - m_last_state_time;
		u32 dt = delta.as_ticks(1000000);

		logerror("level %d duration %6d us\n", m_last_state, dt);

		m_last_state = state;
		m_last_state_time = machine().time();
	}
}