summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/vecstream.h
blob: 1af7dd0cd860d9753b07360c412e951b0c2496f6 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/***************************************************************************

    vecstream.h

    streams with vector storage

    These types are useful if you want a persistent buffer for formatted
    text and you need to use it like a character array or character
    pointer, as you get read-only access to it without copying.  The
    storage is always guaranteed to be contiguous.  Writing to the
    stream may invalidate pointers to storage.

***************************************************************************/

#ifndef MAME_UTIL_VECSTREAM_H
#define MAME_UTIL_VECSTREAM_H

#pragma once

#include <algorithm>
#include <cassert>
#include <ios>
#include <istream>
#include <ostream>
#include <memory>
#include <ostream>
#include <streambuf>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

namespace util {

template <typename CharT, typename Traits = std::char_traits<CharT>, typename Allocator = std::allocator<CharT> >
class basic_vectorbuf : public std::basic_streambuf<CharT, Traits>
{
public:
	typedef typename std::basic_streambuf<CharT, Traits>::char_type char_type;
	typedef typename std::basic_streambuf<CharT, Traits>::int_type  int_type;
	typedef typename std::basic_streambuf<CharT, Traits>::pos_type  pos_type;
	typedef typename std::basic_streambuf<CharT, Traits>::off_type  off_type;
	typedef Allocator                                               allocator_type;
	typedef std::vector<char_type, Allocator>                       vector_type;

