/src/devices/bus/nscsi/

s'>py_regtests MAME - Multiple Arcade Machine Emulator
summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/barni.cpp
blob: 6d993a5683d37c007d823679162c157caa74bfbc (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
// license:BSD-3-Clause
// copyright-holders:Ivan Vangelista
// PINBALL
// Skeleton driver for Barni pinballs. At this time only Red Baron is dumped.
// Known pinballs to be dumped: Shield (1985)
// Hardware listing and ROM definitions from PinMAME.

/*
   Hardware:
CPU:     2 x 6809E, optional MC6802 which may replace second 6809E
    INT: IRQ on CPU 0, FIRQ on CPU 1
IO:      2x PIA 6821
         1x VIA 6522
DISPLAY: 5x6 digit 7 or 16 segment display
SOUND:   basically the same as Bally's Squalk & Talk -61 board but missing AY8912 synth chip
*/

#include "emu.h"
#include "machine/genpin.h"
#include "cpu/m6800/m6800.h"
#include "cpu/m6809/m6809.h"
#include "machine/6522via.h"
#include "machine/6821pia.h"
#include "sound/tms5220.h"

class barni_state : public genpin_class
{
public:
	barni_state(const machine_config &mconfig, device_type type, const char *tag)
		: genpin_class(mconfig, type, tag)
		, m_maincpu(*this, "maincpu") { }

		void barni(machine_config &config);
private:
	required_device<cpu_device> m_maincpu;
};

static ADDRESS_MAP_START( maincpu_map, AS_PROGRAM, 8, barni_state )
	ADDRESS_MAP_UNMAP_HIGH
	AM_RANGE(0x0000, 0x00ff) AM_RAM
	AM_RANGE(0xa100, 0xa7ff) AM_RAM
	AM_RANGE(0xc000, 0xffff) AM_ROM
ADDRESS_MAP_END

static ADDRESS_MAP_START( subcpu_map, AS_PROGRAM, 8, barni_state )
	ADDRESS_MAP_UNMAP_HIGH
	AM_RANGE(0x0000, 0x03ff) AM_RAM
	AM_RANGE(0xe000, 0xffff) AM_ROM
ADDRESS_MAP_END

static ADDRESS_MAP_START( audiocpu_map, AS_PROGRAM, 8, barni_state )
	AM_RANGE(0x0000, 0x007f) AM_RAM
	AM_RANGE(0xc000, 0xffff) AM_ROM
ADDRESS_MAP_END

static INPUT_PORTS_START( barni )
INPUT_PORTS_END

MACHINE_CONFIG_START(barni_state::barni)
	/* basic machine hardware */
	MCFG_CPU_ADD("maincpu", MC6809E, XTAL(4'000'000) / 4)
	MCFG_CPU_PROGRAM_MAP(maincpu_map)

	MCFG_CPU_ADD("subcpu", MC6809E, XTAL(4'000'000) / 4)
	MCFG_CPU_PROGRAM_MAP(subcpu_map)

	MCFG_CPU_ADD("audiocpu", M6802, 4000000) // uses own XTAL, but what is the value?
	MCFG_CPU_PROGRAM_MAP(audiocpu_map)

	/* video hardware */
	//MCFG_DEFAULT_LAYOUT()

	//6522via
	//6821pia

	/* sound hardware */
	//tmms5220
	//dac
	MCFG_FRAGMENT_ADD( genpin_audio )
MACHINE_CONFIG_END


/*--------------------------------
/ Red Baron
/-------------------------------*/
ROM_START(redbarnp)
	ROM_REGION(0x10000, "maincpu", 0)
	ROM_LOAD("redbaron.r1", 0xe000, 0x2000, CRC(fd401d3f) SHA1(33c0f178c798e16a9b4489a0e469f0a227882e79))
	ROM_LOAD("redbaron.r2", 0xc000, 0x2000, CRC(0506e53e) SHA1(a1eaa39181cb3e5a1c281d217d680a42e39c856a))

	ROM_REGION(0x10000, "subcpu", 0)
	ROM_LOAD("redbaron.r3", 0xe000, 0x2000, CRC(45bca0b8) SHA1(77e2d6b04ea8d6fa7e30b59232696b9aa5307286))

	ROM_REGION(0x10000, "audiocpu", 0)
	ROM_LOAD("rbsnd1.732", 0xf000, 0x1000, CRC(674389ce) SHA1(595bbfe51dc3af266f4344e3865c0e48dd96acea))
	ROM_LOAD("rbsnd2.732", 0xe000, 0x1000, CRC(30e7da5e) SHA1(3054cf9b09e0f89c242e1ad35bb31d9bd77248e4))
	ROM_LOAD("rbsnd3.732", 0xd000, 0x1000, CRC(a4ba0f72) SHA1(e46148a2f5125914944973f37e73a62001c76aaa))
	ROM_LOAD("rbsnd4.732", 0xc000, 0x1000, CRC(fd8db899) SHA1(0978213f14f73ccc4a24eb42a39db00d9299c5d0))
ROM_END


GAME( 1985, redbarnp, 0, barni, barni, barni_state, 0, ROT0, "Barni", "Red Baron (Pinball)", MACHINE_IS_SKELETON_MECHANICAL )
i">0; UINT8 shift = m_linec->read() & 0x02 ? 1 : 0; UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0; for(i = 0; i < 7; i++) { switch ( i ) { case 0: code = m_line0->read(); break; case 1: code = m_line1->read(); break; case 2: code = m_line2->read(); break; case 3: code = m_line3->read(); break; case 4: code = m_line4->read(); break; case 5: code = m_line5->read(); break; case 6: code = m_line6->read(); break; default: code = 0; } if (code != 0) { if (i==0 && shift==0) { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } if (i==0 && shift==1) { key_code = 0x20 + row_number(code) + 8*i; // for shifted numbers } if (i==1 && shift==0) { if (row_number(code) < 4) { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } else { key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs } } if (i==1 && shift==1) { if (row_number(code) < 4) { key_code = 0x20 + row_number(code) + 8*i; // for numbers and some signs } else { key_code = 0x30 + row_number(code) + 8*i; // for numbers and some signs } } if (i>=2 && i<=4 && shift==1 && ctrl==0) { key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters } if (i>=2 && i<=4 && shift==0 && ctrl==0) { key_code = 0x40 + row_number(code) + (i-2)*8; // for big letters } if (i>=2 && i<=4 && ctrl==1) { key_code = 0x00 + row_number(code) + (i-2)*8; // for CTRL + letters } if (i==5 && shift==1 && ctrl==0) { if (row_number(code)<7) { key_code = 0x60 + row_number(code) + (i-2)*8; // for small letters } else { key_code = 0x40 + row_number(code) + (i-2)*8; // for signs it is switched } } if (i==5 && shift==0 && ctrl==0) { if (row_number(code)<7) { key_code = 0x40 + row_number(code) + (i-2)*8; // for small letters } else { key_code = 0x60 + row_number(code) + (i-2)*8; // for signs it is switched } } if (i==5 && shift==0 && ctrl==1) { key_code = 0x00 + row_number(code) + (i-2)*8; // for letters + ctrl } if (i==6) { switch(row_number(code)) { case 0: key_code = 0x11; break; case 1: key_code = 0x12; break; case 2: key_code = 0x13; break; case 3: key_code = 0x14; break; case 4: key_code = 0x20; break; // Space case 5: key_code = 0x0D; break; // Enter case 6: key_code = 0x09; break; // TAB case 7: key_code = 0x0A; break; // LF } } } } if (key_code==0 && m_last_code !=0){ m_int_vector = 0xef; m_maincpu->set_input_line(0, HOLD_LINE); } else { m_last_code = key_code; } timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); } IRQ_CALLBACK_MEMBER(poly88_state::poly88_irq_callback) { return m_int_vector; } WRITE_LINE_MEMBER(poly88_state::write_cas_tx) { m_cas_tx = state; } TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) { int data; int current_level; // if (!(ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ //{ /* tape reading */ if (m_cassette->get_state()&CASSETTE_PLAY) { if (m_clk_level_tape) { m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; m_clk_level_tape = 0; } else { current_level = (m_cassette->input() > 0.038) ? 1 : 0; if (m_previous_level!=current_level) { data = (!m_previous_level && current_level) ? 1 : 0; //data = current_level; m_uart->write_rxd(data); m_clk_level_tape = 1; } } m_uart->write_rxc(m_clk_level_tape); } /* tape writing */ if (m_cassette->get_state()&CASSETTE_RECORD) { data = m_cas_tx; data ^= m_clk_level_tape; m_cassette->output(data&0x01 ? 1 : -1); m_clk_level_tape = m_clk_level_tape ? 0 : 1; m_uart->write_txc(m_clk_level_tape); return; } m_clk_level_tape = 1; m_clk_level = m_clk_level ? 0 : 1; m_uart->write_txc(m_clk_level); // } } DRIVER_INIT_MEMBER(poly88_state,poly88) { m_previous_level = 0; m_clk_level = m_clk_level_tape = 1; m_cassette_timer = timer_alloc(TIMER_CASSETTE); m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(600)); timer_set(attotime::from_hz(24000), TIMER_KEYBOARD); } void poly88_state::machine_reset() { m_intr = 0; m_last_code = 0; } INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt) { m_int_vector = 0xf7; device.execute().set_input_line(0, HOLD_LINE); } WRITE_LINE_MEMBER(poly88_state::poly88_usart_rxready) { //drvm_int_vector = 0xe7; //execute().set_input_line(0, HOLD_LINE); } READ8_MEMBER(poly88_state::poly88_keyboard_r) { UINT8 retVal = m_last_code; m_maincpu->set_input_line(0, CLEAR_LINE); m_last_code = 0x00; return retVal; } WRITE8_MEMBER(poly88_state::poly88_intr_w) { m_maincpu->set_input_line(0, CLEAR_LINE); } SNAPSHOT_LOAD_MEMBER( poly88_state, poly88 ) { address_space &space = m_maincpu->space(AS_PROGRAM); UINT8* data= auto_alloc_array(machine(), UINT8, snapshot_size); UINT16 recordNum; UINT16 recordLen; UINT16 address; UINT8 recordType; int pos = 0x300; char name[9]; int i = 0; int theend = 0; image.fread( data, snapshot_size); while (pos<snapshot_size) { for(i=0;i<9;i++) { name[i] = (char) data[pos + i]; } pos+=8; name[8] = 0; recordNum = data[pos]+ data[pos+1]*256; pos+=2; recordLen = data[pos]; pos++; if (recordLen==0) recordLen=0x100; address = data[pos] + data[pos+1]*256; pos+=2; recordType = data[pos]; pos++; logerror("Block :%s number:%d length: %d address=%04x type:%d\n",name,recordNum,recordLen,address, recordType); switch(recordType) { case 0 : /* 00 Absolute */ memcpy(space.get_read_ptr(address ), data + pos ,recordLen); break; case 1 : /* 01 Comment */ break; case 2 : /* 02 End */ theend = 1; break; case 3 : /* 03 Auto Start @ Address */ m_maincpu->set_state_int(I8085_PC, address); theend = 1; break; case 4 : /* 04 Data ( used by Assembler ) */ logerror("ASM load unsupported\n"); theend = 1; break; case 5 : /* 05 BASIC program file */ logerror("BASIC load unsupported\n"); theend = 1; break; case 6 : /* 06 End ( used by Assembler? ) */ theend = 1; break; default: break; } if (theend) { break; } pos+=recordLen; } machine().device("uart")->reset(); return IMAGE_INIT_PASS; }