1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver, Bernd Wiebelt, Allard van der Bas
3 /***************************************************************************
4 
5     Atari Tempest hardware
6 
7     Games supported:
8         * Tempest [5 sets]
9         * Tempest Tubes
10 
11     Known bugs:
12         * none at this time
13 
14 ****************************************************************************
15 
16     TEMPEST
17     -------
18     HEX        R/W   D7 D6 D5 D4 D3 D2 D2 D0  function
19     0000-07FF  R/W   D  D  D  D  D  D  D  D   program ram (2K)
20     0800-080F   W                D  D  D  D   Colour ram
21 
22     0C00        R                         D   Right coin sw
23     0C00        R                      D      Center coin sw
24     0C00        R                   D         Left coin sw
25     0C00        R                D            Slam sw
26     0C00        R             D               Self test sw
27     0C00        R          D                  Diagnostic step sw
28     0C00        R       D                     Halt
29     0C00        R    D                        3kHz ??
30     0D00        R    D  D  D  D  D  D  D  D   option switches
31     0E00        R    D  D  D  D  D  D  D  D   option switches
32 
33     2000-2FFF  R/W   D  D  D  D  D  D  D  D   Vector Ram (4K)
34     3000-3FFF   R    D  D  D  D  D  D  D  D   Vector Rom (4K)
35 
36     4000        W                         D   Right coin counter
37     4000        W                      D      left  coin counter
38     4000        W                D            Video invert - x
39     4000        W             D               Video invert - y
40     4800        W                             Vector generator GO
41 
42     5000        W                             WD clear
43     5800        W                             Vect gen reset
44 
45     6000-603F   W    D  D  D  D  D  D  D  D   EAROM write
46     6040        W    D  D  D  D  D  D  D  D   EAROM control
47     6040        R    D                        Mathbox status
48     6050        R    D  D  D  D  D  D  D  D   EAROM read
49 
50     6060        R    D  D  D  D  D  D  D  D   Mathbox read
51     6070        R    D  D  D  D  D  D  D  D   Mathbox read
52     6080-609F   W    D  D  D  D  D  D  D  D   Mathbox start
53 
54     60C0-60CF  R/W   D  D  D  D  D  D  D  D   Custom audio chip 1
55     60D0-60DF  R/W   D  D  D  D  D  D  D  D   Custom audio chip 2
56 
57     60E0        R                         D   one player start LED
58     60E0        R                      D      two player start LED
59     60E0        R                   D         FLIP
60 
61     9000-DFFF  R     D  D  D  D  D  D  D  D   Program ROM (20K)
62 
63     notes: program ram decode may be incorrect, but it appears like
64     this on the schematics, and the troubleshooting guide.
65 
66     ZAP1,FIRE1,FIRE2,ZAP2 go to pokey2 , bits 3,and 4
67     (depending on state of FLIP)
68     player1 start, player2 start are pokey2 , bits 5 and 6
69 
70     encoder wheel goes to pokey1 bits 0-3
71     pokey1, bit4 is cocktail detect
72 
73 
74     TEMPEST SWITCH SETTINGS (Atari, 1980)
75     -------------------------------------
76 
77 
78     GAME OPTIONS:
79     (8-position switch at L12 on Analog Vector-Generator PCB)
80 
81     1   2   3   4   5   6   7   8   Meaning
82     -------------------------------------------------------------------------
83     Off Off                         2 lives per game
84     On  On                          3 lives per game
85     On  Off                         4 lives per game
86     Off On                          5 lives per game
87             On  On  Off             Bonus life every 10000 pts
88             On  On  On              Bonus life every 20000 pts
89             On  Off On              Bonus life every 30000 pts
90             On  Off Off             Bonus life every 40000 pts
91             Off On  On              Bonus life every 50000 pts
92             Off On  Off             Bonus life every 60000 pts
93             Off Off On              Bonus life every 70000 pts
94             Off Off Off             No bonus lives
95                         On  On      English
96                         On  Off     French
97                         Off On      German
98                         Off Off     Spanish
99                                 On  1-credit minimum
100                                 Off 2-credit minimum
101 
102 
103     GAME OPTIONS:
104     (4-position switch at D/E2 on Math Box PCB)
105 
106     1   2   3   4                   Meaning
107     -------------------------------------------------------------------------
108         Off                         Minimum rating range: 1, 3, 5, 7, 9
109         On                          Minimum rating range tied to high score
110             Off Off                 Medium difficulty (see notes)
111             Off On                  Easy difficulty (see notes)
112             On  Off                 Hard difficulty (see notes)
113             On  On                  Medium difficulty (see notes)
114 
115 
116     PRICING OPTIONS:
117     (8-position switch at N13 on Analog Vector-Generator PCB)
118 
119     1   2   3   4   5   6   7   8   Meaning
120     -------------------------------------------------------------------------
121     On  On  On                      No bonus coins
122     On  On  Off                     For every 2 coins, game adds 1 more coin
123     On  Off On                      For every 4 coins, game adds 1 more coin
124     On  Off Off                     For every 4 coins, game adds 2 more coins
125     Off On  On                      For every 5 coins, game adds 1 more coin
126     Off On  Off                     For every 3 coins, game adds 1 more coin
127     On  Off                 Off On  Demonstration Mode (see notes)
128     Off Off                 Off On  Demonstration-Freeze Mode (see notes)
129                 On                  Left coin mech * 1
130                 Off                 Left coin mech * 2
131                     On  On          Right coin mech * 1
132                     On  Off         Right coin mech * 4
133                     Off On          Right coin mech * 5
134                     Off Off         Right coin mech * 6
135                             Off On  Free Play
136                             Off Off 1 coin 2 plays
137                             On  On  1 coin 1 play
138                             On  Off 2 coins 1 play
139 
140 
141     GAME SETTING NOTES:
142     -------------------
143 
144     Demonstration Mode:
145     - Plays a normal game of Tempest, but pressing SUPERZAP sends you
146       directly to the next level.
147 
148     Demonstration-Freeze Mode:
149     - Just like Demonstration Mode, but with frozen screen action.
150 
151     Both Demonstration Modes:
152     - Pressing RESET in either mode will cause the game to lock up.
153       To recover, set switch 1 to On.
154     - You can start at any level from 1..81, so it's an easy way of
155       seeing what the game can throw at you
156     - The score is zeroed at the end of the game, so you also don't
157       have to worry about artificially high scores disrupting your
158       scoring records as stored in the game's EAROM.
159 
160     Easy Difficulty:
161     - Enemies move more slowly
162     - One less enemy shot on the screen at any given time
163 
164     Hard Difficulty:
165     - Enemies move more quickly
166     - 1-4 more enemy shots on the screen at any given time
167     - One more enemy may be on the screen at any given time
168 
169     High Scores:
170     - Changing toggles 1-5 at L12 (more/fewer lives, bonus ship levels)
171       will erase the high score table.
172     - You should also wait 8-10 seconds after a game has been played
173       before entering self-test mode or powering down; otherwise, you
174       might erase or corrupt the high score table.
175 
176 -----------------------------------------
177 
178 Atari Bulletin, December 4, 1981
179 
180 Tempest Program Bug
181 
182 Tempest Uprights Prior to Serial #17426
183 
184   If the score on your Tempest(tm) is greater then 170,000, there
185 is a 12% chance that a program bug may award 40 credits for one
186 quarter.
187 
188   The ROM (#136002-217) in this package, replaces the ROM in
189 location J-1 on the main PCB and will correct the problem.
190 
191   All cabaret and cocktail cabinets will have the correct ROM
192 Installed.
193 
194 Thank you,
195 
196 Fred McCord
197 Field Service Manager
198 
199 Tech Tip, December 11, 1981
200 
201 Tempest(tm) ROM #136002-117
202 
203 We have found that the above part number in location J1 should be replaced with part
204 number 136002-217 in the main board in order to eliminate the possibility of receiving
205 extra bonus plays after 170,000 points.
206 
207 RMA# T1700
208 
209 Exchange offer expires on March 15, 1982
210 
211 -----------------------------------------
212 
213 Skill-Step(tm) feature of your new Tempest(tm) game:
214 
215 I. Player rating mode
216 
217   1. Occurs at beginning of every game
218   2. Player is given 10 seconds to choose his starting level
219   3. Player may choose from those levels displayed at bottom of screen
220   4. Player chooses level by:
221    a. spinning knob until white box surrounds desired level and then
222    b. pressing fire or superzapper (or start 1 or start 2 if remaining
223       time is less then 8 seconds), or by waiting until timer expires
224   5. Player is given a 3 second warning
225   6. Level choices are determined by several factors
226    a. If the game has been idle for 1 or more attract mode cycles
227       since the last game, then the choices are levels 1,3,5,7,9
228    b. If a player has just finished a game and pressed start before
229       the attract mode has finished its play mode, then the choices
230       depend on the highest level reached in that previous game as
231       follows
232 
233 Highest level
234 reached in
235 last game            Level choices this game
236 -------------        -----------------------
237 1 through 11         1,3,5,7,9
238 12 or 13             1,3,5,7,9,11
239 14 or 15             1,3,5,7,9,11,13
240 16 or 17             1,3,5,7,9,11,13,15
241 18, 19 or 20         1,3,5,7,9,11,13,15,17
242 21 or 22             1,3,5,7,9,11,13,15,17,20
243 23 or 24             1,3,5,7,9,11,13,15,17,20,22
244 25 or 26             1,3,5,7,9,11,13,15,17,20,22,24
245 27 or 28             1,3,5,7,9,11,13,15,17,20,22,24,26
246 29, 30 or 31         1,3,5,7,9,11,13,15,17,20,22,24,26,28
247 32 or 33             1,3,5,7,9,11,13,15,17,20,22,24,26,28,31
248 34, 35 or 36         1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33
249 37,38,39,40          1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36
250 41,42,43,44          1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40
251 45, 46 or 47         1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44
252 48 or 49             1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47
253 50, 51 or 52         1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49
254 53,54,55,56          1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52
255 57,58,59,60          1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56
256 61, 62 or 63         1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56,60
257 64 or 65             1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56,60,63
258 66 through 73        1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56,60,63,65
259 74 through 81        1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56,60,63,65,73
260 82 through 99        1,3,5,7,9,11,13,15,17,20,22,24,26,28,31,33,36,40,44,47,49,52,56,60,63,65,73,81
261 
262 Rom revisions and bug fixes / effects:
263 
264 Revision 2
265 136002-217.j1  Fixes the score cheat (see tech notes above)
266 136002-222.r1  In test mode, changes spinner letters to a line, described in Tempest manual C0-190-01 New Roms
267 
268 Revision 3
269 136002-316.h1  Fixes screen collapse between players when using newer deflection board
270 
271 136002-134.f1  Contains the 136002-316.h1 code fix even though it's listed as a rev 1 rom
272 
273 Note: Roms for Tempest Analog Vector-Generator PCB Assembly A037383-03 or A037383-04 are twice
274       the size as those for Tempest Analog Vector-Generator PCB Assembly A037383-01 or A037383-02
275 
276 ***************************************************************************/
277 
278 #include "emu.h"
279 #include "cpu/m6502/m6502.h"
280 #include "machine/mathbox.h"
281 #include "machine/rescap.h"
282 #include "machine/watchdog.h"
283 #include "video/avgdvg.h"
284 #include "video/vector.h"
285 #include "machine/er2055.h"
286 #include "sound/pokey.h"
287 #include "screen.h"
288 #include "speaker.h"
289 
290 
291 static constexpr XTAL MASTER_CLOCK = 12.096_MHz_XTAL;
292 static constexpr XTAL CLOCK_3KHZ   = MASTER_CLOCK / 4096;
293 
294 #define TEMPEST_KNOB_P1_TAG "KNOBP1"
295 #define TEMPEST_KNOB_P2_TAG "KNOBP2"
296 #define TEMPEST_BUTTONS_P1_TAG  "BUTTONSP1"
297 #define TEMPEST_BUTTONS_P2_TAG  "BUTTONSP2"
298 
299 class tempest_state : public driver_device
300 {
301 public:
tempest_state(const machine_config & mconfig,device_type type,const char * tag)302 	tempest_state(const machine_config &mconfig, device_type type, const char *tag) :
303 		driver_device(mconfig, type, tag),
304 		m_maincpu(*this, "maincpu"),
305 		m_mathbox(*this, "mathbox"),
306 		m_watchdog(*this, "watchdog"),
307 		m_avg(*this, "avg"),
308 		m_earom(*this, "earom"),
309 		m_rom(*this, "maincpu"),
310 		m_knob_p1(*this, TEMPEST_KNOB_P1_TAG),
311 		m_knob_p2(*this, TEMPEST_KNOB_P2_TAG),
312 		m_buttons_p1(*this, TEMPEST_BUTTONS_P1_TAG),
313 		m_buttons_p2(*this, TEMPEST_BUTTONS_P2_TAG),
314 		m_in1(*this, "IN1_DSW0"),
315 		m_in2(*this, "IN2"),
316 		m_leds(*this, "led%u", 0U)
317 	{ }
318 
319 	void tempest(machine_config &config);
320 
321 	DECLARE_CUSTOM_INPUT_MEMBER(tempest_knob_r);
322 	DECLARE_CUSTOM_INPUT_MEMBER(tempest_buttons_r);
323 	DECLARE_READ_LINE_MEMBER(clock_r);
324 
325 protected:
326 	void wdclr_w(uint8_t data);
327 	void tempest_led_w(uint8_t data);
328 	void tempest_coin_w(uint8_t data);
329 	uint8_t input_port_1_bit_r(offs_t offset);
330 	uint8_t input_port_2_bit_r(offs_t offset);
331 
332 	uint8_t earom_read();
333 	void earom_write(offs_t offset, uint8_t data);
334 	void earom_control_w(uint8_t data);
335 
336 	uint8_t rom_ae1f_r();
337 
338 	virtual void machine_start() override;
339 	void main_map(address_map &map);
340 
341 	required_device<cpu_device> m_maincpu;
342 	required_device<mathbox_device> m_mathbox;
343 	required_device<watchdog_timer_device> m_watchdog;
344 	required_device<avg_tempest_device> m_avg;
345 	required_device<er2055_device> m_earom;
346 	required_region_ptr<uint8_t> m_rom;
347 
348 	required_ioport m_knob_p1;
349 	required_ioport m_knob_p2;
350 	required_ioport m_buttons_p1;
351 	required_ioport m_buttons_p2;
352 	required_ioport m_in1;
353 	required_ioport m_in2;
354 	output_finder<2> m_leds;
355 
356 	uint8_t m_player_select;
357 };
358 
359 
machine_start()360 void tempest_state::machine_start()
361 {
362 	m_leds.resolve();
363 	save_item(NAME(m_player_select));
364 }
365 
366 /*************************************
367  *
368  *  Interrupt ack
369  *
370  *************************************/
371 
wdclr_w(uint8_t data)372 void tempest_state::wdclr_w(uint8_t data)
373 {
374 	m_maincpu->set_input_line(0, CLEAR_LINE);
375 	m_watchdog->watchdog_reset();
376 }
377 
378 /*************************************
379  *
380  *  Input ports
381  *
382  *************************************/
383 
CUSTOM_INPUT_MEMBER(tempest_state::tempest_knob_r)384 CUSTOM_INPUT_MEMBER(tempest_state::tempest_knob_r)
385 {
386 	return (m_player_select == 0) ? m_knob_p1->read() : m_knob_p2->read();
387 }
388 
CUSTOM_INPUT_MEMBER(tempest_state::tempest_buttons_r)389 CUSTOM_INPUT_MEMBER(tempest_state::tempest_buttons_r)
390 {
391 	return (m_player_select == 0) ? m_buttons_p1->read() : m_buttons_p2->read();
392 }
393 
394 
READ_LINE_MEMBER(tempest_state::clock_r)395 READ_LINE_MEMBER(tempest_state::clock_r)
396 {
397 	/* Emulate the 3kHz source on bit 7 (divide 1.5MHz by 512) */
398 	return (m_maincpu->total_cycles() & 0x100) ? 1 : 0;
399 }
400 
401 
input_port_1_bit_r(offs_t offset)402 uint8_t tempest_state::input_port_1_bit_r(offs_t offset)
403 {
404 	return (m_in1->read() & (1 << offset)) ? 0 : 228;
405 }
406 
407 
input_port_2_bit_r(offs_t offset)408 uint8_t tempest_state::input_port_2_bit_r(offs_t offset)
409 {
410 	return (m_in2->read() & (1 << offset)) ? 0 : 228;
411 }
412 
413 
414 
415 /*************************************
416  *
417  *  Output ports
418  *
419  *************************************/
420 
tempest_led_w(uint8_t data)421 void tempest_state::tempest_led_w(uint8_t data)
422 {
423 	m_leds[0] = BIT(~data, 1);
424 	m_leds[1] = BIT(~data, 0);
425 	/* FLIP is bit 0x04 */
426 	m_player_select = data & 0x04;
427 }
428 
429 
tempest_coin_w(uint8_t data)430 void tempest_state::tempest_coin_w(uint8_t data)
431 {
432 	machine().bookkeeping().coin_counter_w(0, (data & 0x01));
433 	machine().bookkeeping().coin_counter_w(1, (data & 0x02));
434 	machine().bookkeeping().coin_counter_w(2, (data & 0x04));
435 	m_avg->set_flip_x(data & 0x08);
436 	m_avg->set_flip_y(data & 0x10);
437 }
438 
439 
440 
441 /*************************************
442  *
443  *  High score EAROM
444  *
445  *************************************/
446 
earom_read()447 uint8_t tempest_state::earom_read()
448 {
449 	return m_earom->data();
450 }
451 
earom_write(offs_t offset,uint8_t data)452 void tempest_state::earom_write(offs_t offset, uint8_t data)
453 {
454 	m_earom->set_address(offset & 0x3f);
455 	m_earom->set_data(data);
456 }
457 
earom_control_w(uint8_t data)458 void tempest_state::earom_control_w(uint8_t data)
459 {
460 	// CK = EDB0, C1 = /EDB2, C2 = EDB1, CS1 = EDB3, /CS2 = GND
461 	m_earom->set_control(BIT(data, 3), 1, !BIT(data, 2), BIT(data, 1));
462 	m_earom->set_clk(BIT(data, 0));
463 }
464 
465 
466 
467 /*************************************
468  *
469  *  Main CPU memory handlers
470  *
471  *************************************/
472 
rom_ae1f_r()473 uint8_t tempest_state::rom_ae1f_r()
474 {
475 	// This is needed to ensure that the routine starting at ae1c passes checks and does not corrupt data;
476 	// config.m_perfect_cpu_quantum = subtag("maincpu"); would be very taxing on this driver.
477 	machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
478 	machine().scheduler().abort_timeslice();
479 
480 	return m_rom[0xae1f];
481 }
482 
483 
main_map(address_map & map)484 void tempest_state::main_map(address_map &map)
485 {
486 	map(0x0000, 0x07ff).ram();
487 	map(0x0800, 0x080f).writeonly().share("avg:colorram");
488 	map(0x0c00, 0x0c00).portr("IN0");
489 	map(0x0d00, 0x0d00).portr("DSW1");
490 	map(0x0e00, 0x0e00).portr("DSW2");
491 	map(0x2000, 0x2fff).ram().share("avg:vectorram").region("maincpu", 0x2000);
492 	map(0x3000, 0x3fff).rom();
493 	map(0x4000, 0x4000).w(FUNC(tempest_state::tempest_coin_w));
494 	map(0x4800, 0x4800).w(m_avg, FUNC(avg_tempest_device::go_w));
495 	map(0x5000, 0x5000).w(FUNC(tempest_state::wdclr_w));
496 	map(0x5800, 0x5800).w(m_avg, FUNC(avg_tempest_device::reset_w));
497 	map(0x6000, 0x603f).w(FUNC(tempest_state::earom_write));
498 	map(0x6040, 0x6040).r(m_mathbox, FUNC(mathbox_device::status_r)).w(FUNC(tempest_state::earom_control_w));
499 	map(0x6050, 0x6050).r(FUNC(tempest_state::earom_read));
500 	map(0x6060, 0x6060).r(m_mathbox, FUNC(mathbox_device::lo_r));
501 	map(0x6070, 0x6070).r(m_mathbox, FUNC(mathbox_device::hi_r));
502 	map(0x6080, 0x609f).w(m_mathbox, FUNC(mathbox_device::go_w));
503 	map(0x60c0, 0x60cf).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write));
504 	map(0x60d0, 0x60df).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write));
505 	map(0x60e0, 0x60e0).w(FUNC(tempest_state::tempest_led_w));
506 	map(0x9000, 0xdfff).rom();
507 	map(0xae1f, 0xae1f).r(FUNC(tempest_state::rom_ae1f_r));
508 	map(0xf000, 0xffff).rom(); /* for the reset / interrupt vectors */
509 }
510 
511 
512 /*************************************
513  *
514  *  Port definitions
515  *
516  *************************************/
517 
518 static INPUT_PORTS_START( tempest )
519 	PORT_START("IN0")
520 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
521 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
522 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
523 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
524 	PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
525 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diagnostic Step")
526 	/* bit 6 is the VG HALT bit. We set it to "low" */
527 	/* per default (busy vector processor). */
528 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("avg", avg_tempest_device, done_r)
529 	/* bit 7 is tied to a 3kHz (?) clock */
PORT_READ_LINE_MEMBER(tempest_state,clock_r)530 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(tempest_state, clock_r)
531 
532 	PORT_START("IN1_DSW0")
533 	PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(tempest_state, tempest_knob_r)
534 	/* The next one is reponsible for cocktail mode.
535 	 * According to the documentation, this is not a switch, although
536 	 * it may have been planned to put it on the Math Box PCB, D/E2 )
537 	 */
538 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
539 	PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
540 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
541 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
542 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
543 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
544 
545 	PORT_START("IN2")
546 	PORT_DIPNAME(  0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DE2:4,3")
547 	PORT_DIPSETTING(     0x02, DEF_STR( Easy ) )
548 	PORT_DIPSETTING(     0x03, "Medium1" )
549 	PORT_DIPSETTING(     0x00, "Medium2" )
550 	PORT_DIPSETTING(     0x01, DEF_STR( Hard ) )
551 	PORT_DIPNAME(  0x04, 0x04, "Rating" ) PORT_DIPLOCATION("DE2:2")
552 	PORT_DIPSETTING(     0x04, "1, 3, 5, 7, 9" )
553 	PORT_DIPSETTING(     0x00, "tied to high score" )
554 	PORT_BIT(0x18, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(tempest_state, tempest_buttons_r)
555 	PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1 )
556 	PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START2 )
557 	PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
558 
559 	PORT_START("DSW1")  /* N13 on analog vector generator PCB */
560 	PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("N13:8,7")
561 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
562 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
563 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
564 	PORT_DIPSETTING(    0x02, DEF_STR( Free_Play ) )
565 	PORT_DIPNAME( 0x0c, 0x00, "Right Coin" ) PORT_DIPLOCATION("N13:6,5")
566 	PORT_DIPSETTING(    0x00, "*1" )
567 	PORT_DIPSETTING(    0x04, "*4" )
568 	PORT_DIPSETTING(    0x08, "*5" )
569 	PORT_DIPSETTING(    0x0c, "*6" )
570 	PORT_DIPNAME( 0x10, 0x00, "Left Coin" ) PORT_DIPLOCATION("N13:4")
571 	PORT_DIPSETTING(    0x00, "*1" )
572 	PORT_DIPSETTING(    0x10, "*2" )
573 	PORT_DIPNAME( 0xe0, 0x00, "Bonus Coins" ) PORT_DIPLOCATION("N13:3,2,1")
574 	PORT_DIPSETTING(    0x00, DEF_STR( None ) )
575 	PORT_DIPSETTING(    0x80, "1 each 5" )
576 	PORT_DIPSETTING(    0x40, "1 each 4 (+Demo)" )
577 	PORT_DIPSETTING(    0xa0, "1 each 3" )
578 	PORT_DIPSETTING(    0x60, "2 each 4 (+Demo)" )
579 	PORT_DIPSETTING(    0x20, "1 each 2" )
580 	PORT_DIPSETTING(    0xc0, "Freeze Mode" )
581 	PORT_DIPSETTING(    0xe0, "Freeze Mode" )
582 
583 	PORT_START("DSW2")  /* L12 on analog vector generator PCB */
584 	PORT_DIPNAME( 0x01, 0x00, "Minimum" ) PORT_DIPLOCATION("L12:8")
585 	PORT_DIPSETTING(    0x00, "1 Credit" )
586 	PORT_DIPSETTING(    0x01, "2 Credit" )
587 	PORT_DIPNAME( 0x06, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("L12:7,6")
588 	PORT_DIPSETTING(    0x00, DEF_STR( English ) )
589 	PORT_DIPSETTING(    0x02, DEF_STR( French ) )
590 	PORT_DIPSETTING(    0x04, DEF_STR( German ) )
591 	PORT_DIPSETTING(    0x06, DEF_STR( Spanish ) )
592 	PORT_DIPNAME( 0x38, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("L12:5,4,3")
593 	PORT_DIPSETTING(    0x08, "10000" )
594 	PORT_DIPSETTING(    0x00, "20000" )
595 	PORT_DIPSETTING(    0x10, "30000" )
596 	PORT_DIPSETTING(    0x18, "40000" )
597 	PORT_DIPSETTING(    0x20, "50000" )
598 	PORT_DIPSETTING(    0x28, "60000" )
599 	PORT_DIPSETTING(    0x30, "70000" )
600 	PORT_DIPSETTING(    0x38, DEF_STR( None ) )
601 	PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("L12:2,1")
602 	PORT_DIPSETTING(    0xc0, "2" )
603 	PORT_DIPSETTING(    0x00, "3" )
604 	PORT_DIPSETTING(    0x40, "4" )
605 	PORT_DIPSETTING(    0x80, "5" )
606 
607 	PORT_START(TEMPEST_KNOB_P1_TAG)
608 	/* This is the Tempest spinner input. It only uses 4 bits. */
609 	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_FULL_TURN_COUNT(72)
610 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
611 
612 	PORT_START(TEMPEST_KNOB_P2_TAG)
613 	/* This is the Tempest spinner input. It only uses 4 bits. */
614 	PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(2) PORT_FULL_TURN_COUNT(72)
615 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
616 
617 	PORT_START(TEMPEST_BUTTONS_P1_TAG)
618 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
619 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
620 	PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
621 
622 	PORT_START(TEMPEST_BUTTONS_P2_TAG)
623 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
624 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
625 	PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
626 INPUT_PORTS_END
627 
628 
629 /*************************************
630  *
631  *  Machine drivers
632  *
633  *************************************/
634 
635 void tempest_state::tempest(machine_config &config)
636 {
637 	/* basic machine hardware */
638 	M6502(config, m_maincpu, MASTER_CLOCK / 8);
639 	m_maincpu->set_addrmap(AS_PROGRAM, &tempest_state::main_map);
640 	m_maincpu->set_periodic_int(FUNC(tempest_state::irq0_line_assert), attotime::from_hz(CLOCK_3KHZ / 12));
641 
642 	WATCHDOG_TIMER(config, m_watchdog).set_time(attotime::from_hz(CLOCK_3KHZ / 256));
643 
644 	ER2055(config, m_earom);
645 
646 	/* video hardware */
647 	VECTOR(config, "vector");
648 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_VECTOR));
649 	screen.set_refresh_hz(60);
650 	screen.set_size(400, 300);
651 	screen.set_visarea(0, 580, 0, 570);
652 	screen.set_screen_update("vector", FUNC(vector_device::screen_update));
653 
654 	AVG_TEMPEST(config, m_avg, 0);
655 	m_avg->set_vector_tag("vector");
656 
657 	/* Drivers */
658 	MATHBOX(config, m_mathbox, 0);
659 
660 	/* sound hardware */
661 	SPEAKER(config, "mono").front_center();
662 
663 	pokey_device &pokey1(POKEY(config, "pokey1", MASTER_CLOCK / 8));
664 	pokey1.pot_r<0>().set(FUNC(tempest_state::input_port_1_bit_r));
665 	pokey1.pot_r<1>().set(FUNC(tempest_state::input_port_1_bit_r));
666 	pokey1.pot_r<2>().set(FUNC(tempest_state::input_port_1_bit_r));
667 	pokey1.pot_r<3>().set(FUNC(tempest_state::input_port_1_bit_r));
668 	pokey1.pot_r<4>().set(FUNC(tempest_state::input_port_1_bit_r));
669 	pokey1.pot_r<5>().set(FUNC(tempest_state::input_port_1_bit_r));
670 	pokey1.pot_r<6>().set(FUNC(tempest_state::input_port_1_bit_r));
671 	pokey1.pot_r<7>().set(FUNC(tempest_state::input_port_1_bit_r));
672 	pokey1.set_output_rc(RES_K(10), CAP_U(0.015), 5.0);
673 	pokey1.add_route(ALL_OUTPUTS, "mono", 0.5);
674 
675 	pokey_device &pokey2(POKEY(config, "pokey2", MASTER_CLOCK / 8));
676 	pokey2.pot_r<0>().set(FUNC(tempest_state::input_port_2_bit_r));
677 	pokey2.pot_r<1>().set(FUNC(tempest_state::input_port_2_bit_r));
678 	pokey2.pot_r<2>().set(FUNC(tempest_state::input_port_2_bit_r));
679 	pokey2.pot_r<3>().set(FUNC(tempest_state::input_port_2_bit_r));
680 	pokey2.pot_r<4>().set(FUNC(tempest_state::input_port_2_bit_r));
681 	pokey2.pot_r<5>().set(FUNC(tempest_state::input_port_2_bit_r));
682 	pokey2.pot_r<6>().set(FUNC(tempest_state::input_port_2_bit_r));
683 	pokey2.pot_r<7>().set(FUNC(tempest_state::input_port_2_bit_r));
684 	pokey2.set_output_rc(RES_K(10), CAP_U(0.015), 5.0);
685 	pokey2.add_route(ALL_OUTPUTS, "mono", 0.5);
686 }
687 
688 
689 
690 /*************************************
691  *
692  *  ROM definitions
693  *
694  *************************************/
695 
696 ROM_START( tempest ) /* rev 3 */
697 	ROM_REGION( 0x10000, "maincpu", 0 )
698 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-03 or A037383-04 */
699 	ROM_LOAD( "136002-133.d1",  0x9000, 0x1000, CRC(1d0cc503) SHA1(7bef95db9b1102d6b1166bda0ccb276ef4cc3764) ) /* 136002-113 + 136002-114 */
700 	ROM_LOAD( "136002-134.f1",  0xa000, 0x1000, CRC(c88e3524) SHA1(89144baf1efc703b2336774793ce345b37829ee7) ) /* 136002-115 + 136002-316 */
701 	ROM_LOAD( "136002-235.j1",  0xb000, 0x1000, CRC(a4b2ce3f) SHA1(a5f5fb630a48c5d25346f90d4c13aaa98f60b228) ) /* 136002-217 + 136002-118 */
702 	ROM_LOAD( "136002-136.lm1", 0xc000, 0x1000, CRC(65a9a9f9) SHA1(73aa7d6f4e7093ccb2d97f6344f354872bcfd72a) ) /* 136002-119 + 136002-120 */
703 	ROM_LOAD( "136002-237.p1",  0xd000, 0x1000, CRC(de4e9e34) SHA1(04be074e45bf5cd95a852af97cd04e35b7f27fc4) ) /* 136002-121 + 136002-222 */
704 	ROM_RELOAD(                 0xf000, 0x1000 ) /* for reset/interrupt vectors */
705 	/* Vector ROM */
706 	ROM_LOAD( "136002-138.np3", 0x3000, 0x1000, CRC(9995256d) SHA1(2b725ee1a57d423c7d7377a1744f48412e0f2f69) )
707 
708 	/* AVG PROM */
709 	ROM_REGION( 0x100, "avg:prom", 0 )
710 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
711 
712 	/* Mathbox PROMs */
713 	ROM_REGION( 0x20, "user2", 0 )
714 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
715 
716 	ROM_REGION32_BE( 0x400, "user3", 0 )
717 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
718 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
719 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
720 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
721 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
722 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
723 ROM_END
724 
725 
726 ROM_START( tempest1r ) /* rev 1 */
727 	ROM_REGION( 0x10000, "maincpu", 0 )
728 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-03 or A037383-04 */
729 	ROM_LOAD( "136002-133.d1",  0x9000, 0x1000, CRC(1d0cc503) SHA1(7bef95db9b1102d6b1166bda0ccb276ef4cc3764) ) /* 136002-113 + 136002-114 */
730 	ROM_LOAD( "136002-134.f1",  0xa000, 0x1000, CRC(c88e3524) SHA1(89144baf1efc703b2336774793ce345b37829ee7) ) /* 136002-115 + 136002-316 */
731 	ROM_LOAD( "136002-135.j1",  0xb000, 0x1000, CRC(1ca27781) SHA1(cafbec28d682e98a74fdd5b8dfcfa33c64ff6a93) ) /* 136002-117 + 136002-118 */
732 	ROM_LOAD( "136002-136.lm1", 0xc000, 0x1000, CRC(65a9a9f9) SHA1(73aa7d6f4e7093ccb2d97f6344f354872bcfd72a) ) /* 136002-119 + 136002-120 */
733 	ROM_LOAD( "136002-137.p1",  0xd000, 0x1000, CRC(d75fd2ef) SHA1(19f611a77989d201d346b3e89fac5789663a01ce) ) /* 136002-121 + 136002-122 */
734 	ROM_RELOAD(                 0xf000, 0x1000 ) /* for reset/interrupt vectors */
735 	/* Vector ROM */
736 	ROM_LOAD( "136002-138.np3", 0x3000, 0x1000, CRC(9995256d) SHA1(2b725ee1a57d423c7d7377a1744f48412e0f2f69) )
737 
738 	/* AVG PROM */
739 	ROM_REGION( 0x100, "avg:prom", 0 )
740 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
741 
742 	/* Mathbox PROMs */
743 	ROM_REGION( 0x20, "user2", 0 )
744 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
745 
746 	ROM_REGION32_BE( 0x400, "user3", 0 )
747 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
748 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
749 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
750 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
751 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
752 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
753 ROM_END
754 
755 
756 ROM_START( tempest3 ) /* rev 3 */
757 	ROM_REGION( 0x10000, "maincpu", 0 )
758 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-01 or A037383-02 */
759 	ROM_LOAD( "136002-113.d1",   0x9000, 0x0800, CRC(65d61fe7) SHA1(38a1e8a8f65b7887cf3e190269fe4ce2c6f818aa) )
760 	ROM_LOAD( "136002-114.e1",   0x9800, 0x0800, CRC(11077375) SHA1(ed8ff0ca969da6672a7683b93d4fcf2935a0d903) )
761 	ROM_LOAD( "136002-115.f1",   0xa000, 0x0800, CRC(f3e2827a) SHA1(bd04fcfbbba995e08c3144c1474fcddaaeb1c700) )
762 	ROM_LOAD( "136002-316.h1",   0xa800, 0x0800, CRC(aeb0f7e9) SHA1(a5cc25015b98692673cfc1c7c2e9634efd750870) )
763 	ROM_LOAD( "136002-217.j1",   0xb000, 0x0800, CRC(ef2eb645) SHA1(b1a2c969e8897e335d5354de6ae04a65d4b2a1e4) )
764 	ROM_LOAD( "136002-118.k1",   0xb800, 0x0800, CRC(beb352ab) SHA1(f213166d3970e0bd0f29d8dea8d6afa6990cce38) )
765 	ROM_LOAD( "136002-119.lm1",  0xc000, 0x0800, CRC(a4de050f) SHA1(ea302e43a313a5a18115e74ddbaaedde0fbecda7) )
766 	ROM_LOAD( "136002-120.mn1",  0xc800, 0x0800, CRC(35619648) SHA1(48f1e8bed7ec6afa0b4c549a30e5ec331c071e40) )
767 	ROM_LOAD( "136002-121.p1",   0xd000, 0x0800, CRC(73d38e47) SHA1(9980606376a79ba94f8e2a325871a6c8d10d83fc) )
768 	ROM_LOAD( "136002-222.r1",   0xd800, 0x0800, CRC(707bd5c3) SHA1(2f0af6fb7154c244c794f7247e5c16a1e06ddf7d) )
769 	ROM_RELOAD(                  0xf800, 0x0800 ) /* for reset/interrupt vectors */
770 	/* Vector ROM */
771 	ROM_LOAD( "136002-123.np3",  0x3000, 0x0800, CRC(29f7e937) SHA1(686c8b9b8901262e743497cee7f2f7dd5cb3af7e) ) /* May be labeled "136002-111", same data */
772 	ROM_LOAD( "136002-124.r3",   0x3800, 0x0800, CRC(c16ec351) SHA1(a30a3662c740810c0f20e3712679606921b8ca06) ) /* May be labeled "136002-112", same data */
773 
774 	/* AVG PROM */
775 	ROM_REGION( 0x100, "avg:prom", 0 )
776 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
777 
778 	/* Mathbox PROMs */
779 	ROM_REGION( 0x20, "user2", 0 )
780 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
781 
782 	ROM_REGION32_BE( 0x400, "user3", 0 )
783 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
784 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
785 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
786 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
787 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
788 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
789 ROM_END
790 
791 
792 ROM_START( tempest2 ) /* rev 2 */
793 	ROM_REGION( 0x10000, "maincpu", 0 )
794 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-01 or A037383-02 */
795 	ROM_LOAD( "136002-113.d1",   0x9000, 0x0800, CRC(65d61fe7) SHA1(38a1e8a8f65b7887cf3e190269fe4ce2c6f818aa) )
796 	ROM_LOAD( "136002-114.e1",   0x9800, 0x0800, CRC(11077375) SHA1(ed8ff0ca969da6672a7683b93d4fcf2935a0d903) )
797 	ROM_LOAD( "136002-115.f1",   0xa000, 0x0800, CRC(f3e2827a) SHA1(bd04fcfbbba995e08c3144c1474fcddaaeb1c700) )
798 	ROM_LOAD( "136002-116.h1",   0xa800, 0x0800, CRC(7356896c) SHA1(a013ede292189a8f5a907de882ee1a573d784b3c) )
799 	ROM_LOAD( "136002-217.j1",   0xb000, 0x0800, CRC(ef2eb645) SHA1(b1a2c969e8897e335d5354de6ae04a65d4b2a1e4) )
800 	ROM_LOAD( "136002-118.k1",   0xb800, 0x0800, CRC(beb352ab) SHA1(f213166d3970e0bd0f29d8dea8d6afa6990cce38) )
801 	ROM_LOAD( "136002-119.lm1",  0xc000, 0x0800, CRC(a4de050f) SHA1(ea302e43a313a5a18115e74ddbaaedde0fbecda7) )
802 	ROM_LOAD( "136002-120.mn1",  0xc800, 0x0800, CRC(35619648) SHA1(48f1e8bed7ec6afa0b4c549a30e5ec331c071e40) )
803 	ROM_LOAD( "136002-121.p1",   0xd000, 0x0800, CRC(73d38e47) SHA1(9980606376a79ba94f8e2a325871a6c8d10d83fc) )
804 	ROM_LOAD( "136002-222.r1",   0xd800, 0x0800, CRC(707bd5c3) SHA1(2f0af6fb7154c244c794f7247e5c16a1e06ddf7d) )
805 	ROM_RELOAD(                  0xf800, 0x0800 ) /* for reset/interrupt vectors */
806 	/* Vector ROM */
807 	ROM_LOAD( "136002-123.np3",  0x3000, 0x0800, CRC(29f7e937) SHA1(686c8b9b8901262e743497cee7f2f7dd5cb3af7e) ) /* May be labeled "136002-111", same data */
808 	ROM_LOAD( "136002-124.r3",   0x3800, 0x0800, CRC(c16ec351) SHA1(a30a3662c740810c0f20e3712679606921b8ca06) ) /* May be labeled "136002-112", same data */
809 
810 	/* AVG PROM */
811 	ROM_REGION( 0x100, "avg:prom", 0 )
812 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
813 
814 	/* Mathbox PROMs */
815 	ROM_REGION( 0x20, "user2", 0 )
816 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
817 
818 	ROM_REGION32_BE( 0x400, "user3", 0 )
819 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
820 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
821 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
822 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
823 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
824 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
825 ROM_END
826 
827 
828 ROM_START( tempest1 ) /* rev 1 */
829 	ROM_REGION( 0x10000, "maincpu", 0 )
830 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-01 or A037383-02 */
831 	ROM_LOAD( "136002-113.d1",   0x9000, 0x0800, CRC(65d61fe7) SHA1(38a1e8a8f65b7887cf3e190269fe4ce2c6f818aa) )
832 	ROM_LOAD( "136002-114.e1",   0x9800, 0x0800, CRC(11077375) SHA1(ed8ff0ca969da6672a7683b93d4fcf2935a0d903) )
833 	ROM_LOAD( "136002-115.f1",   0xa000, 0x0800, CRC(f3e2827a) SHA1(bd04fcfbbba995e08c3144c1474fcddaaeb1c700) )
834 	ROM_LOAD( "136002-116.h1",   0xa800, 0x0800, CRC(7356896c) SHA1(a013ede292189a8f5a907de882ee1a573d784b3c) )
835 	ROM_LOAD( "136002-117.j1",   0xb000, 0x0800, CRC(55952119) SHA1(470d914fa52fce3786cb6330889876d3547dca65) )
836 	ROM_LOAD( "136002-118.k1",   0xb800, 0x0800, CRC(beb352ab) SHA1(f213166d3970e0bd0f29d8dea8d6afa6990cce38) )
837 	ROM_LOAD( "136002-119.lm1",  0xc000, 0x0800, CRC(a4de050f) SHA1(ea302e43a313a5a18115e74ddbaaedde0fbecda7) )
838 	ROM_LOAD( "136002-120.mn1",  0xc800, 0x0800, CRC(35619648) SHA1(48f1e8bed7ec6afa0b4c549a30e5ec331c071e40) )
839 	ROM_LOAD( "136002-121.p1",   0xd000, 0x0800, CRC(73d38e47) SHA1(9980606376a79ba94f8e2a325871a6c8d10d83fc) )
840 	ROM_LOAD( "136002-122.r1",   0xd800, 0x0800, CRC(796a9918) SHA1(c862a0d4ea330161e4c3cc8e5e9ad38893fffbd4) )
841 	ROM_RELOAD(                  0xf800, 0x0800 ) /* for reset/interrupt vectors */
842 	/* Vector ROM */
843 	ROM_LOAD( "136002-123.np3",  0x3000, 0x0800, CRC(29f7e937) SHA1(686c8b9b8901262e743497cee7f2f7dd5cb3af7e) ) /* May be labeled "136002-111", same data */
844 	ROM_LOAD( "136002-124.r3",   0x3800, 0x0800, CRC(c16ec351) SHA1(a30a3662c740810c0f20e3712679606921b8ca06) ) /* May be labeled "136002-112", same data */
845 
846 	/* AVG PROM */
847 	ROM_REGION( 0x100, "avg:prom", 0 )
848 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
849 
850 	/* Mathbox PROMs */
851 	ROM_REGION( 0x20, "user2", 0 )
852 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
853 
854 	ROM_REGION32_BE( 0x400, "user3", 0 )
855 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
856 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
857 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
858 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
859 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
860 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
861 ROM_END
862 
863 
864 ROM_START( temptube )
865 	ROM_REGION( 0x10000, "maincpu", 0 )
866 	/* Roms are for Tempest Analog Vector-Generator PCB Assembly A037383-01 or A037383-02 */
867 	ROM_LOAD( "136002-113.d1",   0x9000, 0x0800, CRC(65d61fe7) SHA1(38a1e8a8f65b7887cf3e190269fe4ce2c6f818aa) )
868 	ROM_LOAD( "136002-114.e1",   0x9800, 0x0800, CRC(11077375) SHA1(ed8ff0ca969da6672a7683b93d4fcf2935a0d903) )
869 	ROM_LOAD( "136002-115.f1",   0xa000, 0x0800, CRC(f3e2827a) SHA1(bd04fcfbbba995e08c3144c1474fcddaaeb1c700) )
870 	ROM_LOAD( "136002-316.h1",   0xa800, 0x0800, CRC(aeb0f7e9) SHA1(a5cc25015b98692673cfc1c7c2e9634efd750870) )
871 	ROM_LOAD( "136002-217.j1",   0xb000, 0x0800, CRC(ef2eb645) SHA1(b1a2c969e8897e335d5354de6ae04a65d4b2a1e4) )
872 	ROM_LOAD( "tube-118.k1",     0xb800, 0x0800, CRC(cefb03f0) SHA1(41ddfa4991fa49a31d4740a04551556acca66196) )
873 	ROM_LOAD( "136002-119.lm1",  0xc000, 0x0800, CRC(a4de050f) SHA1(ea302e43a313a5a18115e74ddbaaedde0fbecda7) )
874 	ROM_LOAD( "136002-120.mn1",  0xc800, 0x0800, CRC(35619648) SHA1(48f1e8bed7ec6afa0b4c549a30e5ec331c071e40) )
875 	ROM_LOAD( "136002-121.p1",   0xd000, 0x0800, CRC(73d38e47) SHA1(9980606376a79ba94f8e2a325871a6c8d10d83fc) )
876 	ROM_LOAD( "136002-222.r1",   0xd800, 0x0800, CRC(707bd5c3) SHA1(2f0af6fb7154c244c794f7247e5c16a1e06ddf7d) )
877 	ROM_RELOAD(                  0xf800, 0x0800 ) /* for reset/interrupt vectors */
878 	/* Vector ROM */
879 	ROM_LOAD( "136002-123.np3",  0x3000, 0x0800, CRC(29f7e937) SHA1(686c8b9b8901262e743497cee7f2f7dd5cb3af7e) ) /* May be labeled "136002-111", same data */
880 	ROM_LOAD( "136002-124.r3",   0x3800, 0x0800, CRC(c16ec351) SHA1(a30a3662c740810c0f20e3712679606921b8ca06) ) /* May be labeled "136002-112", same data */
881 
882 	/* AVG PROM */
883 	ROM_REGION( 0x100, "avg:prom", 0 )
884 	ROM_LOAD( "136002-125.d7",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
885 
886 	/* Mathbox PROMs */
887 	ROM_REGION( 0x20, "user2", 0 )
888 	ROM_LOAD( "136002-126.a1",   0x0000, 0x0020, CRC(8b04f921) SHA1(317b3397482f13b2d1bc21f296d3b3f9a118787b) )
889 
890 	ROM_REGION32_BE( 0x400, "user3", 0 )
891 	ROMX_LOAD( "136002-132.l1", 0, 0x100, CRC(2af82e87) SHA1(3816835a9ccf99a76d246adf204989d9261bb065), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
892 	ROMX_LOAD( "136002-131.k1", 0, 0x100, CRC(b31f6e24) SHA1(ce5f8ca34d06a5cfa0076b47400e61e0130ffe74), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
893 	ROMX_LOAD( "136002-130.j1", 1, 0x100, CRC(8119b847) SHA1(c4fbaedd4ce1ad6a4128cbe902b297743edb606a), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
894 	ROMX_LOAD( "136002-129.h1", 1, 0x100, CRC(09f5a4d5) SHA1(d6f2ac07ca9ee385c08831098b0dcaf56808993b), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
895 	ROMX_LOAD( "136002-128.f1", 2, 0x100, CRC(823b61ae) SHA1(d99a839874b45f64e14dae92a036e47a53705d16), ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO | ROM_SKIP(3))
896 	ROMX_LOAD( "136002-127.e1", 2, 0x100, CRC(276eadd5) SHA1(55718cd8ec4bcf75076d5ef0ee1ed2551e19d9ba), ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI | ROM_SKIP(3))
897 ROM_END
898 
899 
900 /*************************************
901  *
902  *  Game drivers
903  *
904  *************************************/
905 
906 GAME( 1980, tempest,   0,       tempest, tempest, tempest_state, empty_init, ROT270, "Atari", "Tempest (rev 3, Revised Hardware)", MACHINE_SUPPORTS_SAVE )
907 GAME( 1980, tempest3,  tempest, tempest, tempest, tempest_state, empty_init, ROT270, "Atari", "Tempest (rev 3)", MACHINE_SUPPORTS_SAVE )
908 GAME( 1980, tempest2,  tempest, tempest, tempest, tempest_state, empty_init, ROT270, "Atari", "Tempest (rev 2)", MACHINE_SUPPORTS_SAVE )
909 GAME( 1980, tempest1,  tempest, tempest, tempest, tempest_state, empty_init, ROT270, "Atari", "Tempest (rev 1)", MACHINE_SUPPORTS_SAVE )
910 GAME( 1980, tempest1r, tempest, tempest, tempest, tempest_state, empty_init, ROT270, "Atari", "Tempest (rev 1, Revised Hardware)", MACHINE_SUPPORTS_SAVE )
911 GAME( 1980, temptube,  tempest, tempest, tempest, tempest_state, empty_init, ROT270, "hack (Duncan Brown)", "Tempest Tubes", MACHINE_SUPPORTS_SAVE )
912