	basic_vectorbuf(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_streambuf<CharT, Traits>(), m_mode(mode), m_storage(), m_threshold(nullptr)
	{
		setup();
	}

	basic_vectorbuf(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_streambuf<CharT, Traits>(), m_mode(mode), m_storage(content), m_threshold(nullptr)
	{
		setup();
	}

	basic_vectorbuf(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_streambuf<CharT, Traits>(), m_mode(mode), m_storage(std::move(content)), m_threshold(nullptr)
	{
		setup();
	}

	basic_vectorbuf(basic_vectorbuf const &that) : std::basic_streambuf<CharT, Traits>(that), m_mode(that.m_mode), m_storage(that.m_storage), m_threshold(nullptr)
	{
		adjust();
	}

	basic_vectorbuf(basic_vectorbuf &&that) : std::basic_streambuf<CharT, Traits>(that), m_mode(that.m_mode), m_storage(std::move(that.m_storage)), m_threshold(that.m_threshold)
	{
		that.clear();
	}

	vector_type const &vec() const
	{
		if (m_mode & std::ios_base::out)
		{
			if (this->pptr() > m_threshold) m_threshold = this->pptr();
			auto const base(this->pbase());
			auto const end(m_threshold - base);
			if (m_storage.size() > std::make_unsigned_t<decltype(end)>(end))
			{
				m_storage.resize(std::make_unsigned_t<decltype(end)>(end));
				assert(&m_storage[0] == base);
				auto const put_offset(this->pptr() - base);
				const_cast<basic_vectorbuf *>(this)->setp(base, base + put_offset);
				const_cast<basic_vectorbuf *>(this)->pbump(put_offset);
			}
		}
		return m_storage;
	}

	void vec(const vector_type &content)
	{
		m_storage = content;
		setup();
	}

	void vec(vector_type &&content)
	{
		m_storage = std::move(content);
		setup();
	}

	void clear()
	{
		m_storage.clear();
		setup();
	}

	void swap(basic_vectorbuf &that)
	{
		using std::swap;
		std::basic_streambuf<CharT, Traits>::swap(that);
		swap(m_mode, that.m_mode);
		swap(m_storage, that.m_storage);
		swap(m_threshold, that.m_threshold);
	}

	void reserve(typename vector_type::size_type size)
	{
		if ((m_mode & std::ios_base::out) && (m_storage.capacity() < size))
		{
			m_storage.reserve(size);
			adjust();
		}
	}

	basic_vectorbuf &operator=(basic_vectorbuf const &that)
	{
		std::basic_streambuf<CharT, Traits>::operator=(that);
		m_mode = that.m_mode;
		m_storage = that.m_storage;
		m_threshold = that.m_threshold;
		adjust();
		return *this;
	}

	basic_vectorbuf &operator=(basic_vectorbuf &&that)
	{
		std::basic_streambuf<CharT, Traits>::operator=(that);
		m_mode = that.m_mode;
		m_storage = std::move(that.m_storage);
		m_threshold = that.m_threshold;
		that.clear();
		return *this;
	}

protected:
	virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override
	{
		bool const in(which & std::ios_base::in);
		bool const out(which & std::ios_base::out);
		if ((!in && !out) ||
			(in && out && (std::ios_base::cur == dir)) ||
			(in && !(m_mode & std::ios_base::in)) ||
			(out && !(m_mode & std::ios_base::out)))
		{
			return pos_type(off_type(-1));
		}
		maximise_egptr();
		off_type const end((m_mode & std::ios_base::out) ? off_type(m_threshold - this->pbase()) : off_type(m_storage.size()));
		switch (dir)
		{
		case std::ios_base::beg:
			break;
		case std::ios_base::end:
			off += end;
			break;
		case std::ios_base::cur:
			off += off_type(in ? (this->gptr() - this->eback()) : (this->pptr() - this->pbase()));
			break;
		default:
			return pos_type(off_type(-1));
		}
		if ((off_type(0) > off) || ((m_mode & std::ios_base::app) && out && (end != off))) return pos_type(off_type(-1));
		if ((out ? off_type(this->epptr() - this->pbase()) : end) < off) return pos_type(off_type(-1));
		if (out)
		{
			this->setp(this->pbase(), this->epptr());
			this->pbump(off);
			if (m_threshold < this->pptr()) m_threshold = this->pptr();
			if (m_mode & std::ios_base::in)
			{
				if (in) this->setg(this->eback(), this->eback() + off, m_threshold);
				else if (this->egptr() < m_threshold) this->setg(this->eback(), this->gptr(), m_threshold);
			}
		}
		else if (in)
		{
			this->setg(this->eback(), this->eback() + off, this->egptr());
		}
		return pos_type(off);
	}

	virtual pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in |std:: ios_base::out) override
	{
		return seekoff(off_type(pos), std::ios_base::beg, which);
	}

	virtual int_type underflow() override
	{
		if (!this->gptr()) return Traits::eof();
		maximise_egptr();
		return (this->gptr() < this->egptr()) ? Traits::to_int_type(*this->gptr()) : Traits::eof();
	}

	virtual int_type overflow(int_type ch = Traits::eof()) override
	{
		if (!(m_mode & std::ios_base::out)) return Traits::eof();
		if (Traits::eq_int_type(ch, Traits::eof())) return Traits::not_eof(ch);
		auto const put_offset(this->pptr() - this->pbase() + 1);
		auto const threshold_offset((std::max)(m_threshold - this->pbase(), put_offset));
		m_storage.push_back(Traits::to_char_type(ch));
		m_storage.resize(m_storage.capacity());
		auto const base(&m_storage[0]);
		this->setp(base, base + m_storage.size());
		m_threshold = base + threshold_offset;
		if (m_mode & std::ios_base::in) this->setg(base, base + (this->gptr() - this->eback()), m_threshold);
		this->pbump(int(put_offset));
		return ch;
	}

	virtual int_type pbackfail(int_type ch = Traits::eof()) override
	{
		if (this->gptr() != this->eback())
		{
			if (Traits::eq_int_type(ch, Traits::eof()))
			{
				this->gbump(-1);
				return Traits::not_eof(ch);
			}
			else if (Traits::eq(Traits::to_char_type(ch), this->gptr()[-1]))
			{
				this->gbump(-1);
				return ch;
			}
			else if (m_mode & std::ios_base::out)
			{
				this->gbump(-1);
				*this->gptr() = Traits::to_char_type(ch);
				return ch;
			}
		}
		return Traits::eof();
	}

private:
	void setup()
	{
		if (m_mode & std::ios_base::out)
		{
			auto const end(m_storage.size());
			m_storage.resize(m_storage.capacity());
			if (m_storage.empty())
			{
				m_threshold = nullptr;
				this->setg(nullptr, nullptr, nullptr);
				this->setp(nullptr, nullptr);
			}
			else
			{
				auto const base(&m_storage[0]);
				m_threshold = base + end;
				this->setp(base, base + m_storage.size());
				if (m_mode & std::ios_base::in) this->setg(base, base, m_threshold);
			}
			if (m_mode & (std::ios_base::app | std::ios_base::ate)) this->pbump(int(unsigned(end)));
		}
		else if (m_storage.empty())
		{
			this->setg(nullptr, nullptr, nullptr);
		}
		else if (m_mode & std::ios_base::in)
		{
			auto const base(&m_storage[0]);
			this->setg(base, base, base + m_storage.size());
		}
	}

	void adjust()
	{
		auto const put_offset(this->pptr() - this->pbase());
		auto const get_offset(this->gptr() - this->eback());
		setup();
		if (m_mode & std::ios_base::out)
		{
			this->pbump(int(put_offset));
			m_threshold = this->pptr();
			if (m_mode & std::ios_base::in)
			{
				auto const base(&m_storage[0]);
				this->setg(base, base + get_offset, m_threshold);
			}
		}
		else if (m_mode & std::ios_base::in)
		{
			this->gbump(int(get_offset));
		}
	}

	void maximise_egptr()
	{
		if (m_mode & std::ios_base::out)
		{
			if (m_threshold < this->pptr()) m_threshold = this->pptr();
			if ((m_mode & std::ios_base::in) && (this->egptr() < m_threshold)) this->setg(this->eback(), this->gptr(), m_threshold);
		}
	}

	std::ios_base::openmode m_mode;
	mutable vector_type     m_storage;
	mutable CharT           *m_threshold;
};

template <typename CharT, typename Traits = std::char_traits<CharT>, typename Allocator = std::allocator<CharT> >
class basic_ivectorstream : public std::basic_istream<CharT, Traits>
{
public:
	typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;

	basic_ivectorstream(std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
	basic_ivectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
	basic_ivectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in) : std::basic_istream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }

	basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_istream<CharT, Traits>::rdbuf()); }
	vector_type const &vec() const { return rdbuf()->vec(); }
	void vec(const vector_type &content) { rdbuf()->vec(content); }
	void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }

	void swap(basic_ivectorstream &that) { std::basic_istream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }

private:
	basic_vectorbuf<CharT, Traits, Allocator> m_rdbuf;
};

template <typename CharT, typename Traits = std::char_traits<CharT>, typename Allocator = std::allocator<CharT> >
class basic_ovectorstream : public std::basic_ostream<CharT, Traits>
{
public:
	typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;

	basic_ovectorstream(std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
	basic_ovectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
	basic_ovectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::out) : std::basic_ostream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }

	basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_ostream<CharT, Traits>::rdbuf()); }

	vector_type const &vec() const { return rdbuf()->vec(); }
	void vec(const vector_type &content) { rdbuf()->vec(content); }
	void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
	basic_ovectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }

	void swap(basic_ovectorstream &that) { std::basic_ostream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }

