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
|
// license:BSD-3-Clause
// copyright-holders:Mike Balfour
/***************************************************************************
Atari Night Driver hardware
driver by Mike Balfour
Games supported:
* Night Driver
Known issues:
* The road boxes in service mode are flipped horizontally and there
is an extraneous box according to the service manual.
****************************************************************************
Memory Map:
0000-01FF R/W SCRAM (Scratchpad RAM)
0200-03FF W PFW (Playfield Write)
0400-05FF W HVC (Horiz/Vert/Char for Roadway)
0600-07FF R IN0
0800-09FF R IN1
0A00-0BFF W OUT0
0C00-0DFF W OUT1
0E00-0FFF - OUT2 (Not used)
8000-83FF R PFR (Playfield Read)
8400-87FF Steering Reset
8800-8FFF - Spare (Not used)
9000-97FF R Program ROM1
9800-9FFF R Program ROM2
(F800-FFFF) R Program ROM2 - only needed for the 6502 vectors
If you have any questions about how this driver works, don't hesitate to
ask. - Mike Balfour (mab22@po.cwru.edu)
***************************************************************************/
#include "emu.h"
#include "includes/nitedrvr.h"
#include "cpu/m6502/m6502.h"
#include "machine/rescap.h"
#include "machine/watchdog.h"
#include "sound/discrete.h"
#include "screen.h"
#include "speaker.h"
// Memory Map
void nitedrvr_state::main_map(address_map &map)
{
map(0x0000, 0x00ff).ram().mirror(0x100); // SCRAM
map(0x0200, 0x027f).nopr().ram().mirror(0x180).share(m_videoram); // PFW
map(0x0400, 0x042f).nopr().writeonly().mirror(0x1c0).share(m_hvc); // POSH, POSV, CHAR
map(0x0430, 0x043f).w("watchdog", FUNC(watchdog_timer_device::reset_w)).mirror(0x1c0);
map(0x0600, 0x07ff).r(FUNC(nitedrvr_state::in0_r));
map(0x0800, 0x09ff).r(FUNC(nitedrvr_state::in1_r));
map(0x0a00, 0x0bff).w(FUNC(nitedrvr_state::out0_w));
map(0x0c00, 0x0dff).w(FUNC(nitedrvr_state::out1_w));
map(0x8000, 0x807f).nopw().ram().mirror(0x380).share(m_videoram); // PFR
map(0x8400, 0x87ff).rw(FUNC(nitedrvr_state::steering_reset_r), FUNC(nitedrvr_state::steering_reset_w));
map(0x9000, 0x9fff).rom(); // ROM1-ROM2
map(0xfff0, 0xffff).rom(); // ROM2 for 6502 vectors
}
// Input Ports
static INPUT_PORTS_START( nitedrvr )
PORT_START("DSW0") // fake
PORT_DIPNAME( 0x30, 0x10, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x30, DEF_STR( 2C_1C ) )
//PORT_DIPSETTING( 0x20, DEF_STR( 1C_1C ) ) // not a typo
PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) )
PORT_DIPNAME( 0xc0, 0x80, "Playing Time" )
PORT_DIPSETTING( 0x00, "50" )
PORT_DIPSETTING( 0x40, "75" )
PORT_DIPSETTING( 0x80, "100" )
PORT_DIPSETTING( 0xC0, "125" )
PORT_START("DSW1") // fake
PORT_DIPNAME( 0x10, 0x00, "Track Set" )
PORT_DIPSETTING( 0x00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x10, DEF_STR( Reverse ) )
PORT_DIPNAME( 0x20, 0x20, "Bonus Time" )
PORT_DIPSETTING( 0x00, DEF_STR ( No ) )
PORT_DIPSETTING( 0x20, "Score = 350" )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
PORT_START("GEARS") // fake
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("1st Gear")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("2nd Gear")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("3rd Gear")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("4th Gear")
PORT_START("DSW2") // fake
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Spare
PORT_DIPNAME( 0x20, 0x00, "Difficult Bonus" )
PORT_DIPSETTING( 0x00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Difficult ) )
PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("IN0") // fake
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gas")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Novice Track")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Expert Track")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Pro Track")
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) // Alternating signal?
PORT_START("STEER") // fake
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
PORT_START("MOTOR")
PORT_ADJUSTER( 60, "Motor RPM" )
INPUT_PORTS_END
// Graphics Layouts
static const gfx_layout charlayout =
{
8, 8,
64,
1,
{ 0 },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8
};
// Graphics Decode Information
static GFXDECODE_START( gfx_nitedrvr )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 )
GFXDECODE_END
// Machine Driver
void nitedrvr_state::nitedrvr(machine_config &config)
{
// basic machine hardware
M6502(config, m_maincpu, 12.096_MHz_XTAL / 12); // 1 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nitedrvr_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(nitedrvr_state::irq0_line_hold));
WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 3);
TIMER(config, "crash_timer").configure_periodic(FUNC(nitedrvr_state::crash_toggle_callback), PERIOD_OF_555_ASTABLE(RES_K(180), 330, CAP_U(1)));
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(12.096_MHz_XTAL / 2, 384, 0, 256, 262, 0, 240);
// PROM derives VRESET, VBLANK, VSYNC, IRQ from vertical scan count and last VBLANK
screen.set_screen_update(FUNC(nitedrvr_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nitedrvr);
PALETTE(config, m_palette, palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
DISCRETE(config, m_discrete, nitedrvr_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
}
// ROMs
/*
ROM_START( nitedrvo ) // early revision has the program code stored in 8 chips
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "006560-01.h1", 0x9000, 0x0200, NO_DUMP ) // PROM 1
ROM_LOAD( "006561-01.c1", 0x9200, 0x0200, NO_DUMP ) // PROM 2
ROM_LOAD( "006562-01.j1", 0x9400, 0x0200, NO_DUMP ) // PROM 3
ROM_LOAD( "006563-01.d1", 0x9600, 0x0200, NO_DUMP ) // PROM 4
ROM_LOAD( "006564-01.k1", 0x9800, 0x0200, NO_DUMP ) // PROM 5
ROM_LOAD( "006565-01.e1", 0x9a00, 0x0200, NO_DUMP ) // PROM 6
ROM_LOAD( "006566-01.l1", 0x9c00, 0x0200, NO_DUMP ) // PROM 7
ROM_LOAD( "006567-01.f1", 0x9e00, 0x0200, NO_DUMP ) // PROM 8
ROM_END
*/
ROM_START( nitedrvr )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "006569-01.d2", 0x9000, 0x0800, CRC(7afa7542) SHA1(81018e25ebdeae1daf1308676661063b6fd7fd22) ) // mask ROM 1
ROM_LOAD( "006570-01.f2", 0x9800, 0x0800, CRC(bf5d77b1) SHA1(6f603f8b0973bd89e0e721b66944aac8e9f904d9) ) // mask ROM 2
ROM_RELOAD( 0xf800, 0x0800 ) // vectors
ROM_REGION( 0x200, "gfx1", 0 )
ROM_LOAD( "006568-01.p2", 0x0000, 0x0200, CRC(f80d8889) SHA1(ca573543dcce1221459d5693c476cef14bfac4f4) ) // PROM, Alpha-Numeric
ROM_REGION( 0x100, "proms", 0 )
ROM_LOAD( "006559-01.h7", 0x0000, 0x0100, CRC(5a8d0e42) SHA1(772220c4c24f18769696ddba26db2bc2e5b0909d) ) // PROM, Sync
ROM_END
// Game Drivers
GAME( 1976, nitedrvr, 0, nitedrvr, nitedrvr, nitedrvr_state, empty_init, ROT0, "Atari", "Night Driver", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
|