private:
	basic_vectorbuf<CharT, Traits, Allocator> m_rdbuf;
};

template <typename CharT, typename Traits = std::char_traits<CharT>, typename Allocator = std::allocator<CharT> >
class basic_vectorstream : public std::basic_iostream<CharT, Traits>
{
public:
	typedef typename basic_vectorbuf<CharT, Traits, Allocator>::vector_type vector_type;

	basic_vectorstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(mode) { }
	basic_vectorstream(vector_type const &content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(content, mode) { }
	basic_vectorstream(vector_type &&content, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : std::basic_iostream<CharT, Traits>(&m_rdbuf), m_rdbuf(std::move(content), mode) { }

	basic_vectorbuf<CharT, Traits, Allocator> *rdbuf() const { return static_cast<basic_vectorbuf<CharT, Traits, Allocator> *>(std::basic_iostream<CharT, Traits>::rdbuf()); }

	vector_type const &vec() const { return rdbuf()->vec(); }
	void vec(const vector_type &content) { rdbuf()->vec(content); }
	void vec(vector_type &&content) { rdbuf()->vec(std::move(content)); }
	basic_vectorstream &reserve(typename vector_type::size_type size) { rdbuf()->reserve(size); return *this; }

	void swap(basic_vectorstream &that) { std::basic_iostream<CharT, Traits>::swap(that); rdbuf()->swap(*that.rdbuf()); }

private:
	basic_vectorbuf<CharT, Traits, Allocator> m_rdbuf;
};

typedef basic_ivectorstream<char>       ivectorstream;
typedef basic_ivectorstream<wchar_t>    wivectorstream;
typedef basic_ovectorstream<char>       ovectorstream;
typedef basic_ovectorstream<wchar_t>    wovectorstream;
typedef basic_vectorstream<char>        vectorstream;
typedef basic_vectorstream<wchar_t>     wvectorstream;

template <typename CharT, typename Traits, typename Allocator>
void swap(basic_vectorbuf<CharT, Traits, Allocator> &a, basic_vectorbuf<CharT, Traits, Allocator> &b) { a.swap(b); }

template <typename CharT, typename Traits, typename Allocator>
void swap(basic_ivectorstream<CharT, Traits, Allocator> &a, basic_ivectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_ovectorstream<CharT, Traits, Allocator> &a, basic_ovectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }
template <typename CharT, typename Traits, typename Allocator>
void swap(basic_vectorstream<CharT, Traits, Allocator> &a, basic_vectorstream<CharT, Traits, Allocator> &b) { a.swap(b); }

extern template class basic_ivectorstream<char>;
extern template class basic_ivectorstream<wchar_t>;
extern template class basic_ovectorstream<char>;
extern template class basic_ovectorstream<wchar_t>;
extern template class basic_vectorstream<char>;
extern template class basic_vectorstream<wchar_t>;

} // namespace util

#endif // MAME_UTIL_VECSTREAM_H
an class="n">m_atapi_timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC( konamim2_state::atapi_delay ),this ) ); m_atapi_timer->adjust( attotime::never ); if (machine().debug_flags & DEBUG_FLAG_ENABLED) { using namespace std::placeholders; machine().debugger().console().register_command("m2", CMDFLAG_NONE, 0, 1, 4, std::bind(&konamim2_state::debug_commands, this, _1, _2)); } } void konamim2_state::machine_reset() { update_disc(); } void konamim2_state::update_disc() { cdrom_file *new_cdrom = m_available_cdroms; atapi_hle_device *image = subdevice<atapi_hle_device>("ata:0:cr589"); if (image != nullptr) { void *current_cdrom = nullptr; image->GetDevice(&current_cdrom); if (current_cdrom != new_cdrom) { current_cdrom = new_cdrom; image->SetDevice(new_cdrom); } } else { abort(); } } /************************************* * * Address map * *************************************/ void konamim2_state::m2_map(address_map &map) { map(0x20000000, 0x201fffff).rom().region("boot", 0); // BIOBUS Slot 0 map(0xfff00000, 0xffffffff).rom().region("boot", 0); map(0x37400000, 0x37400007).w(FUNC(konamim2_state::konami_eeprom_w)).umask64(0xffff000000000000ULL); map(0x37600000, 0x3760000f).w(FUNC(konamim2_state::konami_atapi_unk_w)).umask64(0xffff000000000000ULL); map(0x37a00020, 0x37a0003f).rw(FUNC(konamim2_state::konami_io0_r), FUNC(konamim2_state::konami_io0_w)); map(0x37c00010, 0x37c0001f).rw(FUNC(konamim2_state::konami_sio_r), FUNC(konamim2_state::konami_sio_w)); map(0x37e00000, 0x37e0000f).rw(FUNC(konamim2_state::konami_io1_r), FUNC(konamim2_state::konami_io1_w)); map(0x3f000000, 0x3fffffff).rw(FUNC(konamim2_state::konami_ide_r), FUNC(konamim2_state::konami_ide_w)); } /************************************* * * Port definitions * *************************************/ static INPUT_PORTS_START( konamim2 ) PORT_START("DSW") PORT_DIPNAME( 0x01, 0x00, "Video Res" ) PORT_DIPSETTING( 0x00, "High Res" ) PORT_DIPSETTING( 0x01, "Low Res" ) PORT_START("P1") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNUSED ) // ATAPI? PORT_BIT( 0xDE00, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( btltryst ) PORT_INCLUDE( konamim2 ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "Video Res" ) PORT_DIPSETTING( 0x00, "High Res" ) PORT_DIPSETTING( 0x01, "Low Res" ) PORT_START("P2") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("P4") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("P5") PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P6") PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW ) PORT_BIT( 0xfffb, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( polystar ) PORT_INCLUDE( konamim2 ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x01, "Video Res" ) PORT_DIPSETTING( 0x00, "High Res" ) PORT_DIPSETTING( 0x01, "Low Res" ) PORT_START("P2") PORT_DIPNAME( 0x01, 0x01, "Sound Output" ) PORT_DIPSETTING( 0x01, "Mono" ) PORT_DIPSETTING( 0x00, "Stereo" ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("P4") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("P5") PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P6") PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW ) INPUT_PORTS_END static INPUT_PORTS_START( totlvice ) PORT_INCLUDE( konamim2 ) PORT_START("P2") // TODO: VERIFY PORT_DIPNAME( 0x01, 0x00, "Sound Output" ) PORT_DIPSETTING( 0x01, "Mono" ) PORT_DIPSETTING( 0x00, "Stereo" ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("P4") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("GUNX1") PORT_BIT( 0xffff, 0x0000, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0, 640) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_START("GUNY1") PORT_BIT( 0xffff, 0x0000, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 240) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_START("P5") // Gun switches PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P6") PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW ) PORT_BIT( 0xfffb, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( heatof11 ) PORT_INCLUDE( konamim2 ) PORT_MODIFY("DSW") PORT_DIPNAME( 0x01, 0x00, "Video Res" ) PORT_DIPSETTING( 0x00, "High Res" ) PORT_DIPSETTING( 0x01, "Low Res" ) PORT_START("P2") PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("P4") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("P5") PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P6") PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW ) INPUT_PORTS_END static INPUT_PORTS_START( hellngt ) PORT_INCLUDE( konamim2 ) PORT_START("P2") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("P4") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("GUNX1") PORT_BIT( 0xffff, 0x0000, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX( 0, 320*2 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_START("GUNY1") PORT_BIT( 0xffff, 0x0000, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX( 0, 240 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_START("P5") // Gun switches PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("P6") PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW ) PORT_BIT( 0xfffb, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END /************************************* * * Machine driver * *************************************/ void konamim2_state::cr589_config(device_t *device) { device->subdevice<cdda_device>("cdda")->add_route(0, ":lspeaker", 1.0); device->subdevice<cdda_device>("cdda")->add_route(1, ":rspeaker", 1.0); device = device->subdevice("cdda"); } void konamim2_state::konamim2(machine_config &config) { // Basic machine hardware PPC602(config, m_ppc1, M2_CLOCK); m_ppc1->set_bus_frequency(M2_CLOCK / 2); m_ppc1->set_addrmap(AS_PROGRAM, &konamim2_state::m2_map); PPC602(config, m_ppc2, M2_CLOCK); m_ppc2->set_bus_frequency(M2_CLOCK / 2); m_ppc2->set_addrmap(AS_PROGRAM, &konamim2_state::m2_map); // M2 hardware M2_BDA(config, m_bda, M2_CLOCK, m_ppc1, m_ppc2, m_cde); m_bda->set_ram_size(m2_bda_device::RAM_8MB, m2_bda_device::RAM_8MB); m_bda->subdevice<m2_powerbus_device>("powerbus")->int_handler().set(FUNC(konamim2_state::ppc1_int)); m_bda->subdevice<m2_memctl_device>("memctl")->gpio_out_handler<3>().set(FUNC(konamim2_state::ppc2_int)).invert(); m_bda->subdevice<m2_vdu_device>("vdu")->set_screen("screen"); m_bda->videores_in().set_ioport("DSW"); m_bda->ldac_handler().set(FUNC(konamim2_state::ldac_out)); m_bda->rdac_handler().set(FUNC(konamim2_state::rdac_out)); M2_CDE(config, m_cde, M2_CLOCK, m_ppc1, m_bda); m_cde->int_handler().set(":bda:powerbus", FUNC(m2_powerbus_device::int_line<BDAINT_EXTD4_LINE>)); m_cde->set_syscfg(SYSCONFIG_ARCADE); m_cde->sdbg_out().set(FUNC(konamim2_state::cde_sdbg_out)); // Common devices EEPROM_93C46_16BIT(config, m_eeprom); ATA_INTERFACE(config, m_ata, 0); m_ata->irq_handler().set(FUNC(konamim2_state::ata_int)); m_ata->slot(0).option_add("cr589", CR589); m_ata->slot(0).set_option_machine_config("cr589", cr589_config); m_ata->slot(0).set_default_option("cr589"); // Video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_screen_update("bda:vdu", FUNC(m2_vdu_device::screen_update)); /* Sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); // TODO! DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_ldac, 0).add_route(ALL_OUTPUTS, "lspeaker", 1.0); DAC_16BIT_R2R_TWOS_COMPLEMENT(config, m_rdac, 0).add_route(ALL_OUTPUTS, "rspeaker", 1.0); } /************************************* * * Machine fragments * *************************************/ void konamim2_state::set_ntsc(machine_config &config) { // m_screen->set_raw(11750000, 766, 126, 126+640, 260, 20, 20+240); // TODO m_screen->set_refresh_hz(59.360001); m_screen->set_size(768, 262); m_screen->set_visarea(126, 126+640-1, 20, 20+240-1); } void konamim2_state::set_ntsc2(machine_config &config) { //m_screen->set_raw(11750000, 766, 126, 126+640, 260, 20, 20+240); // TODO m_screen->set_refresh_hz(59.360001); m_screen->set_size(768, 262*2); // TOTAL VICE ONLY WORKS WITH THIS! m_screen->set_visarea(126, 126+640-1, 20, 20+240-1); } void konamim2_state::set_arcres(machine_config &config) { m_screen->set_raw(16934500, 684, 104, 104+512, 416, 26, 26+384); } void konamim2_state::add_ymz280b(machine_config &config) { // TODO: The YMZ280B outputs are actually routed to a speaker in each gun YMZ280B(config, m_ymz280b, XTAL(16'934'400)); m_ymz280b->add_route(0, "lspeaker", 0.5); m_ymz280b->add_route(1, "rspeaker", 0.5); } void konamim2_state::add_mt48t58(machine_config &config) { M48T58(config, m_m48t58); } /************************************* * * Machine drivers * *************************************/ void konamim2_state::polystar(machine_config &config) { konamim2(config); m_bda->set_ram_size(m2_bda_device::RAM_4MB, m2_bda_device::RAM_4MB); set_ntsc(config); } void konamim2_state::totlvice(machine_config &config) { konamim2(config); add_ymz280b(config); // set_arcres(config); set_ntsc2(config); } void konamim2_state::btltryst(machine_config &config) { konamim2(config); add_mt48t58(config); set_ntsc(config); } void konamim2_state::heatof11(machine_config &config) { konamim2(config); add_mt48t58(config); set_arcres(config); } void konamim2_state::evilngt(machine_config &config) { konamim2(config); add_mt48t58(config); add_ymz280b(config); set_ntsc(config); } void konamim2_state::hellngt(machine_config &config) { konamim2(config); add_mt48t58(config); add_ymz280b(config); set_arcres(config); } /************************************* * * ROM definition(s) * *************************************/ ROM_START( polystar ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* EEPROM default contents */ ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(fab5a203) SHA1(153e22aa8cfce80b77ba200957685f796fc99b1c) ) DISK_REGION( "cdrom" ) // Has 1s of silence near the start of the first audio track DISK_IMAGE_READONLY( "623jaa02", 0, BAD_DUMP SHA1(e7d9e628a3e0e085e084e4e3630fa5e3a7345547) ) ROM_END ROM_START( btltryst ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(cc2c5640) SHA1(694cf2b3700f52ed80252b013052c90020e58ce6) ) ROM_REGION( 0x2000, "m48t58", 0 ) /* timekeeper SRAM */ ROM_LOAD( "m48t58", 0x000000, 0x002000, CRC(71ee073b) SHA1(cc8002d7ee8d1695aebbbb2a3a1e97a7e16948c1) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "636jac02", 0, SHA1(d36556a3a4b91058100924a9e9f1a58983399c6e) ) ROM_END #if 0 ROM_START( btltrysta ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION( 0x2000, "m48t58", 0 ) /* timekeeper SRAM */ ROM_LOAD( "m48t58y", 0x000000, 0x002000, CRC(8611ff09) SHA1(6410236947d99c552c4a1f7dd5fd8c7a5ae4cba1) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "636jaa02", 0, SHA1(d36556a3a4b91058100924a9e9f1a58983399c6e) ) ROM_END #endif ROM_START( heatof11 ) ROM_REGION64_BE( 0x200000, "boot", 0 ) /* boot rom */ ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* EEPROM default contents */ ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(e7029938) SHA1(ae41340dbcb600debe246629dc36fb371d1a5b05) ) ROM_REGION( 0x2000, "m48t58", 0 ) /* timekeeper SRAM */ ROM_LOAD( "dallas.5e", 0x000000, 0x002000, CRC(5b74eafd) SHA1(afbf5f1f5a27407fd6f17c764bbb7fae4ab779f5) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "heatof11", 0, BAD_DUMP SHA1(5a0a2782cd8676d3f6dfad4e0f805b309e230d8b) ) ROM_END ROM_START( evilngt ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* EEPROM default contents */ ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(60ae825e) SHA1(fd61db9667c53dd12700a0fe202fcd1e3d35d206) ) ROM_REGION( 0x2000, "m48t58", 0 ) /* timekeeper SRAM */ ROM_LOAD( "m48t58y.9n", 0x000000, 0x002000, CRC(e887ca1f) SHA1(54205f01b1ceba1d5f4d979fc30be1add8116e90) ) ROM_REGION( 0x400000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "810a03.16h", 0x000000, 0x400000, CRC(05112d3a) SHA1(0df2a167b7bc08a32d983b71614d59834efbfb59) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "810uba02", 0, SHA1(e570470c1cbfe187d5bba8125616412f386264ba) ) ROM_END ROM_START( evilngte ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION( 0x2000, "m48t58", 0 ) /* timekeeper SRAM */ ROM_LOAD( "m48t58y.u1", 0x000000, 0x001000, CRC(169bb8f4) SHA1(55c0bafab5d309fe69156489186e232aa87ca0dd) ) ROM_REGION( 0x400000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "810a03.16h", 0x000000, 0x400000, CRC(05112d3a) SHA1(0df2a167b7bc08a32d983b71614d59834efbfb59) ) // TODO: Add CHD ROM_END ROM_START( hellngt ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "636a01.8q", 0x000000, 0x200000, CRC(7b1dc738) SHA1(32ae8e7ddd38fcc70b4410275a2cc5e9a0d7d33b) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) /* EEPROM default contents */ ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(53b41f68) SHA1(f75f59808a5b04b1e49f2cca0592a2466b82f019) ) ROM_REGION( 0x2000, "m48t58", 0 ) ROM_LOAD( "m48t58y.9n", 0x000000, 0x002000, CRC(ff8e78a1) SHA1(02e56f55264dd0bf3a08808726a6366e9cb6031e) ) ROM_REGION( 0x400000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "810a03.16h", 0x000000, 0x400000, CRC(05112d3a) SHA1(0df2a167b7bc08a32d983b71614d59834efbfb59) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "810eaa02", 0, SHA1(d701b900eddc7674015823b2cb33e887bf107fa8) ) ROM_END ROM_START( totlvice ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION16_BE( 0x80, "eeprom", 0 ) ROM_LOAD( "93c46.7k", 0x000000, 0x000080, CRC(25aa0bd1) SHA1(cc461e0629ff71c3a868882f1f67af0e19135c1a) ) ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) // was converted from the following cue/bin pair, is this sufficient / good for this platform? - there are a lot of audio tracks that need verifying as non-corrupt //ROM_LOAD( "TotalVice-GQ639-EBA01.cue", 0, 0x00000555, CRC(55ef2f62) SHA1(8e31b3e62244e6090a93228dae377552340dcdeb) ) //ROM_LOAD( "TotalVice-GQ639-EBA01.bin", 0, 0x1ec4db10, CRC(5882f8ba) SHA1(e589d500d99d2f4cff4506cd5ac9a5bfc8d30675) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "639eba01", 0, BAD_DUMP SHA1(d95c13575e015169b126f7e8492d150bd7e5ebda) ) ROM_END #if 0 // NB: Dumped by Phil, hasn't been converted to CHD yet ROM_START( totlvicd ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "639ead01", 0, SHA1(9d1085281aeb14185e2e78f3f21e7004a591039c) ) ROM_END #endif ROM_START( totlvicu ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "639uac01", 0, BAD_DUMP SHA1(88431b8a0ce83c156c8b19efbba1af901b859404) ) ROM_END ROM_START( totlvica ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "639aab01", 0, SHA1(34f34b26399cc04ffb0207df69f52eba42892eb6) ) ROM_END ROM_START( totlvicj ) ROM_REGION64_BE( 0x200000, "boot", 0 ) ROM_LOAD16_WORD( "623b01.8q", 0x000000, 0x200000, CRC(bd879f93) SHA1(e2d63bfbd2b15260a2664082652442eadea3eab6) ) ROM_REGION( 0x100000, "ymz", 0 ) /* YMZ280B sound rom on sub board */ ROM_LOAD( "639jaa02.bin", 0x000000, 0x100000, CRC(c6163818) SHA1(b6f8f2d808b98610becc0a5be5443ece3908df0b) ) DISK_REGION( "cdrom" ) // Need a re-image DISK_IMAGE_READONLY( "639jad01", 0, BAD_DUMP SHA1(39d41d5a9d1c40636d174c8bb8172b1121e313f8) ) ROM_END #if 0 // FIXME ROM_START( 3do_m2 ) ROM_REGION64_BE( 0x100000, "boot", 0 ) ROM_SYSTEM_BIOS( 0, "panafz35", "Panasonic FZ-35S (3DO M2)" ) ROMX_LOAD( "fz35_jpn.bin", 0x000000, 0x100000, CRC(e1c5bfd3) SHA1(0a3e27d672be79eeee1d2dc2da60d82f6eba7934), ROM_BIOS(1) ) ROM_END #endif /************************************* * * Driver initialization * *************************************/ void konamim2_state::install_m48t58() { read8sm_delegate read_delegate(*m_m48t58, FUNC(m48t58_device::read)); write8sm_delegate write_delegate(*m_m48t58, FUNC(m48t58_device::write)); m_ppc1->space(AS_PROGRAM).install_readwrite_handler(0x36c00000, 0x36c03fff, read_delegate, write_delegate, 0xff00ff00ff00ff00ULL); m_ppc2->space(AS_PROGRAM).install_readwrite_handler(0x36c00000, 0x36c03fff, read_delegate, write_delegate, 0xff00ff00ff00ff00ULL); } void konamim2_state::install_ymz280b() { read8sm_delegate read_delegate(*m_ymz280b, FUNC(ymz280b_device::read)); write8sm_delegate write_delegate(*m_ymz280b, FUNC(ymz280b_device::write)); m_ppc1->space(AS_PROGRAM).install_readwrite_handler(0x3e800000, 0x3e80000f, read_delegate, write_delegate, 0xff00ff0000000000ULL); m_ppc2->space(AS_PROGRAM).install_readwrite_handler(0x3e800000, 0x3e80000f, read_delegate, write_delegate, 0xff00ff0000000000ULL); } void konamim2_state::init_totlvice() { install_ymz280b(); } void konamim2_state::init_btltryst() { install_m48t58(); } void konamim2_state::init_hellngt() { install_m48t58(); install_ymz280b(); } /************************************* * * Game driver(s) * *************************************/ GAME( 1997, polystar, 0, polystar, polystar, konamim2_state, empty_init, ROT0, "Konami", "Tobe! Polystars (ver JAA)", MACHINE_IMPERFECT_TIMING | MACHINE_IMPERFECT_SOUND ) GAME( 1997, totlvice, 0, totlvice, totlvice, konamim2_state, init_totlvice, ROT0, "Konami", "Total Vice (ver EBA)", MACHINE_IMPERFECT_TIMING ) //GAME( 1997, totlvicd, totlvice, totlvice, totlvice, konamim2_state, init_totlvice, ROT0, "Konami", "Total Vice (ver EAD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING ) GAME( 1997, totlvicj, totlvice, totlvice, totlvice, konamim2_state, init_totlvice, ROT0, "Konami", "Total Vice (ver JAD)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING ) GAME( 1997, totlvica, totlvice, totlvice, totlvice, konamim2_state, init_totlvice, ROT0, "Konami", "Total Vice (ver AAB)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING ) GAME( 1997, totlvicu, totlvice, totlvice, totlvice, konamim2_state, init_totlvice, ROT0, "Konami", "Total Vice (ver UAC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING ) GAME( 1998, btltryst, 0, btltryst, btltryst, konamim2_state, init_btltryst, ROT0, "Konami", "Battle Tryst (ver JAC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING | MACHINE_IMPERFECT_GRAPHICS ) //GAME( 1998, btltrysta, btltryst, btltryst, btltryst, konamim2_state, init_btltryst, ROT0, "Konami", "Battle Tryst (ver JAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING | MACHINE_IMPERFECT_GRAPHICS ) GAME( 1998, heatof11, 0, heatof11, heatof11, konamim2_state, init_btltryst, ROT0, "Konami", "Heat of Eleven '98 (ver EAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING | MACHINE_IMPERFECT_GRAPHICS) GAME( 1998, evilngt, 0, evilngt, hellngt, konamim2_state, init_hellngt, ROT0, "Konami", "Evil Night (ver UBA)", MACHINE_IMPERFECT_TIMING ) GAME( 1998, evilngte, evilngt, evilngt, hellngt, konamim2_state, init_hellngt, ROT0, "Konami", "Evil Night (ver EAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING ) GAME( 1998, hellngt, evilngt, hellngt, hellngt, konamim2_state, init_hellngt, ROT0, "Konami", "Hell Night (ver EAA)", MACHINE_IMPERFECT_TIMING ) //CONS( 199?, 3do_m2, 0, 0, 3do_m2, m2, driver_device, 0, "3DO", "3DO M2", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_TIMING | MACHINE_NO_SOUND ) /************************************* * * Debugging Aids * *************************************/ void konamim2_state::debug_help_command(int ref, const std::vector<std::string> &params) { debugger_console &con = machine().debugger().console(); con.printf("Available M2 commands:\n"); con.printf(" konm2 dump_task,<address> -- Dump task object at <address>\n"); con.printf(" konm2 dump_dspp,<address> -- Dump DSPP object at <address>\n"); } void konamim2_state::debug_commands(int ref, const std::vector<std::string> &params) { if (params.size() < 1) return; if (params[0] == "help") debug_help_command(ref, params); else if (params[0] == "dump_task") dump_task_command(ref, params); else if (params[0] == "dump_dspp") subdevice<dspp_device>("bda:dspp")->dump_state(); } void konamim2_state::dump_task_command(int ref, const std::vector<std::string> &params) { typedef uint32_t Item; typedef uint32_t m2ptr; typedef struct TimerTicks { uint32_t tt_Hi; uint32_t tt_Lo; } TimerTicks; struct ItemNode { m2ptr pn_Next; /* pointer to next in list */ // 0 m2ptr pn_Prev; /* pointer to previous in list */ // 4 uint8_t n_SubsysType; /* what component manages this node */ // 8 uint8_t n_Type; /* what type of node for the component */ // 9 uint8_t n_Priority; /* queueing priority */ // A uint8_t n_Flags; /* misc flags, see below */ // B int32_t n_Size; /* total size of node including hdr */ // C m2ptr pn_Name; /* name of item, or NULL */ // 10 uint8_t n_Version; /* version of of this Item */ // 14 uint8_t n_Revision; /* revision of this Item */ // 15 uint8_t n_Reserved0; /* reserved for future use */ // 16 uint8_t n_ItemFlags; /* additional system item flags */ // 17 Item n_Item; /* Item number representing this struct */ //18 Item n_Owner; /* creator, present owner, disposer */ // 1C m2ptr pn_Reserved1; /* reserved for future use */ // 20 }; struct Task { ItemNode t; m2ptr pt_ThreadTask; /* I am a thread of what task? */ uint32_t t_WaitBits; /* signals being waited for */ uint32_t t_SigBits; /* signals received */ uint32_t t_AllocatedSigs; /* signals allocated */ m2ptr pt_StackBase; /* base of stack */ int32_t t_StackSize; /* size of stack */ uint32_t t_MaxUSecs; /* quantum length in usecs */ TimerTicks t_ElapsedTime; /* time spent running this task */ uint32_t t_NumTaskLaunch; /* # times launched this task */ uint32_t t_Flags; /* task flags */ Item t_Module; /* the module we live within */ Item t_DefaultMsgPort; /* default task msgport */ m2ptr pt_UserData; /* user-private data */ }; debugger_console &con = machine().debugger().console(); address_space &space = m_ppc1->space(); uint64_t addr; offs_t address; if (params.size() < 1) return; if (!machine().debugger().commands().validate_number_parameter(params[1], addr)) return; address = (offs_t)addr; address = 0x40FB54E8; if (!m_ppc1->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { con.printf("Address is unmapped.\n"); return; } Task task; task.t.pn_Next = space.read_dword(address + offsetof(ItemNode, pn_Next)); task.t.pn_Prev = space.read_dword(address + offsetof(ItemNode, pn_Prev)); task.t.n_SubsysType = space.read_byte(address + offsetof(ItemNode, n_SubsysType)); task.t.n_Type = space.read_byte(address + offsetof(ItemNode, n_Type)); task.t.n_Priority = space.read_byte(address + offsetof(ItemNode, n_Priority)); task.t.n_Flags = space.read_byte(address + offsetof(ItemNode, n_Flags)); task.t.n_Size = space.read_dword(address + offsetof(ItemNode, n_Size)); task.t.pn_Name = space.read_dword(address + offsetof(ItemNode, pn_Name)); char name[128]; char *ptr = name; uint32_t nameptr = task.t.pn_Name; do { *ptr = space.read_byte(nameptr++); } while (*ptr++ != 0); task.t.n_Version = space.read_byte(address + offsetof(ItemNode, n_Version)); task.t.n_Revision = space.read_byte(address + offsetof(ItemNode, n_Revision)); task.t.n_Reserved0 = space.read_byte(address + offsetof(ItemNode, n_Reserved0)); task.t.n_ItemFlags = space.read_byte(address + offsetof(ItemNode, n_ItemFlags)); task.t.n_Item = space.read_dword(address + offsetof(ItemNode, n_Item)); task.t.n_Owner = space.read_dword(address + offsetof(ItemNode, n_Owner)); task.t.pn_Reserved1 = space.read_dword(address + offsetof(ItemNode, pn_Reserved1)); task.pt_ThreadTask = space.read_dword(address + offsetof(Task, pt_ThreadTask)); task.t_WaitBits = space.read_dword(address + offsetof(Task, t_WaitBits)); task.t_SigBits = space.read_dword(address + offsetof(Task, t_SigBits)); task.t_AllocatedSigs = space.read_dword(address + offsetof(Task, t_AllocatedSigs)); task.pt_StackBase = space.read_dword(address + offsetof(Task, pt_StackBase)); task.t_StackSize = space.read_dword(address + offsetof(Task, t_StackSize)); task.t_MaxUSecs = space.read_dword(address + offsetof(Task, t_MaxUSecs)); task.t_ElapsedTime.tt_Hi = space.read_dword(address + offsetof(Task, t_ElapsedTime)+0); task.t_ElapsedTime.tt_Lo = space.read_dword(address + offsetof(Task, t_ElapsedTime)+4); task.t_NumTaskLaunch = space.read_dword(address + offsetof(Task, t_NumTaskLaunch)); task.t_Flags = space.read_dword(address + offsetof(Task, t_Flags)); task.t_Module = space.read_dword(address + offsetof(Task, t_Module)); task.t_DefaultMsgPort = space.read_dword(address + offsetof(Task, t_DefaultMsgPort)); task.pt_UserData = space.read_dword(address + offsetof(Task, pt_UserData)); // m2ptr pt_ThreadTask; /* I am a thread of what task? */ // uint32_t t_WaitBits; /* signals being waited for */ // uint32_t t_SigBits; /* signals received */ // uint32_t t_AllocatedSigs; /* signals allocated */ // m2ptr pt_StackBase; /* base of stack */ // int32_t t_StackSize; /* size of stack */ // uint32_t t_MaxUSecs; /* quantum length in usecs */ // TimerTicks t_ElapsedTime; /* time spent running this task */ // uint32_t t_NumTaskLaunch; /* # times launched this task */ // uint32_t t_Flags; /* task flags */ // Item t_Module; /* the module we live within */ // Item t_DefaultMsgPort; /* default task msgport */ // m2ptr pt_UserData; /* user-private data */ con.printf("**** Task Info @ %08X ****\n", address); con.printf("Next: %08X\n", task.t.pn_Next); con.printf("Prev: %08X\n", task.t.pn_Prev); con.printf("SubsysType: %X\n", task.t.n_SubsysType); con.printf("Type: %X\n", task.t.n_Type); con.printf("Priority: %X\n", task.t.n_Priority); con.printf("Flags: %X\n", task.t.n_Flags); con.printf("Size: %08X\n", task.t.n_Size); con.printf("Name: %s\n", name); con.printf("Version: %X\n", task.t.n_Version); con.printf("Revision: %X\n", task.t.n_Revision); con.printf("Reserved0: %X\n", task.t.n_Reserved0); con.printf("ItemFlags: %X\n", task.t.n_ItemFlags); con.printf("Item: %08X\n", task.t.n_Item); con.printf("Owner: %08X\n", task.t.n_Owner); con.printf("Reserved1: %08X\n", task.t.pn_Reserved1); con.printf("ThreadTask: %08X\n", task.pt_ThreadTask); con.printf("WaitBits: %08X\n", task.t_WaitBits); con.printf("SigBits: %08X\n", task.t_SigBits); con.printf("AllocSigs: %08X\n", task.t_AllocatedSigs); con.printf("StackBase: %08X\n", task.pt_StackBase); con.printf("StackSize: %08X\n", task.t_StackSize); con.printf("MaxUSecs: %08X\n", task.t_MaxUSecs); con.printf("ElapsedTime: %016llu\n", (uint64_t)task.t_ElapsedTime.tt_Lo + ((uint64_t)task.t_ElapsedTime.tt_Hi << 32ull)); con.printf("NumTaskLaunch: %u\n", task.t_NumTaskLaunch); con.printf("Flags: %08X\n", task.t_Flags); con.printf("Module: %08X\n", task.t_Module); con.printf("DefaultMsgPort: %08X\n", task.t_DefaultMsgPort); con.printf("UserData: %08X\n", task.pt_UserData); con.printf("\n"); }