Previous 15994 Revisions Next

r13302 Friday 18th November, 2011 at 10:04:58 UTC by Miodrag Milanović
fix for some naming conflicts between mame and mess (no whatsnew)
[artwork]ccmk1.zip* ccmk2.zip* mk1.zip mk2.zip
[src/mame/drivers]maxaflex.c
[src/mame/includes]atari.h
[src/mame/machine]atari.c
[src/mess]mess.lst mess.mak
[src/mess/drivers]ace.c acrnsys1.c arcadia.c arcadiah.c* astrocde.c astrocdeh.c* atari400.c bullet.c dc.c dolphin.c enmirage.c* jupace.c* mephisto.c mephistoc.c* mirage.c mk1.c mk2.c pce.c segasms.c* sms.c spectrum.c
[src/mess/includes]pce.h sms.h
[src/mess/layout]segasms1.lay* sms1.lay
[src/mess/machine]pce.c sms.c

src/mame/machine/atari.c
r13301r13302
6464
6565READ8_DEVICE_HANDLER(atari_pia_pa_r)
6666{
67   return atari_input_disabled(device->machine()) ? 0xFF : input_port_read_safe(device->machine(), "djoy_0_1", 0);
67   return input_port_read_safe(device->machine(), "djoy_0_1", 0);
6868}
6969
7070READ8_DEVICE_HANDLER(atari_pia_pb_r)
7171{
72   return atari_input_disabled(device->machine()) ? 0xFF : input_port_read_safe(device->machine(), "djoy_2_3", 0);
72   return input_port_read_safe(device->machine(), "djoy_2_3", 0);
7373}
7474
7575WRITE8_DEVICE_HANDLER(a600xl_pia_pb_w) { a600xl_mmu(device->machine(), data); }
7676
77static WRITE_LINE_DEVICE_HANDLER(atari_pia_cb2_w) { }   // This is used by Floppy drive on Atari 8bits Home Computers
77WRITE_LINE_DEVICE_HANDLER(atari_pia_cb2_w) { }   // This is used by Floppy drive on Atari 8bits Home Computers
7878
7979const pia6821_interface atarixl_pia_interface =
8080{
src/mame/includes/atari.h
r13301r13302
2222READ8_DEVICE_HANDLER(atari_pia_pa_r);
2323READ8_DEVICE_HANDLER(atari_pia_pb_r);
2424WRITE8_DEVICE_HANDLER(a600xl_pia_pb_w);
25WRITE_LINE_DEVICE_HANDLER(atari_pia_cb2_w);
2526
27
2628/* This is needed in MESS as well for Atari 8bit drivers */
2729void atari_machine_start(running_machine &machine);
2830
r13301r13302
595597
596598extern PALETTE_INIT( atari );
597599
598/*----------- defined in drivers/maxaflex.c -----------*/
599
600int atari_input_disabled(running_machine &machine);
601
602600#endif /* ATARI_H */
603601
src/mame/drivers/maxaflex.c
r13301r13302
368368   atari_interrupt_cb
369369};
370370
371READ8_DEVICE_HANDLER(maxaflex_atari_pia_pa_r)
372{
373   return atari_input_disabled(device->machine()) ? 0xFF : input_port_read_safe(device->machine(), "djoy_0_1", 0);
374}
375
376READ8_DEVICE_HANDLER(maxaflex_atari_pia_pb_r)
377{
378   return atari_input_disabled(device->machine()) ? 0xFF : input_port_read_safe(device->machine(), "djoy_2_3", 0);
379}
380
381
382const pia6821_interface maxaflex_atarixl_pia_interface =
383{
384   DEVCB_HANDLER(maxaflex_atari_pia_pa_r),      /* port A in */
385   DEVCB_HANDLER(maxaflex_atari_pia_pb_r),   /* port B in */
386   DEVCB_NULL,      /* line CA1 in */
387   DEVCB_NULL,      /* line CB1 in */
388   DEVCB_NULL,      /* line CA2 in */
389   DEVCB_NULL,      /* line CB2 in */
390   DEVCB_NULL,      /* port A out */
391   DEVCB_HANDLER(a600xl_pia_pb_w),      /* port B out */
392   DEVCB_NULL,      /* line CA2 out */
393   DEVCB_LINE(atari_pia_cb2_w),      /* port CB2 out */
394   DEVCB_NULL,      /* IRQA */
395   DEVCB_NULL      /* IRQB */
396};
397
398
399
371400static MACHINE_CONFIG_START( a600xl, maxaflex_state )
372401   /* basic machine hardware */
373402   MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
r13301r13302
377406   MCFG_CPU_ADD("mcu", M68705, 3579545)
378407   MCFG_CPU_PROGRAM_MAP(mcu_mem)
379408
380   MCFG_PIA6821_ADD("pia", atarixl_pia_interface)
409   MCFG_PIA6821_ADD("pia", maxaflex_atarixl_pia_interface)
381410   MCFG_TIMER_ADD("mcu_timer", mcu_timer_proc)
382411
383412   /* video hardware */
src/mess/machine/sms.c
r13301r13302
17171717   machine.scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
17181718}
17191719
1720MACHINE_RESET( sms )
1720MACHINE_RESET( segasms )
17211721{
17221722   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
17231723   sms_state *state = machine.driver_data<sms_state>();
src/mess/machine/pce.c
r13301r13302
251251   return 0;
252252}
253253
254DRIVER_INIT( pce )
254DRIVER_INIT( mess_pce )
255255{
256256   pce_state *state = machine.driver_data<pce_state>();
257257   state->m_io_port_options = PCE_JOY_SIG | CONST_SIG;
r13301r13302
274274   pce_cd_init( machine );
275275}
276276
277MACHINE_RESET( pce )
277MACHINE_RESET( mess_pce )
278278{
279279   pce_state *state = machine.driver_data<pce_state>();
280280   pce_cd_t &pce_cd = state->m_cd;
r13301r13302
298298}
299299
300300/* todo: how many input ports does the PCE have? */
301WRITE8_HANDLER ( pce_joystick_w )
301WRITE8_HANDLER ( mess_pce_joystick_w )
302302{
303303   pce_state *state = space->machine().driver_data<pce_state>();
304304   int joy_i;
r13301r13302
328328    }
329329}
330330
331READ8_HANDLER ( pce_joystick_r )
331READ8_HANDLER ( mess_pce_joystick_r )
332332{
333333   pce_state *state = space->machine().driver_data<pce_state>();
334334   static const char *const joyname[4][5] = {
src/mess/includes/sms.h
r13301r13302
149149DEVICE_IMAGE_LOAD( sms_cart );
150150
151151MACHINE_START( sms );
152MACHINE_RESET( sms );
152MACHINE_RESET( segasms );
153153
154154READ8_HANDLER( sms_store_cart_select_r );
155155WRITE8_HANDLER( sms_store_cart_select_w );
src/mess/includes/pce.h
r13301r13302
124124
125125DEVICE_IMAGE_LOAD(pce_cart);
126126NVRAM_HANDLER( pce );
127WRITE8_HANDLER ( pce_joystick_w );
128 READ8_HANDLER ( pce_joystick_r );
127WRITE8_HANDLER ( mess_pce_joystick_w );
128 READ8_HANDLER ( mess_pce_joystick_r );
129129
130130extern const msm5205_interface pce_cd_msm5205_interface;
131131WRITE8_HANDLER( pce_cd_bram_w );
r13301r13302
136136WRITE8_HANDLER( pce_cd_acard_wram_w );
137137READ8_HANDLER( pce_cd_acard_wram_r );
138138
139DRIVER_INIT( pce );
139DRIVER_INIT( mess_pce );
140140DRIVER_INIT( tg16 );
141141DRIVER_INIT( sgx );
142142MACHINE_START( pce );
143MACHINE_RESET( pce );
143MACHINE_RESET( mess_pce );
144144
145145
146146#endif /* PCE_H_ */
src/mess/mess.lst
r13301r13302
164164d6800      // Dream 6800
165165
166166// Ensoniq
167mirage // 1985 Mirage Digital Multi-Sampler
167enmirage // 1985 Mirage Digital Multi-Sampler
168168esq1   // 1986 ESQ-1 Digital Wave Synthesizer
169169
170170// Fairchild
r13301r13302
935935pc9821xs
936936
937937// Cantab
938ace   // Jupiter Ace
938jupace   // Jupiter Ace
939939
940940// Sord
941941m5
r13301r13302
16811681
16821682//***************Games******************************************************
16831683// Computer Electronic
1684mk1      // Chess Champion MK I
1684ccmk1      // Chess Champion MK I
16851685// Quelle International
1686mk2      // Chess Champion MK II
1686ccmk2      // Chess Champion MK II
16871687
16881688// Novag
16891689ssystem3  // Chess Champion Super System III / MK III
r13301r13302
19431943pipbug
19441944elektor
19451945instruct
1946dolphin
1946dolphunk
19471947chaos
19481948z80dev
19491949pegasus
r13301r13302
19881988fp1100
19891989fp6000
19901990tim011
1991bullet
1991wmbullet
19921992pc4
19931993pofo
19941994homez80
src/mess/layout/sms1.lay
r13301r13302
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <view name="Main Screen Standard (4:3)">
4      <screen index="0">
5         <bounds left="0" top="0" right="4" bottom="3" />
6      </screen>
7   </view>
8
9   <view name="SegaScope Left LCD Standard (4:3)">
10      <screen index="1">
11         <bounds left="0" top="0" right="4" bottom="3" />
12      </screen>
13   </view>
14
15   <view name="SegaScope Right LCD Standard (4:3)">
16      <screen index="2">
17         <bounds left="0" top="0" right="4" bottom="3" />
18      </screen>
19   </view>
20
21   <view name="Main Screen Pixel Aspect (~scr0nativexaspect~:~scr0nativeyaspect~)">
22      <screen index="0">
23         <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" />
24      </screen>
25   </view>
26
27   <view name="SegaScope Left LCD Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
28      <screen index="1">
29         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
30      </screen>
31   </view>
32
33   <view name="SegaScope Right LCD Pixel Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
34      <screen index="2">
35         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
36      </screen>
37   </view>
38
39   <view name="Main Screen">
40      <screen index="0">
41         <bounds x="0" y="0" width="4" height="3" />
42      </screen>
43   </view>
44
45   <view name="SegaScope 3-D Glasses">
46      <screen index="1">
47         <bounds x="0" y="0" width="4" height="3" />
48      </screen>
49      <screen index="2">
50         <bounds x="4.03" y="0" width="4" height="3" />
51      </screen>
52   </view>
53
54   <view name="SegaScope 3-D Glasses (Gapless)">
55      <screen index="1">
56         <bounds x="0" y="0" width="4" height="3" />
57      </screen>
58      <screen index="2">
59         <bounds x="4" y="0" width="4" height="3" />
60      </screen>
61   </view>
62</mamelayout>
src/mess/layout/segasms1.lay
r0r13302
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <view name="Main Screen Standard (4:3)">
4      <screen index="0">
5         <bounds left="0" top="0" right="4" bottom="3" />
6      </screen>
7   </view>
8
9   <view name="SegaScope Left LCD Standard (4:3)">
10      <screen index="1">
11         <bounds left="0" top="0" right="4" bottom="3" />
12      </screen>
13   </view>
14
15   <view name="SegaScope Right LCD Standard (4:3)">
16      <screen index="2">
17         <bounds left="0" top="0" right="4" bottom="3" />
18      </screen>
19   </view>
20
21   <view name="Main Screen Pixel Aspect (~scr0nativexaspect~:~scr0nativeyaspect~)">
22      <screen index="0">
23         <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" />
24      </screen>
25   </view>
26
27   <view name="SegaScope Left LCD Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
28      <screen index="1">
29         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
30      </screen>
31   </view>
32
33   <view name="SegaScope Right LCD Pixel Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
34      <screen index="2">
35         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
36      </screen>
37   </view>
38
39   <view name="Main Screen">
40      <screen index="0">
41         <bounds x="0" y="0" width="4" height="3" />
42      </screen>
43   </view>
44
45   <view name="SegaScope 3-D Glasses">
46      <screen index="1">
47         <bounds x="0" y="0" width="4" height="3" />
48      </screen>
49      <screen index="2">
50         <bounds x="4.03" y="0" width="4" height="3" />
51      </screen>
52   </view>
53
54   <view name="SegaScope 3-D Glasses (Gapless)">
55      <screen index="1">
56         <bounds x="0" y="0" width="4" height="3" />
57      </screen>
58      <screen index="2">
59         <bounds x="4" y="0" width="4" height="3" />
60      </screen>
61   </view>
62</mamelayout>
src/mess/mess.mak
r13301r13302
644644   $(MESS_DRIVERS)/mbee.o      \
645645
646646$(MESSOBJ)/arcadia.a:         \
647   $(MESS_DRIVERS)/arcadia.o   \
647   $(MESS_DRIVERS)/arcadiah.o   \
648648   $(MESS_AUDIO)/arcadia.o      \
649649   $(MESS_VIDEO)/arcadia.o      \
650650
r13301r13302
680680   $(MESS_DRIVERS)/unixpc.o   \
681681
682682$(MESSOBJ)/bally.a:                     \
683   $(MESS_DRIVERS)/astrocde.o   \
683   $(MESS_DRIVERS)/astrocdeh.o   \
684684
685685$(MESSOBJ)/bandai.a:         \
686686   $(MESS_DRIVERS)/pippin.o   \
r13301r13302
715715   $(MESS_DRIVERS)/x07.o      \
716716
717717$(MESSOBJ)/cantab.a:         \
718   $(MESS_DRIVERS)/ace.o      \
718   $(MESS_DRIVERS)/jupace.o      \
719719   $(MESS_FORMATS)/ace_ace.o   \
720720
721721$(MESSOBJ)/casio.a:         \
r13301r13302
920920
921921$(MESSOBJ)/ensoniq.a:         \
922922   $(MESS_DRIVERS)/esq1.o      \
923   $(MESS_DRIVERS)/mirage.o    \
923   $(MESS_DRIVERS)/enmirage.o    \
924924
925925$(MESSOBJ)/entex.a:            \
926926   $(MESS_VIDEO)/advision.o   \
r13301r13302
994994$(MESSOBJ)/hegener.a:         \
995995   $(MESS_MACHINE)/mboard.o   \
996996   $(MESS_DRIVERS)/glasgow.o   \
997   $(MESS_DRIVERS)/mephisto.o   \
997   $(MESS_DRIVERS)/mephistoc.o   \
998998        $(MESS_DRIVERS)/mmodular.o   \
999999
10001000
r13301r13302
13801380   $(MESS_MACHINE)/dccons.o   \
13811381   $(MESS_VIDEO)/smsvdp.o      \
13821382   $(MESS_MACHINE)/sms.o   \
1383   $(MESS_DRIVERS)/sms.o   \
1383   $(MESS_DRIVERS)/segasms.o   \
13841384   $(MESS_DRIVERS)/sg1000.o   \
13851385
13861386$(MESSOBJ)/sgi.a:            \
r13301r13302
18871887$(MESS_DRIVERS)/lx800.o:   $(MESS_LAYOUT)/lx800.lh
18881888$(MESS_DRIVERS)/mac.o:      $(MESS_LAYOUT)/mac.lh
18891889$(MESS_DRIVERS)/mekd2.o:   $(MESS_LAYOUT)/mekd2.lh
1890$(MESS_DRIVERS)/mephisto.o:   $(MESS_LAYOUT)/mephisto.lh
1890$(MESS_DRIVERS)/mephistoc.o:   $(MESS_LAYOUT)/mephisto.lh
18911891$(MESS_DRIVERS)/mikrolab.o:   $(MESS_LAYOUT)/mikrolab.lh
18921892$(MESS_DRIVERS)/mk1.o:      $(MESS_LAYOUT)/mk1.lh
18931893$(MESS_DRIVERS)/mk14.o:      $(MESS_LAYOUT)/mk14.lh
r13301r13302
19141914$(MESS_DRIVERS)/selz80.o:   $(MESS_LAYOUT)/selz80.lh
19151915$(MESS_DRIVERS)/sitcom.o:   $(MESS_LAYOUT)/sitcom.lh
19161916$(MESS_DRIVERS)/slc1.o:      $(MESS_LAYOUT)/slc1.lh
1917$(MESS_DRIVERS)/sms.o:      $(MAME_LAYOUT)/sms1.lh
1917$(MESS_DRIVERS)/segasms.o:   $(MAME_LAYOUT)/sms1.lh
19181918$(MESS_DRIVERS)/stopthie.o:   $(MESS_LAYOUT)/stopthie.lh
19191919$(MESS_DRIVERS)/super80.o:   $(MESS_LAYOUT)/super80.lh
19201920$(MESS_DRIVERS)/supercon.o:   $(MESS_LAYOUT)/supercon.lh
src/mess/drivers/arcadia.c
r13301r13302
1/******************************************************************************
2Consolidation and enhancement of documentation by Manfred Schneider based on previous work from
3 PeT mess@utanet.at and Paul Robson (autismuk@aol.com) minor updates by incog
4
5 Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/
6
7 TODO: implement the RESET key on the front panel
8       find a dump of the character ROM
9       convert the drawing code to tilemap
10
11
12 1. General
13   SYSTEM
14- Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL)
15- 1k x 8 of RAM (physically present but only 512 byte available)
16- 2 x 2 axis Analogue Joysticks
17- 2 x 12 button Controllers
18- 3 buttons on system unit and CPU Reset
19   VIDEO
20- 128 x 208 pixel resolution (alternate 128 x 104 mode available)
21- 16 x 26 (can be 16x13) background display (2 colour 8 x 8 pixel characters)
22- 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels)
23- total of 8 user defined characters available
24   SOUND
25- Single channel beeper
26
27
282. Memory map
29The memory map of the 2001 is below.
300000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
311000 - 13FF     mirror of $1800-$1BFF
321400 - 17FF     mirror of $1800-$1BFF
331800 - 1BFF     UVI2637 Area (detail description in video/arcadia.c)
34    1800 - 18CF     Screen display , upper 13 lines, characters/palette high bits
35    18D0 - 18EF Free for user programs.
36    18F0 - 18F7     Sprite coordinates y0x0y1x1y2x2y3x3
37    18F8 - 1908     registers of UVI
38    1909 - 197F     Unmapped
39    1980 - 19BF     User defined characters (8 possible, 8 bytes per character)
40    19C0 - 19F7     Unmapped
41    19F8 - 19FF     registers of UVI
42    1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits
43    1AD0 - 1AFF User memory
44    1B00 - 1BFF     mirror of 1900-19FF
451C00 - 1FFF     mirror of 1800-1BFF
462000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler)
473000 - 3FFF mirror of 1000-1FFF
484000 - 4FFF mirror of 0000-0FFF
495000 - 5FFF mirror of 1000-1FFF
506000 - 6FFF mirror of 0000-0FFF
517000 - 7FFF mirror of 1000-1FFF
52
53The Palladium VCG memory map is as follows.
540000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
551000 - 17FF     could be ROM or RAM but no Cartridge uses this
561800 - 1BFF     UVI2637 Area (detail description in video/arcadia.c)
57    1800 - 18CF     Screen display , upper 13 lines, characters/palette high bits
58    18D0 - 18EF Free for user programs.
59    18F0 - 18F7     Sprite coordinates y0x0y1x1y2x2y3x3
60    18F8 - 1908     registers of UVI
61    1909 - 197F     Unmapped
62    1980 - 19BF     User defined characters (8 possible, 8 bytes per character)
63    19C0 - 19F7     Unmapped
64    19F8 - 19FF     registers of UVI
65    1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits
66    1AD0 - 1AFF User memory
67    1B00 - 1BFF     mirror of 1900-19FF
681C00 - 1FFF     could be ROM or RAM but no Cartridge uses this
692000 - 2FFF 4k ROM Block  (for 8k carts such as Jungler)
703000 - 3FFF could be ROM or RAM but no Cartridge uses this
714000 - 4FFF 4k ROM Block  (first 2K used by Golf)
725000 - 5FFF 4k ROM Block
736000 - 6FFF 4k ROM Block
747000 - 7FFF 4k ROM Block
75
76
773. ROM Images
78ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the
79second half of the Rom is located at 2000-2FFF. Except for the Golf cart
80which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on
81Palladium VCG.
82
83
844. Controls
85All key controls are indicated by a bit going to '1'. Unused bits at
86the memory location are set to zero.
87
88Keypads
89
901900-1902 (Player 1) 1904-1906 (Player 2)
91The keypads are arranged as follows :-
92
93        1       2       3
94        4       5       6
95        7       8       9
96      Enter     0     Clear
97
98Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6
99The topmost key is bit 3, the lowermost key is bit 0.
100
101Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty.
102These keys are "latched" i.e. a press causes a logic 1 to appear
103on the current frame.
104
105The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and
1061905 bit 3.
107
108Palladium has 4 additional key per keypad which are mapped at
1091903 palladium player 1
1101907 palladium player 2
111
112
1135. Other information
114Interrupts are not supported
115The Read/Write 2650 CPU Port-Commands do not appear to be connected to
116anything in hardware. No cartridge has been found which uses them.
117
118 ******************************************************************************/
119
120#include <assert.h>
121#include "emu.h"
122#include "cpu/s2650/s2650.h"
123#include "includes/arcadia.h"
124#include "imagedev/cartslot.h"
125
126static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8)
127   AM_RANGE( 0x0000, 0x0fff) AM_ROM
128   AM_RANGE( 0x1800, 0x1aff) AM_READWRITE( arcadia_video_r, arcadia_video_w )
129   AM_RANGE( 0x2000, 0x2fff) AM_ROM
130ADDRESS_MAP_END
131
132static ADDRESS_MAP_START( arcadia_io, AS_IO, 8)
133//{ S2650_CTRL_PORT,S2650_CTRL_PORT, },
134//{ S2650_DATA_PORT,S2650_DATA_PORT, },
135   AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ( arcadia_vsync_r)
136ADDRESS_MAP_END
137
138/* The Emerson Arcadia 2001 controllers have 2 fire buttons on the side,
139   but actually they are wired to keypad button #2. The following definitions
140   are meant to document this fact. The keypad has the following layout:
141
142     1  2  3
143     4  5  6
144     7  8  9
145    Cl  0 En                                                                  */
146
147static INPUT_PORTS_START( arcadia )
148   PORT_START("panel")
149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )    PORT_NAME("Start")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Option")          PORT_CODE(KEYCODE_O)
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )   PORT_NAME("Select")
152//  PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Reset")           PORT_CODE(KEYCODE_R)         Not implemented
153
154   PORT_START("controller1_col1")
155   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
156   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD)
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD)
158   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD)
159   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD)
160
161   PORT_START("controller1_col2")
162   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
163   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD)
164   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD)
165   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD)
166   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD)
167
168   PORT_START("controller1_col3")
169   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
170   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD)
171   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD)
172   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD)
173   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD)
174
175   PORT_START("controller1_extra")
176   PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium
177
178   PORT_START("controller2_col1")
179   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
180   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z)
181   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A)
182   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q)
183   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_V)
184
185   PORT_START("controller2_col2")
186   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
187   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X)
188   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S)
189   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W)
190   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F)
191
192   PORT_START("controller2_col3")
193   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
194   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C)
195   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D)
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E)
197   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_R)
198
199   PORT_START("controller2_extra")
200   PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium
201
202/* FIXME: the joystick are analog - the actual definition is merely an hack */
203
204#if 0
205   // auto centering too slow, so only using 5 bits, and scaling at videoside
206   PORT_START("controller1_joy_x")
207   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X)
208   PORT_SENSITIVITY(1)
209   PORT_KEYDELTA(2000)
210   PORT_MINMAX(0,0x1f)
211   PORT_CODE_DEC(KEYCODE_LEFT)
212   PORT_CODE_INC(KEYCODE_RIGHT)
213   PORT_CODE_DEC(JOYCODE_1_LEFT)
214   PORT_CODE_INC(JOYCODE_1_RIGHT)
215   PORT_PLAYER(1)
216   PORT_RESET
217
218   PORT_START("controller1_joy_y")
219   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y)
220   PORT_SENSITIVITY(1)
221   PORT_KEYDELTA(2000)
222   PORT_MINMAX(0,0x1f)
223   PORT_CODE_DEC(KEYCODE_UP)
224   PORT_CODE_INC(KEYCODE_DOWN)
225   PORT_CODE_DEC(JOYCODE_1_UP)
226   PORT_CODE_INC(JOYCODE_1_DOWN)
227   PORT_PLAYER(1)
228   PORT_RESET
229
230   PORT_START("controller2_joy_x")
231   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X)
232   PORT_SENSITIVITY(100)
233   PORT_KEYDELTA(10)
234   PORT_MINMAX(0,0x1f)
235   PORT_CODE_DEC(KEYCODE_DEL)
236   PORT_CODE_INC(KEYCODE_PGDN)
237   PORT_CODE_DEC(JOYCODE_2_LEFT)
238   PORT_CODE_INC(JOYCODE_2_RIGHT)
239   PORT_PLAYER(2)
240   PORT_RESET
241
242   PORT_START("controller2_joy_y")
243   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y)
244   PORT_SENSITIVITY(100)
245   PORT_KEYDELTA(10)
246   PORT_MINMAX(0,0x1f)
247   PORT_CODE_DEC(KEYCODE_HOME)
248   PORT_CODE_INC(KEYCODE_END)
249   PORT_CODE_DEC(JOYCODE_2_UP)
250   PORT_CODE_INC(JOYCODE_2_DOWN)
251   PORT_PLAYER(2)
252   PORT_RESET
253#else
254   PORT_START("joysticks")
255   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
256   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
257   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
258   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
259   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
260   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
261   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
262   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
263#endif
264INPUT_PORTS_END
265
266/* The Palladium Video-Computer-Game controllers have no fire buttons on their side
267   but have a 16 keys unlabeled keypad. The keys are fully independent and layed out
268   according to this weird scheme, which keeps backward compatibility to Arcadia 2001's
269   electrical wiring.
270
271        2
272    13 14 15
273     1 16  3
274     4  5  6
275     7  8  9
276    10 11 12                                                                           */
277
278static INPUT_PORTS_START( plldium )
279   PORT_START("panel")
280   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )   PORT_NAME("Start")
281   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT )  PORT_NAME("Selector A")
282   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER )   PORT_NAME("Selector B")    PORT_CODE(KEYCODE_O)
283//  PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Reset")           PORT_CODE(KEYCODE_R)         Not implemented
284
285   PORT_START("controller1_col1")
286   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) // some bits must be high
287   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD)
288   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD)
289   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD)
290   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 10") PORT_CODE(KEYCODE_MINUS_PAD)
291
292   PORT_START("controller1_col2")
293   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
294   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD)
295   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD)
296   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD)
297   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 11") PORT_CODE(KEYCODE_0_PAD)
298
299   PORT_START("controller1_col3")
300   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
301   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD)
302   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD)
303   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD)
304   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 12") PORT_CODE(KEYCODE_PLUS_PAD)
305
306   PORT_START("controller1_extra")
307   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
308   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 13") PORT_CODE(KEYCODE_ENTER_PAD)
309   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 14") PORT_CODE(KEYCODE_SLASH_PAD)
310   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 15") PORT_CODE(KEYCODE_ASTERISK)
311   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 16") PORT_CODE(KEYCODE_DEL_PAD)
312
313   PORT_START("controller2_col1")
314   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
315   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z)
316   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A)
317   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q)
318   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 10") PORT_CODE(KEYCODE_V)
319
320   PORT_START("controller2_col2")
321   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
322   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X)
323   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S)
324   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W)
325   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 11") PORT_CODE(KEYCODE_F)
326
327   PORT_START("controller2_col3")
328   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
329   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C)
330   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D)
331   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E)
332   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 12") PORT_CODE(KEYCODE_R)
333
334   PORT_START("controller2_extra")
335   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
336   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 13") PORT_CODE(KEYCODE_B)
337   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 14") PORT_CODE(KEYCODE_G)
338   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 15") PORT_CODE(KEYCODE_T)
339   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 16") PORT_CODE(KEYCODE_H)
340
341/* FIXME: the joystick are analog - the actual definition is merely an hack */
342
343#if 0
344   // auto centering too slow, so only using 5 bits, and scaling at videoside
345   PORT_START("controller1_joy_x")
346   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X)
347   PORT_SENSITIVITY(1)
348   PORT_KEYDELTA(2000)
349   PORT_MINMAX(0,0x1f)
350   PORT_CODE_DEC(KEYCODE_LEFT)
351   PORT_CODE_INC(KEYCODE_RIGHT)
352   PORT_CODE_DEC(JOYCODE_1_LEFT)
353   PORT_CODE_INC(JOYCODE_1_RIGHT)
354   PORT_PLAYER(1)
355   PORT_RESET
356
357   PORT_START("controller1_joy_y")
358   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y)
359   PORT_SENSITIVITY(1)
360   PORT_KEYDELTA(2000)
361   PORT_MINMAX(0,0x1f)
362   PORT_CODE_DEC(KEYCODE_UP)
363   PORT_CODE_INC(KEYCODE_DOWN)
364   PORT_CODE_DEC(JOYCODE_1_UP)
365   PORT_CODE_INC(JOYCODE_1_DOWN)
366   PORT_PLAYER(1)
367   PORT_RESET
368
369   PORT_START("controller2_joy_x")
370   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X)
371   PORT_SENSITIVITY(100)
372   PORT_KEYDELTA(10)
373   PORT_MINMAX(0,0x1f)
374   PORT_CODE_DEC(KEYCODE_DEL)
375   PORT_CODE_INC(KEYCODE_PGDN)
376   PORT_CODE_DEC(JOYCODE_2_LEFT)
377   PORT_CODE_INC(JOYCODE_2_RIGHT)
378   PORT_PLAYER(2)
379   PORT_RESET
380
381   PORT_START("controller2_joy_y")
382   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y)
383   PORT_SENSITIVITY(100)
384   PORT_KEYDELTA(10)
385   PORT_MINMAX(0,0x1f)
386   PORT_CODE_DEC(KEYCODE_HOME)
387   PORT_CODE_INC(KEYCODE_END)
388   PORT_CODE_DEC(JOYCODE_2_UP)
389   PORT_CODE_INC(JOYCODE_2_DOWN)
390   PORT_PLAYER(2)
391   PORT_RESET
392#else
393   PORT_START("joysticks")
394   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )      PORT_PLAYER(1) PORT_8WAY
395   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(1) PORT_8WAY
396   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )      PORT_PLAYER(1) PORT_8WAY
397   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )      PORT_PLAYER(1) PORT_8WAY
398   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )      PORT_PLAYER(2) PORT_8WAY
399   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(2) PORT_8WAY
400   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )      PORT_PLAYER(2) PORT_8WAY
401   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )      PORT_PLAYER(2) PORT_8WAY
402#endif
403INPUT_PORTS_END
404
405static const gfx_layout arcadia_charlayout =
406{
407   8,                  /*width*/
408   1,                  /*height*/
409   256,               /* 256 characters */
410   1,                  /* 1 bits per pixel */
411   { 0 },                  /* no bitplanes; 1 bit per pixel */
412   { 0, 1, 2, 3, 4, 5, 6, 7 },   /* x offsets */
413   { 0 },               /* y offsets */
414   1*8
415};
416
417static GFXDECODE_START( arcadia )
418   GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 68 )
419GFXDECODE_END
420
421static const rgb_t arcadia_colors[] =
422{
423   RGB_WHITE,               /* white */
424   MAKE_RGB(0xff, 0xff, 0x00),   /* yellow */
425   MAKE_RGB(0x00, 0xff, 0xff),   /* cyan */
426   MAKE_RGB(0x00, 0xff, 0x00),   /* green */
427   MAKE_RGB(0xff, 0x00, 0xff),   /* magenta */
428   MAKE_RGB(0xff, 0x00, 0x00),   /* red */
429   MAKE_RGB(0x00, 0x00, 0xff),   /* blue */
430   RGB_BLACK               /* black */
431};
432
433static const unsigned short arcadia_palette[128+8] =  /* bgnd, fgnd */
434{
435   0,1,2,3,4,5,6,7,
436
437   0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7,
438   1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7,
439   2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7,
440   3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7,
441   4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7,
442   5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7,
443   6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7,
444   7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7
445};
446
447static PALETTE_INIT( arcadia )
448{
449   int i;
450
451   machine.colortable = colortable_alloc(machine, 8);
452
453   for (i = 0; i < 8; i++)
454      colortable_palette_set_color(machine.colortable, i, arcadia_colors[i]);
455
456   for (i = 0; i < 128+8; i++)
457      colortable_entry_set_value(machine.colortable, i, arcadia_palette[i]);
458}
459
460static DEVICE_IMAGE_LOAD( arcadia_cart )
461{
462   UINT8 *rom = image.device().machine().region("maincpu")->base();
463   int size;
464
465   memset(rom, 0, 0x8000);
466   if (image.software_entry() == NULL)
467   {
468      size = image.length();
469
470      if (size > image.device().machine().region("maincpu")->bytes())
471         size = image.device().machine().region("maincpu")->bytes();
472
473      if (image.fread(rom, size) != size)
474         return IMAGE_INIT_FAIL;
475   }
476   else
477   {
478      size = image.get_software_region_length("rom");
479      memcpy(rom, image.get_software_region("rom"), size);
480   }
481
482   if (size > 0x1000)
483      memmove(rom + 0x2000, rom + 0x1000, size - 0x1000);
484
485   if (size > 0x2000)
486      memmove(rom + 0x4000, rom + 0x3000, size - 0x2000);
487
488#if 1
489   // golf cartridge support
490   // 4kbyte at 0x0000
491   // 2kbyte at 0x4000
492   if (size <= 0x2000)
493      memcpy(rom + 0x4000, rom + 0x2000, 0x1000);
494#else
495   /* this is a testpatch for the golf cartridge
496       so it could be burned in a arcadia 2001 cartridge
497       activate it and use debugger to save patched version */
498   // not enough yet (some pointers stored as data?)
499   int i;
500   static const struct { UINT16 address; UINT8 old; UINT8 new; }
501   patch[]= {
502      { 0x0077,0x40,0x20 },
503      { 0x011e,0x40,0x20 },
504      { 0x0348,0x40,0x20 },
505      { 0x03be,0x40,0x20 },
506      { 0x04ce,0x40,0x20 },
507      { 0x04da,0x40,0x20 },
508      { 0x0562,0x42,0x22 },
509      { 0x0617,0x40,0x20 },
510      { 0x0822,0x40,0x20 },
511      { 0x095e,0x42,0x22 },
512      { 0x09d3,0x42,0x22 },
513      { 0x0bb0,0x42,0x22 },
514      { 0x0efb,0x40,0x20 },
515      { 0x0ec1,0x43,0x23 },
516      { 0x0f00,0x40,0x20 },
517      { 0x0f12,0x40,0x20 },
518      { 0x0ff5,0x43,0x23 },
519      { 0x0ff7,0x41,0x21 },
520      { 0x0ff9,0x40,0x20 },
521      { 0x0ffb,0x41,0x21 },
522      { 0x20ec,0x42,0x22 }
523   };
524
525   for (i = 0; i < ARRAY_LENGTH(patch); i++)
526   {
527      assert(rom[patch[i].address] == patch[i].old);
528      rom[patch[i].address] = patch[i].new;
529   }
530#endif
531   return IMAGE_INIT_PASS;
532}
533
534static MACHINE_CONFIG_START( arcadia, arcadia_state )
535   /* basic machine hardware */
536   MCFG_CPU_ADD("maincpu", S2650, 3580000/4)        /* 0.895 MHz */
537   MCFG_CPU_PROGRAM_MAP(arcadia_mem)
538   MCFG_CPU_IO_MAP(arcadia_io)
539   MCFG_CPU_PERIODIC_INT(arcadia_video_line, 262*60)
540   MCFG_QUANTUM_TIME(attotime::from_hz(60))
541
542   /* video hardware */
543   MCFG_SCREEN_ADD("screen", RASTER)
544   MCFG_SCREEN_REFRESH_RATE(60)
545   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
546   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
547   MCFG_SCREEN_SIZE(128+2*XPOS, 262)
548   MCFG_SCREEN_VISIBLE_AREA(0, 2*XPOS+128-1, 0, 262-1)
549   MCFG_SCREEN_UPDATE( arcadia )
550
551   MCFG_GFXDECODE( arcadia )
552   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(arcadia_palette))
553   MCFG_PALETTE_INIT( arcadia )
554
555   MCFG_VIDEO_START( arcadia )
556
557   /* sound hardware */
558   MCFG_SPEAKER_STANDARD_MONO("mono")
559   MCFG_SOUND_ADD("custom", ARCADIA, 0)
560   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
561
562   /* cartridge */
563   MCFG_CARTSLOT_ADD("cart")
564   MCFG_CARTSLOT_EXTENSION_LIST("bin")
565   MCFG_CARTSLOT_NOT_MANDATORY
566   MCFG_CARTSLOT_INTERFACE("arcadia_cart")
567   MCFG_CARTSLOT_LOAD(arcadia_cart)
568
569   /* Software lists */
570   MCFG_SOFTWARE_LIST_ADD("cart_list","arcadia")
571MACHINE_CONFIG_END
572
573ROM_START(advsnha)
574   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
575   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
576ROM_END
577
578ROM_START(bndarc)
579   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
580   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
581ROM_END
582
583ROM_START(arcadia)
584   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
585   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
586ROM_END
587
588ROM_START(tccosmos)
589   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
590   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
591ROM_END
592
593ROM_START(dynavisn)
594   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
595   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
596ROM_END
597
598ROM_START(ekusera)
599   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
600   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
601ROM_END
602
603ROM_START(hanihac)
604   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
605   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
606ROM_END
607
608ROM_START(hmg2650)
609   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
610   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
611ROM_END
612
613ROM_START(intmpt03)
614   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
615   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
616ROM_END
617
618ROM_START(ixl2000)
619   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
620   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
621ROM_END
622
623ROM_START(intervsn)
624   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
625   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
626ROM_END
627
628ROM_START(itmcmtp3)
629   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
630   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
631ROM_END
632
633ROM_START(lvision)
634   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
635   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
636ROM_END
637
638ROM_START(leonardo)
639   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
640   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
641ROM_END
642
643ROM_START(mratlus)
644   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
645   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
646ROM_END
647
648ROM_START(ormatu)
649   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
650   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
651ROM_END
652
653ROM_START(plldium)
654   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
655   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
656ROM_END
657
658ROM_START(polyvcg)
659   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
660   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
661ROM_END
662
663ROM_START(poppympt)
664   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
665   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
666ROM_END
667
668ROM_START(prestmpt)
669   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
670   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
671ROM_END
672
673ROM_START(rowtrn2k)
674   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
675   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
676ROM_END
677
678ROM_START(tvg2000)
679   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
680   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
681ROM_END
682
683ROM_START(sheenhvc)
684   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
685   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
686ROM_END
687
688ROM_START(soundic)
689   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
690   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
691ROM_END
692
693ROM_START(telefevr)
694   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
695   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
696ROM_END
697
698ROM_START(tempestm)
699   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
700   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
701ROM_END
702
703ROM_START(tbbympt3)
704   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
705   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
706ROM_END
707
708ROM_START(trakcvg)
709   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
710   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
711ROM_END
712
713ROM_START(tunixha)
714   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
715   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
716ROM_END
717
718ROM_START(tryomvgc)
719   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
720   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
721ROM_END
722
723ROM_START(orbituvi)
724   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
725   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
726ROM_END
727
728ROM_START(vdmaster)
729   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
730   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
731ROM_END
732
733
734/***************************************************************************
735
736  Game driver(s)
737
738***************************************************************************/
739
740static DRIVER_INIT( arcadia )
741{
742   int i;
743   UINT8 *gfx=machine.region("gfx1")->base();
744   for (i=0; i<256; i++) gfx[i]=i;
745#if 0
746   // this is here to allow developement of some simple testroutines
747   // for a real console
748   {
749      UINT8 *rom=machine.region("maincpu")->base();
750      /* this is a simple routine to display all rom characters
751           on the display for a snapshot */
752      static const UINT8 prog[]={ // address 0 of course
753      0x20, // eorz, 0
754      0x1b, 0x01, // bctr,a $0004
755      0x17, // retc a
756      0x76, 0x20, // ppsu ii
757
758      // fill screen
759      0x04, 0x00, // lodi,0 0
760      0x04|1, 0x00, // lodi,1 0
761      0xcc|1, 0x78, 0x10, //a: stra,0 $1800,r1
762      0x75,9, //cpsl wc|c
763      0x84,0x41, // addi,0 0x41
764      0x75,9, //cpsl wc|c
765      0x84|1, 0x01, // addi,1 1
766      0xe4|1, 0x40, // comi,1 40
767      0x98, 0x80-15, // bcfr,0 a
768
769      0x04, 0xff, // lodi,0 7
770      0xcc, 0x18, 0xfc, // stra,0 $19f8
771      0x04, 0x00, // lodi,0 7
772      0xcc, 0x18, 0xfd, // stra,0 $18fd
773      0x04, 0x07, // lodi,0 7
774      0xcc, 0x19, 0xf9, // stra,0 $19f9
775
776      0x04, 0x00, // lodi,0 7
777      0xcc, 0x19, 0xbe, // stra,0 $19bf
778      0x04, 0x00, // lodi,0 7
779      0xcc, 0x19, 0xbf, // stra,0 $19bf
780
781      //loop: 0x0021
782      // print keyboards
783      0x04|1, 0x00, //y:lodi,1 0
784      0x0c|1, 0x79, 0x00, //x: ldra,0 1900,r1
785      0x44|0, 0x0f, //andi,0 0f
786      0x64|0, 0x10, //ori,0  10
787      0xcc|1, 0x78, 0x01, //stra,0 1840,r1
788      0x75,9, //cpsl wc|c
789      0x84|1, 0x01, //addi,1 1
790      0xe4|1, 0x09, //comi,1 9
791      0x98, 0x80-18, //bcfr,0 x
792
793      // cycle colors
794      0x0c|1, 0x19, 0x00, //ldra,1 1900
795      0x44|1, 0xf, //andi,0 0f
796      0xe4|1, 1, //comi,1 1
797      0x98, +10, //bcfr,0 c
798      0x0c, 0x19, 0xbf,//ldra,0 19f9,0
799      0x84, 1, //addi,0 1
800      0xcc, 0x19, 0xbf, //stra,0 19f9,0
801      0x18|3, 12, // bctr,a
802      0xe4|1, 2, //c:comi,1 2
803      0x98, +10, //bcfr,0 d
804      0x0c, 0x19, 0xbf, //ldra,0 19f9,0
805      0x84, 8, //addi,0 8
806      0xcc, 0x19, 0xbf, //stra,0 19f9,0
807      0x18|3, 12, // bctr,a
808
809      // cycle colors
810      0xe4|1, 4, //comi,1 4
811      0x98, +10, //bcfr,0 c
812      0x0c, 0x19, 0xbe,//ldra,0 19f9,0
813      0x84, 1, //addi,0 1
814      0xcc, 0x19, 0xbe, //stra,0 19f9,0
815      0x18|3, 12, // bctr,a
816      0xe4|1, 8, //c:comi,1 2
817      0x98, +8+9, //bcfr,0 d
818      0x0c, 0x19, 0xbe, //ldra,0 19f9,0
819      0x84, 8, //addi,0 8
820      0xcc, 0x19, 0xbe, //stra,0 19f9,0
821
822      0x0c, 0x19, 0x00, //b: ldra,0 1900
823      0x44|0, 0xf, //andi,0 0f
824      0xe4, 0, //comi,0 0
825      0x98, 0x80-9, //bcfr,0 b
826
827      0x0c, 0x19, 0xbe, //ldra,0 19bf
828      0xcc, 0x19, 0xf8, //stra,0 19f8
829      0x0c, 0x19, 0xbf, //ldra,0 19bf
830      0xcc, 0x19, 0xf9, //stra,0 19f8
831
832      0x0c, 0x19, 0xbe, //ldra,0 17ff
833      0x44|0, 0xf, //andi,0 7
834      0x64|0, 0x10, //ori,0  10
835      0xcc, 0x18, 0x0d, //stra,0 180f
836      0x0c, 0x19, 0xbe, //x: ldra,0 19bf
837      0x50, 0x50, 0x50, 0x50, //shr,0 4
838      0x44|0, 0xf, //andi,0 7
839      0x64|0, 0x10, //ori,0  10
840      0xcc, 0x18, 0x0c, //stra,0 180e
841
842      0x0c, 0x19, 0xbf, //ldra,0 17ff
843      0x44|0, 0xf, //andi,0 7
844      0x64|0, 0x10, //ori,0  10
845      0xcc, 0x18, 0x0f, //stra,0 180f
846      0x0c, 0x19, 0xbf, //x: ldra,0 19bf
847      0x50, 0x50, 0x50, 0x50, //shr,0 4
848      0x44|0, 0xf, //andi,0 7
849      0x64|0, 0x10, //ori,0  10
850      0xcc, 0x18, 0x0e, //stra,0 180e
851
852      0x0c, 0x18, 0x00, //ldra,0 1800
853      0x84, 1, //addi,0 1
854      0xcc, 0x18, 0x00, //stra,0 1800
855
856//      0x1b, 0x80-20-29-26-9-8-2 // bctr,a y
857      0x1c|3, 0, 0x32, // bcta,3 loop
858
859      // calling too many subdirectories causes cpu to reset!
860      // bxa causes trap
861      };
862#if 1
863      FILE *f;
864      f=fopen("chartest.bin","wb");
865      fwrite(prog, ARRAY_LENGTH(prog), sizeof(prog[0]), f);
866      fclose(f);
867#endif
868      for (i=0; i<ARRAY_LENGTH(prog); i++) rom[i]=prog[i];
869
870   }
871#endif
872}
873
874
875/*   YEAR  NAME       PARENT     COMPAT    MACHINE       INPUT     INIT          COMPANY               FULLNAME */
876CONS(1983, advsnha,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Advision",           "Advision Home Arcade", GAME_IMPERFECT_SOUND )    /* France */
877CONS(1982, bndarc,    arcadia,   0,        arcadia,      arcadia,  arcadia,      "Bandai",             "Arcadia", GAME_IMPERFECT_SOUND )                 /* Japan */
878CONS(1982, arcadia,   0,         0,        arcadia,      arcadia,  arcadia,      "Emerson",            "Arcadia 2001", GAME_IMPERFECT_SOUND )            /* U.S.A. */
879CONS(198?, tccosmos,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "Mobilar?",           "Tele-Computer Cosmos", GAME_IMPERFECT_SOUND )    /* Spain? I have only found pictures of a German Cosmos ( http://www.pong-picture-page.de/catalog/product_info.php?products_id=2170 ) */
880CONS(1982, dynavisn,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Yamagiwa",           "Dynavision", GAME_IMPERFECT_SOUND )              /* Japan */
881CONS(1982, ekusera,   intmpt03,  0,        arcadia,      arcadia,  arcadia,      "P.I.C",              "Ekusera", GAME_IMPERFECT_SOUND )                 /* Japan */
882CONS(1982, hanihac,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Hanimex",            "Hanimex Home Arcade Centre", GAME_IMPERFECT_SOUND )  /* UK */
883CONS(1982, hmg2650,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Hanimex",            "HMG-2650", GAME_IMPERFECT_SOUND )                 /* Germany */
884CONS(198?, intmpt03,  0,         arcadia,  arcadia,      arcadia,  arcadia,      "Intelligent Game",   "Intelligent Game MPT-03", GAME_IMPERFECT_SOUND )  /* U.S.A */
885CONS(198?, ixl2000,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Intercord",          "Intercord XL 2000 System", GAME_IMPERFECT_SOUND ) /* Germany */
886CONS(198?, intervsn,  ormatu,    0,        arcadia,      arcadia,  arcadia,      "Intervision",        "Intervision 2001", GAME_IMPERFECT_SOUND )         /* Switzerland */
887CONS(198?, itmcmtp3,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "ITMC",               "ITMC MPT-03", GAME_IMPERFECT_SOUND )              /* France */
888CONS(1982, lvision,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Leisure-Dynamics",   "Leisure-Vision", GAME_IMPERFECT_SOUND )           /* Canada */
889CONS(1982, leonardo,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "GiG Electronics",    "Leonardo", GAME_IMPERFECT_SOUND )                 /* Italy */
890CONS(1983, mratlus,   plldium,   0,        arcadia,      arcadia,  arcadia,      "H.G.S.",             "Mr. Altus Tele Brain", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )    /* Germany */
891CONS(198?, ormatu,    0,         arcadia,  arcadia,      arcadia,  arcadia,      "Ormatu Electronics", "Ormatu 2001", GAME_IMPERFECT_SOUND )              /* Netherlands */
892CONS(198?, plldium,   0,         arcadia,  arcadia,      plldium,  arcadia,      "Neckermann",         "Palladium Video-Computer-Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Germany, 16 keys instead of 12 */
893CONS(1983, polyvcg,   plldium,   0,        arcadia,      arcadia,  arcadia,      "Polybrain",          "Polybrain Video Computer Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Germany */
894CONS(198?, poppympt,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Transonic",          "Poppy MPT-03 Tele Computer Spiel", GAME_IMPERFECT_SOUND )           /* Germany */
895CONS(198?, prestmpt,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Prestige",           "Prestige Video Computer Game MPT-03", GAME_IMPERFECT_SOUND )        /* France */
896CONS(198?, rowtrn2k,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Rowtron",            "Rowtron 2000", GAME_IMPERFECT_SOUND )               /* UK */
897CONS(1982, tvg2000,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Schmid",             "Schmid TVG 2000", GAME_IMPERFECT_SOUND )            /* Germany */
898CONS(198?, sheenhvc,  ormatu,    0,        arcadia,      arcadia,  arcadia,      "Sheen",              "Sheen Home Video Centre 2001", GAME_IMPERFECT_SOUND )     /* Australia */
899CONS(198?, soundic,   intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Soundic",            "Soundic MPT-03", GAME_IMPERFECT_SOUND )             /* Finland */
900CONS(198?, telefevr,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "Tchibo",             "Tele-Fever", GAME_IMPERFECT_SOUND )                 /* Germany */
901CONS(198?, tempestm,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tempest",            "Tempest MPT-03", GAME_IMPERFECT_SOUND )             /* Australia */
902CONS(198?, tbbympt3,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tobby",              "Tobby MPT-03", GAME_IMPERFECT_SOUND )               /* ? */
903CONS(198?, trakcvg,   plldium,   0,        arcadia,      arcadia,  arcadia,      "Trakton",            "Trakton Computer Video Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Australia */
904CONS(1982, tunixha,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Monaco Leisure",     "Tunix Home Arcade", GAME_IMPERFECT_SOUND )          /* New Zealand */
905CONS(198?, tryomvgc,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tryom",              "Tryom Video Game Center", GAME_IMPERFECT_SOUND )    /* U.S.A */
906CONS(198?, orbituvi,  0,         arcadia,  arcadia,      arcadia,  arcadia,      "Orbit Electronics",  "UVI Compu-Game", GAME_IMPERFECT_SOUND )             /* New Zealand */
907CONS(198?, vdmaster,  orbituvi,  0,        arcadia,      arcadia,  arcadia,      "Grandstand",         "Video Master", GAME_IMPERFECT_SOUND )               /* New Zealand */
src/mess/drivers/ace.c
r13301r13302
1/***************************************************************************
2Jupiter Ace memory map
3
4    CPU: Z80
5        0000-1fff ROM
6        2000-23ff Mirror of 2400-27FF
7        2400-27ff RAM (1K RAM used for screen and edit/cassette buffer)
8        2800-2bff Mirror of 2C00-2FFF
9        2c00-2fff RAM (1K RAM for char set, write only)
10        3000-3bff Mirror of 3C00-3FFF
11        3c00-3fff RAM (1K RAM standard)
12        4000-7fff RAM (16K Expansion)
13        8000-ffff RAM (48K Expansion)
14
15Interrupts:
16
17    IRQ:
18        50Hz vertical sync
19
20Ports:
21
22    Out 0xfe:
23        Tape and buzzer
24
25    In 0xfe:
26        Keyboard input, tape, and buzzer
27
28    http://www.jupiter-ace.co.uk/
29
30***************************************************************************/
31
32/*
33
34    TODO:
35
36    - Ace Colour Board
37    - 96K ram expansion
38    - Deep Thought disc interface (6850, 6821)
39
40*/
41
42#define ADDRESS_MAP_MODERN
43
44#include "emu.h"
45#include "cpu/z80/z80.h"
46#include "formats/ace_ace.h"
47#include "formats/ace_tap.h"
48#include "imagedev/cassette.h"
49#include "imagedev/snapquik.h"
50#include "machine/ctronics.h"
51#include "machine/i8255.h"
52#include "machine/ram.h"
53#include "machine/z80pio.h"
54#include "sound/ay8910.h"
55#include "sound/sp0256.h"
56#include "sound/speaker.h"
57#include "sound/wave.h"
58#include "includes/ace.h"
59
60
61
62//**************************************************************************
63//  READ/WRITE HANDLERS
64//**************************************************************************
65
66//-------------------------------------------------
67//   io_r -
68//-------------------------------------------------
69
70READ8_MEMBER( ace_state::io_r )
71{
72   UINT8 data = 0xff;
73
74   if (!BIT(offset, 8)) data &= input_port_read(machine(), "A8");
75   if (!BIT(offset, 9)) data &= input_port_read(machine(), "A9");
76   if (!BIT(offset, 10)) data &= input_port_read(machine(), "A10");
77   if (!BIT(offset, 11)) data &= input_port_read(machine(), "A11");
78   if (!BIT(offset, 12)) data &= input_port_read(machine(), "A12");
79   if (!BIT(offset, 13)) data &= input_port_read(machine(), "A13");
80   if (!BIT(offset, 14)) data &= input_port_read(machine(), "A14");
81
82   if (!BIT(offset, 15))
83   {
84      data &= input_port_read(machine(), "A15");
85
86      m_cassette->output(-1);
87      speaker_level_w(m_speaker, 0);
88   }
89
90   if (m_cassette->input() > 0)
91   {
92      data &= ~0x20;
93   }
94
95   return data;
96}
97
98
99//-------------------------------------------------
100//   io_w -
101//-------------------------------------------------
102
103WRITE8_MEMBER( ace_state::io_w )
104{
105   m_cassette->output(1);
106   speaker_level_w(m_speaker, 1);
107}
108
109
110//-------------------------------------------------
111//   ppi_r -
112//-------------------------------------------------
113
114READ8_MEMBER( ace_state::ppi_pa_r )
115{
116   return m_ppi->read(space, 0);
117}
118
119READ8_MEMBER( ace_state::ppi_pb_r )
120{
121   return m_ppi->read(space, 1);
122}
123
124READ8_MEMBER( ace_state::ppi_pc_r )
125{
126   return m_ppi->read(space, 2);
127}
128
129READ8_MEMBER( ace_state::ppi_control_r )
130{
131   return m_ppi->read(space, 3);
132}
133
134
135//-------------------------------------------------
136//   ppi_w -
137//-------------------------------------------------
138
139WRITE8_MEMBER( ace_state::ppi_pa_w )
140{
141   m_ppi->write(space, 0, data);
142}
143
144WRITE8_MEMBER( ace_state::ppi_pb_w )
145{
146   m_ppi->write(space, 1, data);
147}
148
149WRITE8_MEMBER( ace_state::ppi_pc_w )
150{
151   m_ppi->write(space, 2, data);
152}
153
154WRITE8_MEMBER( ace_state::ppi_control_w )
155{
156   m_ppi->write(space, 3, data);
157}
158
159
160//-------------------------------------------------
161//   pio_r -
162//-------------------------------------------------
163
164static READ8_DEVICE_HANDLER( pio_ad_r )
165{
166   return z80pio_d_r(device, 0);
167}
168
169static READ8_DEVICE_HANDLER( pio_bd_r )
170{
171   return z80pio_d_r(device, 1);
172}
173
174static READ8_DEVICE_HANDLER( pio_ac_r )
175{
176   return z80pio_c_r(device, 0);
177}
178
179static READ8_DEVICE_HANDLER( pio_bc_r )
180{
181   return z80pio_c_r(device, 1);
182}
183
184
185//-------------------------------------------------
186//   pio_w -
187//-------------------------------------------------
188
189static WRITE8_DEVICE_HANDLER( pio_ad_w )
190{
191   z80pio_d_w(device, 0, data);
192}
193
194static WRITE8_DEVICE_HANDLER( pio_bd_w )
195{
196   z80pio_d_w(device, 1, data);
197}
198
199static WRITE8_DEVICE_HANDLER( pio_ac_w )
200{
201   z80pio_c_w(device, 0, data);
202}
203
204static WRITE8_DEVICE_HANDLER( pio_bc_w )
205{
206   z80pio_c_w(device, 1, data);
207}
208
209
210
211//**************************************************************************
212//  ADDRESS MAPS
213//**************************************************************************
214
215//-------------------------------------------------
216//  ADDRESS_MAP( ace_mem )
217//-------------------------------------------------
218
219static ADDRESS_MAP_START( ace_mem, AS_PROGRAM, 8, ace_state )
220   AM_RANGE(0x0000, 0x1fff) AM_ROM
221   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_video_ram)
222   AM_RANGE(0x2800, 0x2bff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_char_ram) AM_REGION(Z80_TAG, 0xfc00)
223   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
224   AM_RANGE(0x4000, 0xffff) AM_RAM
225ADDRESS_MAP_END
226
227
228//-------------------------------------------------
229//  ADDRESS_MAP( ace_io )
230//-------------------------------------------------
231
232static ADDRESS_MAP_START( ace_io, AS_IO, 8, ace_state )
233   AM_RANGE(0x00, 0x00) AM_MIRROR(0xfffe) AM_MASK(0xff00) AM_READWRITE(io_r, io_w)
234   AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_READ_PORT("JOY")
235   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff80) AM_READWRITE(ppi_pa_r, ppi_pa_w)
236   AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_READWRITE(ppi_pb_r, ppi_pb_w)
237   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_READWRITE(ppi_pc_r, ppi_pc_w)
238   AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_READWRITE(ppi_control_r, ppi_control_w)
239   AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ad_r, pio_ad_w)
240   AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bd_r, pio_bd_w)
241   AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ac_r, pio_ac_w)
242   AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bc_r, pio_bc_w)
243   AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY(AY8910_TAG, ay8910_address_w)
244   AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(AY8910_TAG, ay8910_r, ay8910_data_w)
245ADDRESS_MAP_END
246
247
248
249//**************************************************************************
250//  INPUT PORTS
251//**************************************************************************
252
253//-------------------------------------------------
254//  INPUT_PORTS( ace )
255//-------------------------------------------------
256
257static INPUT_PORTS_START( ace )
258   PORT_START("A8")
259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)      PORT_CHAR(UCHAR_SHIFT_1)
260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Symbol Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2)
261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z)         PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':')
262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X)         PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3')
263   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C)         PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?')
264   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
265
266   PORT_START("A9")
267   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A)         PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('~')
268   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S)         PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR('|')
269   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D)         PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR('\\')
270   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F)         PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{')
271   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G)         PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}')
272   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
273
274   PORT_START("A10")
275   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q)         PORT_CHAR('q') PORT_CHAR('Q')
276   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W)         PORT_CHAR('w') PORT_CHAR('W')
277   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E)         PORT_CHAR('e') PORT_CHAR('E')
278   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R)         PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<')
279   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T)         PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>')
280   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
281
282   PORT_START("A11")
283   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1)         PORT_CHAR('1') PORT_CHAR('!')
284   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2)         PORT_CHAR('2') PORT_CHAR('@')
285   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3)         PORT_CHAR('3') PORT_CHAR('#')
286   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4)         PORT_CHAR('4') PORT_CHAR('$')
287   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_LEFT) PORT_CHAR('5') PORT_CHAR('%')
288   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
289
290   PORT_START("A12")
291   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0)         PORT_CHAR('0') PORT_CHAR('_')
292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9)         PORT_CHAR('9') PORT_CHAR(')')
293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR('8') PORT_CHAR('(')
294   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('7') PORT_CHAR('\'')
295   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_UP)   PORT_CHAR('6') PORT_CHAR('&')
296   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
297
298   PORT_START("A13")
299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)         PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"')
300   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O)         PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';')
301   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I)         PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00A9)
302   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U)         PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(']')
303   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y)         PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR('[')
304   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
305
306   PORT_START("A14")
307   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
308   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L)         PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=')
309   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K)         PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+')
310   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J)         PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-')
311   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h  H  \xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
312   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
313
314   PORT_START("A15")
315   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(' ')
316   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M)         PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.')
317   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N)         PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',')
318   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B)         PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*')
319   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V)         PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/')
320   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
321
322   PORT_START("JOY")
323   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
324   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
325   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
326   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
327   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
328   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 )
329   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
330   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
331INPUT_PORTS_END
332
333
334
335//**************************************************************************
336//  VIDEO
337//**************************************************************************
338
339//-------------------------------------------------
340//  gfx_layout ace_charlayout
341//-------------------------------------------------
342
343static const gfx_layout ace_charlayout =
344{
345   8,8,
346   128,
347   1,
348   { RGN_FRAC(0,1) },
349   { STEP8(0,1) },
350   { STEP8(0,8) },
351   8*8
352};
353
354
355//-------------------------------------------------
356//  GFXDECODE( ace )
357//-------------------------------------------------
358
359static GFXDECODE_START( ace )
360   GFXDECODE_ENTRY( Z80_TAG, 0xfc00, ace_charlayout, 0, 1 )
361GFXDECODE_END
362
363
364//-------------------------------------------------
365//  TIMER_DEVICE_CALLBACK( set_irq )
366//-------------------------------------------------
367
368static TIMER_DEVICE_CALLBACK( set_irq )
369{
370   cputag_set_input_line(timer.machine(), Z80_TAG, INPUT_LINE_IRQ0, ASSERT_LINE);
371}
372
373
374//-------------------------------------------------
375//  TIMER_DEVICE_CALLBACK( clear_irq )
376//-------------------------------------------------
377
378static TIMER_DEVICE_CALLBACK( clear_irq )
379{
380   cputag_set_input_line(timer.machine(), Z80_TAG, INPUT_LINE_IRQ0, CLEAR_LINE);
381}
382
383
384//-------------------------------------------------
385//  SCREEN_UPDATE( ace )
386//-------------------------------------------------
387
388bool ace_state::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect)
389{
390   UINT8 y,ra,chr,gfx;
391   UINT16 sy=56,ma=0,x;
392
393   for (y = 0; y < 24; y++)
394   {
395      for (ra = 0; ra < 8; ra++)
396      {
397         UINT16 *p = BITMAP_ADDR16(&bitmap, sy++, 40);
398
399         for (x = ma; x < ma+32; x++)
400         {
401            chr = m_video_ram[x];
402
403            /* get pattern of pixels for that character scanline */
404            gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0);
405
406            /* Display a scanline of a character (8 pixels) */
407            *p++ = BIT(gfx, 7);
408            *p++ = BIT(gfx, 6);
409            *p++ = BIT(gfx, 5);
410            *p++ = BIT(gfx, 4);
411            *p++ = BIT(gfx, 3);
412            *p++ = BIT(gfx, 2);
413            *p++ = BIT(gfx, 1);
414            *p++ = BIT(gfx, 0);
415         }
416      }
417      ma+=32;
418   }
419   return 0;
420}
421
422
423
424//**************************************************************************
425//  DEVICE CONFIGURATION
426//**************************************************************************
427
428//-------------------------------------------------
429//  cassette_interface ace_cassette_interface
430//-------------------------------------------------
431
432static const cassette_interface ace_cassette_interface =
433{
434   ace_cassette_formats,
435   NULL,
436   (cassette_state)(CASSETTE_STOPPED),
437   NULL,
438   NULL
439};
440
441
442//-------------------------------------------------
443//  ay8910_interface psg_intf
444//-------------------------------------------------
445
446static const ay8910_interface psg_intf =
447{
448   AY8910_LEGACY_OUTPUT,
449   AY8910_DEFAULT_LOADS,
450   DEVCB_NULL,
451   DEVCB_NULL,
452   DEVCB_NULL,
453   DEVCB_NULL
454};
455
456
457//-------------------------------------------------
458//  sp0256_interface sp0256_intf
459//-------------------------------------------------
460
461static const sp0256_interface sp0256_intf =
462{
463   DEVCB_NULL,
464   DEVCB_NULL
465};
466
467
468//-------------------------------------------------
469//  I8255A_INTERFACE( ppi_intf )
470//-------------------------------------------------
471
472static READ8_DEVICE_HANDLER( sby_r )
473{
474   /*
475
476        bit     description
477
478        PC0     SP0256 SBY
479        PC1
480        PC2
481        PC3
482        PC4
483        PC5
484        PC6
485        PC7
486
487    */
488
489   return sp0256_sby_r(device);
490}
491
492static WRITE8_DEVICE_HANDLER( ald_w )
493{
494   /*
495
496        bit     description
497
498        PA0     SP0256 A1
499        PA1     SP0256 A2
500        PA2     SP0256 A3
501        PA3     SP0256 A4
502        PA4     SP0256 A5
503        PA5     SP0256 A6
504        PA6     SP0256 _ALD
505        PA7
506
507    */
508
509   if (!BIT(data, 6))
510   {
511      sp0256_ALD_w(device, 0, data & 0x3f);
512   }
513}
514
515static I8255A_INTERFACE( ppi_intf )
516{
517   DEVCB_NULL,
518   DEVCB_NULL,
519   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, sby_r),
520   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, ald_w),
521   DEVCB_NULL,
522   DEVCB_NULL
523};
524
525
526//-------------------------------------------------
527//  Z80PIO_INTERFACE( pio_intf )
528//-------------------------------------------------
529
530READ8_MEMBER( ace_state::pio_pa_r )
531{
532   /*
533
534        bit     description
535
536        PA0
537        PA1     RxD
538        PA2
539        PA3
540        PA4
541        PA5
542        PA6
543        PA7
544
545    */
546
547   return 0;
548};
549
550WRITE8_MEMBER( ace_state::pio_pa_w )
551{
552   /*
553
554        bit     description
555
556        PA0     RTS
557        PA1
558        PA2     CTS
559        PA3     TxD
560        PA4
561        PA5
562        PA6     STB
563        PA7
564
565    */
566
567   // centronics strobe
568   centronics_strobe_w(m_centronics, !BIT(data, 6));
569};
570
571static Z80PIO_INTERFACE( pio_intf )
572{
573   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
574   DEVCB_DRIVER_MEMBER(ace_state, pio_pa_r),
575   DEVCB_DRIVER_MEMBER(ace_state, pio_pa_w),
576   DEVCB_NULL,
577   DEVCB_NULL,
578   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w),
579   DEVCB_NULL
580};
581
582
583
584//**************************************************************************
585//  MACHINE INITIALIZATION
586//**************************************************************************
587
588//-------------------------------------------------
589//  MACHINE_START( ace )
590//-------------------------------------------------
591
592void ace_state::machine_start()
593{
594   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
595
596   /* configure RAM */
597   switch (ram_get_size(m_ram))
598   {
599   case 1*1024:
600      program->unmap_readwrite(0x4000, 0xffff);
601      break;
602
603   case 16*1024:
604      program->unmap_readwrite(0x8000, 0xffff);
605      break;
606
607   case 32*1024:
608      program->unmap_readwrite(0xc000, 0xffff);
609      break;
610   }
611}
612
613
614
615//**************************************************************************
616//  MACHINE CONFIGURATION
617//**************************************************************************
618
619//-------------------------------------------------
620//  MACHINE_CONFIG( ace )
621//-------------------------------------------------
622
623static MACHINE_CONFIG_START( ace, ace_state )
624   // basic machine hardware
625   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6_5MHz/2)
626   MCFG_CPU_PROGRAM_MAP(ace_mem)
627   MCFG_CPU_IO_MAP(ace_io)
628   MCFG_QUANTUM_TIME(attotime::from_hz(60))
629
630   // video hardware
631   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
632   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
633   MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304)
634   MCFG_TIMER_ADD_SCANLINE("set_irq", set_irq, SCREEN_TAG, 31*8, 264)
635   MCFG_TIMER_ADD_SCANLINE("clear_irq", clear_irq, SCREEN_TAG, 32*8, 264)
636
637   MCFG_PALETTE_LENGTH(2)
638   MCFG_PALETTE_INIT(black_and_white)
639
640   MCFG_GFXDECODE(ace)
641
642   // sound hardware
643   MCFG_SPEAKER_STANDARD_MONO("mono")
644   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
645   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
646   MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
647   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
648
649   MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_6_5MHz/2)
650   MCFG_SOUND_CONFIG(psg_intf)
651   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
652
653   MCFG_SOUND_ADD(SP0256AL2_TAG, SP0256, XTAL_3MHz)
654   MCFG_SOUND_CONFIG(sp0256_intf)
655   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
656
657   // devices
658   MCFG_CASSETTE_ADD(CASSETTE_TAG, ace_cassette_interface)
659   MCFG_SNAPSHOT_ADD("snapshot", ace, "ace", 1)
660   MCFG_I8255A_ADD(I8255_TAG, ppi_intf)
661   MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_6_5MHz/2, pio_intf)
662   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
663
664   // internal ram
665   MCFG_RAM_ADD(RAM_TAG)
666   MCFG_RAM_DEFAULT_SIZE("1K")
667   MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K")
668MACHINE_CONFIG_END
669
670
671
672//**************************************************************************
673//  ROMS
674//**************************************************************************
675
676//-------------------------------------------------
677//  ROM( ace )
678//-------------------------------------------------
679
680ROM_START( ace )
681   ROM_REGION( 0x10000, Z80_TAG, 0 )
682   ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) )
683   ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) )
684
685   ROM_REGION( 0x1000, "fdc", 0 ) // Deep Thought disc interface
686   ROM_LOAD( "dos 4.bin", 0x0000, 0x1000, CRC(04c70448) SHA1(53ddcced6ae2feafd687a3b55864726656b71412) )
687
688   ROM_REGION( 0x10000, SP0256AL2_TAG, 0 )
689   ROM_LOAD( "sp0256-al2.ic1", 0x000, 0x800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
690ROM_END
691
692
693
694//**************************************************************************
695//  SYSTEM DRIVERS
696//**************************************************************************
697
698//    YEAR  NAME     PARENT    COMPAT  MACHINE    INPUT     INIT     COMPANY         FULLNAME      FLAGS
699COMP( 1981, ace,     0,        0,      ace,       ace,      0,   "Jupiter Cantab", "Jupiter Ace" , 0 )
src/mess/drivers/astrocde.c
r13301r13302
1/****************************************************************************
2
3    Bally Astrocade consumer hardware
4    driver by Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles,
5    Dirk Best
6
7****************************************************************************/
8
9#include "emu.h"
10#include "cpu/z80/z80.h"
11#include "includes/astrocde.h"
12#include "sound/astrocde.h"
13#include "imagedev/cartslot.h"
14#include "machine/ram.h"
15
16MACHINE_RESET( astrocde );
17void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end);
18
19/*************************************
20 *
21 *  Memory maps
22 *
23 * $0000 to $1FFF:  8K on-board ROM (could be one of three available BIOS dumps)
24 * $2000 to $3FFF:  8K cartridge ROM
25 * $4000 to $4FFF:  4K screen RAM
26 * $5000 to $FFFF:  44K address space not available in standard machine.  With a
27 * sufficiently large RAM expansion, all of this RAM can be added, and accessed
28 * by an extended BASIC program.  Bally and Astrocade BASIC can access from
29 * $5000 to $7FFF if available.
30 *
31 *  RAM Expansions
32 *
33 * Several third party RAM expansions have been made for the Astrocade.  These
34 * allow access to various ranges of the expansion memory ($5000 to $FFFF).
35 * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC
36 * and VIPERSoft BASIC.  All of the expansions also have a RAM protect switch, which
37 * can be flipped at any time to make the RAM act like ROM.  Extended BASIC
38 * programs need access to the RAM and won't work with RAM protect enabled, but
39 * this can be useful with Bally and Astrocade BASIC.  They also have a range switch
40 * (not implemented).  The default position is 6K, but it can be switched to
41 * 2K.  This means that the expanded memory starting at $6000 will instead be
42 * mapped to the cartridge memory starting at $2000.  So it would be possible to
43 * load a cartridge program from tape into the expansion memory, then flip the range
44 * switch and run it as a cartridge.  This is useful for cartridge development.
45 *
46 * NOTE:  If you have any trouble running cartridges with a RAM expansion installed, hit reset.
47 *
48 * Blue RAM -- available in 4K, 16K, and 32K.  These also use an INS8154 chip,
49 * (not yet implemented) which has an additional $80 bytes of RAM mapped
50 * immediately after the end of the expansion address space.  This memory
51 * can't be write protected.  The INS8154 has I/O features needed for loading
52 * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
53 * 4K:  $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
54 * past this range)
55 * 16K:  $6000 to $9FFF
56 * 32K:  $6000 to $DFFF
57 *
58 * VIPER System 1 -- This is available in 16K only.  It also includes a keyboard (not implemented).
59 * 16K:  $6000 to $9FFF
60 *
61 * Lil' WHITE RAM -- This is available in 32K only.  Attempts to read and write
62 * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion
63 * memory $5000 to $7FFF.  The current implementation won't allow the shadow RAM area
64 * to be accessed when RAM protect is on, but there is no known software that will
65 * access the upper range of the expansion RAM when RAM protect is enabled.
66 * 32K:  $5000 to $CFFF
67 *
68 * R&L 64K RAM Board -- This is a highly configurable kit.  RAM can be installed in
69 * 2K increments.  So, the entire 44K expansion memory can be filled.  It is also
70 * possible to override the rest of the memory map with RAM (not implemented).
71 * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented).
72 * RAM write protection can be implemented in three ranges through jumpers or by
73 * installing switches.  The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K),
74 * and $0000 to $FFFF (all 64K).  The current implementation is for 44K expansion memory mapped from
75 * $5000 to $FFFF, with only a single write protect covering this entire range.
76 *
77 *************************************/
78
79static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8 )
80   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w)
81   AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */
82   AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE_MEMBER(astrocde_state, m_videoram) /* ASG */
83ADDRESS_MAP_END
84
85
86static ADDRESS_MAP_START( astrocade_io, AS_IO, 8 )
87   AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w)
88ADDRESS_MAP_END
89
90static INPUT_CHANGED( set_write_protect )  // run when RAM expansion write protect switch is changed
91{
92   int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
93   address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM);
94   UINT8 *expram = ram_get_ptr(field.machine().device("ram_tag"));
95
96   get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
97
98    if (ram_expansion_installed == 1)
99    {
100        if (write_protect_on == 0)  // write protect off, so install memory normally
101        {
102            space->install_ram(expansion_ram_start, expansion_ram_end, expram);
103            if (shadow_ram_end > expansion_ram_end)
104                space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
105        }
106        else  // write protect on, so make memory read only
107        {
108            space->nop_write(expansion_ram_start, expansion_ram_end);
109        }
110     }
111}
112
113/*************************************
114 *
115 *  Input ports
116 *
117 *
118 *  The Astrocade has ports for four hand controllers.  Each controller has a
119 *  knob on top that can be simultaneously pushed as an eight-way joystick and
120 *  twisted as a paddle, in addition to a trigger button.  The knob can twist
121 *  through about 270 degrees, registering 256 unique positions.  It does not
122 *  autocenter.  When selecting options on the menu, twisting the knob to the
123 *  right gives lower numbers, and twisting to the left gives larger numbers.
124 *  Paddle games like Clowns have more intuitive behavior -- twisting to the
125 *  right moves the character right.
126 *
127 *  There is a 24-key keypad on the system itself (6 rows, 4 columns).  It is
128 *  labeled for the built-in calculator, but overlays were released for other
129 *  programs, the most popular being the BASIC cartridges, which allowed a
130 *  large number of inputs by making the bottom row shift buttons.  The labels
131 *  below first list the calculator key, then the BASIC keys in the order of no
132 *  shift, GREEN shift, RED shift, BLUE shift, WORDS shift.
133 *
134 *************************************/
135
136static INPUT_PORTS_START( astrocde )
137   PORT_START("P1HANDLE")
138   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
139   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
140   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
141   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY
142   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(1)
143   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
144
145   PORT_START("P2HANDLE")
146   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(2) PORT_8WAY
147   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(2) PORT_8WAY
148   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(2) PORT_8WAY
149   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY
150   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(2)
151   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
152
153   PORT_START("P3HANDLE")
154   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(3) PORT_8WAY
155   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(3) PORT_8WAY
156   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(3) PORT_8WAY
157   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY
158   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(3)
159   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
160
161   PORT_START("P4HANDLE")
162   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(4) PORT_8WAY
163   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(4) PORT_8WAY
164   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(4) PORT_8WAY
165   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY
166   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(4)
167   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
168
169   PORT_START("KEYPAD0")
170   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("%   \xC3\xB7         [   ]   LIST") PORT_CODE(KEYCODE_O)
171   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/   x     J   K   L   NEXT") PORT_CODE(KEYCODE_SLASH_PAD)
172   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x   -     V   W   X   IF") PORT_CODE(KEYCODE_ASTERISK)
173   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("-   +     &   @   *   GOTO") PORT_CODE(KEYCODE_MINUS_PAD)
174   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+   =     #   %   :   PRINT") PORT_CODE(KEYCODE_PLUS_PAD)
175   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("=   WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD)
176   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
177
178   PORT_START("KEYPAD1")
179   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93   HALT              RUN") PORT_CODE(KEYCODE_PGDN)
180   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH  9     G   H   I   STEP") PORT_CODE(KEYCODE_H)
181   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9   6     S   T   U   RND") PORT_CODE(KEYCODE_9)
182   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6   3     \xE2\x86\x91   .   \xE2\x86\x93   BOX") PORT_CODE(KEYCODE_6)
183   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3   ERASE (   ;   )") PORT_CODE(KEYCODE_3)
184   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(".   BLUE Shift") PORT_CODE(KEYCODE_STOP)
185   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
186
187   PORT_START("KEYPAD2")
188   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91   PAUSE     /   \\") PORT_CODE(KEYCODE_PGUP)
189   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS  8     D   E   F   TO") PORT_CODE(KEYCODE_S)
190   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8   5     P   Q   R   RETN") PORT_CODE(KEYCODE_8)
191   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5   2     \xE2\x86\x90   '   \xE2\x86\x92   LINE") PORT_CODE(KEYCODE_5)
192   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2   0     <   \"   >   INPUT") PORT_CODE(KEYCODE_2)
193   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0   RED Shift") PORT_CODE(KEYCODE_0)
194   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
195
196   PORT_START("KEYPAD3")
197   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C   GO                +10") PORT_CODE(KEYCODE_C)
198   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR  7     A   B   C   FOR") PORT_CODE(KEYCODE_R)
199   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7   4     M   N   O   GOSB") PORT_CODE(KEYCODE_7)
200   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4   1     Y   Z   !   CLEAR") PORT_CODE(KEYCODE_4)
201   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1   SPACE $   ,   ?") PORT_CODE(KEYCODE_1)
202   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE  GREEN Shift") PORT_CODE(KEYCODE_E)
203   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
204
205   PORT_START("P1_KNOB")
206   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1)
207
208   PORT_START("P2_KNOB")
209   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
210
211   PORT_START("P3_KNOB")
212   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3)
213
214   PORT_START("P4_KNOB")
215   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4)
216
217    PORT_START("CFG")   /* machine config */
218   PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion")
219   PORT_DIPSETTING(   0x00, "No RAM Expansion")
220   PORT_DIPSETTING(   0x01, "16KB Viper System 1 RAM Expansion")
221   PORT_DIPSETTING(   0x02, "32KB Lil' WHITE RAM Expansion")
222   PORT_DIPSETTING(   0x04, "R&L 64K RAM Board (44K installed)")
223   PORT_DIPSETTING(   0x08, "4KB Blue RAM Expansion")
224   PORT_DIPSETTING(   0x10, "16KB Blue RAM Expansion")
225   PORT_DIPSETTING(   0x20, "32KB Blue RAM Expansion")
226
227   PORT_START("PROTECT")  /* Write protect RAM */
228   PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED(set_write_protect, 0)
229   PORT_DIPSETTING( 0x00, "Write Protect Off")
230   PORT_DIPSETTING( 0x01, "Write Protect On")
231INPUT_PORTS_END
232
233
234/*************************************
235 *
236 *  Machine drivers
237 *
238 *************************************/
239
240static MACHINE_CONFIG_START( astrocde, astrocde_state )
241   /* basic machine hardware */
242   MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4)        /* 1.789 MHz */
243   MCFG_CPU_PROGRAM_MAP(astrocade_mem)
244   MCFG_CPU_IO_MAP(astrocade_io)
245
246   MCFG_MACHINE_RESET( astrocde )
247
248   /* video hardware */
249   MCFG_SCREEN_ADD("screen", RASTER)
250   MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240)
251   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
252   MCFG_SCREEN_UPDATE(astrocde)
253
254   MCFG_PALETTE_LENGTH(512)
255   MCFG_PALETTE_INIT(astrocde)
256
257   MCFG_VIDEO_START(astrocde)
258
259   /* sound hardware */
260   MCFG_SPEAKER_STANDARD_MONO("mono")
261   MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4)
262   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
263
264    /* optional expansion ram (installed in MACHINE_RESET)*/
265   MCFG_RAM_ADD("ram_tag")
266   MCFG_RAM_DEFAULT_SIZE("32k")
267
268   /* cartridge */
269   MCFG_CARTSLOT_ADD("cart")
270   MCFG_CARTSLOT_EXTENSION_LIST("bin")
271   MCFG_CARTSLOT_INTERFACE("astrocde_cart")
272
273   /* Software lists */
274   MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde")
275MACHINE_CONFIG_END
276
277
278/*************************************
279 *
280 *  ROM definitions
281 *
282 *************************************/
283
284ROM_START( astrocde )
285   ROM_REGION( 0x10000, "maincpu", 0 )
286   ROM_LOAD( "astro.bin",  0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) )
287   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
288ROM_END
289
290ROM_START( astrocdl )
291   ROM_REGION( 0x10000, "maincpu", 0 )
292   ROM_LOAD( "ballyhlc.bin",  0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) )
293   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
294ROM_END
295
296ROM_START( astrocdw )
297   ROM_REGION( 0x10000, "maincpu", 0 )
298   ROM_LOAD( "bioswhit.bin",  0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) )
299   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
300ROM_END
301
302/*************************************
303 *
304 *  Driver initialization
305 *
306 *************************************/
307
308static DRIVER_INIT( astrocde )
309{
310   astrocde_state *state = machine.driver_data<astrocde_state>();
311   state->m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS;
312}
313
314MACHINE_RESET( astrocde )
315{
316    int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
317    address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
318    UINT8 *expram = ram_get_ptr(machine.device("ram_tag"));
319    space->unmap_readwrite(0x5000, 0xffff);  // unmap any previously installed expansion RAM
320
321    get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
322
323    if (ram_expansion_installed == 1)
324    {
325        if (write_protect_on == 0)  // write protect off, so install memory normally
326        {
327            space->install_ram(expansion_ram_start, expansion_ram_end, expram);
328            if (shadow_ram_end > expansion_ram_end)
329                space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
330        }
331        else  // write protect on, so make memory read only
332        {
333            space->nop_write(expansion_ram_start, expansion_ram_end);
334        }
335     }
336}
337
338void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end)
339{
340    if (input_port_read(space->machine(), "PROTECT") == 0x01)
341        write_protect_on = 1;
342    else
343        write_protect_on = 0;
344
345    ram_expansion_installed = 1;
346
347    switch(input_port_read(space->machine(), "CFG"))  // check RAM expansion configuration and set address ranges
348    {
349        case 0x00:  // No RAM Expansion
350             ram_expansion_installed = 0;
351             break;
352        case 0x01:  // 16KB Viper System 1 RAM Expansion
353             expansion_ram_start = 0x6000;
354             expansion_ram_end = 0x9fff;
355             shadow_ram_end = 0;
356             break;
357        case 0x02:  // "32KB Lil' WHITE RAM Expansion
358             expansion_ram_start = 0x5000;
359             expansion_ram_end = 0xcfff;
360             shadow_ram_end = 0xffff;
361             break;
362        case 0x04:  // R&L 64K RAM Board (44KB installed)
363             expansion_ram_start = 0x5000;
364             expansion_ram_end = 0xffff;
365             shadow_ram_end = 0;
366             break;
367        case 0x08:  // 4KB Blue RAM Expansion
368             expansion_ram_start = 0x6000;
369             expansion_ram_end = 0x6fff;
370             shadow_ram_end = 0;
371             break;
372        case 0x10:  // 16KB Blue RAM Expansion
373             expansion_ram_start = 0x6000;
374             expansion_ram_end = 0x9fff;
375             shadow_ram_end = 0;
376             break;
377        case 0x20:  // 32KB Blue RAM Expansion
378             expansion_ram_start = 0x6000;
379             expansion_ram_end = 0xdfff;
380             shadow_ram_end = 0;
381             break;
382        default:
383            break;
384    }
385}
386
387
388/*************************************
389 *
390 *  Driver definitions
391 *
392 *************************************/
393
394/*    YEAR  NAME      PARENT    COMPAT    MACHINE   INPUT     INIT      COMPANY                FULLNAME                     FLAGS */
395CONS( 1978, astrocde, 0,        0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", GAME_SUPPORTS_SAVE )
396CONS( 1977, astrocdl, astrocde, 0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Home Library Computer", GAME_SUPPORTS_SAVE )
397CONS( 1977, astrocdw, astrocde, 0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", GAME_SUPPORTS_SAVE )
src/mess/drivers/mirage.c
r13301r13302
1/***************************************************************************
2
3    drivers/mirage.c
4
5    Ensoniq Mirage Sampler
6    Preliminary driver by R. Belmont
7
8    Map for Mirage:
9    0000-7fff: 32k window on 128k of sample RAM
10    8000-bfff: main RAM
11    c000-dfff: optional expansion RAM
12    e100-e101: 6850 UART (for MIDI)
13    e200-e2ff: 6522 VIA
14    e408-e40f: filter cut-off frequency
15    e410-e417: filter resonance
16    e418-e41f: multiplexer address pre-set
17    e800-e803: WD1770 FDC
18    ec00-ecef: ES5503 "DOC" sound chip
19    f000-ffff: boot ROM
20
21LED patterns
22
23     80
24    _____
25   |     | 40
2604 | 02  |
27    _____
28   |     | 20
2908 |     |
30    _____
31     10
32
33PORT A: 111xyzzz
34
35
36***************************************************************************/
37
38#define ADDRESS_MAP_MODERN
39
40#include "emu.h"
41#include "cpu/m6809/m6809.h"
42#include "machine/6850acia.h"
43#include "machine/6522via.h"
44#include "machine/wd17xx.h"
45#include "imagedev/flopdrv.h"
46#include "formats/basicdsk.h"
47#include "sound/es5503.h"
48
49class mirage_state : public driver_device
50{
51public:
52    mirage_state(const machine_config &mconfig, device_type type, const char *tag)
53    : driver_device(mconfig, type, tag) { }
54
55   virtual void machine_reset();
56
57    int last_sndram_bank;
58};
59
60
61static void mirage_doc_irq(device_t *device, int state)
62{
63}
64
65static UINT8 mirage_adc_read(device_t *device)
66{
67   return 0x80;
68}
69
70static VIDEO_START( mirage )
71{
72}
73
74static SCREEN_UPDATE( mirage )
75{
76   return 0;
77}
78
79void mirage_state::machine_reset()
80{
81   last_sndram_bank = 0;
82   memory_set_bankptr(machine(), "sndbank", machine().region("es5503")->base() );
83}
84
85static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state )
86   AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("sndbank")   // 32k window on 128k of wave RAM
87   AM_RANGE(0x8000, 0xbfff) AM_RAM         // main RAM
88   AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_read, control_write)
89   AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_read, data_write)
90   AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write)
91   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_status_r,wd17xx_command_w)
92   AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_track_r,wd17xx_track_w)
93   AM_RANGE(0xe802, 0xe802) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_sector_r,wd17xx_sector_w)
94   AM_RANGE(0xe803, 0xe803) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_data_r,wd17xx_data_w)
95//  AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write)
96   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0)
97ADDRESS_MAP_END
98
99// port A: front panel
100static WRITE8_DEVICE_HANDLER( mirage_via_write_porta )
101{
102//  printf("PORT A: %02x\n", data);
103}
104
105// port B:
106//  bit 7: OUT UART clock
107//  bit 4: OUT disk enable (motor on?)
108//  bit 3: OUT sample/play
109//  bit 2: OUT mic line/in
110//  bit 1: OUT upper/lower bank (64k halves)
111//  bit 0: OUT bank 0/bank 1 (32k halves)
112
113static WRITE8_DEVICE_HANDLER( mirage_via_write_portb )
114{
115   int bank = 0;
116    mirage_state *mirage = device->machine().driver_data<mirage_state>();
117
118   // handle sound RAM bank switching
119   bank = (data & 2) ? (64*1024) : 0;
120   bank += (data & 1) ? (32*1024) : 0;
121   if (bank != mirage->last_sndram_bank)
122   {
123      mirage->last_sndram_bank = bank;
124      memory_set_bankptr(device->machine(), "sndbank", device->machine().region("es5503")->base() + bank);
125   }
126}
127
128// port A: front panel
129static READ8_DEVICE_HANDLER( mirage_via_read_porta )
130{
131   return 0;
132}
133
134// port B:
135//  bit 6: IN FDC disk loaded
136//  bit 5: IN 5503 sync (?)
137static READ8_DEVICE_HANDLER( mirage_via_read_portb )
138{
139   return 0x60;
140}
141
142// external sync pulse
143static READ8_DEVICE_HANDLER( mirage_via_read_ca1 )
144{
145   return 0;
146}
147
148// keyscan
149static READ8_DEVICE_HANDLER( mirage_via_read_cb1 )
150{
151   return 0;
152}
153
154// keyscan
155static READ8_DEVICE_HANDLER( mirage_via_read_ca2 )
156{
157   return 0;
158}
159
160
161// keyscan
162static READ8_DEVICE_HANDLER( mirage_via_read_cb2 )
163{
164   return 0;
165}
166
167const via6522_interface mirage_via =
168{
169   DEVCB_HANDLER(mirage_via_read_porta),
170   DEVCB_HANDLER(mirage_via_read_portb),
171   DEVCB_HANDLER(mirage_via_read_ca1),
172   DEVCB_HANDLER(mirage_via_read_cb1),
173   DEVCB_HANDLER(mirage_via_read_ca2),
174   DEVCB_HANDLER(mirage_via_read_cb2),
175   DEVCB_HANDLER(mirage_via_write_porta),
176   DEVCB_HANDLER(mirage_via_write_portb),
177   DEVCB_NULL,
178   DEVCB_NULL,
179   DEVCB_NULL,
180   DEVCB_NULL,
181   DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE)
182};
183
184static ACIA6850_INTERFACE( mirage_acia6850_interface )
185{
186   0,            // tx clock
187   0,            // rx clock
188   DEVCB_NULL,         // rx in
189   DEVCB_NULL,         // rx out
190   DEVCB_NULL,         // cts in
191   DEVCB_NULL,         // rts out
192   DEVCB_NULL,         // dcd in
193   DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
194};
195
196static LEGACY_FLOPPY_OPTIONS_START(mirage)
197   LEGACY_FLOPPY_OPTION(mirage, "img", "Mirage disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
198      HEADS([1])
199      TRACKS([80])
200      SECTORS([5])
201      SECTOR_LENGTH([512])
202      FIRST_SECTOR_ID([0]))
203LEGACY_FLOPPY_OPTIONS_END
204
205static const floppy_interface mirage_floppy_interface =
206{
207   DEVCB_NULL,
208   DEVCB_NULL,
209   DEVCB_NULL,
210   DEVCB_NULL,
211   DEVCB_NULL,
212   FLOPPY_STANDARD_3_5_DSDD,
213   LEGACY_FLOPPY_OPTIONS_NAME(mirage),
214   NULL,
215   NULL
216};
217
218const wd17xx_interface mirage_wd17xx_interface =
219{
220   DEVCB_NULL,         // dden
221   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),   // intrq
222   DEVCB_NULL,         // drq
223   {FLOPPY_0, NULL, NULL, NULL}
224};
225
226static MACHINE_CONFIG_START( mirage, mirage_state )
227   MCFG_CPU_ADD("maincpu", M6809E, 4000000)
228   MCFG_CPU_PROGRAM_MAP(mirage_map)
229
230   MCFG_SCREEN_ADD("screen", RASTER)
231   MCFG_SCREEN_REFRESH_RATE(60)
232   MCFG_VIDEO_START(mirage)
233   MCFG_SCREEN_UPDATE(mirage)
234   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
235   MCFG_SCREEN_SIZE(320, 240)
236   MCFG_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
237
238   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
239   MCFG_ES5503_ADD("es5503", 7000000, mirage_doc_irq, mirage_adc_read)
240   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
241   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
242
243   MCFG_VIA6522_ADD("via6522", 1000000, mirage_via)
244
245   MCFG_ACIA6850_ADD("acia6850", mirage_acia6850_interface)
246
247   MCFG_WD1770_ADD("wd177x", mirage_wd17xx_interface )
248   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mirage_floppy_interface)
249MACHINE_CONFIG_END
250
251static INPUT_PORTS_START( mirage )
252INPUT_PORTS_END
253
254ROM_START( mirage )
255   ROM_REGION(0x1000, "osrom", 0)
256   ROM_LOAD( "mirage.bin",   0x0000, 0x1000, CRC(9fc7553c) SHA1(ec6ea5613eeafd21d8f3a7431a35a6ff16eed56d) )
257
258   ROM_REGION(0x20000, "es5503", ROMREGION_ERASE)
259ROM_END
260
261CONS( 1984, mirage, 0, 0, mirage, mirage, 0, "Ensoniq", "Mirage", GAME_NOT_WORKING )
262
src/mess/drivers/sms.c
r13301r13302
1/******************************************************************************
2 Contributors:
3
4    Marat Fayzullin (MG source)
5    Charles MacDonald
6    Mathis Rosenhauer
7    Brad Oliver
8    Michael Luong
9
10 To do:
11
12 - SIO interface for Game Gear (needs netplay, I guess)
13 - SMS lightgun support
14 - LCD persistence emulation for GG
15 - SMS 3D glass support
16
17 The Game Gear SIO hardware is not emulated but has some
18 placeholders in 'machine/sms.c'
19
20 Changes:
21    Apr 02 - Added raster palette effects for SMS & GG (ML)
22                 - Added sprite collision (ML)
23                 - Added zoomed sprites (ML)
24    May 02 - Fixed paging bug (ML)
25                 - Fixed sprite and tile priority bug (ML)
26                 - Fixed bug #66 (ML)
27                 - Fixed bug #78 (ML)
28                 - try to implement LCD persistence emulation for GG (ML)
29    Jun 10, 02 - Added bios emulation (ML)
30    Jun 12, 02 - Added PAL & NTSC systems (ML)
31    Jun 25, 02 - Added border emulation (ML)
32    Jun 27, 02 - Version bits for Game Gear (bits 6 of port 00) (ML)
33    Nov-Dec, 05 - Numerous cleanups, fixes, updates (WP)
34    Mar, 07 - More cleanups, fixes, mapper additions, etc (WP)
35
36SMS Store Unit memory map for the second CPU:
37
380000-3FFF - BIOS
394000-47FF - RAM
408000      - System Control Register (R/W)
41            Reading:
42            bit7      - ready (0 = ready, 1 = not ready)
43            bit6-bit5 - unknown
44            bit4-bit3 - timer selection bit switches
45            bit2-bit0 - unknown
46            Writing:
47            bit7-bit4 - unknown, maybe led of selected game to set?
48            bit3      - unknown, 1 seems to be written all the time
49            bit2      - unknown, 1 seems to be written all the time
50            bit1      - reset signal for sms cpu, 0 = reset low, 1 = reset high
51            bit0      - which cpu receives interrupt signals, 0 = sms cpu, 1 = controlling cpu
52C000      - Card/Cartridge selction register (W)
53            bit7-bit4 - slot to select
54            bit3      - slot type (0 = cartridge, 1 = card ?)
55            bit2-bit0 - unknown
56C400      - ???? (used once)
57D800      - Selection buttons #1, 1-8 (R)
58DC00      - Selection buttons #2, 9-16 (R)
59
60 ******************************************************************************/
61
62#include "emu.h"
63#include "cpu/z80/z80.h"
64#include "sound/sn76496.h"
65#include "sound/2413intf.h"
66#include "includes/sms.h"
67#include "video/smsvdp.h"
68#include "imagedev/cartslot.h"
69
70#include "sms1.lh"
71
72#define MASTER_CLOCK_PAL   53203400   /* This might be a tiny bit too low */
73
74
75static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8 )
76   AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1")               /* First 0x0400 part always points to first page */
77   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK("bank2")               /* switchable rom bank */
78   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3")               /* switchable rom bank */
79   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4")               /* switchable rom bank */
80   AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w)   /* ROM bank / on-cart RAM */
81   AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w)   /* ROM bank / on-cart RAM */
82   AM_RANGE(0xc000, 0xdff7) AM_MIRROR(0x2000) AM_RAM         /* RAM (mirror at 0xE000) */
83   AM_RANGE(0xdff8, 0xdfff) AM_RAM                  /* RAM "underneath" frame registers */
84   AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w)   /* 3-D glasses */
85   AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w)   /* Bankswitch control */
86ADDRESS_MAP_END
87
88static ADDRESS_MAP_START( sms_mem, AS_PROGRAM, 8 )
89   AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1")               /* First 0x0400 part always points to first page */
90   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK("bank2")               /* switchable rom bank */
91   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3")               /* switchable rom bank */
92   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4")               /* switchable rom bank */
93   AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w)   /* ROM bank / on-cart RAM */
94   AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w)   /* ROM bank / on-cart RAM */
95   AM_RANGE(0xc000, 0xdffb) AM_MIRROR(0x2000) AM_RAM         /* RAM (mirror at 0xE000) */
96   AM_RANGE(0xdffc, 0xdfff) AM_RAM                  /* RAM "underneath" frame registers */
97   AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w)   /* Bankswitch control */
98ADDRESS_MAP_END
99
100static ADDRESS_MAP_START( sms_store_mem, AS_PROGRAM, 8 )
101   AM_RANGE(0x0000, 0x3fff) AM_ROM                  /* BIOS */
102   AM_RANGE(0x4000, 0x47ff) AM_RAM                  /* RAM */
103   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank10")               /* Cartridge/card peek area */
104   AM_RANGE(0x8000, 0x8000) AM_READWRITE(sms_store_control_r, sms_store_control_w)   /* Control */
105   AM_RANGE(0xc000, 0xc000) AM_READWRITE(sms_store_cart_select_r, sms_store_cart_select_w)    /* cartridge/card slot selector */
106   AM_RANGE(0xd800, 0xd800) AM_READ(sms_store_select1)         /* Game selector port #1 */
107   AM_RANGE(0xdc00, 0xdc00) AM_READ(sms_store_select2)         /* Game selector port #2 */
108ADDRESS_MAP_END
109
110static ADDRESS_MAP_START( sms_io, AS_IO, 8 )
111   ADDRESS_MAP_GLOBAL_MASK(0xff)
112   ADDRESS_MAP_UNMAP_HIGH
113   AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w)
114   AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_io_control_w)
115   AM_RANGE(0x40, 0x7f)                 AM_READ(sms_count_r)
116   AM_RANGE(0x40, 0x7f)                 AM_DEVWRITE("segapsg", sn76496_w)
117   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_data_r, sms_vdp_data_w)
118   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_ctrl_r, sms_vdp_ctrl_w)
119   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1e) AM_READ(sms_input_port_0_r)
120   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x1e) AM_READ(sms_input_port_1_r)
121   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0e) AM_READ(sms_input_port_0_r)
122   AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x0e) AM_READ(sms_input_port_1_r)
123   AM_RANGE(0xf0, 0xf0)                 AM_READWRITE(sms_input_port_0_r, sms_ym2413_register_port_0_w)
124   AM_RANGE(0xf1, 0xf1)                 AM_READWRITE(sms_input_port_1_r, sms_ym2413_data_port_0_w)
125   AM_RANGE(0xf2, 0xf2)                 AM_READWRITE(sms_fm_detect_r, sms_fm_detect_w)
126   AM_RANGE(0xf3, 0xf3)                 AM_READ(sms_input_port_1_r)
127   AM_RANGE(0xf4, 0xf4) AM_MIRROR(0x02) AM_READ(sms_input_port_0_r)
128   AM_RANGE(0xf5, 0xf5) AM_MIRROR(0x02) AM_READ(sms_input_port_1_r)
129   AM_RANGE(0xf8, 0xf8) AM_MIRROR(0x06) AM_READ(sms_input_port_0_r)
130   AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x06) AM_READ(sms_input_port_1_r)
131ADDRESS_MAP_END
132
133static ADDRESS_MAP_START( gg_io, AS_IO, 8 )
134   ADDRESS_MAP_GLOBAL_MASK(0xff)
135   ADDRESS_MAP_UNMAP_HIGH
136   AM_RANGE(0x00, 0x00)                 AM_READ(gg_input_port_2_r)
137   AM_RANGE(0x01, 0x05)                 AM_READWRITE(gg_sio_r, gg_sio_w)
138   AM_RANGE(0x06, 0x06)                 AM_DEVWRITE("gamegear", sn76496_stereo_w)
139   AM_RANGE(0x07, 0x07)                 AM_WRITE(sms_io_control_w)
140   AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w)
141   AM_RANGE(0x09, 0x09) AM_MIRROR(0x06) AM_WRITE(sms_io_control_w)
142   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w)
143   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_WRITE(sms_io_control_w)
144   AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w)
145   AM_RANGE(0x21, 0x21) AM_MIRROR(0x1e) AM_WRITE(sms_io_control_w)
146   AM_RANGE(0x40, 0x7f)                 AM_READ(sms_count_r)
147   AM_RANGE(0x40, 0x7f)                 AM_DEVWRITE("gamegear", sn76496_w)
148   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_data_r, sms_vdp_data_w)
149   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_ctrl_r, sms_vdp_ctrl_w)
150   AM_RANGE(0xc0, 0xc0)                 AM_READ_PORT("PORT_DC")
151   AM_RANGE(0xc1, 0xc1)                 AM_READ_PORT("PORT_DD")
152   AM_RANGE(0xdc, 0xdc)                 AM_READ_PORT("PORT_DC")
153   AM_RANGE(0xdd, 0xdd)                 AM_READ_PORT("PORT_DD")
154ADDRESS_MAP_END
155
156
157static INPUT_PORTS_START( sms )
158   PORT_START("PORT_DC")
159   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
160   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
161   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
162   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
163   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
164   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
165   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
166   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
167
168   PORT_START("PORT_DD")
169   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
170   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
171   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
172   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
173   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* Software Reset bit */
174   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
175   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* Port A TH */
176   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* Port B TH */
177
178   PORT_START("PAUSE")
179   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
180   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME(DEF_STR(Pause))
181
182   PORT_START("LPHASER0")   /* Light phaser X - player 1 */
183   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CHANGED(lgun1_changed, NULL) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
184
185   PORT_START("LPHASER1")   /* Light phaser Y - player 1 */
186   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CHANGED(lgun1_changed, NULL) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
187
188   PORT_START("LPHASER2")   /* Light phaser X - player 2 */
189   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CHANGED(lgun2_changed, NULL) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
190
191   PORT_START("LPHASER3")   /* Light phaser Y - player 2 */
192   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(2) PORT_CHANGED(lgun2_changed, NULL) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
193
194   PORT_START("RFU")   /* Rapid Fire Unit */
195   PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit - Player 1" )
196   PORT_CONFSETTING(   0x00, DEF_STR( Off ) )
197   PORT_CONFSETTING(   0x01, "Button A" )
198   PORT_CONFSETTING(   0x02, "Button B" )
199   PORT_CONFSETTING(   0x03, "Button A + B" )
200   PORT_CONFNAME( 0x0c, 0x00, "Rapid Fire Unit - Player 2" )
201   PORT_CONFSETTING(   0x00, DEF_STR( Off ) )
202   PORT_CONFSETTING(   0x04, "Button A" )
203   PORT_CONFSETTING(   0x08, "Button B" )
204   PORT_CONFSETTING(   0x0c, "Button A + B" )
205
206   PORT_START("PADDLE0")   /* Paddle player 1 */
207   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x02)
208
209   PORT_START("PADDLE1")   /* Paddle player 2 */
210   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x20)
211
212   PORT_START("CTRLIPT")   /* Light Phaser and Paddle Control buttons */
213   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
214   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x02)
215   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
216   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
217   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
218   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x20)
219   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
220   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
221
222   PORT_START("CTRLSEL")   /* Controller selection */
223   PORT_CONFNAME( 0x0f, 0x00, "Player 1 Controller" )
224   PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) )
225   PORT_CONFSETTING( 0x01, "Light Phaser" )
226   PORT_CONFSETTING( 0x02, "Sega Paddle Control" )
227   PORT_CONFSETTING( 0x04, "Sega Sports Pad" )
228   PORT_CONFNAME( 0xf0, 0x00, "Player 2 Controller" )
229   PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) )
230   PORT_CONFSETTING( 0x10, "Light Phaser" )
231   PORT_CONFSETTING( 0x20, "Sega Paddle Control" )
232   PORT_CONFSETTING( 0x40, "Sega Sports Pad" )
233
234   PORT_START("SPORT0")   /* Player 1 Sports Pad X axis */
235   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
236
237   PORT_START("SPORT1")   /* Player 1 Sports Pad Y axis */
238   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
239
240   PORT_START("SPORT2")   /* Player 2 Sports Pad X axis */
241   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
242
243   PORT_START("SPORT3")   /* Player 2 Sports Pad Y axis */
244   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
245INPUT_PORTS_END
246
247static INPUT_PORTS_START( sms1 )
248   PORT_INCLUDE( sms )
249
250   PORT_START("RESET")
251   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Reset Button")
252
253   PORT_START("SEGASCOPE")
254   PORT_CONFNAME( 0x01, 0x00, "SegaScope (3-D Glasses)" )
255   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
256   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
257
258   PORT_START("SSCOPE_BINOCULAR")
259   PORT_CONFNAME( 0x03, 0x00, "SegaScope - Binocular Hack" ) PORT_CONDITION("SEGASCOPE", 0x01, PORTCOND_EQUALS, 0x01)
260   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
261   PORT_CONFSETTING( 0x01, "Left Lens" )
262   PORT_CONFSETTING( 0x02, "Right Lens" )
263   PORT_CONFSETTING( 0x03, "Both Lens" )
264   PORT_BIT( 0x03, 0x00, IPT_UNUSED ) PORT_CONDITION("SEGASCOPE", 0x01, PORTCOND_EQUALS, 0x00)
265INPUT_PORTS_END
266
267static INPUT_PORTS_START( smsj )
268   PORT_INCLUDE( sms1 )
269
270   PORT_START("TVDRAW")
271   PORT_CONFNAME( 0x01, 0x00, "Terebi Oekaki Graphics Tablet" )
272   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
273   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
274
275   PORT_START("TVDRAW_X")
276   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Tablet - X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
277   PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
278
279   PORT_START("TVDRAW_Y")
280   PORT_BIT( 0xff, 0x60, IPT_LIGHTGUN_Y ) PORT_NAME("Tablet - Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 191) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
281   PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
282
283   PORT_START("TVDRAW_PEN")
284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Tablet - Pen") PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
285INPUT_PORTS_END
286
287static INPUT_PORTS_START( gg )
288   PORT_START("PORT_DC")
289   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
290   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
291   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
292   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
295   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
296
297   PORT_START("PORT_DD")
298   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
299
300   PORT_START("START")
301   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
302   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */
303INPUT_PORTS_END
304
305static PALETTE_INIT( sms )
306{
307   int i;
308   for (i = 0; i < 64; i++)
309   {
310      int r = i & 0x03;
311      int g = (i & 0x0c) >> 2;
312      int b = (i & 0x30) >> 4;
313      palette_set_color_rgb(machine, i, r << 6, g << 6, b << 6);
314   }
315   /* TMS9918 palette */
316   palette_set_color_rgb(machine, 64+ 0,   0,   0,   0);
317   palette_set_color_rgb(machine, 64+ 1,   0,   0,   0);
318   palette_set_color_rgb(machine, 64+ 2,  33, 200,  66);
319   palette_set_color_rgb(machine, 64+ 3,  94, 220, 120);
320   palette_set_color_rgb(machine, 64+ 4,  84,  85, 237);
321   palette_set_color_rgb(machine, 64+ 5, 125, 118, 252);
322   palette_set_color_rgb(machine, 64+ 6, 212,  82,  77);
323   palette_set_color_rgb(machine, 64+ 7,  66, 235, 245);
324   palette_set_color_rgb(machine, 64+ 8, 252,  85,  84);
325   palette_set_color_rgb(machine, 64+ 9, 255, 121, 120);
326   palette_set_color_rgb(machine, 64+10, 212, 193,  84);
327   palette_set_color_rgb(machine, 64+11, 230, 206, 128);
328   palette_set_color_rgb(machine, 64+12,  33, 176,  59);
329   palette_set_color_rgb(machine, 64+13, 201,  91, 186);
330   palette_set_color_rgb(machine, 64+14, 204, 204, 204);
331   palette_set_color_rgb(machine, 64+15, 255, 255, 255);
332}
333
334static PALETTE_INIT( gamegear )
335{
336   int i;
337   for (i = 0; i < 4096; i++)
338   {
339      int r = i & 0x000f;
340      int g = (i & 0x00f0) >> 4;
341      int b = (i & 0x0f00) >> 8;
342      palette_set_color_rgb(machine, i, r << 4, g << 4, b << 4);
343   }
344}
345
346
347
348static void sms_int_callback( running_machine &machine, int state )
349{
350   cputag_set_input_line(machine, "maincpu", 0, state);
351}
352
353static const smsvdp_interface _315_5124_intf =
354{
355   MODEL_315_5124,
356   sms_int_callback,
357   sms_pause_callback
358};
359
360static const smsvdp_interface _315_5246_intf =
361{
362   MODEL_315_5246,
363   sms_int_callback,
364   sms_pause_callback
365};
366
367static const smsvdp_interface _315_5378_intf =
368{
369   MODEL_315_5378,
370   sms_int_callback,
371   sms_pause_callback
372};
373
374static const smsvdp_interface sms_store_intf =
375{
376   MODEL_315_5124,
377   sms_store_int_callback,
378   sms_pause_callback
379};
380
381static MACHINE_CONFIG_FRAGMENT( sms_cartslot )
382   MCFG_CARTSLOT_ADD("cart1")
383   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin")
384   MCFG_CARTSLOT_NOT_MANDATORY
385   MCFG_CARTSLOT_INTERFACE("sms_cart")
386   MCFG_CARTSLOT_START(sms_cart)
387   MCFG_CARTSLOT_LOAD(sms_cart)
388
389   MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
390MACHINE_CONFIG_END
391
392static MACHINE_CONFIG_FRAGMENT( gg_cartslot )
393   MCFG_CARTSLOT_ADD("cart1")
394   MCFG_CARTSLOT_EXTENSION_LIST("gg,bin")
395   MCFG_CARTSLOT_MANDATORY
396   MCFG_CARTSLOT_INTERFACE("gamegear_cart")
397   MCFG_CARTSLOT_START(sms_cart)
398   MCFG_CARTSLOT_LOAD(sms_cart)
399
400   MCFG_SOFTWARE_LIST_ADD("cart_list","gamegear")
401MACHINE_CONFIG_END
402
403static MACHINE_CONFIG_START( sms_ntsc_base, sms_state )
404   /* basic machine hardware */
405   MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15)
406   MCFG_CPU_PROGRAM_MAP(sms_mem)
407   MCFG_CPU_IO_MAP(sms_io)
408
409   MCFG_QUANTUM_TIME(attotime::from_hz(60))
410
411   MCFG_MACHINE_START(sms)
412   MCFG_MACHINE_RESET(sms)
413
414   /* sound hardware */
415   MCFG_SPEAKER_STANDARD_MONO("mono")
416   MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_53_693175MHz/15)
417   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
418
419   MCFG_FRAGMENT_ADD( sms_cartslot )
420MACHINE_CONFIG_END
421
422static MACHINE_CONFIG_DERIVED( sms2_ntsc, sms_ntsc_base )
423   /* video hardware */
424   MCFG_SCREEN_ADD("screen", RASTER)
425   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
426   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
427   MCFG_SCREEN_UPDATE(sms)
428
429   MCFG_PALETTE_LENGTH(64+16)
430   MCFG_PALETTE_INIT(sms)
431
432   MCFG_SMSVDP_ADD("sms_vdp", _315_5246_intf)
433MACHINE_CONFIG_END
434
435static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base )
436
437   MCFG_CPU_MODIFY("maincpu")
438   MCFG_CPU_PROGRAM_MAP(sms1_mem)   // This adds the SegaScope handlers for 3-D glasses
439   MCFG_CPU_IO_MAP(sms_io)
440
441   /* video hardware */
442   MCFG_SCREEN_ADD("screen", RASTER)
443   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
444   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
445   MCFG_SCREEN_UPDATE(sms1)
446
447   MCFG_SCREEN_ADD("left_lcd", LCD)   // This is needed for SegaScope Left LCD
448   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
449   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
450   MCFG_SCREEN_UPDATE(sms1)
451
452   MCFG_SCREEN_ADD("right_lcd", LCD)   // This is needed for SegaScope Right LCD
453   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
454   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
455   MCFG_SCREEN_UPDATE(sms1)
456
457   MCFG_DEFAULT_LAYOUT(layout_sms1)
458
459   MCFG_PALETTE_LENGTH(64+16)
460   MCFG_PALETTE_INIT(sms)
461
462   MCFG_VIDEO_START(sms1)
463
464   MCFG_SMSVDP_ADD("sms_vdp", _315_5124_intf)
465MACHINE_CONFIG_END
466
467#define MCFG_SMSSDISP_CARTSLOT_ADD(_tag) \
468   MCFG_CARTSLOT_ADD(_tag) \
469   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin") \
470   MCFG_CARTSLOT_NOT_MANDATORY \
471   MCFG_CARTSLOT_INTERFACE("sms_cart") \
472   MCFG_CARTSLOT_START(sms_cart) \
473   MCFG_CARTSLOT_LOAD(sms_cart)
474
475static MACHINE_CONFIG_DERIVED( sms_sdisp, sms2_ntsc )
476
477   MCFG_DEVICE_REMOVE("sms_vdp")
478   MCFG_SMSVDP_ADD("sms_vdp", sms_store_intf)
479
480   MCFG_CPU_ADD("control", Z80, XTAL_53_693175MHz/15)
481   MCFG_CPU_PROGRAM_MAP(sms_store_mem)
482   /* Both CPUs seem to communicate with the VDP etc? */
483   MCFG_CPU_IO_MAP(sms_io)
484
485   MCFG_CARTSLOT_MODIFY("cart1")
486   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin")
487   MCFG_CARTSLOT_MANDATORY
488   MCFG_CARTSLOT_INTERFACE("sms_cart")
489   MCFG_CARTSLOT_START(sms_cart)
490   MCFG_CARTSLOT_LOAD(sms_cart)
491
492   MCFG_SMSSDISP_CARTSLOT_ADD("cart2")
493   MCFG_SMSSDISP_CARTSLOT_ADD("cart3")
494   MCFG_SMSSDISP_CARTSLOT_ADD("cart4")
495   MCFG_SMSSDISP_CARTSLOT_ADD("cart5")
496   MCFG_SMSSDISP_CARTSLOT_ADD("cart6")
497   MCFG_SMSSDISP_CARTSLOT_ADD("cart7")
498   MCFG_SMSSDISP_CARTSLOT_ADD("cart8")
499   MCFG_SMSSDISP_CARTSLOT_ADD("cart9")
500   MCFG_SMSSDISP_CARTSLOT_ADD("cart10")
501   MCFG_SMSSDISP_CARTSLOT_ADD("cart11")
502   MCFG_SMSSDISP_CARTSLOT_ADD("cart12")
503   MCFG_SMSSDISP_CARTSLOT_ADD("cart13")
504   MCFG_SMSSDISP_CARTSLOT_ADD("cart14")
505   MCFG_SMSSDISP_CARTSLOT_ADD("cart15")
506   MCFG_SMSSDISP_CARTSLOT_ADD("cart16")
507MACHINE_CONFIG_END
508
509static MACHINE_CONFIG_START( sms_pal_base, sms_state )
510   /* basic machine hardware */
511   MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15)
512   MCFG_CPU_PROGRAM_MAP(sms_mem)
513   MCFG_CPU_IO_MAP(sms_io)
514
515   MCFG_QUANTUM_TIME(attotime::from_hz(60))
516
517   MCFG_MACHINE_START(sms)
518   MCFG_MACHINE_RESET(sms)
519
520   /* sound hardware */
521   MCFG_SPEAKER_STANDARD_MONO("mono")
522   MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15)
523   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
524
525   MCFG_FRAGMENT_ADD( sms_cartslot )
526MACHINE_CONFIG_END
527
528static MACHINE_CONFIG_DERIVED( sms2_pal, sms_pal_base )
529
530   /* video hardware */
531   MCFG_SCREEN_ADD("screen", RASTER)
532   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
533   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
534   MCFG_SCREEN_UPDATE(sms)
535
536   MCFG_PALETTE_LENGTH(64+16)
537   MCFG_PALETTE_INIT(sms)
538
539   MCFG_SMSVDP_ADD("sms_vdp", _315_5246_intf)
540MACHINE_CONFIG_END
541
542static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base )
543
544   MCFG_CPU_MODIFY("maincpu")
545   MCFG_CPU_PROGRAM_MAP(sms1_mem)   // This adds the SegaScope handlers for 3-D glasses
546   MCFG_CPU_IO_MAP(sms_io)
547
548   /* video hardware */
549   MCFG_SCREEN_ADD("screen", RASTER)
550   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
551   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
552   MCFG_SCREEN_UPDATE(sms1)
553
554   MCFG_SCREEN_ADD("left_lcd", LCD)   // This is needed for SegaScope Left LCD
555   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
556   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
557   MCFG_SCREEN_UPDATE(sms1)
558
559   MCFG_SCREEN_ADD("right_lcd", LCD)   // This is needed for SegaScope Right LCD
560   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
561   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
562   MCFG_SCREEN_UPDATE(sms1)
563
564   MCFG_PALETTE_LENGTH(64+16)
565   MCFG_PALETTE_INIT(sms)
566
567   MCFG_DEFAULT_LAYOUT(layout_sms1)
568
569   MCFG_SMSVDP_ADD("sms_vdp", _315_5124_intf)
570MACHINE_CONFIG_END
571
572static MACHINE_CONFIG_DERIVED( sms_fm, sms1_ntsc )
573
574   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15)
575   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
576MACHINE_CONFIG_END
577
578static MACHINE_CONFIG_DERIVED( sg1000m3, sms_fm )
579
580   MCFG_CARTSLOT_MODIFY("cart1")
581   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin,sg")
582   MCFG_CARTSLOT_MANDATORY
583   MCFG_CARTSLOT_START(sms_cart)
584   MCFG_CARTSLOT_LOAD(sms_cart)
585MACHINE_CONFIG_END
586
587static MACHINE_CONFIG_DERIVED( sms2_fm, sms2_ntsc )
588
589   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15)
590   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
591MACHINE_CONFIG_END
592
593static MACHINE_CONFIG_START( gamegear, sms_state )
594   /* basic machine hardware */
595   MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15)
596   MCFG_CPU_PROGRAM_MAP(sms_mem)
597   MCFG_CPU_IO_MAP(gg_io)
598
599   MCFG_QUANTUM_TIME(attotime::from_hz(60))
600
601   MCFG_MACHINE_START(sms)
602   MCFG_MACHINE_RESET(sms)
603
604   /* video hardware */
605   MCFG_SCREEN_ADD("screen", LCD)
606   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
607   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS + 6*8, LBORDER_START + LBORDER_X_PIXELS + 26*8, NTSC_Y_PIXELS, TBORDER_START + NTSC_192_TBORDER_Y_PIXELS + 3*8, TBORDER_START + NTSC_192_TBORDER_Y_PIXELS + 21*8 )
608   MCFG_SCREEN_UPDATE(gamegear)
609
610   MCFG_PALETTE_LENGTH(4096)
611   MCFG_PALETTE_INIT(gamegear)
612
613   MCFG_VIDEO_START(gamegear)
614
615   MCFG_SMSVDP_ADD("sms_vdp", _315_5378_intf)
616
617   /* sound hardware */
618   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
619   MCFG_SOUND_ADD("gamegear", GAMEGEAR, XTAL_53_693175MHz/15)
620   MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
621   MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)
622
623   /* cartridge */
624   MCFG_FRAGMENT_ADD( gg_cartslot )
625MACHINE_CONFIG_END
626
627
628ROM_START(sms1)
629   ROM_REGION(0x4000, "maincpu", 0)
630   ROM_FILL(0x0000, 0x4000, 0xff)
631
632   ROM_REGION(0x20000, "user1", 0)
633   ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" )
634   ROMX_LOAD("bios13fx.rom", 0x0000, 0x2000, CRC(0072ED54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1))
635   ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
636   ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91E93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2))
637   ROM_SYSTEM_BIOS( 2, "hangon", "US/European BIOS v3.4 with Hang On (1988)" )
638   ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8EDF7AC6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3))
639   ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" )
640   ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(E79BB689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4))
641   ROM_SYSTEM_BIOS( 4, "proto", "US Master System Prototype BIOS" )
642   ROMX_LOAD("m404prot.rom", 0x0000, 0x2000, CRC(1a15dfcc) SHA1(4a06c8e66261611dce0305217c42138b71331701), ROM_BIOS(5))
643ROM_END
644
645ROM_START(sms)
646   ROM_REGION(0x4000, "maincpu", 0)
647   ROM_FILL(0x0000, 0x4000, 0xff)
648
649   ROM_REGION(0x20000, "user1", 0)
650   ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
651   ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(CF4A09EA) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */
652ROM_END
653
654ROM_START(smssdisp)
655   ROM_REGION(0x4000, "maincpu", 0)
656   ROM_FILL(0x0000, 0x4000, 0x00)
657
658   ROM_REGION(0x4000, "user1", 0)
659   ROM_FILL(0x0000, 0x4000, 0xff)
660
661   ROM_REGION(0x4000, "control", 0)
662   ROM_LOAD("smssdisp.rom", 0x0000, 0x4000, CRC(ee2c29ba) SHA1(fc465122134d95363112eb51b9ab71db3576cefd))
663ROM_END
664
665ROM_START(sms1pal)
666   ROM_REGION(0x4000, "maincpu", 0)
667   ROM_FILL(0x0000, 0x4000, 0xff)
668
669   ROM_REGION(0x20000, "user1", 0)
670   ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" )
671   ROMX_LOAD("bios13fx.rom", 0x0000, 0x2000, CRC(0072ED54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1))
672   ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
673   ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91E93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2))
674   ROM_SYSTEM_BIOS( 2, "hangon", "Sega Master System - US/European BIOS v3.4 with Hang On (1988)" )
675   ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8EDF7AC6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3))
676   ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" )
677   ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(E79BB689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4))
678ROM_END
679
680ROM_START(smspal)
681   ROM_REGION(0x4000, "maincpu", 0)
682   ROM_FILL(0x0000, 0x4000, 0xff)
683
684   ROM_REGION(0x40000, "user1", 0)
685   ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) /* PCB Label: SEGA // IC BD M4Jr. PAL" Master System II with 314-5246 (ZIP) VDP and 314-5237 (DIP48) IO */
686   ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(CF4A09EA) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */
687   ROM_SYSTEM_BIOS( 1, "sonic", "European/Brazilian BIOS with Sonic the Hedgehog (1991)" )
688   ROMX_LOAD("sonbios.rom", 0x0000, 0x40000, CRC(81C3476B) SHA1(6aca0e3dffe461ba1cb11a86cd4caf5b97e1b8df), ROM_BIOS(2))
689ROM_END
690
691ROM_START(sg1000m3)
692   ROM_REGION(0x4000, "maincpu", 0)
693   ROM_FILL(0x0000, 0x4000, 0x00)
694ROM_END
695
696ROM_START(smsj) /* PCB Label: "SEGA(R) IC BOARD M4J MAIN // 837-6418"; has "YM2413 // 78 04 71 G" at IC10; Back of pcb has traces marked "171-5541 (C)SEGA 1987 MADE IN JAPAN"
697    see http://www.smspower.org/Development/JapaneseSMS837-6418 */
698   ROM_REGION(0x4000, "maincpu", 0)
699   ROM_FILL(0x0000, 0x4000, 0xff)
700
701   ROM_REGION(0x4000, "user1", 0)
702   ROM_SYSTEM_BIOS( 0, "jbios21", "Japanese BIOS v2.1 (1987)" )
703   ROMX_LOAD("mpr-11124.ic2", 0x0000, 0x2000, CRC(48D44A13) SHA1(a8c1b39a2e41137835eda6a5de6d46dd9fadbaf2), ROM_BIOS(1)) /* "SONY 7J06 // MPR-11124 // JAPAN 021" @ IC2 */
704ROM_END
705
706ROM_START(sms2kr)
707   ROM_REGION(0x4000, "maincpu", 0)
708   ROM_FILL(0x0000, 0x4000, 0xff)
709
710   ROM_REGION(0x20000, "user1", 0)
711   ROM_SYSTEM_BIOS( 0, "akbioskr", "Samsung Gam*Boy II with Alex Kidd in Miracle World (1990)" )
712   ROMX_LOAD("akbioskr.rom", 0x000, 0x20000, CRC(9c5bad91) SHA1(2feafd8f1c40fdf1bd5668f8c5c02e5560945b17), ROM_BIOS(1))
713ROM_END
714
715ROM_START(gamegear)
716   ROM_REGION(0x4000, "maincpu", 0)
717   ROM_FILL(0x0000, 0x4000, 0x00)
718
719   ROM_REGION(0x0400, "user1", 0)
720   ROM_SYSTEM_BIOS( 0, "none", "No BIOS" ) /* gamegear */
721   ROM_SYSTEM_BIOS( 1, "majesco", "Majesco BIOS" ) /* gamg */
722   ROMX_LOAD("majbios.rom", 0x0000, 0x0400, CRC(0EBEA9D4) SHA1(914aa165e3d879f060be77870d345b60cfeb4ede), ROM_BIOS(2))
723ROM_END
724
725#define rom_gamegeaj rom_gamegear
726
727/***************************************************************************
728
729  Game driver(s)
730
731  US
732   - Sega Master System I (sms1)
733     - prototype (M404) bios - 1986
734     - without built-in game v1.3 - 1986
735     - built-in Hang On/Safari Hunt v2.4 - 1988
736     - built-in Hang On v3.4 - 1988
737     - built-in Missile Defense 3-D v4.4 - 1988
738     - built-in Hang On/Astro Warrior ????
739   - Sega Master System II (sms)
740     - built-in Alex Kidd in Miracle World - 1990
741
742  JP
743   - Sega SG-1000 Mark III (sg1000m3)
744     - no bios
745   - Sega Master System (I) (smsj)
746     - without built-in game v2.1 - 1987
747
748  KR
749   - Sega Master System II (sms2kr)
750     - built-in Alex Kidd in Miracle World (Korean)
751
752  EU
753   - Sega Master System I (sms1pal)
754     - without built-in game v1.3 - 1986
755     - built-in Hang On/Safari Hunt v2.4 - 1988
756     - built-in Hang On v3.4 - 1988
757     - built-in Missile Defense 3-D v4.4 - 1988
758     - built-in Hang On/Astro Warrior ????
759   - Sega Master System II (smspal)
760     - built-in Alex Kidd in Miracle World - 1990
761     - built-in Sonic the Hedgehog - 1991
762
763  BR
764   - Sega Master System I - 1987
765   - Sega Master System II???
766   - Sega Master System III - Tec Toy, 1987
767   - Sega Master System Compact - Tec Toy, 1992
768   - Sega Master System Girl - Tec Toy, 1992
769
770***************************************************************************/
771
772/*    YEAR  NAME        PARENT      COMPAT  MACHINE      INPUT   INIT      COMPANY     FULLNAME                            FLAGS */
773CONS( 1984, sg1000m3,   sms,        0,      sg1000m3,    smsj,   sg1000m3, "Sega",     "SG-1000 Mark III",                 0 )
774CONS( 1986, sms1,       sms,        0,      sms1_ntsc,   sms1,   sms1,     "Sega",     "Master System I",                  0 )
775CONS( 1986, sms1pal,    sms,        0,      sms1_pal,    sms1,   sms1,     "Sega",     "Master System I (PAL)" ,           0 )
776CONS( 1986, smssdisp,   sms,        0,      sms_sdisp,   sms,    smssdisp, "Sega",     "Master System Store Display Unit", GAME_NOT_WORKING )
777CONS( 1987, smsj,       sms,        0,      sms_fm,      smsj,   smsj,     "Sega",     "Master System (Japan)",            0 )
778CONS( 1990, sms,        0,          0,      sms2_ntsc,   sms,    sms1,     "Sega",     "Master System II",                 0 )
779CONS( 1990, smspal,     sms,        0,      sms2_pal,    sms,    sms1,     "Sega",     "Master System II (PAL)",           0 )
780CONS( 1990, sms2kr,     sms,        0,      sms2_fm,     sms,    sms2kr,   "Samsung",  "Gam*Boy II (Korea)",               0 )
781
782CONS( 1990, gamegear,   0,          sms,    gamegear,    gg,     gamegear, "Sega",     "Game Gear (Europe/America)",       0 )
783CONS( 1990, gamegeaj,   gamegear,   0,      gamegear,    gg,     gamegeaj, "Sega",     "Game Gear (Japan)",                0 )
src/mess/drivers/mephisto.c
r13301r13302
1/******************************************************************************
2 Mephisto 4 + 5 Chess Computer
3 2007 Dirk V.
4
5CPU 65C02 P4
6Clock 4.9152 MHz
7NMI CLK 600 Hz
8IRQ Line is set to VSS
98 KByte  SRAM Sony CXK5864-15l
10
111-CD74HC4060E   14 Bit Counter
121-CD74HC166E
131-CD74HC251E
141-SN74HC138N TI
151-SN74HC139N TI
161-74HC14AP Toshiba
171-74HC02AP Toshiba
181-74HC00AP Toshiba
191-CD74HC259E
20
21
22$0000-$1fff   S-RAM
23$2000 LCD 4 Byte Shift Register writeonly right to left
24every 2nd char xor'd by $FF
25
262c00-2c07 Keyboard (8to1 Multiplexer) 74HCT251
272*8 Matrix
28Adr. 0x3407
29==0 !=0
302c00 CL E5
312c01 POS F6
322c02 MEMO G7
332c03 INFO A1
342c04 LEV H8
352c05 ENT B2
362c06 >0 C3
372c07 <9 D4
38
39$3400-$3407 LED 1-6, Buzzer, Keyboard select
40
41$2400 // Chess Board
42$2800 // Chess Board
43$3000 // Chess Board
44
45$4000-7FFF Opening Modul HG550
46$8000-$FFF ROM
47
48Mephisto 4 Turbo Kit 18mhz - (mm4tk)
49    This is a replacement rom combining the turbo kit initial rom with the original MM IV.
50    The Turbo Kit powers up to it's tiny rom, copies itself to ram, banks in normal rom,
51    copies that to faster SRAM, then patches the checksum and the LED blink delays.
52    If someone else wants to code up the power up banking, feel free
53
54    There is an undumped MM V Turbo Kit, which will be the exact same except for location of
55    the patches. The mm5tk just needs the normal mm5 ROM swapped out for that one to
56    blinks the LEDs a little slower.
57
58    -- Cowering (2011)
59
60'rebel5' driver broke somewhere between 0.141 and 0.142 and is now marked as NOT_WORKING
61
62***********************************************************************************************/
63
64#define ADDRESS_MAP_MODERN
65
66#include "emu.h"
67#include "cpu/m6502/m6502.h"
68#include "sound/beep.h"
69//#include "mephisto.lh"
70
71#include "machine/mboard.h"
72
73
74class mephisto_state : public driver_device
75{
76public:
77   mephisto_state(const machine_config &mconfig, device_type type, const char *tag)
78      : driver_device(mconfig, type, tag),
79   m_maincpu(*this, "maincpu"),
80   m_beep(*this, BEEPER_TAG)
81   { }
82
83   required_device<cpu_device> m_maincpu;
84   required_device<device_t> m_beep;
85   DECLARE_WRITE8_MEMBER(write_lcd);
86   DECLARE_WRITE8_MEMBER(mephisto_NMI);
87   DECLARE_READ8_MEMBER(read_keys);
88   DECLARE_WRITE8_MEMBER(write_led);
89   DECLARE_WRITE8_MEMBER(write_led_mm2);
90   UINT8 m_lcd_shift_counter;
91   UINT8 m_led_status;
92   //UINT8 *m_p_ram;
93   UINT8 m_led7;
94   UINT8 m_allowNMI;
95};
96
97
98WRITE8_MEMBER( mephisto_state::write_lcd )
99{
100   if (m_led7 == 0) output_set_digit_value(m_lcd_shift_counter,data);   // 0x109 MM IV // 0x040 MM V
101
102   //output_set_digit_value(m_lcd_shift_counter,data ^ m_p_ram[0x165]);    // 0x109 MM IV // 0x040 MM V
103   m_lcd_shift_counter--;
104   m_lcd_shift_counter &= 3;
105}
106
107WRITE8_MEMBER( mephisto_state::mephisto_NMI )
108{
109   m_allowNMI = 1;
110}
111
112READ8_MEMBER( mephisto_state::read_keys )
113{
114   UINT8 data;
115   static const char *const keynames[2][8] =
116         {
117            { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" },
118            { "KEY2_0", "KEY2_1", "KEY2_2", "KEY2_3", "KEY2_4", "KEY2_5", "KEY2_6", "KEY2_7" }
119         };
120
121   data = 0xff;
122   if (((m_led_status & 0x80) == 0x00))
123      data=input_port_read(machine(), keynames[0][offset]);
124   else
125      data=input_port_read(machine(), keynames[1][offset]);
126
127   logerror("Keyboard Port = %s Data = %d\n  ", ((m_led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
128   return data | 0x7f;
129}
130
131WRITE8_MEMBER( mephisto_state::write_led )
132{
133   UINT8 LED_offset=100;
134   data &= 0x80;
135
136   if (data==0)m_led_status &= 255-(1<<offset) ; else m_led_status|=1<<offset;
137   if (offset<6)output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0);
138   if (offset==7) m_led7=data& 0x80 ? 0x00 :0xff;
139   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
140}
141
142WRITE8_MEMBER( mephisto_state::write_led_mm2 )
143{
144   UINT8 LED_offset=100;
145   data &= 0x80;
146
147   if (data==0)
148      m_led_status &= 255-(1<<offset);
149   else
150      m_led_status|=1<<offset;
151
152   if (offset<6)
153      output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0);
154
155   if (offset==7)
156      m_led7= BIT(data, 7) ? 0xff :0x00;   //MM2
157}
158
159static ADDRESS_MAP_START( rebel5_mem, AS_PROGRAM, 8, mephisto_state )
160   AM_RANGE( 0x0000, 0x1fff) AM_RAM                  // AM_BASE(m_p_ram)
161   AM_RANGE( 0x2000, 0x2007) AM_WRITE(write_led)         // Status LEDs+ buzzer
162   AM_RANGE( 0x3000, 0x3007) AM_READ(read_keys)         // Rebel 5.0
163   AM_RANGE( 0x3000, 0x4000) AM_READ_LEGACY(mboard_read_board_8)      // Chessboard
164   AM_RANGE( 0x5000, 0x5000) AM_WRITE(write_lcd)
165   AM_RANGE( 0x6000, 0x6000) AM_WRITE_LEGACY(mboard_write_LED_8)      // Chessboard
166   AM_RANGE( 0x7000, 0x7000) AM_WRITE_LEGACY(mboard_write_board_8)   // Chessboard
167   AM_RANGE( 0x8000, 0xffff) AM_ROM
168ADDRESS_MAP_END
169
170
171static ADDRESS_MAP_START( mephisto_mem, AS_PROGRAM, 8, mephisto_state )
172   AM_RANGE( 0x0000, 0x1fff) AM_RAM //AM_BASE(m_p_ram)
173   AM_RANGE( 0x2000, 0x2000) AM_WRITE(write_lcd)
174   AM_RANGE( 0x2400, 0x2407) AM_WRITE_LEGACY(mboard_write_LED_8)      // Chessboard
175   AM_RANGE( 0x2800, 0x2800) AM_WRITE_LEGACY(mboard_write_board_8)      // Chessboard
176   AM_RANGE( 0x2c00, 0x2c07) AM_READ(read_keys)
177   AM_RANGE( 0x3000, 0x3000) AM_READ_LEGACY(mboard_read_board_8)      // Chessboard
178   AM_RANGE( 0x3400, 0x3407) AM_WRITE(write_led)         // Status LEDs+ buzzer
179   AM_RANGE( 0x3800, 0x3800) AM_WRITE(mephisto_NMI)         // NMI enable
180   AM_RANGE( 0x4000, 0x7fff) AM_ROM                  // Opening Library
181   AM_RANGE( 0x8000, 0xffff) AM_ROM
182ADDRESS_MAP_END
183
184static ADDRESS_MAP_START( mm2_mem, AS_PROGRAM, 8, mephisto_state )
185   AM_RANGE( 0x0000, 0x0fff) AM_RAM //AM_BASE(m_p_ram)
186   AM_RANGE( 0x1000, 0x1007) AM_WRITE(write_led_mm2)      //Status LEDs
187   AM_RANGE( 0x1800, 0x1807) AM_READ(read_keys)
188   AM_RANGE( 0x2000, 0x2000) AM_READ_LEGACY(mboard_read_board_8)      //Chessboard
189   AM_RANGE( 0x2800, 0x2800) AM_WRITE(write_lcd)
190   AM_RANGE( 0x3000, 0x3000) AM_WRITE_LEGACY(mboard_write_LED_8)      //Chessboard
191   AM_RANGE( 0x3800, 0x3800) AM_WRITE_LEGACY(mboard_write_board_8)      //Chessboard
192   AM_RANGE( 0x4000, 0x7fff) AM_ROM                  // Opening Library ?
193   AM_RANGE( 0x8000, 0xffff) AM_ROM
194ADDRESS_MAP_END
195
196static INPUT_PORTS_START( board )
197   PORT_START("LINE2")
198   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
199   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
200   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
201   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
202   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
203   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
204   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
205   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
206   PORT_START("LINE3")
207   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
208   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
209   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
210   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
211   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
212   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
213   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
214   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
215   PORT_START("LINE4")
216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
219   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
220   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
224   PORT_START("LINE5")
225   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
226   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
227   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
228   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
229   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
230   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
231   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
232   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
233   PORT_START("LINE6")
234   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
235   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
236   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
237   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
238   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
239   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
240   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
241   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
242   PORT_START("LINE7")
243   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
244   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
245   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
246   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
247   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
248   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
249   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
250   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
251   PORT_START("LINE8")
252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
253   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
254   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
255   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
256   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
257   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
258   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
259   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
260   PORT_START("LINE9")
261   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
262   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
263   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
264   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
265   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
266   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
267   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
268   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
269
270   PORT_START("LINE10")
271   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD)
272
273   PORT_START("B_WHITE")
274   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
275   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
276   PORT_BIT(0x04,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
277   PORT_BIT(0x08,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
278   PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD)
279   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD)
280
281   PORT_START("B_BLACK")
282   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
283   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
284   PORT_BIT(0x04,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
285   PORT_BIT(0x08,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
286   PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD)
287   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD)
288
289   PORT_START("B_BUTTONS")
290   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
291   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
292INPUT_PORTS_END
293
294static INPUT_PORTS_START( mephisto )
295   PORT_START("KEY1_0") //Port $2c00
296   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_F1)
297   PORT_START("KEY1_1") //Port $2c01
298   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2)
299   PORT_START("KEY1_2") //Port $2c02
300   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3)
301   PORT_START("KEY1_3") //Port $2c03
302   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INFO") PORT_CODE(KEYCODE_F4)
303   PORT_START("KEY1_4") //Port $2c04
304   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F5)
305   PORT_START("KEY1_5") //Port $2c05
306   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER)
307   PORT_START("KEY1_6") //Port $2c06
308   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
309   PORT_START("KEY1_7") //Port $2c07
310   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
311
312   PORT_START("KEY2_0") //Port $2c08
313   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5)
314   PORT_START("KEY2_1") //Port $2c09
315   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6)
316   PORT_START("KEY2_2") //Port $2c0a
317   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7)
318   PORT_START("KEY2_3") //Port $2c0b
319   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1)
320   PORT_START("KEY2_4") //Port $2c0c
321   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8)
322   PORT_START("KEY2_5") //Port $2c0d
323   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2)
324   PORT_START("KEY2_6") //Port $2c0e
325   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3)
326   PORT_START("KEY2_7") //Port $2c0f
327   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4)
328
329   PORT_INCLUDE( board )
330INPUT_PORTS_END
331
332
333static TIMER_DEVICE_CALLBACK( update_nmi )
334{
335   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
336   if (state->m_allowNMI)
337   {
338      state->m_allowNMI = 0;
339      cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI,PULSE_LINE);
340   }
341   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
342}
343
344static TIMER_DEVICE_CALLBACK( update_irq )      //only mm2
345{
346   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
347   cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, ASSERT_LINE);
348   cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, CLEAR_LINE);
349
350   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
351}
352
353static MACHINE_START( mephisto )
354{
355   mephisto_state *state = machine.driver_data<mephisto_state>();
356   state->m_lcd_shift_counter = 3;
357   state->m_allowNMI = 1;
358   mboard_savestate_register(machine);
359}
360
361static MACHINE_START( mm2 )
362{
363   mephisto_state *state = machine.driver_data<mephisto_state>();
364   state->m_lcd_shift_counter = 3;
365   state->m_led7=0xff;
366
367   mboard_savestate_register(machine);
368}
369
370
371static MACHINE_RESET( mephisto )
372{
373   mephisto_state *state = machine.driver_data<mephisto_state>();
374   state->m_lcd_shift_counter = 3;
375   state->m_allowNMI = 1;
376   mboard_set_border_pieces();
377   mboard_set_board();
378
379/* adjust artwork depending on current emulation*/
380
381   if (!strcmp(machine.system().name,"mm2") )
382      output_set_value("MM",1);
383   else if (!strcmp(machine.system().name,"mm4") )
384      output_set_value("MM",2);
385   else if (!strcmp(machine.system().name,"mm4tk") )
386      output_set_value("MM",5);
387   else if (!strcmp(machine.system().name,"mm5tk") )
388      output_set_value("MM",5);
389   else if (!strcmp(machine.system().name,"mm5") )
390      output_set_value("MM",3);
391   else if (!strcmp(machine.system().name,"mm50") )
392      output_set_value("MM",3);
393   else if (!strcmp(machine.system().name,"rebel5") )
394      output_set_value("MM",4);
395}
396
397
398static MACHINE_CONFIG_START( mephisto, mephisto_state )
399   /* basic machine hardware */
400   MCFG_CPU_ADD("maincpu",M65C02,4915200)   /* 65C02 */
401   MCFG_CPU_PROGRAM_MAP(mephisto_mem)
402   MCFG_QUANTUM_TIME(attotime::from_hz(60))
403   MCFG_MACHINE_START( mephisto )
404   MCFG_MACHINE_RESET( mephisto )
405
406   /* sound hardware */
407   MCFG_SPEAKER_STANDARD_MONO("mono")
408   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
409   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
410
411   MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi, attotime::from_hz(600))
412   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
413MACHINE_CONFIG_END
414
415static MACHINE_CONFIG_DERIVED( rebel5, mephisto )
416   /* basic machine hardware */
417   MCFG_CPU_MODIFY("maincpu")
418   MCFG_CPU_PROGRAM_MAP(rebel5_mem)
419MACHINE_CONFIG_END
420
421static MACHINE_CONFIG_DERIVED( mm2, mephisto )
422   MCFG_CPU_REPLACE("maincpu", M65C02, 3700000)
423   MCFG_CPU_PROGRAM_MAP(mm2_mem)
424   MCFG_MACHINE_START( mm2 )
425
426   MCFG_DEVICE_REMOVE("nmi_timer")
427   MCFG_TIMER_ADD_PERIODIC("irq_timer", update_irq, attotime::from_hz(450))
428MACHINE_CONFIG_END
429
430static MACHINE_CONFIG_DERIVED( mm4tk, mephisto )
431   MCFG_CPU_MODIFY("maincpu")
432   MCFG_CPU_REPLACE("maincpu", M65C02, 18000000)
433   MCFG_CPU_PROGRAM_MAP(mephisto_mem)
434MACHINE_CONFIG_END
435
436ROM_START(rebel5)
437   ROM_REGION(0x10000,"maincpu",0)
438   ROM_LOAD("rebel5.rom", 0x8000, 0x8000, CRC(8d02e1ef) SHA1(9972c75936613bd68cfd3fe62bd222e90e8b1083))
439ROM_END
440
441ROM_START(mm2)
442   ROM_REGION(0x10000,"maincpu",0)
443   ROM_LOAD("mm2_1.bin", 0x8000, 0x4000, CRC(e2daac82) SHA1(c9fa59ca92362f8ee770733073bfa2ab8c7904ad))
444   ROM_LOAD("mm2_2.bin", 0xc000, 0x4000, CRC(5e296939) SHA1(badd2a377259cf738cd076d8fb245c3dc284c24d))
445ROM_END
446
447ROM_START(mm4)
448   ROM_REGION(0x10000,"maincpu",0)
449   ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c))
450   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
451   ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
452   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2))
453ROM_END
454
455ROM_START(mm4tk)
456   ROM_REGION(0x10000,"maincpu",0)
457   ROM_LOAD("mm4tk.rom", 0x8000, 0x8000, CRC(51cb36a4) SHA1(9e184b4e85bb721e794b88d8657ae8d2ff5a24af))
458   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
459   ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
460   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(0))
461ROM_END
462
463ROM_START(mm5tk)
464   ROM_REGION(0x10000,"maincpu",0)
465   ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, BAD_DUMP CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048))
466   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
467   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
468   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(0))
469ROM_END
470
471ROM_START(mm5)
472   ROM_REGION(0x10000,"maincpu",0)
473   ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048))
474   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
475   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
476   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
477ROM_END
478
479ROM_START(mm50)
480   ROM_REGION(0x10000,"maincpu",0)
481   ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da))
482   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
483   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
484   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
485ROM_END
486
487
488static DRIVER_INIT( mephisto )
489{
490   mephisto_state *state = machine.driver_data<mephisto_state>();
491   state->m_lcd_shift_counter = 3;
492}
493
494/***************************************************************************
495
496    Game driver(s)
497
498***************************************************************************/
499
500/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY             FULLNAME                            FLAGS */
501
502CONS( 1984, mm2,        mm4,   0,      mm2,        mephisto,   mephisto,   "Hegener & Glaser", "Mephisto MM2 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
503CONS( 1986, rebel5,     mm4,   0,      rebel5,     mephisto,   mephisto,   "Hegener & Glaser", "Mephisto Rebel 5 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK|GAME_NOT_WORKING )
504CONS( 1987, mm4,        0,      0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 4 Schachcomputer",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
505CONS( 1987, mm4tk,      mm4,    0,      mm4tk,      mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 4 Schachcomputer Turbo Kit + HG440",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
506CONS( 1990, mm5,        mm4,   0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.1 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
507CONS( 1990, mm50,       mm4,   0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.0 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
508CONS( 1990, mm5tk,      mm4,    0,      mm4tk,      mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.1 Schachcomputer Turbo Kit + HG550",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
src/mess/drivers/atari400.c
r13301r13302
323323ADDRESS_MAP_END
324324
325325
326int atari_input_disabled(running_machine &machine)
327{
328   return 0;
329}
330326
331327/**************************************************************
332328 *
src/mess/drivers/jupace.c
r0r13302
1/***************************************************************************
2Jupiter Ace memory map
3
4    CPU: Z80
5        0000-1fff ROM
6        2000-23ff Mirror of 2400-27FF
7        2400-27ff RAM (1K RAM used for screen and edit/cassette buffer)
8        2800-2bff Mirror of 2C00-2FFF
9        2c00-2fff RAM (1K RAM for char set, write only)
10        3000-3bff Mirror of 3C00-3FFF
11        3c00-3fff RAM (1K RAM standard)
12        4000-7fff RAM (16K Expansion)
13        8000-ffff RAM (48K Expansion)
14
15Interrupts:
16
17    IRQ:
18        50Hz vertical sync
19
20Ports:
21
22    Out 0xfe:
23        Tape and buzzer
24
25    In 0xfe:
26        Keyboard input, tape, and buzzer
27
28    http://www.jupiter-ace.co.uk/
29
30***************************************************************************/
31
32/*
33
34    TODO:
35
36    - Ace Colour Board
37    - 96K ram expansion
38    - Deep Thought disc interface (6850, 6821)
39
40*/
41
42#define ADDRESS_MAP_MODERN
43
44#include "emu.h"
45#include "cpu/z80/z80.h"
46#include "formats/ace_ace.h"
47#include "formats/ace_tap.h"
48#include "imagedev/cassette.h"
49#include "imagedev/snapquik.h"
50#include "machine/ctronics.h"
51#include "machine/i8255.h"
52#include "machine/ram.h"
53#include "machine/z80pio.h"
54#include "sound/ay8910.h"
55#include "sound/sp0256.h"
56#include "sound/speaker.h"
57#include "sound/wave.h"
58#include "includes/ace.h"
59
60
61
62//**************************************************************************
63//  READ/WRITE HANDLERS
64//**************************************************************************
65
66//-------------------------------------------------
67//   io_r -
68//-------------------------------------------------
69
70READ8_MEMBER( ace_state::io_r )
71{
72   UINT8 data = 0xff;
73
74   if (!BIT(offset, 8)) data &= input_port_read(machine(), "A8");
75   if (!BIT(offset, 9)) data &= input_port_read(machine(), "A9");
76   if (!BIT(offset, 10)) data &= input_port_read(machine(), "A10");
77   if (!BIT(offset, 11)) data &= input_port_read(machine(), "A11");
78   if (!BIT(offset, 12)) data &= input_port_read(machine(), "A12");
79   if (!BIT(offset, 13)) data &= input_port_read(machine(), "A13");
80   if (!BIT(offset, 14)) data &= input_port_read(machine(), "A14");
81
82   if (!BIT(offset, 15))
83   {
84      data &= input_port_read(machine(), "A15");
85
86      m_cassette->output(-1);
87      speaker_level_w(m_speaker, 0);
88   }
89
90   if (m_cassette->input() > 0)
91   {
92      data &= ~0x20;
93   }
94
95   return data;
96}
97
98
99//-------------------------------------------------
100//   io_w -
101//-------------------------------------------------
102
103WRITE8_MEMBER( ace_state::io_w )
104{
105   m_cassette->output(1);
106   speaker_level_w(m_speaker, 1);
107}
108
109
110//-------------------------------------------------
111//   ppi_r -
112//-------------------------------------------------
113
114READ8_MEMBER( ace_state::ppi_pa_r )
115{
116   return m_ppi->read(space, 0);
117}
118
119READ8_MEMBER( ace_state::ppi_pb_r )
120{
121   return m_ppi->read(space, 1);
122}
123
124READ8_MEMBER( ace_state::ppi_pc_r )
125{
126   return m_ppi->read(space, 2);
127}
128
129READ8_MEMBER( ace_state::ppi_control_r )
130{
131   return m_ppi->read(space, 3);
132}
133
134
135//-------------------------------------------------
136//   ppi_w -
137//-------------------------------------------------
138
139WRITE8_MEMBER( ace_state::ppi_pa_w )
140{
141   m_ppi->write(space, 0, data);
142}
143
144WRITE8_MEMBER( ace_state::ppi_pb_w )
145{
146   m_ppi->write(space, 1, data);
147}
148
149WRITE8_MEMBER( ace_state::ppi_pc_w )
150{
151   m_ppi->write(space, 2, data);
152}
153
154WRITE8_MEMBER( ace_state::ppi_control_w )
155{
156   m_ppi->write(space, 3, data);
157}
158
159
160//-------------------------------------------------
161//   pio_r -
162//-------------------------------------------------
163
164static READ8_DEVICE_HANDLER( pio_ad_r )
165{
166   return z80pio_d_r(device, 0);
167}
168
169static READ8_DEVICE_HANDLER( pio_bd_r )
170{
171   return z80pio_d_r(device, 1);
172}
173
174static READ8_DEVICE_HANDLER( pio_ac_r )
175{
176   return z80pio_c_r(device, 0);
177}
178
179static READ8_DEVICE_HANDLER( pio_bc_r )
180{
181   return z80pio_c_r(device, 1);
182}
183
184
185//-------------------------------------------------
186//   pio_w -
187//-------------------------------------------------
188
189static WRITE8_DEVICE_HANDLER( pio_ad_w )
190{
191   z80pio_d_w(device, 0, data);
192}
193
194static WRITE8_DEVICE_HANDLER( pio_bd_w )
195{
196   z80pio_d_w(device, 1, data);
197}
198
199static WRITE8_DEVICE_HANDLER( pio_ac_w )
200{
201   z80pio_c_w(device, 0, data);
202}
203
204static WRITE8_DEVICE_HANDLER( pio_bc_w )
205{
206   z80pio_c_w(device, 1, data);
207}
208
209
210
211//**************************************************************************
212//  ADDRESS MAPS
213//**************************************************************************
214
215//-------------------------------------------------
216//  ADDRESS_MAP( ace_mem )
217//-------------------------------------------------
218
219static ADDRESS_MAP_START( ace_mem, AS_PROGRAM, 8, ace_state )
220   AM_RANGE(0x0000, 0x1fff) AM_ROM
221   AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_video_ram)
222   AM_RANGE(0x2800, 0x2bff) AM_MIRROR(0x0400) AM_RAM AM_BASE(m_char_ram) AM_REGION(Z80_TAG, 0xfc00)
223   AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
224   AM_RANGE(0x4000, 0xffff) AM_RAM
225ADDRESS_MAP_END
226
227
228//-------------------------------------------------
229//  ADDRESS_MAP( ace_io )
230//-------------------------------------------------
231
232static ADDRESS_MAP_START( ace_io, AS_IO, 8, ace_state )
233   AM_RANGE(0x00, 0x00) AM_MIRROR(0xfffe) AM_MASK(0xff00) AM_READWRITE(io_r, io_w)
234   AM_RANGE(0x01, 0x01) AM_MIRROR(0xff00) AM_READ_PORT("JOY")
235   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff80) AM_READWRITE(ppi_pa_r, ppi_pa_w)
236   AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_READWRITE(ppi_pb_r, ppi_pb_w)
237   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_READWRITE(ppi_pc_r, ppi_pc_w)
238   AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_READWRITE(ppi_control_r, ppi_control_w)
239   AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ad_r, pio_ad_w)
240   AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bd_r, pio_bd_w)
241   AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ac_r, pio_ac_w)
242   AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bc_r, pio_bc_w)
243   AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY(AY8910_TAG, ay8910_address_w)
244   AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(AY8910_TAG, ay8910_r, ay8910_data_w)
245ADDRESS_MAP_END
246
247
248
249//**************************************************************************
250//  INPUT PORTS
251//**************************************************************************
252
253//-------------------------------------------------
254//  INPUT_PORTS( ace )
255//-------------------------------------------------
256
257static INPUT_PORTS_START( ace )
258   PORT_START("A8")
259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)      PORT_CHAR(UCHAR_SHIFT_1)
260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Symbol Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_2)
261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z)         PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(':')
262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X)         PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR('\xA3')
263   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C)         PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR('?')
264   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
265
266   PORT_START("A9")
267   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A)         PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR('~')
268   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S)         PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR('|')
269   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D)         PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR('\\')
270   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F)         PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR('{')
271   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G)         PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR('}')
272   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
273
274   PORT_START("A10")
275   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q)         PORT_CHAR('q') PORT_CHAR('Q')
276   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W)         PORT_CHAR('w') PORT_CHAR('W')
277   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E)         PORT_CHAR('e') PORT_CHAR('E')
278   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R)         PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR('<')
279   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T)         PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR('>')
280   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
281
282   PORT_START("A11")
283   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1)         PORT_CHAR('1') PORT_CHAR('!')
284   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2)         PORT_CHAR('2') PORT_CHAR('@')
285   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3)         PORT_CHAR('3') PORT_CHAR('#')
286   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4)         PORT_CHAR('4') PORT_CHAR('$')
287   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_LEFT) PORT_CHAR('5') PORT_CHAR('%')
288   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
289
290   PORT_START("A12")
291   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0)         PORT_CHAR('0') PORT_CHAR('_')
292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9)         PORT_CHAR('9') PORT_CHAR(')')
293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR('8') PORT_CHAR('(')
294   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_DOWN) PORT_CHAR('7') PORT_CHAR('\'')
295   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_UP)   PORT_CHAR('6') PORT_CHAR('&')
296   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
297
298   PORT_START("A13")
299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)         PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR('"')
300   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O)         PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(';')
301   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I)         PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x00A9)
302   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U)         PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(']')
303   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y)         PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR('[')
304   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
305
306   PORT_START("A14")
307   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER)      PORT_CHAR(13)
308   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L)         PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR('=')
309   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K)         PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR('+')
310   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J)         PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR('-')
311   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("h  H  \xE2\x86\x91") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
312   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
313
314   PORT_START("A15")
315   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(' ')
316   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M)         PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR('.')
317   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N)         PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(',')
318   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B)         PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR('*')
319   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V)         PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR('/')
320   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
321
322   PORT_START("JOY")
323   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
324   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
325   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
326   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
327   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
328   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 )
329   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
330   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
331INPUT_PORTS_END
332
333
334
335//**************************************************************************
336//  VIDEO
337//**************************************************************************
338
339//-------------------------------------------------
340//  gfx_layout ace_charlayout
341//-------------------------------------------------
342
343static const gfx_layout ace_charlayout =
344{
345   8,8,
346   128,
347   1,
348   { RGN_FRAC(0,1) },
349   { STEP8(0,1) },
350   { STEP8(0,8) },
351   8*8
352};
353
354
355//-------------------------------------------------
356//  GFXDECODE( ace )
357//-------------------------------------------------
358
359static GFXDECODE_START( ace )
360   GFXDECODE_ENTRY( Z80_TAG, 0xfc00, ace_charlayout, 0, 1 )
361GFXDECODE_END
362
363
364//-------------------------------------------------
365//  TIMER_DEVICE_CALLBACK( set_irq )
366//-------------------------------------------------
367
368static TIMER_DEVICE_CALLBACK( set_irq )
369{
370   cputag_set_input_line(timer.machine(), Z80_TAG, INPUT_LINE_IRQ0, ASSERT_LINE);
371}
372
373
374//-------------------------------------------------
375//  TIMER_DEVICE_CALLBACK( clear_irq )
376//-------------------------------------------------
377
378static TIMER_DEVICE_CALLBACK( clear_irq )
379{
380   cputag_set_input_line(timer.machine(), Z80_TAG, INPUT_LINE_IRQ0, CLEAR_LINE);
381}
382
383
384//-------------------------------------------------
385//  SCREEN_UPDATE( ace )
386//-------------------------------------------------
387
388bool ace_state::screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect)
389{
390   UINT8 y,ra,chr,gfx;
391   UINT16 sy=56,ma=0,x;
392
393   for (y = 0; y < 24; y++)
394   {
395      for (ra = 0; ra < 8; ra++)
396      {
397         UINT16 *p = BITMAP_ADDR16(&bitmap, sy++, 40);
398
399         for (x = ma; x < ma+32; x++)
400         {
401            chr = m_video_ram[x];
402
403            /* get pattern of pixels for that character scanline */
404            gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0);
405
406            /* Display a scanline of a character (8 pixels) */
407            *p++ = BIT(gfx, 7);
408            *p++ = BIT(gfx, 6);
409            *p++ = BIT(gfx, 5);
410            *p++ = BIT(gfx, 4);
411            *p++ = BIT(gfx, 3);
412            *p++ = BIT(gfx, 2);
413            *p++ = BIT(gfx, 1);
414            *p++ = BIT(gfx, 0);
415         }
416      }
417      ma+=32;
418   }
419   return 0;
420}
421
422
423
424//**************************************************************************
425//  DEVICE CONFIGURATION
426//**************************************************************************
427
428//-------------------------------------------------
429//  cassette_interface ace_cassette_interface
430//-------------------------------------------------
431
432static const cassette_interface ace_cassette_interface =
433{
434   ace_cassette_formats,
435   NULL,
436   (cassette_state)(CASSETTE_STOPPED),
437   NULL,
438   NULL
439};
440
441
442//-------------------------------------------------
443//  ay8910_interface psg_intf
444//-------------------------------------------------
445
446static const ay8910_interface psg_intf =
447{
448   AY8910_LEGACY_OUTPUT,
449   AY8910_DEFAULT_LOADS,
450   DEVCB_NULL,
451   DEVCB_NULL,
452   DEVCB_NULL,
453   DEVCB_NULL
454};
455
456
457//-------------------------------------------------
458//  sp0256_interface sp0256_intf
459//-------------------------------------------------
460
461static const sp0256_interface sp0256_intf =
462{
463   DEVCB_NULL,
464   DEVCB_NULL
465};
466
467
468//-------------------------------------------------
469//  I8255A_INTERFACE( ppi_intf )
470//-------------------------------------------------
471
472static READ8_DEVICE_HANDLER( sby_r )
473{
474   /*
475
476        bit     description
477
478        PC0     SP0256 SBY
479        PC1
480        PC2
481        PC3
482        PC4
483        PC5
484        PC6
485        PC7
486
487    */
488
489   return sp0256_sby_r(device);
490}
491
492static WRITE8_DEVICE_HANDLER( ald_w )
493{
494   /*
495
496        bit     description
497
498        PA0     SP0256 A1
499        PA1     SP0256 A2
500        PA2     SP0256 A3
501        PA3     SP0256 A4
502        PA4     SP0256 A5
503        PA5     SP0256 A6
504        PA6     SP0256 _ALD
505        PA7
506
507    */
508
509   if (!BIT(data, 6))
510   {
511      sp0256_ALD_w(device, 0, data & 0x3f);
512   }
513}
514
515static I8255A_INTERFACE( ppi_intf )
516{
517   DEVCB_NULL,
518   DEVCB_NULL,
519   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, sby_r),
520   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, ald_w),
521   DEVCB_NULL,
522   DEVCB_NULL
523};
524
525
526//-------------------------------------------------
527//  Z80PIO_INTERFACE( pio_intf )
528//-------------------------------------------------
529
530READ8_MEMBER( ace_state::pio_pa_r )
531{
532   /*
533
534        bit     description
535
536        PA0
537        PA1     RxD
538        PA2
539        PA3
540        PA4
541        PA5
542        PA6
543        PA7
544
545    */
546
547   return 0;
548};
549
550WRITE8_MEMBER( ace_state::pio_pa_w )
551{
552   /*
553
554        bit     description
555
556        PA0     RTS
557        PA1
558        PA2     CTS
559        PA3     TxD
560        PA4
561        PA5
562        PA6     STB
563        PA7
564
565    */
566
567   // centronics strobe
568   centronics_strobe_w(m_centronics, !BIT(data, 6));
569};
570
571static Z80PIO_INTERFACE( pio_intf )
572{
573   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
574   DEVCB_DRIVER_MEMBER(ace_state, pio_pa_r),
575   DEVCB_DRIVER_MEMBER(ace_state, pio_pa_w),
576   DEVCB_NULL,
577   DEVCB_NULL,
578   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w),
579   DEVCB_NULL
580};
581
582
583
584//**************************************************************************
585//  MACHINE INITIALIZATION
586//**************************************************************************
587
588//-------------------------------------------------
589//  MACHINE_START( ace )
590//-------------------------------------------------
591
592void ace_state::machine_start()
593{
594   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
595
596   /* configure RAM */
597   switch (ram_get_size(m_ram))
598   {
599   case 1*1024:
600      program->unmap_readwrite(0x4000, 0xffff);
601      break;
602
603   case 16*1024:
604      program->unmap_readwrite(0x8000, 0xffff);
605      break;
606
607   case 32*1024:
608      program->unmap_readwrite(0xc000, 0xffff);
609      break;
610   }
611}
612
613
614
615//**************************************************************************
616//  MACHINE CONFIGURATION
617//**************************************************************************
618
619//-------------------------------------------------
620//  MACHINE_CONFIG( ace )
621//-------------------------------------------------
622
623static MACHINE_CONFIG_START( ace, ace_state )
624   // basic machine hardware
625   MCFG_CPU_ADD(Z80_TAG, Z80, XTAL_6_5MHz/2)
626   MCFG_CPU_PROGRAM_MAP(ace_mem)
627   MCFG_CPU_IO_MAP(ace_io)
628   MCFG_QUANTUM_TIME(attotime::from_hz(60))
629
630   // video hardware
631   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
632   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
633   MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304)
634   MCFG_TIMER_ADD_SCANLINE("set_irq", set_irq, SCREEN_TAG, 31*8, 264)
635   MCFG_TIMER_ADD_SCANLINE("clear_irq", clear_irq, SCREEN_TAG, 32*8, 264)
636
637   MCFG_PALETTE_LENGTH(2)
638   MCFG_PALETTE_INIT(black_and_white)
639
640   MCFG_GFXDECODE(ace)
641
642   // sound hardware
643   MCFG_SPEAKER_STANDARD_MONO("mono")
644   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
645   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
646   MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
647   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
648
649   MCFG_SOUND_ADD(AY8910_TAG, AY8910, XTAL_6_5MHz/2)
650   MCFG_SOUND_CONFIG(psg_intf)
651   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
652
653   MCFG_SOUND_ADD(SP0256AL2_TAG, SP0256, XTAL_3MHz)
654   MCFG_SOUND_CONFIG(sp0256_intf)
655   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
656
657   // devices
658   MCFG_CASSETTE_ADD(CASSETTE_TAG, ace_cassette_interface)
659   MCFG_SNAPSHOT_ADD("snapshot", ace, "ace", 1)
660   MCFG_I8255A_ADD(I8255_TAG, ppi_intf)
661   MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_6_5MHz/2, pio_intf)
662   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
663
664   // internal ram
665   MCFG_RAM_ADD(RAM_TAG)
666   MCFG_RAM_DEFAULT_SIZE("1K")
667   MCFG_RAM_EXTRA_OPTIONS("16K,32K,48K")
668MACHINE_CONFIG_END
669
670
671
672//**************************************************************************
673//  ROMS
674//**************************************************************************
675
676//-------------------------------------------------
677//  ROM( ace )
678//-------------------------------------------------
679
680ROM_START( jupace )
681   ROM_REGION( 0x10000, Z80_TAG, 0 )
682   ROM_LOAD( "rom-a.z1", 0x0000, 0x1000, CRC(dc8438a5) SHA1(8fa97eb71e5dd17c7d190c6587ee3840f839347c) )
683   ROM_LOAD( "rom-b.z2", 0x1000, 0x1000, CRC(4009f636) SHA1(98c5d4bcd74bcf014268cf4c00b2007ea5cc21f3) )
684
685   ROM_REGION( 0x1000, "fdc", 0 ) // Deep Thought disc interface
686   ROM_LOAD( "dos 4.bin", 0x0000, 0x1000, CRC(04c70448) SHA1(53ddcced6ae2feafd687a3b55864726656b71412) )
687
688   ROM_REGION( 0x10000, SP0256AL2_TAG, 0 )
689   ROM_LOAD( "sp0256-al2.ic1", 0x000, 0x800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
690ROM_END
691
692
693
694//**************************************************************************
695//  SYSTEM DRIVERS
696//**************************************************************************
697
698//    YEAR  NAME     PARENT    COMPAT  MACHINE    INPUT     INIT     COMPANY         FULLNAME      FLAGS
699COMP( 1981, jupace,     0,        0,      ace,       ace,      0,   "Jupiter Cantab", "Jupiter Ace" , 0 )
src/mess/drivers/mk1.c
r13301r13302
197197MACHINE_CONFIG_END
198198
199199
200ROM_START( mk1 )
200ROM_START( ccmk1 )
201201   ROM_REGION(0x10000,"maincpu",0)
202202   ROM_LOAD("82c210-1", 0x0000, 0x800, CRC(278f7bf3) SHA1(b384c95ba691d52dfdddd35987a71e9746a46170))
203203ROM_END
r13301r13302
211211
212212// seams to be developed by mostek (MK)
213213/*    YEAR   NAME  PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY                 FULLNAME */
214CONS( 1979,  mk1,  0,      0,      mk1,    mk1,    0,   "Computer Electronic", "Chess Champion MK I", GAME_NO_SOUND_HW )
214CONS( 1979,  ccmk1,  0,      0,      mk1,    mk1,    0,   "Computer Electronic", "Chess Champion MK I", GAME_NO_SOUND_HW )
src/mess/drivers/dolphin.c
r13301r13302
169169MACHINE_CONFIG_END
170170
171171/* ROM definition */
172ROM_START( dolphin )
172ROM_START( dolphunk )
173173   ROM_REGION( 0x8000, "maincpu", 0 )
174174   ROM_LOAD( "dolphin_mo.rom", 0x0000, 0x0100, CRC(1ac4ac18) SHA1(62a63de6fcd6cd5fcee930d31c73fe603647f06c))
175175   ROM_LOAD( "dolphin_moni.rom", 0x0100, 0x0100, NO_DUMP )
r13301r13302
179179/* Driver */
180180
181181/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
182COMP( 1979, dolphin,  0,       0,   dolphin,   dolphin,    0,   "<unknown>",   "Dolphin",   GAME_NOT_WORKING | GAME_NO_SOUND )
182COMP( 1979, dolphunk,  0,       0,   dolphin,   dolphin,    0,   "<unknown>",   "Dolphin",   GAME_NOT_WORKING | GAME_NO_SOUND )
183183
src/mess/drivers/spectrum.c
r13301r13302
10241024COMP( 1988, hc88,     spectrum, 0,      spectrum,      spectrum,   spectrum,   "ICE-Felix",   "HC-88" , GAME_NOT_WORKING)
10251025COMP( 1990, hc90,     spectrum, 0,      spectrum,      spectrum,   spectrum,   "ICE-Felix",   "HC-90" , 0)
10261026COMP( 1991, hc91,     spectrum, 0,      spectrum,      spec_plus,   spectrum,   "ICE-Felix",   "HC-91" , 0)
1027COMP( 1988, cobrasp,   spectrum, 0,      spectrum,      spectrum,   spectrum,   "ITCI",   "Cobra" , GAME_NOT_WORKING)
1028COMP( 1988, cobra80,  spectrum, 0,      spectrum,      spectrum,   spectrum,   "ITCI",   "Cobra 80K" , GAME_NOT_WORKING)
1027COMP( 1988, cobrasp,   spectrum, 0,      spectrum,      spectrum,   spectrum,   "ITCI",   "Cobra (ITCI)" , GAME_NOT_WORKING)
1028COMP( 1988, cobra80,  spectrum, 0,      spectrum,      spectrum,   spectrum,   "ITCI",   "Cobra 80K (ITCI)" , GAME_NOT_WORKING)
10291029COMP( 1987, cip01,    spectrum, 0,      spectrum,      spectrum,   spectrum,   "Electronica",   "CIP-01" , 0)   // keyboard should be spectrum, but image was not clear
10301030COMP( 1988, cip03,    spectrum, 0,      spectrum,      spectrum,   spectrum,   "Electronica",   "CIP-03" , 0)   // keyboard should be spectrum, but image was not clear
10311031COMP( 1990, jet,      spectrum, 0,      spectrum,      spectrum,   spectrum,   "Electromagnetica",   "JET" , 0)   // keyboard should be spectrum, but image was not clear
src/mess/drivers/mk2.c
r13301r13302
212212MACHINE_CONFIG_END
213213
214214
215ROM_START(mk2)
215ROM_START(ccmk2)
216216   ROM_REGION(0x10000,"maincpu",0)
217217   ROM_LOAD("024_1879", 0x0c00, 0x0400, CRC(4f28c443) SHA1(e33f8b7f38e54d7a6e0f0763f2328cc12cb0eade))
218218   ROM_LOAD("005_2179", 0x1000, 0x1000, CRC(6f10991b) SHA1(90cdc5a15d9ad813ad20410f21081c6e3e481812)) // chess mate 7.5
r13301r13302
226226
227227
228228/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY               FULLNAME */
229CONS( 1979, mk2,    0,      0,      mk2,    mk2,    0, "Quelle International", "Chess Champion MK II", 0)
229CONS( 1979, ccmk2,    0,      0,      mk2,    mk2,    0, "Quelle International", "Chess Champion MK II", 0)
230230// second design sold (same computer/program?)
src/mess/drivers/bullet.c
r13301r13302
741741//  ROM( bullet )
742742//-------------------------------------------------
743743
744ROM_START( bullet )
744ROM_START( wmbullet )
745745    ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF )
746746   ROM_LOAD( "sr70x.u8", 0x0000, 0x0020, CRC(d54b8a30) SHA1(65ff8753dd63c9dd1899bc9364a016225585d050) )
747747ROM_END
r13301r13302
753753//**************************************************************************
754754
755755//    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    COMPANY         FULLNAME                FLAGS
756COMP( 1982, bullet,      0,         0,      bullet,      bullet,      0,      "Wave Mate",   "Bullet",            GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
757//COMP( 1982, bullete,  bullet,     0,      bullet,     bullet,     0,      "Wave Mate",    "Bullet (Revision E)",  GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
756COMP( 1982, wmbullet,      0,         0,      bullet,      bullet,      0,      "Wave Mate",   "Bullet",            GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
757//COMP( 1982, wmbullete,  bullet,     0,      bullet,     bullet,     0,      "Wave Mate",    "Bullet (Revision E)",  GAME_NOT_WORKING | GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW )
src/mess/drivers/enmirage.c
r0r13302
1/***************************************************************************
2
3    drivers/mirage.c
4
5    Ensoniq Mirage Sampler
6    Preliminary driver by R. Belmont
7
8    Map for Mirage:
9    0000-7fff: 32k window on 128k of sample RAM
10    8000-bfff: main RAM
11    c000-dfff: optional expansion RAM
12    e100-e101: 6850 UART (for MIDI)
13    e200-e2ff: 6522 VIA
14    e408-e40f: filter cut-off frequency
15    e410-e417: filter resonance
16    e418-e41f: multiplexer address pre-set
17    e800-e803: WD1770 FDC
18    ec00-ecef: ES5503 "DOC" sound chip
19    f000-ffff: boot ROM
20
21LED patterns
22
23     80
24    _____
25   |     | 40
2604 | 02  |
27    _____
28   |     | 20
2908 |     |
30    _____
31     10
32
33PORT A: 111xyzzz
34
35
36***************************************************************************/
37
38#define ADDRESS_MAP_MODERN
39
40#include "emu.h"
41#include "cpu/m6809/m6809.h"
42#include "machine/6850acia.h"
43#include "machine/6522via.h"
44#include "machine/wd17xx.h"
45#include "imagedev/flopdrv.h"
46#include "formats/basicdsk.h"
47#include "sound/es5503.h"
48
49class mirage_state : public driver_device
50{
51public:
52    mirage_state(const machine_config &mconfig, device_type type, const char *tag)
53    : driver_device(mconfig, type, tag) { }
54
55   virtual void machine_reset();
56
57    int last_sndram_bank;
58};
59
60
61static void mirage_doc_irq(device_t *device, int state)
62{
63}
64
65static UINT8 mirage_adc_read(device_t *device)
66{
67   return 0x80;
68}
69
70static VIDEO_START( mirage )
71{
72}
73
74static SCREEN_UPDATE( mirage )
75{
76   return 0;
77}
78
79void mirage_state::machine_reset()
80{
81   last_sndram_bank = 0;
82   memory_set_bankptr(machine(), "sndbank", machine().region("es5503")->base() );
83}
84
85static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state )
86   AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("sndbank")   // 32k window on 128k of wave RAM
87   AM_RANGE(0x8000, 0xbfff) AM_RAM         // main RAM
88   AM_RANGE(0xe100, 0xe100) AM_DEVREADWRITE("acia6850", acia6850_device, status_read, control_write)
89   AM_RANGE(0xe101, 0xe101) AM_DEVREADWRITE("acia6850", acia6850_device, data_read, data_write)
90   AM_RANGE(0xe200, 0xe2ff) AM_DEVREADWRITE("via6522", via6522_device, read, write)
91   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_status_r,wd17xx_command_w)
92   AM_RANGE(0xe801, 0xe801) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_track_r,wd17xx_track_w)
93   AM_RANGE(0xe802, 0xe802) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_sector_r,wd17xx_sector_w)
94   AM_RANGE(0xe803, 0xe803) AM_DEVREADWRITE_LEGACY("wd177x", wd17xx_data_r,wd17xx_data_w)
95//  AM_RANGE(0xec00, 0xecef) AM_DEVREADWRITE("es5503", es5503_device, read, write)
96   AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION("osrom", 0)
97ADDRESS_MAP_END
98
99// port A: front panel
100static WRITE8_DEVICE_HANDLER( mirage_via_write_porta )
101{
102//  printf("PORT A: %02x\n", data);
103}
104
105// port B:
106//  bit 7: OUT UART clock
107//  bit 4: OUT disk enable (motor on?)
108//  bit 3: OUT sample/play
109//  bit 2: OUT mic line/in
110//  bit 1: OUT upper/lower bank (64k halves)
111//  bit 0: OUT bank 0/bank 1 (32k halves)
112
113static WRITE8_DEVICE_HANDLER( mirage_via_write_portb )
114{
115   int bank = 0;
116    mirage_state *mirage = device->machine().driver_data<mirage_state>();
117
118   // handle sound RAM bank switching
119   bank = (data & 2) ? (64*1024) : 0;
120   bank += (data & 1) ? (32*1024) : 0;
121   if (bank != mirage->last_sndram_bank)
122   {
123      mirage->last_sndram_bank = bank;
124      memory_set_bankptr(device->machine(), "sndbank", device->machine().region("es5503")->base() + bank);
125   }
126}
127
128// port A: front panel
129static READ8_DEVICE_HANDLER( mirage_via_read_porta )
130{
131   return 0;
132}
133
134// port B:
135//  bit 6: IN FDC disk loaded
136//  bit 5: IN 5503 sync (?)
137static READ8_DEVICE_HANDLER( mirage_via_read_portb )
138{
139   return 0x60;
140}
141
142// external sync pulse
143static READ8_DEVICE_HANDLER( mirage_via_read_ca1 )
144{
145   return 0;
146}
147
148// keyscan
149static READ8_DEVICE_HANDLER( mirage_via_read_cb1 )
150{
151   return 0;
152}
153
154// keyscan
155static READ8_DEVICE_HANDLER( mirage_via_read_ca2 )
156{
157   return 0;
158}
159
160
161// keyscan
162static READ8_DEVICE_HANDLER( mirage_via_read_cb2 )
163{
164   return 0;
165}
166
167const via6522_interface mirage_via =
168{
169   DEVCB_HANDLER(mirage_via_read_porta),
170   DEVCB_HANDLER(mirage_via_read_portb),
171   DEVCB_HANDLER(mirage_via_read_ca1),
172   DEVCB_HANDLER(mirage_via_read_cb1),
173   DEVCB_HANDLER(mirage_via_read_ca2),
174   DEVCB_HANDLER(mirage_via_read_cb2),
175   DEVCB_HANDLER(mirage_via_write_porta),
176   DEVCB_HANDLER(mirage_via_write_portb),
177   DEVCB_NULL,
178   DEVCB_NULL,
179   DEVCB_NULL,
180   DEVCB_NULL,
181   DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE)
182};
183
184static ACIA6850_INTERFACE( mirage_acia6850_interface )
185{
186   0,            // tx clock
187   0,            // rx clock
188   DEVCB_NULL,         // rx in
189   DEVCB_NULL,         // rx out
190   DEVCB_NULL,         // cts in
191   DEVCB_NULL,         // rts out
192   DEVCB_NULL,         // dcd in
193   DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
194};
195
196static LEGACY_FLOPPY_OPTIONS_START(mirage)
197   LEGACY_FLOPPY_OPTION(mirage, "img", "Mirage disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
198      HEADS([1])
199      TRACKS([80])
200      SECTORS([5])
201      SECTOR_LENGTH([512])
202      FIRST_SECTOR_ID([0]))
203LEGACY_FLOPPY_OPTIONS_END
204
205static const floppy_interface mirage_floppy_interface =
206{
207   DEVCB_NULL,
208   DEVCB_NULL,
209   DEVCB_NULL,
210   DEVCB_NULL,
211   DEVCB_NULL,
212   FLOPPY_STANDARD_3_5_DSDD,
213   LEGACY_FLOPPY_OPTIONS_NAME(mirage),
214   NULL,
215   NULL
216};
217
218const wd17xx_interface mirage_wd17xx_interface =
219{
220   DEVCB_NULL,         // dden
221   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),   // intrq
222   DEVCB_NULL,         // drq
223   {FLOPPY_0, NULL, NULL, NULL}
224};
225
226static MACHINE_CONFIG_START( mirage, mirage_state )
227   MCFG_CPU_ADD("maincpu", M6809E, 4000000)
228   MCFG_CPU_PROGRAM_MAP(mirage_map)
229
230   MCFG_SCREEN_ADD("screen", RASTER)
231   MCFG_SCREEN_REFRESH_RATE(60)
232   MCFG_VIDEO_START(mirage)
233   MCFG_SCREEN_UPDATE(mirage)
234   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
235   MCFG_SCREEN_SIZE(320, 240)
236   MCFG_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
237
238   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
239   MCFG_ES5503_ADD("es5503", 7000000, mirage_doc_irq, mirage_adc_read)
240   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
241   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
242
243   MCFG_VIA6522_ADD("via6522", 1000000, mirage_via)
244
245   MCFG_ACIA6850_ADD("acia6850", mirage_acia6850_interface)
246
247   MCFG_WD1770_ADD("wd177x", mirage_wd17xx_interface )
248   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mirage_floppy_interface)
249MACHINE_CONFIG_END
250
251static INPUT_PORTS_START( mirage )
252INPUT_PORTS_END
253
254ROM_START( enmirage )
255   ROM_REGION(0x1000, "osrom", 0)
256   ROM_LOAD( "mirage.bin",   0x0000, 0x1000, CRC(9fc7553c) SHA1(ec6ea5613eeafd21d8f3a7431a35a6ff16eed56d) )
257
258   ROM_REGION(0x20000, "es5503", ROMREGION_ERASE)
259ROM_END
260
261CONS( 1984, enmirage, 0, 0, mirage, mirage, 0, "Ensoniq", "Ensoniq Mirage", GAME_NOT_WORKING )
262
src/mess/drivers/dc.c
r13301r13302
2929#include "machine/maple-dc.h"
3030#define CPU_CLOCK (200000000)
3131
32UINT16 actel_id;
33int jvsboard_type;
34
3532// things from mess/machine/dc.c
3633void dreamcast_atapi_init(running_machine &machine);
3734void dreamcast_atapi_reset(running_machine &machine);
src/mess/drivers/arcadiah.c
r0r13302
1/******************************************************************************
2Consolidation and enhancement of documentation by Manfred Schneider based on previous work from
3 PeT mess@utanet.at and Paul Robson (autismuk@aol.com) minor updates by incog
4
5 Schematics, manuals and anything you can desire for at http://amigan.classicgaming.gamespy.com/
6
7 TODO: implement the RESET key on the front panel
8       find a dump of the character ROM
9       convert the drawing code to tilemap
10
11
12 1. General
13   SYSTEM
14- Signetics 2650 CPU at 3.58/4 MHz(for NTSC) or at 4,433/5 (for PAL)
15- 1k x 8 of RAM (physically present but only 512 byte available)
16- 2 x 2 axis Analogue Joysticks
17- 2 x 12 button Controllers
18- 3 buttons on system unit and CPU Reset
19   VIDEO
20- 128 x 208 pixel resolution (alternate 128 x 104 mode available)
21- 16 x 26 (can be 16x13) background display (2 colour 8 x 8 pixel characters)
22- 4 x 8 x 8 Sprites (2 colour 8 x 8 pixels)
23- total of 8 user defined characters available
24   SOUND
25- Single channel beeper
26
27
282. Memory map
29The memory map of the 2001 is below.
300000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
311000 - 13FF     mirror of $1800-$1BFF
321400 - 17FF     mirror of $1800-$1BFF
331800 - 1BFF     UVI2637 Area (detail description in video/arcadia.c)
34    1800 - 18CF     Screen display , upper 13 lines, characters/palette high bits
35    18D0 - 18EF Free for user programs.
36    18F0 - 18F7     Sprite coordinates y0x0y1x1y2x2y3x3
37    18F8 - 1908     registers of UVI
38    1909 - 197F     Unmapped
39    1980 - 19BF     User defined characters (8 possible, 8 bytes per character)
40    19C0 - 19F7     Unmapped
41    19F8 - 19FF     registers of UVI
42    1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits
43    1AD0 - 1AFF User memory
44    1B00 - 1BFF     mirror of 1900-19FF
451C00 - 1FFF     mirror of 1800-1BFF
462000 - 2FFF 4k ROM Block 2 (for 8k carts such as Jungler)
473000 - 3FFF mirror of 1000-1FFF
484000 - 4FFF mirror of 0000-0FFF
495000 - 5FFF mirror of 1000-1FFF
506000 - 6FFF mirror of 0000-0FFF
517000 - 7FFF mirror of 1000-1FFF
52
53The Palladium VCG memory map is as follows.
540000 - 0FFF 4k ROM Block 1 (first 4k of a cartridge)
551000 - 17FF     could be ROM or RAM but no Cartridge uses this
561800 - 1BFF     UVI2637 Area (detail description in video/arcadia.c)
57    1800 - 18CF     Screen display , upper 13 lines, characters/palette high bits
58    18D0 - 18EF Free for user programs.
59    18F0 - 18F7     Sprite coordinates y0x0y1x1y2x2y3x3
60    18F8 - 1908     registers of UVI
61    1909 - 197F     Unmapped
62    1980 - 19BF     User defined characters (8 possible, 8 bytes per character)
63    19C0 - 19F7     Unmapped
64    19F8 - 19FF     registers of UVI
65    1A00 - 1ACF Screen display , lower 13 lines, characters/palette high bits
66    1AD0 - 1AFF User memory
67    1B00 - 1BFF     mirror of 1900-19FF
681C00 - 1FFF     could be ROM or RAM but no Cartridge uses this
692000 - 2FFF 4k ROM Block  (for 8k carts such as Jungler)
703000 - 3FFF could be ROM or RAM but no Cartridge uses this
714000 - 4FFF 4k ROM Block  (first 2K used by Golf)
725000 - 5FFF 4k ROM Block
736000 - 6FFF 4k ROM Block
747000 - 7FFF 4k ROM Block
75
76
773. ROM Images
78ROM Images are loaded into 0000-0FFF. If the ROM is an 8k ROM the
79second half of the Rom is located at 2000-2FFF. Except for the Golf cart
80which is located from 0x0000-0x0FFF and a 2kbyte block from 0x4000 only on
81Palladium VCG.
82
83
844. Controls
85All key controls are indicated by a bit going to '1'. Unused bits at
86the memory location are set to zero.
87
88Keypads
89
901900-1902 (Player 1) 1904-1906 (Player 2)
91The keypads are arranged as follows :-
92
93        1       2       3
94        4       5       6
95        7       8       9
96      Enter     0     Clear
97
98Row 1/4/7 is 1900/4, Row 2/5/8/0 is 1901/5 and Row 3/6/9 is 1902/6
99The topmost key is bit 3, the lowermost key is bit 0.
100
101Location $1908 contains bit 0 Start,bit 1 Option,bit 2 Difficulty.
102These keys are "latched" i.e. a press causes a logic 1 to appear
103on the current frame.
104
105The fire buttons are equivalent to Keypad #2 e.g. they are 1901 and
1061905 bit 3.
107
108Palladium has 4 additional key per keypad which are mapped at
1091903 palladium player 1
1101907 palladium player 2
111
112
1135. Other information
114Interrupts are not supported
115The Read/Write 2650 CPU Port-Commands do not appear to be connected to
116anything in hardware. No cartridge has been found which uses them.
117
118 ******************************************************************************/
119
120#include <assert.h>
121#include "emu.h"
122#include "cpu/s2650/s2650.h"
123#include "includes/arcadia.h"
124#include "imagedev/cartslot.h"
125
126static ADDRESS_MAP_START( arcadia_mem, AS_PROGRAM, 8)
127   AM_RANGE( 0x0000, 0x0fff) AM_ROM
128   AM_RANGE( 0x1800, 0x1aff) AM_READWRITE( arcadia_video_r, arcadia_video_w )
129   AM_RANGE( 0x2000, 0x2fff) AM_ROM
130ADDRESS_MAP_END
131
132static ADDRESS_MAP_START( arcadia_io, AS_IO, 8)
133//{ S2650_CTRL_PORT,S2650_CTRL_PORT, },
134//{ S2650_DATA_PORT,S2650_DATA_PORT, },
135   AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ( arcadia_vsync_r)
136ADDRESS_MAP_END
137
138/* The Emerson Arcadia 2001 controllers have 2 fire buttons on the side,
139   but actually they are wired to keypad button #2. The following definitions
140   are meant to document this fact. The keypad has the following layout:
141
142     1  2  3
143     4  5  6
144     7  8  9
145    Cl  0 En                                                                  */
146
147static INPUT_PORTS_START( arcadia )
148   PORT_START("panel")
149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )    PORT_NAME("Start")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Option")          PORT_CODE(KEYCODE_O)
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )   PORT_NAME("Select")
152//  PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Reset")           PORT_CODE(KEYCODE_R)         Not implemented
153
154   PORT_START("controller1_col1")
155   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
156   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD)
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD)
158   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD)
159   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Clear") PORT_CODE(KEYCODE_MINUS_PAD)
160
161   PORT_START("controller1_col2")
162   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
163   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD)
164   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD)
165   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD)
166   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 0") PORT_CODE(KEYCODE_0_PAD)
167
168   PORT_START("controller1_col3")
169   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
170   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD)
171   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD)
172   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD)
173   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad Enter") PORT_CODE(KEYCODE_PLUS_PAD)
174
175   PORT_START("controller1_extra")
176   PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium
177
178   PORT_START("controller2_col1")
179   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
180   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z)
181   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A)
182   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q)
183   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Clear") PORT_CODE(KEYCODE_V)
184
185   PORT_START("controller2_col2")
186   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
187   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X)
188   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S)
189   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W)
190   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 0") PORT_CODE(KEYCODE_F)
191
192   PORT_START("controller2_col3")
193   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
194   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C)
195   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D)
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E)
197   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad Enter") PORT_CODE(KEYCODE_R)
198
199   PORT_START("controller2_extra")
200   PORT_BIT( 0xff, 0xf0, IPT_UNUSED) // used in palladium
201
202/* FIXME: the joystick are analog - the actual definition is merely an hack */
203
204#if 0
205   // auto centering too slow, so only using 5 bits, and scaling at videoside
206   PORT_START("controller1_joy_x")
207   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X)
208   PORT_SENSITIVITY(1)
209   PORT_KEYDELTA(2000)
210   PORT_MINMAX(0,0x1f)
211   PORT_CODE_DEC(KEYCODE_LEFT)
212   PORT_CODE_INC(KEYCODE_RIGHT)
213   PORT_CODE_DEC(JOYCODE_1_LEFT)
214   PORT_CODE_INC(JOYCODE_1_RIGHT)
215   PORT_PLAYER(1)
216   PORT_RESET
217
218   PORT_START("controller1_joy_y")
219   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y)
220   PORT_SENSITIVITY(1)
221   PORT_KEYDELTA(2000)
222   PORT_MINMAX(0,0x1f)
223   PORT_CODE_DEC(KEYCODE_UP)
224   PORT_CODE_INC(KEYCODE_DOWN)
225   PORT_CODE_DEC(JOYCODE_1_UP)
226   PORT_CODE_INC(JOYCODE_1_DOWN)
227   PORT_PLAYER(1)
228   PORT_RESET
229
230   PORT_START("controller2_joy_x")
231   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X)
232   PORT_SENSITIVITY(100)
233   PORT_KEYDELTA(10)
234   PORT_MINMAX(0,0x1f)
235   PORT_CODE_DEC(KEYCODE_DEL)
236   PORT_CODE_INC(KEYCODE_PGDN)
237   PORT_CODE_DEC(JOYCODE_2_LEFT)
238   PORT_CODE_INC(JOYCODE_2_RIGHT)
239   PORT_PLAYER(2)
240   PORT_RESET
241
242   PORT_START("controller2_joy_y")
243   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y)
244   PORT_SENSITIVITY(100)
245   PORT_KEYDELTA(10)
246   PORT_MINMAX(0,0x1f)
247   PORT_CODE_DEC(KEYCODE_HOME)
248   PORT_CODE_INC(KEYCODE_END)
249   PORT_CODE_DEC(JOYCODE_2_UP)
250   PORT_CODE_INC(JOYCODE_2_DOWN)
251   PORT_PLAYER(2)
252   PORT_RESET
253#else
254   PORT_START("joysticks")
255   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
256   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
257   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
258   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
259   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
260   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
261   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
262   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
263#endif
264INPUT_PORTS_END
265
266/* The Palladium Video-Computer-Game controllers have no fire buttons on their side
267   but have a 16 keys unlabeled keypad. The keys are fully independent and layed out
268   according to this weird scheme, which keeps backward compatibility to Arcadia 2001's
269   electrical wiring.
270
271        2
272    13 14 15
273     1 16  3
274     4  5  6
275     7  8  9
276    10 11 12                                                                           */
277
278static INPUT_PORTS_START( plldium )
279   PORT_START("panel")
280   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )   PORT_NAME("Start")
281   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SELECT )  PORT_NAME("Selector A")
282   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER )   PORT_NAME("Selector B")    PORT_CODE(KEYCODE_O)
283//  PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Reset")           PORT_CODE(KEYCODE_R)         Not implemented
284
285   PORT_START("controller1_col1")
286   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED) // some bits must be high
287   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD)
288   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 4") PORT_CODE(KEYCODE_4_PAD)
289   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 7") PORT_CODE(KEYCODE_7_PAD)
290   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 10") PORT_CODE(KEYCODE_MINUS_PAD)
291
292   PORT_START("controller1_col2")
293   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
294   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 2/Button") PORT_CODE(KEYCODE_2_PAD)
295   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 5") PORT_CODE(KEYCODE_5_PAD)
296   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 8") PORT_CODE(KEYCODE_8_PAD)
297   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 11") PORT_CODE(KEYCODE_0_PAD)
298
299   PORT_START("controller1_col3")
300   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
301   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 3") PORT_CODE(KEYCODE_3_PAD)
302   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 6") PORT_CODE(KEYCODE_6_PAD)
303   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 9") PORT_CODE(KEYCODE_9_PAD)
304   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 12") PORT_CODE(KEYCODE_PLUS_PAD)
305
306   PORT_START("controller1_extra")
307   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
308   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 13") PORT_CODE(KEYCODE_ENTER_PAD)
309   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 14") PORT_CODE(KEYCODE_SLASH_PAD)
310   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 15") PORT_CODE(KEYCODE_ASTERISK)
311   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 16") PORT_CODE(KEYCODE_DEL_PAD)
312
313   PORT_START("controller2_col1")
314   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
315   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 1") PORT_CODE(KEYCODE_Z)
316   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 4") PORT_CODE(KEYCODE_A)
317   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 7") PORT_CODE(KEYCODE_Q)
318   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 10") PORT_CODE(KEYCODE_V)
319
320   PORT_START("controller2_col2")
321   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
322   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 2/Button") PORT_CODE(KEYCODE_X)
323   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 5") PORT_CODE(KEYCODE_S)
324   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 8") PORT_CODE(KEYCODE_W)
325   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 11") PORT_CODE(KEYCODE_F)
326
327   PORT_START("controller2_col3")
328   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
329   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 3") PORT_CODE(KEYCODE_C)
330   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 6") PORT_CODE(KEYCODE_D)
331   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 9") PORT_CODE(KEYCODE_E)
332   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 12") PORT_CODE(KEYCODE_R)
333
334   PORT_START("controller2_extra")
335   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
336   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 13") PORT_CODE(KEYCODE_B)
337   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 14") PORT_CODE(KEYCODE_G)
338   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 15") PORT_CODE(KEYCODE_T)
339   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P2 Keypad 16") PORT_CODE(KEYCODE_H)
340
341/* FIXME: the joystick are analog - the actual definition is merely an hack */
342
343#if 0
344   // auto centering too slow, so only using 5 bits, and scaling at videoside
345   PORT_START("controller1_joy_x")
346   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_X)
347   PORT_SENSITIVITY(1)
348   PORT_KEYDELTA(2000)
349   PORT_MINMAX(0,0x1f)
350   PORT_CODE_DEC(KEYCODE_LEFT)
351   PORT_CODE_INC(KEYCODE_RIGHT)
352   PORT_CODE_DEC(JOYCODE_1_LEFT)
353   PORT_CODE_INC(JOYCODE_1_RIGHT)
354   PORT_PLAYER(1)
355   PORT_RESET
356
357   PORT_START("controller1_joy_y")
358   PORT_BIT( 0x1fe,0x10,IPT_AD_STICK_Y)
359   PORT_SENSITIVITY(1)
360   PORT_KEYDELTA(2000)
361   PORT_MINMAX(0,0x1f)
362   PORT_CODE_DEC(KEYCODE_UP)
363   PORT_CODE_INC(KEYCODE_DOWN)
364   PORT_CODE_DEC(JOYCODE_1_UP)
365   PORT_CODE_INC(JOYCODE_1_DOWN)
366   PORT_PLAYER(1)
367   PORT_RESET
368
369   PORT_START("controller2_joy_x")
370   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_X)
371   PORT_SENSITIVITY(100)
372   PORT_KEYDELTA(10)
373   PORT_MINMAX(0,0x1f)
374   PORT_CODE_DEC(KEYCODE_DEL)
375   PORT_CODE_INC(KEYCODE_PGDN)
376   PORT_CODE_DEC(JOYCODE_2_LEFT)
377   PORT_CODE_INC(JOYCODE_2_RIGHT)
378   PORT_PLAYER(2)
379   PORT_RESET
380
381   PORT_START("controller2_joy_y")
382   PORT_BIT( 0x1ff,0x10,IPT_AD_STICK_Y)
383   PORT_SENSITIVITY(100)
384   PORT_KEYDELTA(10)
385   PORT_MINMAX(0,0x1f)
386   PORT_CODE_DEC(KEYCODE_HOME)
387   PORT_CODE_INC(KEYCODE_END)
388   PORT_CODE_DEC(JOYCODE_2_UP)
389   PORT_CODE_INC(JOYCODE_2_DOWN)
390   PORT_PLAYER(2)
391   PORT_RESET
392#else
393   PORT_START("joysticks")
394   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )      PORT_PLAYER(1) PORT_8WAY
395   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(1) PORT_8WAY
396   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )      PORT_PLAYER(1) PORT_8WAY
397   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )      PORT_PLAYER(1) PORT_8WAY
398   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )      PORT_PLAYER(2) PORT_8WAY
399   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(2) PORT_8WAY
400   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )      PORT_PLAYER(2) PORT_8WAY
401   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )      PORT_PLAYER(2) PORT_8WAY
402#endif
403INPUT_PORTS_END
404
405static const gfx_layout arcadia_charlayout =
406{
407   8,                  /*width*/
408   1,                  /*height*/
409   256,               /* 256 characters */
410   1,                  /* 1 bits per pixel */
411   { 0 },                  /* no bitplanes; 1 bit per pixel */
412   { 0, 1, 2, 3, 4, 5, 6, 7 },   /* x offsets */
413   { 0 },               /* y offsets */
414   1*8
415};
416
417static GFXDECODE_START( arcadia )
418   GFXDECODE_ENTRY( "gfx1", 0x0000, arcadia_charlayout, 0, 68 )
419GFXDECODE_END
420
421static const rgb_t arcadia_colors[] =
422{
423   RGB_WHITE,               /* white */
424   MAKE_RGB(0xff, 0xff, 0x00),   /* yellow */
425   MAKE_RGB(0x00, 0xff, 0xff),   /* cyan */
426   MAKE_RGB(0x00, 0xff, 0x00),   /* green */
427   MAKE_RGB(0xff, 0x00, 0xff),   /* magenta */
428   MAKE_RGB(0xff, 0x00, 0x00),   /* red */
429   MAKE_RGB(0x00, 0x00, 0xff),   /* blue */
430   RGB_BLACK               /* black */
431};
432
433static const unsigned short arcadia_palette[128+8] =  /* bgnd, fgnd */
434{
435   0,1,2,3,4,5,6,7,
436
437   0,0, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7,
438   1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7,
439   2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7,
440   3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7,
441   4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7,
442   5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7,
443   6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7,
444   7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7
445};
446
447static PALETTE_INIT( arcadia )
448{
449   int i;
450
451   machine.colortable = colortable_alloc(machine, 8);
452
453   for (i = 0; i < 8; i++)
454      colortable_palette_set_color(machine.colortable, i, arcadia_colors[i]);
455
456   for (i = 0; i < 128+8; i++)
457      colortable_entry_set_value(machine.colortable, i, arcadia_palette[i]);
458}
459
460static DEVICE_IMAGE_LOAD( arcadia_cart )
461{
462   UINT8 *rom = image.device().machine().region("maincpu")->base();
463   int size;
464
465   memset(rom, 0, 0x8000);
466   if (image.software_entry() == NULL)
467   {
468      size = image.length();
469
470      if (size > image.device().machine().region("maincpu")->bytes())
471         size = image.device().machine().region("maincpu")->bytes();
472
473      if (image.fread(rom, size) != size)
474         return IMAGE_INIT_FAIL;
475   }
476   else
477   {
478      size = image.get_software_region_length("rom");
479      memcpy(rom, image.get_software_region("rom"), size);
480   }
481
482   if (size > 0x1000)
483      memmove(rom + 0x2000, rom + 0x1000, size - 0x1000);
484
485   if (size > 0x2000)
486      memmove(rom + 0x4000, rom + 0x3000, size - 0x2000);
487
488#if 1
489   // golf cartridge support
490   // 4kbyte at 0x0000
491   // 2kbyte at 0x4000
492   if (size <= 0x2000)
493      memcpy(rom + 0x4000, rom + 0x2000, 0x1000);
494#else
495   /* this is a testpatch for the golf cartridge
496       so it could be burned in a arcadia 2001 cartridge
497       activate it and use debugger to save patched version */
498   // not enough yet (some pointers stored as data?)
499   int i;
500   static const struct { UINT16 address; UINT8 old; UINT8 new; }
501   patch[]= {
502      { 0x0077,0x40,0x20 },
503      { 0x011e,0x40,0x20 },
504      { 0x0348,0x40,0x20 },
505      { 0x03be,0x40,0x20 },
506      { 0x04ce,0x40,0x20 },
507      { 0x04da,0x40,0x20 },
508      { 0x0562,0x42,0x22 },
509      { 0x0617,0x40,0x20 },
510      { 0x0822,0x40,0x20 },
511      { 0x095e,0x42,0x22 },
512      { 0x09d3,0x42,0x22 },
513      { 0x0bb0,0x42,0x22 },
514      { 0x0efb,0x40,0x20 },
515      { 0x0ec1,0x43,0x23 },
516      { 0x0f00,0x40,0x20 },
517      { 0x0f12,0x40,0x20 },
518      { 0x0ff5,0x43,0x23 },
519      { 0x0ff7,0x41,0x21 },
520      { 0x0ff9,0x40,0x20 },
521      { 0x0ffb,0x41,0x21 },
522      { 0x20ec,0x42,0x22 }
523   };
524
525   for (i = 0; i < ARRAY_LENGTH(patch); i++)
526   {
527      assert(rom[patch[i].address] == patch[i].old);
528      rom[patch[i].address] = patch[i].new;
529   }
530#endif
531   return IMAGE_INIT_PASS;
532}
533
534static MACHINE_CONFIG_START( arcadia, arcadia_state )
535   /* basic machine hardware */
536   MCFG_CPU_ADD("maincpu", S2650, 3580000/4)        /* 0.895 MHz */
537   MCFG_CPU_PROGRAM_MAP(arcadia_mem)
538   MCFG_CPU_IO_MAP(arcadia_io)
539   MCFG_CPU_PERIODIC_INT(arcadia_video_line, 262*60)
540   MCFG_QUANTUM_TIME(attotime::from_hz(60))
541
542   /* video hardware */
543   MCFG_SCREEN_ADD("screen", RASTER)
544   MCFG_SCREEN_REFRESH_RATE(60)
545   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
546   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
547   MCFG_SCREEN_SIZE(128+2*XPOS, 262)
548   MCFG_SCREEN_VISIBLE_AREA(0, 2*XPOS+128-1, 0, 262-1)
549   MCFG_SCREEN_UPDATE( arcadia )
550
551   MCFG_GFXDECODE( arcadia )
552   MCFG_PALETTE_LENGTH(ARRAY_LENGTH(arcadia_palette))
553   MCFG_PALETTE_INIT( arcadia )
554
555   MCFG_VIDEO_START( arcadia )
556
557   /* sound hardware */
558   MCFG_SPEAKER_STANDARD_MONO("mono")
559   MCFG_SOUND_ADD("custom", ARCADIA, 0)
560   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
561
562   /* cartridge */
563   MCFG_CARTSLOT_ADD("cart")
564   MCFG_CARTSLOT_EXTENSION_LIST("bin")
565   MCFG_CARTSLOT_NOT_MANDATORY
566   MCFG_CARTSLOT_INTERFACE("arcadia_cart")
567   MCFG_CARTSLOT_LOAD(arcadia_cart)
568
569   /* Software lists */
570   MCFG_SOFTWARE_LIST_ADD("cart_list","arcadia")
571MACHINE_CONFIG_END
572
573ROM_START(advsnha)
574   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
575   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
576ROM_END
577
578ROM_START(bndarc)
579   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
580   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
581ROM_END
582
583ROM_START(arcadia)
584   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
585   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
586ROM_END
587
588ROM_START(tccosmos)
589   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
590   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
591ROM_END
592
593ROM_START(dynavisn)
594   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
595   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
596ROM_END
597
598ROM_START(ekusera)
599   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
600   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
601ROM_END
602
603ROM_START(hanihac)
604   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
605   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
606ROM_END
607
608ROM_START(hmg2650)
609   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
610   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
611ROM_END
612
613ROM_START(intmpt03)
614   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
615   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
616ROM_END
617
618ROM_START(ixl2000)
619   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
620   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
621ROM_END
622
623ROM_START(intervsn)
624   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
625   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
626ROM_END
627
628ROM_START(itmcmtp3)
629   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
630   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
631ROM_END
632
633ROM_START(lvision)
634   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
635   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
636ROM_END
637
638ROM_START(leonardo)
639   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
640   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
641ROM_END
642
643ROM_START(mratlus)
644   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
645   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
646ROM_END
647
648ROM_START(ormatu)
649   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
650   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
651ROM_END
652
653ROM_START(plldium)
654   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
655   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
656ROM_END
657
658ROM_START(polyvcg)
659   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
660   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
661ROM_END
662
663ROM_START(poppympt)
664   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
665   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
666ROM_END
667
668ROM_START(prestmpt)
669   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
670   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
671ROM_END
672
673ROM_START(rowtrn2k)
674   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
675   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
676ROM_END
677
678ROM_START(tvg2000)
679   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
680   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
681ROM_END
682
683ROM_START(sheenhvc)
684   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
685   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
686ROM_END
687
688ROM_START(soundic)
689   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
690   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
691ROM_END
692
693ROM_START(telefevr)
694   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
695   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
696ROM_END
697
698ROM_START(tempestm)
699   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
700   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
701ROM_END
702
703ROM_START(tbbympt3)
704   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
705   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
706ROM_END
707
708ROM_START(trakcvg)
709   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
710   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
711ROM_END
712
713ROM_START(tunixha)
714   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
715   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
716ROM_END
717
718ROM_START(tryomvgc)
719   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
720   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
721ROM_END
722
723ROM_START(orbituvi)
724   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
725   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
726ROM_END
727
728ROM_START(vdmaster)
729   ROM_REGION(0x8000,"maincpu", ROMREGION_ERASEFF)
730   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
731ROM_END
732
733
734/***************************************************************************
735
736  Game driver(s)
737
738***************************************************************************/
739
740static DRIVER_INIT( arcadia )
741{
742   int i;
743   UINT8 *gfx=machine.region("gfx1")->base();
744   for (i=0; i<256; i++) gfx[i]=i;
745#if 0
746   // this is here to allow developement of some simple testroutines
747   // for a real console
748   {
749      UINT8 *rom=machine.region("maincpu")->base();
750      /* this is a simple routine to display all rom characters
751           on the display for a snapshot */
752      static const UINT8 prog[]={ // address 0 of course
753      0x20, // eorz, 0
754      0x1b, 0x01, // bctr,a $0004
755      0x17, // retc a
756      0x76, 0x20, // ppsu ii
757
758      // fill screen
759      0x04, 0x00, // lodi,0 0
760      0x04|1, 0x00, // lodi,1 0
761      0xcc|1, 0x78, 0x10, //a: stra,0 $1800,r1
762      0x75,9, //cpsl wc|c
763      0x84,0x41, // addi,0 0x41
764      0x75,9, //cpsl wc|c
765      0x84|1, 0x01, // addi,1 1
766      0xe4|1, 0x40, // comi,1 40
767      0x98, 0x80-15, // bcfr,0 a
768
769      0x04, 0xff, // lodi,0 7
770      0xcc, 0x18, 0xfc, // stra,0 $19f8
771      0x04, 0x00, // lodi,0 7
772      0xcc, 0x18, 0xfd, // stra,0 $18fd
773      0x04, 0x07, // lodi,0 7
774      0xcc, 0x19, 0xf9, // stra,0 $19f9
775
776      0x04, 0x00, // lodi,0 7
777      0xcc, 0x19, 0xbe, // stra,0 $19bf
778      0x04, 0x00, // lodi,0 7
779      0xcc, 0x19, 0xbf, // stra,0 $19bf
780
781      //loop: 0x0021
782      // print keyboards
783      0x04|1, 0x00, //y:lodi,1 0
784      0x0c|1, 0x79, 0x00, //x: ldra,0 1900,r1
785      0x44|0, 0x0f, //andi,0 0f
786      0x64|0, 0x10, //ori,0  10
787      0xcc|1, 0x78, 0x01, //stra,0 1840,r1
788      0x75,9, //cpsl wc|c
789      0x84|1, 0x01, //addi,1 1
790      0xe4|1, 0x09, //comi,1 9
791      0x98, 0x80-18, //bcfr,0 x
792
793      // cycle colors
794      0x0c|1, 0x19, 0x00, //ldra,1 1900
795      0x44|1, 0xf, //andi,0 0f
796      0xe4|1, 1, //comi,1 1
797      0x98, +10, //bcfr,0 c
798      0x0c, 0x19, 0xbf,//ldra,0 19f9,0
799      0x84, 1, //addi,0 1
800      0xcc, 0x19, 0xbf, //stra,0 19f9,0
801      0x18|3, 12, // bctr,a
802      0xe4|1, 2, //c:comi,1 2
803      0x98, +10, //bcfr,0 d
804      0x0c, 0x19, 0xbf, //ldra,0 19f9,0
805      0x84, 8, //addi,0 8
806      0xcc, 0x19, 0xbf, //stra,0 19f9,0
807      0x18|3, 12, // bctr,a
808
809      // cycle colors
810      0xe4|1, 4, //comi,1 4
811      0x98, +10, //bcfr,0 c
812      0x0c, 0x19, 0xbe,//ldra,0 19f9,0
813      0x84, 1, //addi,0 1
814      0xcc, 0x19, 0xbe, //stra,0 19f9,0
815      0x18|3, 12, // bctr,a
816      0xe4|1, 8, //c:comi,1 2
817      0x98, +8+9, //bcfr,0 d
818      0x0c, 0x19, 0xbe, //ldra,0 19f9,0
819      0x84, 8, //addi,0 8
820      0xcc, 0x19, 0xbe, //stra,0 19f9,0
821
822      0x0c, 0x19, 0x00, //b: ldra,0 1900
823      0x44|0, 0xf, //andi,0 0f
824      0xe4, 0, //comi,0 0
825      0x98, 0x80-9, //bcfr,0 b
826
827      0x0c, 0x19, 0xbe, //ldra,0 19bf
828      0xcc, 0x19, 0xf8, //stra,0 19f8
829      0x0c, 0x19, 0xbf, //ldra,0 19bf
830      0xcc, 0x19, 0xf9, //stra,0 19f8
831
832      0x0c, 0x19, 0xbe, //ldra,0 17ff
833      0x44|0, 0xf, //andi,0 7
834      0x64|0, 0x10, //ori,0  10
835      0xcc, 0x18, 0x0d, //stra,0 180f
836      0x0c, 0x19, 0xbe, //x: ldra,0 19bf
837      0x50, 0x50, 0x50, 0x50, //shr,0 4
838      0x44|0, 0xf, //andi,0 7
839      0x64|0, 0x10, //ori,0  10
840      0xcc, 0x18, 0x0c, //stra,0 180e
841
842      0x0c, 0x19, 0xbf, //ldra,0 17ff
843      0x44|0, 0xf, //andi,0 7
844      0x64|0, 0x10, //ori,0  10
845      0xcc, 0x18, 0x0f, //stra,0 180f
846      0x0c, 0x19, 0xbf, //x: ldra,0 19bf
847      0x50, 0x50, 0x50, 0x50, //shr,0 4
848      0x44|0, 0xf, //andi,0 7
849      0x64|0, 0x10, //ori,0  10
850      0xcc, 0x18, 0x0e, //stra,0 180e
851
852      0x0c, 0x18, 0x00, //ldra,0 1800
853      0x84, 1, //addi,0 1
854      0xcc, 0x18, 0x00, //stra,0 1800
855
856//      0x1b, 0x80-20-29-26-9-8-2 // bctr,a y
857      0x1c|3, 0, 0x32, // bcta,3 loop
858
859      // calling too many subdirectories causes cpu to reset!
860      // bxa causes trap
861      };
862#if 1
863      FILE *f;
864      f=fopen("chartest.bin","wb");
865      fwrite(prog, ARRAY_LENGTH(prog), sizeof(prog[0]), f);
866      fclose(f);
867#endif
868      for (i=0; i<ARRAY_LENGTH(prog); i++) rom[i]=prog[i];
869
870   }
871#endif
872}
873
874
875/*   YEAR  NAME       PARENT     COMPAT    MACHINE       INPUT     INIT          COMPANY               FULLNAME */
876CONS(1983, advsnha,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Advision",           "Advision Home Arcade", GAME_IMPERFECT_SOUND )    /* France */
877CONS(1982, bndarc,    arcadia,   0,        arcadia,      arcadia,  arcadia,      "Bandai",             "Arcadia", GAME_IMPERFECT_SOUND )                 /* Japan */
878CONS(1982, arcadia,   0,         0,        arcadia,      arcadia,  arcadia,      "Emerson",            "Arcadia 2001", GAME_IMPERFECT_SOUND )            /* U.S.A. */
879CONS(198?, tccosmos,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "Mobilar?",           "Tele-Computer Cosmos", GAME_IMPERFECT_SOUND )    /* Spain? I have only found pictures of a German Cosmos ( http://www.pong-picture-page.de/catalog/product_info.php?products_id=2170 ) */
880CONS(1982, dynavisn,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Yamagiwa",           "Dynavision", GAME_IMPERFECT_SOUND )              /* Japan */
881CONS(1982, ekusera,   intmpt03,  0,        arcadia,      arcadia,  arcadia,      "P.I.C",              "Ekusera", GAME_IMPERFECT_SOUND )                 /* Japan */
882CONS(1982, hanihac,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Hanimex",            "Hanimex Home Arcade Centre", GAME_IMPERFECT_SOUND )  /* UK */
883CONS(1982, hmg2650,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Hanimex",            "HMG-2650", GAME_IMPERFECT_SOUND )                 /* Germany */
884CONS(198?, intmpt03,  0,         arcadia,  arcadia,      arcadia,  arcadia,      "Intelligent Game",   "Intelligent Game MPT-03", GAME_IMPERFECT_SOUND )  /* U.S.A */
885CONS(198?, ixl2000,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Intercord",          "Intercord XL 2000 System", GAME_IMPERFECT_SOUND ) /* Germany */
886CONS(198?, intervsn,  ormatu,    0,        arcadia,      arcadia,  arcadia,      "Intervision",        "Intervision 2001", GAME_IMPERFECT_SOUND )         /* Switzerland */
887CONS(198?, itmcmtp3,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "ITMC",               "ITMC MPT-03", GAME_IMPERFECT_SOUND )              /* France */
888CONS(1982, lvision,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Leisure-Dynamics",   "Leisure-Vision", GAME_IMPERFECT_SOUND )           /* Canada */
889CONS(1982, leonardo,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "GiG Electronics",    "Leonardo", GAME_IMPERFECT_SOUND )                 /* Italy */
890CONS(1983, mratlus,   plldium,   0,        arcadia,      arcadia,  arcadia,      "H.G.S.",             "Mr. Altus Tele Brain", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )    /* Germany */
891CONS(198?, ormatu,    0,         arcadia,  arcadia,      arcadia,  arcadia,      "Ormatu Electronics", "Ormatu 2001", GAME_IMPERFECT_SOUND )              /* Netherlands */
892CONS(198?, plldium,   0,         arcadia,  arcadia,      plldium,  arcadia,      "Neckermann",         "Palladium Video-Computer-Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Germany, 16 keys instead of 12 */
893CONS(1983, polyvcg,   plldium,   0,        arcadia,      arcadia,  arcadia,      "Polybrain",          "Polybrain Video Computer Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Germany */
894CONS(198?, poppympt,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Transonic",          "Poppy MPT-03 Tele Computer Spiel", GAME_IMPERFECT_SOUND )           /* Germany */
895CONS(198?, prestmpt,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Prestige",           "Prestige Video Computer Game MPT-03", GAME_IMPERFECT_SOUND )        /* France */
896CONS(198?, rowtrn2k,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Rowtron",            "Rowtron 2000", GAME_IMPERFECT_SOUND )               /* UK */
897CONS(1982, tvg2000,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Schmid",             "Schmid TVG 2000", GAME_IMPERFECT_SOUND )            /* Germany */
898CONS(198?, sheenhvc,  ormatu,    0,        arcadia,      arcadia,  arcadia,      "Sheen",              "Sheen Home Video Centre 2001", GAME_IMPERFECT_SOUND )     /* Australia */
899CONS(198?, soundic,   intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Soundic",            "Soundic MPT-03", GAME_IMPERFECT_SOUND )             /* Finland */
900CONS(198?, telefevr,  arcadia,   0,        arcadia,      arcadia,  arcadia,      "Tchibo",             "Tele-Fever", GAME_IMPERFECT_SOUND )                 /* Germany */
901CONS(198?, tempestm,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tempest",            "Tempest MPT-03", GAME_IMPERFECT_SOUND )             /* Australia */
902CONS(198?, tbbympt3,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tobby",              "Tobby MPT-03", GAME_IMPERFECT_SOUND )               /* ? */
903CONS(198?, trakcvg,   plldium,   0,        arcadia,      arcadia,  arcadia,      "Trakton",            "Trakton Computer Video Game", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )      /* Australia */
904CONS(1982, tunixha,   arcadia,   0,        arcadia,      arcadia,  arcadia,      "Monaco Leisure",     "Tunix Home Arcade", GAME_IMPERFECT_SOUND )          /* New Zealand */
905CONS(198?, tryomvgc,  intmpt03,  0,        arcadia,      arcadia,  arcadia,      "Tryom",              "Tryom Video Game Center", GAME_IMPERFECT_SOUND )    /* U.S.A */
906CONS(198?, orbituvi,  0,         arcadia,  arcadia,      arcadia,  arcadia,      "Orbit Electronics",  "UVI Compu-Game", GAME_IMPERFECT_SOUND )             /* New Zealand */
907CONS(198?, vdmaster,  orbituvi,  0,        arcadia,      arcadia,  arcadia,      "Grandstand",         "Video Master", GAME_IMPERFECT_SOUND )               /* New Zealand */
src/mess/drivers/astrocdeh.c
r0r13302
1/****************************************************************************
2
3    Bally Astrocade consumer hardware
4    driver by Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles,
5    Dirk Best
6
7****************************************************************************/
8
9#include "emu.h"
10#include "cpu/z80/z80.h"
11#include "includes/astrocde.h"
12#include "sound/astrocde.h"
13#include "imagedev/cartslot.h"
14#include "machine/ram.h"
15
16MACHINE_RESET( astrocde );
17void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end);
18
19/*************************************
20 *
21 *  Memory maps
22 *
23 * $0000 to $1FFF:  8K on-board ROM (could be one of three available BIOS dumps)
24 * $2000 to $3FFF:  8K cartridge ROM
25 * $4000 to $4FFF:  4K screen RAM
26 * $5000 to $FFFF:  44K address space not available in standard machine.  With a
27 * sufficiently large RAM expansion, all of this RAM can be added, and accessed
28 * by an extended BASIC program.  Bally and Astrocade BASIC can access from
29 * $5000 to $7FFF if available.
30 *
31 *  RAM Expansions
32 *
33 * Several third party RAM expansions have been made for the Astrocade.  These
34 * allow access to various ranges of the expansion memory ($5000 to $FFFF).
35 * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC
36 * and VIPERSoft BASIC.  All of the expansions also have a RAM protect switch, which
37 * can be flipped at any time to make the RAM act like ROM.  Extended BASIC
38 * programs need access to the RAM and won't work with RAM protect enabled, but
39 * this can be useful with Bally and Astrocade BASIC.  They also have a range switch
40 * (not implemented).  The default position is 6K, but it can be switched to
41 * 2K.  This means that the expanded memory starting at $6000 will instead be
42 * mapped to the cartridge memory starting at $2000.  So it would be possible to
43 * load a cartridge program from tape into the expansion memory, then flip the range
44 * switch and run it as a cartridge.  This is useful for cartridge development.
45 *
46 * NOTE:  If you have any trouble running cartridges with a RAM expansion installed, hit reset.
47 *
48 * Blue RAM -- available in 4K, 16K, and 32K.  These also use an INS8154 chip,
49 * (not yet implemented) which has an additional $80 bytes of RAM mapped
50 * immediately after the end of the expansion address space.  This memory
51 * can't be write protected.  The INS8154 has I/O features needed for loading
52 * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
53 * 4K:  $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
54 * past this range)
55 * 16K:  $6000 to $9FFF
56 * 32K:  $6000 to $DFFF
57 *
58 * VIPER System 1 -- This is available in 16K only.  It also includes a keyboard (not implemented).
59 * 16K:  $6000 to $9FFF
60 *
61 * Lil' WHITE RAM -- This is available in 32K only.  Attempts to read and write
62 * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion
63 * memory $5000 to $7FFF.  The current implementation won't allow the shadow RAM area
64 * to be accessed when RAM protect is on, but there is no known software that will
65 * access the upper range of the expansion RAM when RAM protect is enabled.
66 * 32K:  $5000 to $CFFF
67 *
68 * R&L 64K RAM Board -- This is a highly configurable kit.  RAM can be installed in
69 * 2K increments.  So, the entire 44K expansion memory can be filled.  It is also
70 * possible to override the rest of the memory map with RAM (not implemented).
71 * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented).
72 * RAM write protection can be implemented in three ranges through jumpers or by
73 * installing switches.  The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K),
74 * and $0000 to $FFFF (all 64K).  The current implementation is for 44K expansion memory mapped from
75 * $5000 to $FFFF, with only a single write protect covering this entire range.
76 *
77 *************************************/
78
79static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8 )
80   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w)
81   AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */
82   AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE_MEMBER(astrocde_state, m_videoram) /* ASG */
83ADDRESS_MAP_END
84
85
86static ADDRESS_MAP_START( astrocade_io, AS_IO, 8 )
87   AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w)
88ADDRESS_MAP_END
89
90static INPUT_CHANGED( set_write_protect )  // run when RAM expansion write protect switch is changed
91{
92   int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
93   address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM);
94   UINT8 *expram = ram_get_ptr(field.machine().device("ram_tag"));
95
96   get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
97
98    if (ram_expansion_installed == 1)
99    {
100        if (write_protect_on == 0)  // write protect off, so install memory normally
101        {
102            space->install_ram(expansion_ram_start, expansion_ram_end, expram);
103            if (shadow_ram_end > expansion_ram_end)
104                space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
105        }
106        else  // write protect on, so make memory read only
107        {
108            space->nop_write(expansion_ram_start, expansion_ram_end);
109        }
110     }
111}
112
113/*************************************
114 *
115 *  Input ports
116 *
117 *
118 *  The Astrocade has ports for four hand controllers.  Each controller has a
119 *  knob on top that can be simultaneously pushed as an eight-way joystick and
120 *  twisted as a paddle, in addition to a trigger button.  The knob can twist
121 *  through about 270 degrees, registering 256 unique positions.  It does not
122 *  autocenter.  When selecting options on the menu, twisting the knob to the
123 *  right gives lower numbers, and twisting to the left gives larger numbers.
124 *  Paddle games like Clowns have more intuitive behavior -- twisting to the
125 *  right moves the character right.
126 *
127 *  There is a 24-key keypad on the system itself (6 rows, 4 columns).  It is
128 *  labeled for the built-in calculator, but overlays were released for other
129 *  programs, the most popular being the BASIC cartridges, which allowed a
130 *  large number of inputs by making the bottom row shift buttons.  The labels
131 *  below first list the calculator key, then the BASIC keys in the order of no
132 *  shift, GREEN shift, RED shift, BLUE shift, WORDS shift.
133 *
134 *************************************/
135
136static INPUT_PORTS_START( astrocde )
137   PORT_START("P1HANDLE")
138   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(1) PORT_8WAY
139   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(1) PORT_8WAY
140   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(1) PORT_8WAY
141   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY
142   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(1)
143   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
144
145   PORT_START("P2HANDLE")
146   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(2) PORT_8WAY
147   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(2) PORT_8WAY
148   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(2) PORT_8WAY
149   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY
150   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(2)
151   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
152
153   PORT_START("P3HANDLE")
154   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(3) PORT_8WAY
155   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(3) PORT_8WAY
156   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(3) PORT_8WAY
157   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY
158   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(3)
159   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
160
161   PORT_START("P4HANDLE")
162   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)    PORT_PLAYER(4) PORT_8WAY
163   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)  PORT_PLAYER(4) PORT_8WAY
164   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)  PORT_PLAYER(4) PORT_8WAY
165   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY
166   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)        PORT_PLAYER(4)
167   PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED)
168
169   PORT_START("KEYPAD0")
170   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("%   \xC3\xB7         [   ]   LIST") PORT_CODE(KEYCODE_O)
171   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("/   x     J   K   L   NEXT") PORT_CODE(KEYCODE_SLASH_PAD)
172   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("x   -     V   W   X   IF") PORT_CODE(KEYCODE_ASTERISK)
173   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("-   +     &   @   *   GOTO") PORT_CODE(KEYCODE_MINUS_PAD)
174   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("+   =     #   %   :   PRINT") PORT_CODE(KEYCODE_PLUS_PAD)
175   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("=   WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD)
176   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
177
178   PORT_START("KEYPAD1")
179   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x93   HALT              RUN") PORT_CODE(KEYCODE_PGDN)
180   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CH  9     G   H   I   STEP") PORT_CODE(KEYCODE_H)
181   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9   6     S   T   U   RND") PORT_CODE(KEYCODE_9)
182   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6   3     \xE2\x86\x91   .   \xE2\x86\x93   BOX") PORT_CODE(KEYCODE_6)
183   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3   ERASE (   ;   )") PORT_CODE(KEYCODE_3)
184   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME(".   BLUE Shift") PORT_CODE(KEYCODE_STOP)
185   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
186
187   PORT_START("KEYPAD2")
188   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("\xE2\x86\x91   PAUSE     /   \\") PORT_CODE(KEYCODE_PGUP)
189   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MS  8     D   E   F   TO") PORT_CODE(KEYCODE_S)
190   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8   5     P   Q   R   RETN") PORT_CODE(KEYCODE_8)
191   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5   2     \xE2\x86\x90   '   \xE2\x86\x92   LINE") PORT_CODE(KEYCODE_5)
192   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2   0     <   \"   >   INPUT") PORT_CODE(KEYCODE_2)
193   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0   RED Shift") PORT_CODE(KEYCODE_0)
194   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
195
196   PORT_START("KEYPAD3")
197   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C   GO                +10") PORT_CODE(KEYCODE_C)
198   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("MR  7     A   B   C   FOR") PORT_CODE(KEYCODE_R)
199   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7   4     M   N   O   GOSB") PORT_CODE(KEYCODE_7)
200   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4   1     Y   Z   !   CLEAR") PORT_CODE(KEYCODE_4)
201   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1   SPACE $   ,   ?") PORT_CODE(KEYCODE_1)
202   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CE  GREEN Shift") PORT_CODE(KEYCODE_E)
203   PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED)
204
205   PORT_START("P1_KNOB")
206   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1)
207
208   PORT_START("P2_KNOB")
209   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
210
211   PORT_START("P3_KNOB")
212   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Q) PORT_CODE_INC(KEYCODE_W) PORT_PLAYER(3)
213
214   PORT_START("P4_KNOB")
215   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4)
216
217    PORT_START("CFG")   /* machine config */
218   PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion")
219   PORT_DIPSETTING(   0x00, "No RAM Expansion")
220   PORT_DIPSETTING(   0x01, "16KB Viper System 1 RAM Expansion")
221   PORT_DIPSETTING(   0x02, "32KB Lil' WHITE RAM Expansion")
222   PORT_DIPSETTING(   0x04, "R&L 64K RAM Board (44K installed)")
223   PORT_DIPSETTING(   0x08, "4KB Blue RAM Expansion")
224   PORT_DIPSETTING(   0x10, "16KB Blue RAM Expansion")
225   PORT_DIPSETTING(   0x20, "32KB Blue RAM Expansion")
226
227   PORT_START("PROTECT")  /* Write protect RAM */
228   PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED(set_write_protect, 0)
229   PORT_DIPSETTING( 0x00, "Write Protect Off")
230   PORT_DIPSETTING( 0x01, "Write Protect On")
231INPUT_PORTS_END
232
233
234/*************************************
235 *
236 *  Machine drivers
237 *
238 *************************************/
239
240static MACHINE_CONFIG_START( astrocde, astrocde_state )
241   /* basic machine hardware */
242   MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4)        /* 1.789 MHz */
243   MCFG_CPU_PROGRAM_MAP(astrocade_mem)
244   MCFG_CPU_IO_MAP(astrocade_io)
245
246   MCFG_MACHINE_RESET( astrocde )
247
248   /* video hardware */
249   MCFG_SCREEN_ADD("screen", RASTER)
250   MCFG_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240)
251   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
252   MCFG_SCREEN_UPDATE(astrocde)
253
254   MCFG_PALETTE_LENGTH(512)
255   MCFG_PALETTE_INIT(astrocde)
256
257   MCFG_VIDEO_START(astrocde)
258
259   /* sound hardware */
260   MCFG_SPEAKER_STANDARD_MONO("mono")
261   MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4)
262   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
263
264    /* optional expansion ram (installed in MACHINE_RESET)*/
265   MCFG_RAM_ADD("ram_tag")
266   MCFG_RAM_DEFAULT_SIZE("32k")
267
268   /* cartridge */
269   MCFG_CARTSLOT_ADD("cart")
270   MCFG_CARTSLOT_EXTENSION_LIST("bin")
271   MCFG_CARTSLOT_INTERFACE("astrocde_cart")
272
273   /* Software lists */
274   MCFG_SOFTWARE_LIST_ADD("cart_list","astrocde")
275MACHINE_CONFIG_END
276
277
278/*************************************
279 *
280 *  ROM definitions
281 *
282 *************************************/
283
284ROM_START( astrocde )
285   ROM_REGION( 0x10000, "maincpu", 0 )
286   ROM_LOAD( "astro.bin",  0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc) )
287   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
288ROM_END
289
290ROM_START( astrocdl )
291   ROM_REGION( 0x10000, "maincpu", 0 )
292   ROM_LOAD( "ballyhlc.bin",  0x0000, 0x2000, CRC(d7c517ba) SHA1(6b2bef5d970e54ed204549f58ba6d197a8bfd3cc) )
293   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
294ROM_END
295
296ROM_START( astrocdw )
297   ROM_REGION( 0x10000, "maincpu", 0 )
298   ROM_LOAD( "bioswhit.bin",  0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf) )
299   ROM_CART_LOAD( "cart", 0x2000, 0x8000, 0 )
300ROM_END
301
302/*************************************
303 *
304 *  Driver initialization
305 *
306 *************************************/
307
308static DRIVER_INIT( astrocde )
309{
310   astrocde_state *state = machine.driver_data<astrocde_state>();
311   state->m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS;
312}
313
314MACHINE_RESET( astrocde )
315{
316    int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
317    address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
318    UINT8 *expram = ram_get_ptr(machine.device("ram_tag"));
319    space->unmap_readwrite(0x5000, 0xffff);  // unmap any previously installed expansion RAM
320
321    get_ram_expansion_settings(space, ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
322
323    if (ram_expansion_installed == 1)
324    {
325        if (write_protect_on == 0)  // write protect off, so install memory normally
326        {
327            space->install_ram(expansion_ram_start, expansion_ram_end, expram);
328            if (shadow_ram_end > expansion_ram_end)
329                space->install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
330        }
331        else  // write protect on, so make memory read only
332        {
333            space->nop_write(expansion_ram_start, expansion_ram_end);
334        }
335     }
336}
337
338void get_ram_expansion_settings(address_space *space, int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end)
339{
340    if (input_port_read(space->machine(), "PROTECT") == 0x01)
341        write_protect_on = 1;
342    else
343        write_protect_on = 0;
344
345    ram_expansion_installed = 1;
346
347    switch(input_port_read(space->machine(), "CFG"))  // check RAM expansion configuration and set address ranges
348    {
349        case 0x00:  // No RAM Expansion
350             ram_expansion_installed = 0;
351             break;
352        case 0x01:  // 16KB Viper System 1 RAM Expansion
353             expansion_ram_start = 0x6000;
354             expansion_ram_end = 0x9fff;
355             shadow_ram_end = 0;
356             break;
357        case 0x02:  // "32KB Lil' WHITE RAM Expansion
358             expansion_ram_start = 0x5000;
359             expansion_ram_end = 0xcfff;
360             shadow_ram_end = 0xffff;
361             break;
362        case 0x04:  // R&L 64K RAM Board (44KB installed)
363             expansion_ram_start = 0x5000;
364             expansion_ram_end = 0xffff;
365             shadow_ram_end = 0;
366             break;
367        case 0x08:  // 4KB Blue RAM Expansion
368             expansion_ram_start = 0x6000;
369             expansion_ram_end = 0x6fff;
370             shadow_ram_end = 0;
371             break;
372        case 0x10:  // 16KB Blue RAM Expansion
373             expansion_ram_start = 0x6000;
374             expansion_ram_end = 0x9fff;
375             shadow_ram_end = 0;
376             break;
377        case 0x20:  // 32KB Blue RAM Expansion
378             expansion_ram_start = 0x6000;
379             expansion_ram_end = 0xdfff;
380             shadow_ram_end = 0;
381             break;
382        default:
383            break;
384    }
385}
386
387
388/*************************************
389 *
390 *  Driver definitions
391 *
392 *************************************/
393
394/*    YEAR  NAME      PARENT    COMPAT    MACHINE   INPUT     INIT      COMPANY                FULLNAME                     FLAGS */
395CONS( 1978, astrocde, 0,        0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", GAME_SUPPORTS_SAVE )
396CONS( 1977, astrocdl, astrocde, 0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Home Library Computer", GAME_SUPPORTS_SAVE )
397CONS( 1977, astrocdw, astrocde, 0,        astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", GAME_SUPPORTS_SAVE )
src/mess/drivers/segasms.c
r0r13302
1/******************************************************************************
2 Contributors:
3
4    Marat Fayzullin (MG source)
5    Charles MacDonald
6    Mathis Rosenhauer
7    Brad Oliver
8    Michael Luong
9
10 To do:
11
12 - SIO interface for Game Gear (needs netplay, I guess)
13 - SMS lightgun support
14 - LCD persistence emulation for GG
15 - SMS 3D glass support
16
17 The Game Gear SIO hardware is not emulated but has some
18 placeholders in 'machine/sms.c'
19
20 Changes:
21    Apr 02 - Added raster palette effects for SMS & GG (ML)
22                 - Added sprite collision (ML)
23                 - Added zoomed sprites (ML)
24    May 02 - Fixed paging bug (ML)
25                 - Fixed sprite and tile priority bug (ML)
26                 - Fixed bug #66 (ML)
27                 - Fixed bug #78 (ML)
28                 - try to implement LCD persistence emulation for GG (ML)
29    Jun 10, 02 - Added bios emulation (ML)
30    Jun 12, 02 - Added PAL & NTSC systems (ML)
31    Jun 25, 02 - Added border emulation (ML)
32    Jun 27, 02 - Version bits for Game Gear (bits 6 of port 00) (ML)
33    Nov-Dec, 05 - Numerous cleanups, fixes, updates (WP)
34    Mar, 07 - More cleanups, fixes, mapper additions, etc (WP)
35
36SMS Store Unit memory map for the second CPU:
37
380000-3FFF - BIOS
394000-47FF - RAM
408000      - System Control Register (R/W)
41            Reading:
42            bit7      - ready (0 = ready, 1 = not ready)
43            bit6-bit5 - unknown
44            bit4-bit3 - timer selection bit switches
45            bit2-bit0 - unknown
46            Writing:
47            bit7-bit4 - unknown, maybe led of selected game to set?
48            bit3      - unknown, 1 seems to be written all the time
49            bit2      - unknown, 1 seems to be written all the time
50            bit1      - reset signal for sms cpu, 0 = reset low, 1 = reset high
51            bit0      - which cpu receives interrupt signals, 0 = sms cpu, 1 = controlling cpu
52C000      - Card/Cartridge selction register (W)
53            bit7-bit4 - slot to select
54            bit3      - slot type (0 = cartridge, 1 = card ?)
55            bit2-bit0 - unknown
56C400      - ???? (used once)
57D800      - Selection buttons #1, 1-8 (R)
58DC00      - Selection buttons #2, 9-16 (R)
59
60 ******************************************************************************/
61
62#include "emu.h"
63#include "cpu/z80/z80.h"
64#include "sound/sn76496.h"
65#include "sound/2413intf.h"
66#include "includes/sms.h"
67#include "video/smsvdp.h"
68#include "imagedev/cartslot.h"
69
70#include "sms1.lh"
71
72#define MASTER_CLOCK_PAL   53203400   /* This might be a tiny bit too low */
73
74
75static ADDRESS_MAP_START( sms1_mem, AS_PROGRAM, 8 )
76   AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1")               /* First 0x0400 part always points to first page */
77   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK("bank2")               /* switchable rom bank */
78   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3")               /* switchable rom bank */
79   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4")               /* switchable rom bank */
80   AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w)   /* ROM bank / on-cart RAM */
81   AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w)   /* ROM bank / on-cart RAM */
82   AM_RANGE(0xc000, 0xdff7) AM_MIRROR(0x2000) AM_RAM         /* RAM (mirror at 0xE000) */
83   AM_RANGE(0xdff8, 0xdfff) AM_RAM                  /* RAM "underneath" frame registers */
84   AM_RANGE(0xfff8, 0xfffb) AM_READWRITE(sms_sscope_r, sms_sscope_w)   /* 3-D glasses */
85   AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w)   /* Bankswitch control */
86ADDRESS_MAP_END
87
88static ADDRESS_MAP_START( sms_mem, AS_PROGRAM, 8 )
89   AM_RANGE(0x0000, 0x03ff) AM_ROMBANK("bank1")               /* First 0x0400 part always points to first page */
90   AM_RANGE(0x0400, 0x3fff) AM_ROMBANK("bank2")               /* switchable rom bank */
91   AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank3")               /* switchable rom bank */
92   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank4")               /* switchable rom bank */
93   AM_RANGE(0x8000, 0x9fff) AM_READ_BANK("bank5") AM_WRITE(sms_cartram_w)   /* ROM bank / on-cart RAM */
94   AM_RANGE(0xa000, 0xbfff) AM_READ_BANK("bank6") AM_WRITE(sms_cartram2_w)   /* ROM bank / on-cart RAM */
95   AM_RANGE(0xc000, 0xdffb) AM_MIRROR(0x2000) AM_RAM         /* RAM (mirror at 0xE000) */
96   AM_RANGE(0xdffc, 0xdfff) AM_RAM                  /* RAM "underneath" frame registers */
97   AM_RANGE(0xfffc, 0xffff) AM_READWRITE(sms_mapper_r, sms_mapper_w)   /* Bankswitch control */
98ADDRESS_MAP_END
99
100static ADDRESS_MAP_START( sms_store_mem, AS_PROGRAM, 8 )
101   AM_RANGE(0x0000, 0x3fff) AM_ROM                  /* BIOS */
102   AM_RANGE(0x4000, 0x47ff) AM_RAM                  /* RAM */
103   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank10")               /* Cartridge/card peek area */
104   AM_RANGE(0x8000, 0x8000) AM_READWRITE(sms_store_control_r, sms_store_control_w)   /* Control */
105   AM_RANGE(0xc000, 0xc000) AM_READWRITE(sms_store_cart_select_r, sms_store_cart_select_w)    /* cartridge/card slot selector */
106   AM_RANGE(0xd800, 0xd800) AM_READ(sms_store_select1)         /* Game selector port #1 */
107   AM_RANGE(0xdc00, 0xdc00) AM_READ(sms_store_select2)         /* Game selector port #2 */
108ADDRESS_MAP_END
109
110static ADDRESS_MAP_START( sms_io, AS_IO, 8 )
111   ADDRESS_MAP_GLOBAL_MASK(0xff)
112   ADDRESS_MAP_UNMAP_HIGH
113   AM_RANGE(0x00, 0x00) AM_MIRROR(0x3e) AM_WRITE(sms_bios_w)
114   AM_RANGE(0x01, 0x01) AM_MIRROR(0x3e) AM_WRITE(sms_io_control_w)
115   AM_RANGE(0x40, 0x7f)                 AM_READ(sms_count_r)
116   AM_RANGE(0x40, 0x7f)                 AM_DEVWRITE("segapsg", sn76496_w)
117   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_data_r, sms_vdp_data_w)
118   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_ctrl_r, sms_vdp_ctrl_w)
119   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1e) AM_READ(sms_input_port_0_r)
120   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x1e) AM_READ(sms_input_port_1_r)
121   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0e) AM_READ(sms_input_port_0_r)
122   AM_RANGE(0xe1, 0xe1) AM_MIRROR(0x0e) AM_READ(sms_input_port_1_r)
123   AM_RANGE(0xf0, 0xf0)                 AM_READWRITE(sms_input_port_0_r, sms_ym2413_register_port_0_w)
124   AM_RANGE(0xf1, 0xf1)                 AM_READWRITE(sms_input_port_1_r, sms_ym2413_data_port_0_w)
125   AM_RANGE(0xf2, 0xf2)                 AM_READWRITE(sms_fm_detect_r, sms_fm_detect_w)
126   AM_RANGE(0xf3, 0xf3)                 AM_READ(sms_input_port_1_r)
127   AM_RANGE(0xf4, 0xf4) AM_MIRROR(0x02) AM_READ(sms_input_port_0_r)
128   AM_RANGE(0xf5, 0xf5) AM_MIRROR(0x02) AM_READ(sms_input_port_1_r)
129   AM_RANGE(0xf8, 0xf8) AM_MIRROR(0x06) AM_READ(sms_input_port_0_r)
130   AM_RANGE(0xf9, 0xf9) AM_MIRROR(0x06) AM_READ(sms_input_port_1_r)
131ADDRESS_MAP_END
132
133static ADDRESS_MAP_START( gg_io, AS_IO, 8 )
134   ADDRESS_MAP_GLOBAL_MASK(0xff)
135   ADDRESS_MAP_UNMAP_HIGH
136   AM_RANGE(0x00, 0x00)                 AM_READ(gg_input_port_2_r)
137   AM_RANGE(0x01, 0x05)                 AM_READWRITE(gg_sio_r, gg_sio_w)
138   AM_RANGE(0x06, 0x06)                 AM_DEVWRITE("gamegear", sn76496_stereo_w)
139   AM_RANGE(0x07, 0x07)                 AM_WRITE(sms_io_control_w)
140   AM_RANGE(0x08, 0x08) AM_MIRROR(0x06) AM_WRITE(sms_bios_w)
141   AM_RANGE(0x09, 0x09) AM_MIRROR(0x06) AM_WRITE(sms_io_control_w)
142   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0e) AM_WRITE(sms_bios_w)
143   AM_RANGE(0x11, 0x11) AM_MIRROR(0x0e) AM_WRITE(sms_io_control_w)
144   AM_RANGE(0x20, 0x20) AM_MIRROR(0x1e) AM_WRITE(sms_bios_w)
145   AM_RANGE(0x21, 0x21) AM_MIRROR(0x1e) AM_WRITE(sms_io_control_w)
146   AM_RANGE(0x40, 0x7f)                 AM_READ(sms_count_r)
147   AM_RANGE(0x40, 0x7f)                 AM_DEVWRITE("gamegear", sn76496_w)
148   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_data_r, sms_vdp_data_w)
149   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("sms_vdp", sms_vdp_ctrl_r, sms_vdp_ctrl_w)
150   AM_RANGE(0xc0, 0xc0)                 AM_READ_PORT("PORT_DC")
151   AM_RANGE(0xc1, 0xc1)                 AM_READ_PORT("PORT_DD")
152   AM_RANGE(0xdc, 0xdc)                 AM_READ_PORT("PORT_DC")
153   AM_RANGE(0xdd, 0xdd)                 AM_READ_PORT("PORT_DD")
154ADDRESS_MAP_END
155
156
157static INPUT_PORTS_START( sms )
158   PORT_START("PORT_DC")
159   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
160   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
161   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
162   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
163   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
164   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x00)
165   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
166   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
167
168   PORT_START("PORT_DD")
169   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
170   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
171   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
172   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x00)
173   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* Software Reset bit */
174   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
175   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) /* Port A TH */
176   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* Port B TH */
177
178   PORT_START("PAUSE")
179   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
180   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME(DEF_STR(Pause))
181
182   PORT_START("LPHASER0")   /* Light phaser X - player 1 */
183   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CHANGED(lgun1_changed, NULL) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
184
185   PORT_START("LPHASER1")   /* Light phaser Y - player 1 */
186   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_CHANGED(lgun1_changed, NULL) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
187
188   PORT_START("LPHASER2")   /* Light phaser X - player 2 */
189   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_CHANGED(lgun2_changed, NULL) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
190
191   PORT_START("LPHASER3")   /* Light phaser Y - player 2 */
192   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(2) PORT_CHANGED(lgun2_changed, NULL) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
193
194   PORT_START("RFU")   /* Rapid Fire Unit */
195   PORT_CONFNAME( 0x03, 0x00, "Rapid Fire Unit - Player 1" )
196   PORT_CONFSETTING(   0x00, DEF_STR( Off ) )
197   PORT_CONFSETTING(   0x01, "Button A" )
198   PORT_CONFSETTING(   0x02, "Button B" )
199   PORT_CONFSETTING(   0x03, "Button A + B" )
200   PORT_CONFNAME( 0x0c, 0x00, "Rapid Fire Unit - Player 2" )
201   PORT_CONFSETTING(   0x00, DEF_STR( Off ) )
202   PORT_CONFSETTING(   0x04, "Button A" )
203   PORT_CONFSETTING(   0x08, "Button B" )
204   PORT_CONFSETTING(   0x0c, "Button A + B" )
205
206   PORT_START("PADDLE0")   /* Paddle player 1 */
207   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x02)
208
209   PORT_START("PADDLE1")   /* Paddle player 2 */
210   PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x20)
211
212   PORT_START("CTRLIPT")   /* Light Phaser and Paddle Control buttons */
213   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x01)
214   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x02)
215   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
216   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
217   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x10)
218   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x20)
219   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
220   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
221
222   PORT_START("CTRLSEL")   /* Controller selection */
223   PORT_CONFNAME( 0x0f, 0x00, "Player 1 Controller" )
224   PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) )
225   PORT_CONFSETTING( 0x01, "Light Phaser" )
226   PORT_CONFSETTING( 0x02, "Sega Paddle Control" )
227   PORT_CONFSETTING( 0x04, "Sega Sports Pad" )
228   PORT_CONFNAME( 0xf0, 0x00, "Player 2 Controller" )
229   PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) )
230   PORT_CONFSETTING( 0x10, "Light Phaser" )
231   PORT_CONFSETTING( 0x20, "Sega Paddle Control" )
232   PORT_CONFSETTING( 0x40, "Sega Sports Pad" )
233
234   PORT_START("SPORT0")   /* Player 1 Sports Pad X axis */
235   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
236
237   PORT_START("SPORT1")   /* Player 1 Sports Pad Y axis */
238   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, PORTCOND_EQUALS, 0x04)
239
240   PORT_START("SPORT2")   /* Player 2 Sports Pad X axis */
241   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
242
243   PORT_START("SPORT3")   /* Player 2 Sports Pad Y axis */
244   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_PLAYER(2) PORT_CONDITION("CTRLSEL", 0xf0, PORTCOND_EQUALS, 0x40)
245INPUT_PORTS_END
246
247static INPUT_PORTS_START( sms1 )
248   PORT_INCLUDE( sms )
249
250   PORT_START("RESET")
251   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Reset Button")
252
253   PORT_START("SEGASCOPE")
254   PORT_CONFNAME( 0x01, 0x00, "SegaScope (3-D Glasses)" )
255   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
256   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
257
258   PORT_START("SSCOPE_BINOCULAR")
259   PORT_CONFNAME( 0x03, 0x00, "SegaScope - Binocular Hack" ) PORT_CONDITION("SEGASCOPE", 0x01, PORTCOND_EQUALS, 0x01)
260   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
261   PORT_CONFSETTING( 0x01, "Left Lens" )
262   PORT_CONFSETTING( 0x02, "Right Lens" )
263   PORT_CONFSETTING( 0x03, "Both Lens" )
264   PORT_BIT( 0x03, 0x00, IPT_UNUSED ) PORT_CONDITION("SEGASCOPE", 0x01, PORTCOND_EQUALS, 0x00)
265INPUT_PORTS_END
266
267static INPUT_PORTS_START( smsj )
268   PORT_INCLUDE( sms1 )
269
270   PORT_START("TVDRAW")
271   PORT_CONFNAME( 0x01, 0x00, "Terebi Oekaki Graphics Tablet" )
272   PORT_CONFSETTING( 0x00, DEF_STR( Off ) )
273   PORT_CONFSETTING( 0x01, DEF_STR( On ) )
274
275   PORT_START("TVDRAW_X")
276   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_NAME("Tablet - X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
277   PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
278
279   PORT_START("TVDRAW_Y")
280   PORT_BIT( 0xff, 0x60, IPT_LIGHTGUN_Y ) PORT_NAME("Tablet - Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 191) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
281   PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
282
283   PORT_START("TVDRAW_PEN")
284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Tablet - Pen") PORT_CONDITION("TVDRAW", 0x01, PORTCOND_EQUALS, 0x01)
285INPUT_PORTS_END
286
287static INPUT_PORTS_START( gg )
288   PORT_START("PORT_DC")
289   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
290   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
291   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
292   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
295   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
296
297   PORT_START("PORT_DD")
298   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
299
300   PORT_START("START")
301   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
302   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */
303INPUT_PORTS_END
304
305static PALETTE_INIT( sms )
306{
307   int i;
308   for (i = 0; i < 64; i++)
309   {
310      int r = i & 0x03;
311      int g = (i & 0x0c) >> 2;
312      int b = (i & 0x30) >> 4;
313      palette_set_color_rgb(machine, i, r << 6, g << 6, b << 6);
314   }
315   /* TMS9918 palette */
316   palette_set_color_rgb(machine, 64+ 0,   0,   0,   0);
317   palette_set_color_rgb(machine, 64+ 1,   0,   0,   0);
318   palette_set_color_rgb(machine, 64+ 2,  33, 200,  66);
319   palette_set_color_rgb(machine, 64+ 3,  94, 220, 120);
320   palette_set_color_rgb(machine, 64+ 4,  84,  85, 237);
321   palette_set_color_rgb(machine, 64+ 5, 125, 118, 252);
322   palette_set_color_rgb(machine, 64+ 6, 212,  82,  77);
323   palette_set_color_rgb(machine, 64+ 7,  66, 235, 245);
324   palette_set_color_rgb(machine, 64+ 8, 252,  85,  84);
325   palette_set_color_rgb(machine, 64+ 9, 255, 121, 120);
326   palette_set_color_rgb(machine, 64+10, 212, 193,  84);
327   palette_set_color_rgb(machine, 64+11, 230, 206, 128);
328   palette_set_color_rgb(machine, 64+12,  33, 176,  59);
329   palette_set_color_rgb(machine, 64+13, 201,  91, 186);
330   palette_set_color_rgb(machine, 64+14, 204, 204, 204);
331   palette_set_color_rgb(machine, 64+15, 255, 255, 255);
332}
333
334static PALETTE_INIT( gamegear )
335{
336   int i;
337   for (i = 0; i < 4096; i++)
338   {
339      int r = i & 0x000f;
340      int g = (i & 0x00f0) >> 4;
341      int b = (i & 0x0f00) >> 8;
342      palette_set_color_rgb(machine, i, r << 4, g << 4, b << 4);
343   }
344}
345
346
347
348static void sms_int_callback( running_machine &machine, int state )
349{
350   cputag_set_input_line(machine, "maincpu", 0, state);
351}
352
353static const smsvdp_interface _315_5124_intf =
354{
355   MODEL_315_5124,
356   sms_int_callback,
357   sms_pause_callback
358};
359
360static const smsvdp_interface _315_5246_intf =
361{
362   MODEL_315_5246,
363   sms_int_callback,
364   sms_pause_callback
365};
366
367static const smsvdp_interface _315_5378_intf =
368{
369   MODEL_315_5378,
370   sms_int_callback,
371   sms_pause_callback
372};
373
374static const smsvdp_interface sms_store_intf =
375{
376   MODEL_315_5124,
377   sms_store_int_callback,
378   sms_pause_callback
379};
380
381static MACHINE_CONFIG_FRAGMENT( sms_cartslot )
382   MCFG_CARTSLOT_ADD("cart1")
383   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin")
384   MCFG_CARTSLOT_NOT_MANDATORY
385   MCFG_CARTSLOT_INTERFACE("sms_cart")
386   MCFG_CARTSLOT_START(sms_cart)
387   MCFG_CARTSLOT_LOAD(sms_cart)
388
389   MCFG_SOFTWARE_LIST_ADD("cart_list","sms")
390MACHINE_CONFIG_END
391
392static MACHINE_CONFIG_FRAGMENT( gg_cartslot )
393   MCFG_CARTSLOT_ADD("cart1")
394   MCFG_CARTSLOT_EXTENSION_LIST("gg,bin")
395   MCFG_CARTSLOT_MANDATORY
396   MCFG_CARTSLOT_INTERFACE("gamegear_cart")
397   MCFG_CARTSLOT_START(sms_cart)
398   MCFG_CARTSLOT_LOAD(sms_cart)
399
400   MCFG_SOFTWARE_LIST_ADD("cart_list","gamegear")
401MACHINE_CONFIG_END
402
403static MACHINE_CONFIG_START( sms_ntsc_base, sms_state )
404   /* basic machine hardware */
405   MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15)
406   MCFG_CPU_PROGRAM_MAP(sms_mem)
407   MCFG_CPU_IO_MAP(sms_io)
408
409   MCFG_QUANTUM_TIME(attotime::from_hz(60))
410
411   MCFG_MACHINE_START(sms)
412   MCFG_MACHINE_RESET(segasms)
413
414   /* sound hardware */
415   MCFG_SPEAKER_STANDARD_MONO("mono")
416   MCFG_SOUND_ADD("segapsg", SEGAPSG, XTAL_53_693175MHz/15)
417   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
418
419   MCFG_FRAGMENT_ADD( sms_cartslot )
420MACHINE_CONFIG_END
421
422static MACHINE_CONFIG_DERIVED( sms2_ntsc, sms_ntsc_base )
423   /* video hardware */
424   MCFG_SCREEN_ADD("screen", RASTER)
425   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
426   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
427   MCFG_SCREEN_UPDATE(sms)
428
429   MCFG_PALETTE_LENGTH(64+16)
430   MCFG_PALETTE_INIT(sms)
431
432   MCFG_SMSVDP_ADD("sms_vdp", _315_5246_intf)
433MACHINE_CONFIG_END
434
435static MACHINE_CONFIG_DERIVED( sms1_ntsc, sms_ntsc_base )
436
437   MCFG_CPU_MODIFY("maincpu")
438   MCFG_CPU_PROGRAM_MAP(sms1_mem)   // This adds the SegaScope handlers for 3-D glasses
439   MCFG_CPU_IO_MAP(sms_io)
440
441   /* video hardware */
442   MCFG_SCREEN_ADD("screen", RASTER)
443   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
444   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
445   MCFG_SCREEN_UPDATE(sms1)
446
447   MCFG_SCREEN_ADD("left_lcd", LCD)   // This is needed for SegaScope Left LCD
448   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
449   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
450   MCFG_SCREEN_UPDATE(sms1)
451
452   MCFG_SCREEN_ADD("right_lcd", LCD)   // This is needed for SegaScope Right LCD
453   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
454   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, NTSC_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS, TBORDER_START + NTSC_224_TBORDER_Y_PIXELS + 224)
455   MCFG_SCREEN_UPDATE(sms1)
456
457   MCFG_DEFAULT_LAYOUT(layout_sms1)
458
459   MCFG_PALETTE_LENGTH(64+16)
460   MCFG_PALETTE_INIT(sms)
461
462   MCFG_VIDEO_START(sms1)
463
464   MCFG_SMSVDP_ADD("sms_vdp", _315_5124_intf)
465MACHINE_CONFIG_END
466
467#define MCFG_SMSSDISP_CARTSLOT_ADD(_tag) \
468   MCFG_CARTSLOT_ADD(_tag) \
469   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin") \
470   MCFG_CARTSLOT_NOT_MANDATORY \
471   MCFG_CARTSLOT_INTERFACE("sms_cart") \
472   MCFG_CARTSLOT_START(sms_cart) \
473   MCFG_CARTSLOT_LOAD(sms_cart)
474
475static MACHINE_CONFIG_DERIVED( sms_sdisp, sms2_ntsc )
476
477   MCFG_DEVICE_REMOVE("sms_vdp")
478   MCFG_SMSVDP_ADD("sms_vdp", sms_store_intf)
479
480   MCFG_CPU_ADD("control", Z80, XTAL_53_693175MHz/15)
481   MCFG_CPU_PROGRAM_MAP(sms_store_mem)
482   /* Both CPUs seem to communicate with the VDP etc? */
483   MCFG_CPU_IO_MAP(sms_io)
484
485   MCFG_CARTSLOT_MODIFY("cart1")
486   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin")
487   MCFG_CARTSLOT_MANDATORY
488   MCFG_CARTSLOT_INTERFACE("sms_cart")
489   MCFG_CARTSLOT_START(sms_cart)
490   MCFG_CARTSLOT_LOAD(sms_cart)
491
492   MCFG_SMSSDISP_CARTSLOT_ADD("cart2")
493   MCFG_SMSSDISP_CARTSLOT_ADD("cart3")
494   MCFG_SMSSDISP_CARTSLOT_ADD("cart4")
495   MCFG_SMSSDISP_CARTSLOT_ADD("cart5")
496   MCFG_SMSSDISP_CARTSLOT_ADD("cart6")
497   MCFG_SMSSDISP_CARTSLOT_ADD("cart7")
498   MCFG_SMSSDISP_CARTSLOT_ADD("cart8")
499   MCFG_SMSSDISP_CARTSLOT_ADD("cart9")
500   MCFG_SMSSDISP_CARTSLOT_ADD("cart10")
501   MCFG_SMSSDISP_CARTSLOT_ADD("cart11")
502   MCFG_SMSSDISP_CARTSLOT_ADD("cart12")
503   MCFG_SMSSDISP_CARTSLOT_ADD("cart13")
504   MCFG_SMSSDISP_CARTSLOT_ADD("cart14")
505   MCFG_SMSSDISP_CARTSLOT_ADD("cart15")
506   MCFG_SMSSDISP_CARTSLOT_ADD("cart16")
507MACHINE_CONFIG_END
508
509static MACHINE_CONFIG_START( sms_pal_base, sms_state )
510   /* basic machine hardware */
511   MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_PAL/15)
512   MCFG_CPU_PROGRAM_MAP(sms_mem)
513   MCFG_CPU_IO_MAP(sms_io)
514
515   MCFG_QUANTUM_TIME(attotime::from_hz(60))
516
517   MCFG_MACHINE_START(sms)
518   MCFG_MACHINE_RESET(segasms)
519
520   /* sound hardware */
521   MCFG_SPEAKER_STANDARD_MONO("mono")
522   MCFG_SOUND_ADD("segapsg", SEGAPSG, MASTER_CLOCK_PAL/15)
523   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
524
525   MCFG_FRAGMENT_ADD( sms_cartslot )
526MACHINE_CONFIG_END
527
528static MACHINE_CONFIG_DERIVED( sms2_pal, sms_pal_base )
529
530   /* video hardware */
531   MCFG_SCREEN_ADD("screen", RASTER)
532   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
533   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
534   MCFG_SCREEN_UPDATE(sms)
535
536   MCFG_PALETTE_LENGTH(64+16)
537   MCFG_PALETTE_INIT(sms)
538
539   MCFG_SMSVDP_ADD("sms_vdp", _315_5246_intf)
540MACHINE_CONFIG_END
541
542static MACHINE_CONFIG_DERIVED( sms1_pal, sms_pal_base )
543
544   MCFG_CPU_MODIFY("maincpu")
545   MCFG_CPU_PROGRAM_MAP(sms1_mem)   // This adds the SegaScope handlers for 3-D glasses
546   MCFG_CPU_IO_MAP(sms_io)
547
548   /* video hardware */
549   MCFG_SCREEN_ADD("screen", RASTER)
550   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
551   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
552   MCFG_SCREEN_UPDATE(sms1)
553
554   MCFG_SCREEN_ADD("left_lcd", LCD)   // This is needed for SegaScope Left LCD
555   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
556   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
557   MCFG_SCREEN_UPDATE(sms1)
558
559   MCFG_SCREEN_ADD("right_lcd", LCD)   // This is needed for SegaScope Right LCD
560   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
561   MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK_PAL/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS - 2, LBORDER_START + LBORDER_X_PIXELS + 256 + 10, PAL_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS, TBORDER_START + PAL_240_TBORDER_Y_PIXELS + 240)
562   MCFG_SCREEN_UPDATE(sms1)
563
564   MCFG_PALETTE_LENGTH(64+16)
565   MCFG_PALETTE_INIT(sms)
566
567   MCFG_DEFAULT_LAYOUT(layout_sms1)
568
569   MCFG_SMSVDP_ADD("sms_vdp", _315_5124_intf)
570MACHINE_CONFIG_END
571
572static MACHINE_CONFIG_DERIVED( sms_fm, sms1_ntsc )
573
574   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15)
575   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
576MACHINE_CONFIG_END
577
578static MACHINE_CONFIG_DERIVED( sg1000m3, sms_fm )
579
580   MCFG_CARTSLOT_MODIFY("cart1")
581   MCFG_CARTSLOT_EXTENSION_LIST("sms,bin,sg")
582   MCFG_CARTSLOT_MANDATORY
583   MCFG_CARTSLOT_START(sms_cart)
584   MCFG_CARTSLOT_LOAD(sms_cart)
585MACHINE_CONFIG_END
586
587static MACHINE_CONFIG_DERIVED( sms2_fm, sms2_ntsc )
588
589   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_53_693175MHz/15)
590   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
591MACHINE_CONFIG_END
592
593static MACHINE_CONFIG_START( gamegear, sms_state )
594   /* basic machine hardware */
595   MCFG_CPU_ADD("maincpu", Z80, XTAL_53_693175MHz/15)
596   MCFG_CPU_PROGRAM_MAP(sms_mem)
597   MCFG_CPU_IO_MAP(gg_io)
598
599   MCFG_QUANTUM_TIME(attotime::from_hz(60))
600
601   MCFG_MACHINE_START(sms)
602   MCFG_MACHINE_RESET(segasms)
603
604   /* video hardware */
605   MCFG_SCREEN_ADD("screen", LCD)
606   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
607   MCFG_SCREEN_RAW_PARAMS(XTAL_53_693175MHz/10, SMS_X_PIXELS, LBORDER_START + LBORDER_X_PIXELS + 6*8, LBORDER_START + LBORDER_X_PIXELS + 26*8, NTSC_Y_PIXELS, TBORDER_START + NTSC_192_TBORDER_Y_PIXELS + 3*8, TBORDER_START + NTSC_192_TBORDER_Y_PIXELS + 21*8 )
608   MCFG_SCREEN_UPDATE(gamegear)
609
610   MCFG_PALETTE_LENGTH(4096)
611   MCFG_PALETTE_INIT(gamegear)
612
613   MCFG_VIDEO_START(gamegear)
614
615   MCFG_SMSVDP_ADD("sms_vdp", _315_5378_intf)
616
617   /* sound hardware */
618   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
619   MCFG_SOUND_ADD("gamegear", GAMEGEAR, XTAL_53_693175MHz/15)
620   MCFG_SOUND_ROUTE(0, "lspeaker", 1.00)
621   MCFG_SOUND_ROUTE(1, "rspeaker", 1.00)
622
623   /* cartridge */
624   MCFG_FRAGMENT_ADD( gg_cartslot )
625MACHINE_CONFIG_END
626
627
628ROM_START(sms1)
629   ROM_REGION(0x4000, "maincpu", 0)
630   ROM_FILL(0x0000, 0x4000, 0xff)
631
632   ROM_REGION(0x20000, "user1", 0)
633   ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" )
634   ROMX_LOAD("bios13fx.rom", 0x0000, 0x2000, CRC(0072ED54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1))
635   ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
636   ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91E93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2))
637   ROM_SYSTEM_BIOS( 2, "hangon", "US/European BIOS v3.4 with Hang On (1988)" )
638   ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8EDF7AC6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3))
639   ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" )
640   ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(E79BB689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4))
641   ROM_SYSTEM_BIOS( 4, "proto", "US Master System Prototype BIOS" )
642   ROMX_LOAD("m404prot.rom", 0x0000, 0x2000, CRC(1a15dfcc) SHA1(4a06c8e66261611dce0305217c42138b71331701), ROM_BIOS(5))
643ROM_END
644
645ROM_START(sms)
646   ROM_REGION(0x4000, "maincpu", 0)
647   ROM_FILL(0x0000, 0x4000, 0xff)
648
649   ROM_REGION(0x20000, "user1", 0)
650   ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" )
651   ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(CF4A09EA) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */
652ROM_END
653
654ROM_START(smssdisp)
655   ROM_REGION(0x4000, "maincpu", 0)
656   ROM_FILL(0x0000, 0x4000, 0x00)
657
658   ROM_REGION(0x4000, "user1", 0)
659   ROM_FILL(0x0000, 0x4000, 0xff)
660
661   ROM_REGION(0x4000, "control", 0)
662   ROM_LOAD("smssdisp.rom", 0x0000, 0x4000, CRC(ee2c29ba) SHA1(fc465122134d95363112eb51b9ab71db3576cefd))
663ROM_END
664
665ROM_START(sms1pal)
666   ROM_REGION(0x4000, "maincpu", 0)
667   ROM_FILL(0x0000, 0x4000, 0xff)
668
669   ROM_REGION(0x20000, "user1", 0)
670   ROM_SYSTEM_BIOS( 0, "bios13", "US/European BIOS v1.3 (1986)" )
671   ROMX_LOAD("bios13fx.rom", 0x0000, 0x2000, CRC(0072ED54) SHA1(c315672807d8ddb8d91443729405c766dd95cae7), ROM_BIOS(1))
672   ROM_SYSTEM_BIOS( 1, "hangonsh", "US/European BIOS v2.4 with Hang On and Safari Hunt (1988)" )
673   ROMX_LOAD("mpr-11459a.rom", 0x0000, 0x20000, CRC(91E93385) SHA1(9e179392cd416af14024d8f31c981d9ee9a64517), ROM_BIOS(2))
674   ROM_SYSTEM_BIOS( 2, "hangon", "Sega Master System - US/European BIOS v3.4 with Hang On (1988)" )
675   ROMX_LOAD("mpr-11458.rom", 0x0000, 0x20000, CRC(8EDF7AC6) SHA1(51fd6d7990f62cd9d18c9ecfc62ed7936169107e), ROM_BIOS(3))
676   ROM_SYSTEM_BIOS( 3, "missiled", "US/European BIOS v4.4 with Missile Defense 3D (1988)" )
677   ROMX_LOAD("missiled.rom", 0x0000, 0x20000, CRC(E79BB689) SHA1(aa92ae576ca670b00855e278378d89e9f85e0351), ROM_BIOS(4))
678ROM_END
679
680ROM_START(smspal)
681   ROM_REGION(0x4000, "maincpu", 0)
682   ROM_FILL(0x0000, 0x4000, 0xff)
683
684   ROM_REGION(0x40000, "user1", 0)
685   ROM_SYSTEM_BIOS( 0, "alexkidd", "US/European BIOS with Alex Kidd in Miracle World (1990)" ) /* PCB Label: SEGA // IC BD M4Jr. PAL" Master System II with 314-5246 (ZIP) VDP and 314-5237 (DIP48) IO */
686   ROMX_LOAD("mpr-12808.ic2", 0x0000, 0x20000, CRC(CF4A09EA) SHA1(3af7b66248d34eb26da40c92bf2fa4c73a46a051), ROM_BIOS(1)) /* "SEGA // MPR-12808 W63 // 9114E9004" @ IC2 */
687   ROM_SYSTEM_BIOS( 1, "sonic", "European/Brazilian BIOS with Sonic the Hedgehog (1991)" )
688   ROMX_LOAD("sonbios.rom", 0x0000, 0x40000, CRC(81C3476B) SHA1(6aca0e3dffe461ba1cb11a86cd4caf5b97e1b8df), ROM_BIOS(2))
689ROM_END
690
691ROM_START(sg1000m3)
692   ROM_REGION(0x4000, "maincpu", 0)
693   ROM_FILL(0x0000, 0x4000, 0x00)
694ROM_END
695
696ROM_START(smsj) /* PCB Label: "SEGA(R) IC BOARD M4J MAIN // 837-6418"; has "YM2413 // 78 04 71 G" at IC10; Back of pcb has traces marked "171-5541 (C)SEGA 1987 MADE IN JAPAN"
697    see http://www.smspower.org/Development/JapaneseSMS837-6418 */
698   ROM_REGION(0x4000, "maincpu", 0)
699   ROM_FILL(0x0000, 0x4000, 0xff)
700
701   ROM_REGION(0x4000, "user1", 0)
702   ROM_SYSTEM_BIOS( 0, "jbios21", "Japanese BIOS v2.1 (1987)" )
703   ROMX_LOAD("mpr-11124.ic2", 0x0000, 0x2000, CRC(48D44A13) SHA1(a8c1b39a2e41137835eda6a5de6d46dd9fadbaf2), ROM_BIOS(1)) /* "SONY 7J06 // MPR-11124 // JAPAN 021" @ IC2 */
704ROM_END
705
706ROM_START(sms2kr)
707   ROM_REGION(0x4000, "maincpu", 0)
708   ROM_FILL(0x0000, 0x4000, 0xff)
709
710   ROM_REGION(0x20000, "user1", 0)
711   ROM_SYSTEM_BIOS( 0, "akbioskr", "Samsung Gam*Boy II with Alex Kidd in Miracle World (1990)" )
712   ROMX_LOAD("akbioskr.rom", 0x000, 0x20000, CRC(9c5bad91) SHA1(2feafd8f1c40fdf1bd5668f8c5c02e5560945b17), ROM_BIOS(1))
713ROM_END
714
715ROM_START(gamegear)
716   ROM_REGION(0x4000, "maincpu", 0)
717   ROM_FILL(0x0000, 0x4000, 0x00)
718
719   ROM_REGION(0x0400, "user1", 0)
720   ROM_SYSTEM_BIOS( 0, "none", "No BIOS" ) /* gamegear */
721   ROM_SYSTEM_BIOS( 1, "majesco", "Majesco BIOS" ) /* gamg */
722   ROMX_LOAD("majbios.rom", 0x0000, 0x0400, CRC(0EBEA9D4) SHA1(914aa165e3d879f060be77870d345b60cfeb4ede), ROM_BIOS(2))
723ROM_END
724
725#define rom_gamegeaj rom_gamegear
726
727/***************************************************************************
728
729  Game driver(s)
730
731  US
732   - Sega Master System I (sms1)
733     - prototype (M404) bios - 1986
734     - without built-in game v1.3 - 1986
735     - built-in Hang On/Safari Hunt v2.4 - 1988
736     - built-in Hang On v3.4 - 1988
737     - built-in Missile Defense 3-D v4.4 - 1988
738     - built-in Hang On/Astro Warrior ????
739   - Sega Master System II (sms)
740     - built-in Alex Kidd in Miracle World - 1990
741
742  JP
743   - Sega SG-1000 Mark III (sg1000m3)
744     - no bios
745   - Sega Master System (I) (smsj)
746     - without built-in game v2.1 - 1987
747
748  KR
749   - Sega Master System II (sms2kr)
750     - built-in Alex Kidd in Miracle World (Korean)
751
752  EU
753   - Sega Master System I (sms1pal)
754     - without built-in game v1.3 - 1986
755     - built-in Hang On/Safari Hunt v2.4 - 1988
756     - built-in Hang On v3.4 - 1988
757     - built-in Missile Defense 3-D v4.4 - 1988
758     - built-in Hang On/Astro Warrior ????
759   - Sega Master System II (smspal)
760     - built-in Alex Kidd in Miracle World - 1990
761     - built-in Sonic the Hedgehog - 1991
762
763  BR
764   - Sega Master System I - 1987
765   - Sega Master System II???
766   - Sega Master System III - Tec Toy, 1987
767   - Sega Master System Compact - Tec Toy, 1992
768   - Sega Master System Girl - Tec Toy, 1992
769
770***************************************************************************/
771
772/*    YEAR  NAME        PARENT      COMPAT  MACHINE      INPUT   INIT      COMPANY     FULLNAME                            FLAGS */
773CONS( 1984, sg1000m3,   sms,        0,      sg1000m3,    smsj,   sg1000m3, "Sega",     "SG-1000 Mark III",                 0 )
774CONS( 1986, sms1,       sms,        0,      sms1_ntsc,   sms1,   sms1,     "Sega",     "Master System I",                  0 )
775CONS( 1986, sms1pal,    sms,        0,      sms1_pal,    sms1,   sms1,     "Sega",     "Master System I (PAL)" ,           0 )
776CONS( 1986, smssdisp,   sms,        0,      sms_sdisp,   sms,    smssdisp, "Sega",     "Master System Store Display Unit", GAME_NOT_WORKING )
777CONS( 1987, smsj,       sms,        0,      sms_fm,      smsj,   smsj,     "Sega",     "Master System (Japan)",            0 )
778CONS( 1990, sms,        0,          0,      sms2_ntsc,   sms,    sms1,     "Sega",     "Master System II",                 0 )
779CONS( 1990, smspal,     sms,        0,      sms2_pal,    sms,    sms1,     "Sega",     "Master System II (PAL)",           0 )
780CONS( 1990, sms2kr,     sms,        0,      sms2_fm,     sms,    sms2kr,   "Samsung",  "Gam*Boy II (Korea)",               0 )
781
782CONS( 1990, gamegear,   0,          sms,    gamegear,    gg,     gamegear, "Sega",     "Game Gear (Europe/America)",       0 )
783CONS( 1990, gamegeaj,   gamegear,   0,      gamegear,    gg,     gamegeaj, "Sega",     "Game Gear (Japan)",                0 )
src/mess/drivers/acrnsys1.c
r13301r13302
231231***************************************************************************/
232232
233233/*    YEAR  NAME      PARENT COMPAT MACHINE   INPUT     INIT  COMPANY  FULLNAME    FLAGS */
234COMP( 1978, acrnsys1, 0,     0,     acrnsys1, acrnsys1, 0,    "Acorn", "System 1", GAME_NO_SOUND_HW )
234COMP( 1978, acrnsys1, 0,     0,     acrnsys1, acrnsys1, 0,    "Acorn", "Acorn System 1", GAME_NO_SOUND_HW )
src/mess/drivers/pce.c
r13301r13302
8181   AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w )
8282   AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE(C6280_TAG, c6280_r, c6280_w )
8383   AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w )
84   AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w )
84   AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( mess_pce_joystick_r, mess_pce_joystick_w )
8585   AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE( h6280_irq_status_r, h6280_irq_status_w )
8686   AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE( pce_cd_intf_r, pce_cd_intf_w )
8787ADDRESS_MAP_END
r13301r13302
106106   AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE( vce_r, vce_w )
107107   AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE(C6280_TAG, c6280_r, c6280_w )
108108   AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE( h6280_timer_r, h6280_timer_w )
109   AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( pce_joystick_r, pce_joystick_w )
109   AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE( mess_pce_joystick_r, mess_pce_joystick_w )
110110   AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE( h6280_irq_status_r, h6280_irq_status_w )
111111   AM_RANGE( 0x1FF800, 0x1FFBFF) AM_READWRITE( pce_cd_intf_r, pce_cd_intf_w )
112112ADDRESS_MAP_END
r13301r13302
353353   MCFG_QUANTUM_TIME(attotime::from_hz(60))
354354
355355   MCFG_MACHINE_START( pce )
356   MCFG_MACHINE_RESET( pce )
356   MCFG_MACHINE_RESET( mess_pce )
357357
358358    /* video hardware */
359359   MCFG_SCREEN_ADD("screen", RASTER)
r13301r13302
405405   MCFG_QUANTUM_TIME(attotime::from_hz(60))
406406
407407   MCFG_MACHINE_START( pce )
408   MCFG_MACHINE_RESET( pce )
408   MCFG_MACHINE_RESET( mess_pce )
409409
410410   /* video hardware */
411411   MCFG_SCREEN_ADD("screen", RASTER)
r13301r13302
455455#define rom_sgx rom_pce
456456
457457/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT    INIT   COMPANY  FULLNAME */
458CONS( 1987, pce,    0,      0,      pce,    pce,     pce,   "Nippon Electronic Company", "PC Engine", GAME_IMPERFECT_SOUND)
459CONS( 1989, tg16,   pce,    0,      tg16,   pce,     tg16,  "Nippon Electronic Company", "TurboGrafx 16", GAME_IMPERFECT_SOUND)
460CONS( 1989, sgx,    pce,    0,      sgx,    pce,     sgx,   "Nippon Electronic Company", "SuperGrafx", GAME_IMPERFECT_SOUND)
458CONS( 1987, pce,    0,      0,      pce,    pce,     mess_pce,   "Nippon Electronic Company", "PC Engine", GAME_IMPERFECT_SOUND)
459CONS( 1989, tg16,   pce,    0,      tg16,   pce,     tg16,       "Nippon Electronic Company", "TurboGrafx 16", GAME_IMPERFECT_SOUND)
460CONS( 1989, sgx,    pce,    0,      sgx,    pce,     sgx,       "Nippon Electronic Company", "SuperGrafx", GAME_IMPERFECT_SOUND)
src/mess/drivers/mephistoc.c
r0r13302
1/******************************************************************************
2 Mephisto 4 + 5 Chess Computer
3 2007 Dirk V.
4
5CPU 65C02 P4
6Clock 4.9152 MHz
7NMI CLK 600 Hz
8IRQ Line is set to VSS
98 KByte  SRAM Sony CXK5864-15l
10
111-CD74HC4060E   14 Bit Counter
121-CD74HC166E
131-CD74HC251E
141-SN74HC138N TI
151-SN74HC139N TI
161-74HC14AP Toshiba
171-74HC02AP Toshiba
181-74HC00AP Toshiba
191-CD74HC259E
20
21
22$0000-$1fff   S-RAM
23$2000 LCD 4 Byte Shift Register writeonly right to left
24every 2nd char xor'd by $FF
25
262c00-2c07 Keyboard (8to1 Multiplexer) 74HCT251
272*8 Matrix
28Adr. 0x3407
29==0 !=0
302c00 CL E5
312c01 POS F6
322c02 MEMO G7
332c03 INFO A1
342c04 LEV H8
352c05 ENT B2
362c06 >0 C3
372c07 <9 D4
38
39$3400-$3407 LED 1-6, Buzzer, Keyboard select
40
41$2400 // Chess Board
42$2800 // Chess Board
43$3000 // Chess Board
44
45$4000-7FFF Opening Modul HG550
46$8000-$FFF ROM
47
48Mephisto 4 Turbo Kit 18mhz - (mm4tk)
49    This is a replacement rom combining the turbo kit initial rom with the original MM IV.
50    The Turbo Kit powers up to it's tiny rom, copies itself to ram, banks in normal rom,
51    copies that to faster SRAM, then patches the checksum and the LED blink delays.
52    If someone else wants to code up the power up banking, feel free
53
54    There is an undumped MM V Turbo Kit, which will be the exact same except for location of
55    the patches. The mm5tk just needs the normal mm5 ROM swapped out for that one to
56    blinks the LEDs a little slower.
57
58    -- Cowering (2011)
59
60'rebel5' driver broke somewhere between 0.141 and 0.142 and is now marked as NOT_WORKING
61
62***********************************************************************************************/
63
64#define ADDRESS_MAP_MODERN
65
66#include "emu.h"
67#include "cpu/m6502/m6502.h"
68#include "sound/beep.h"
69//#include "mephisto.lh"
70
71#include "machine/mboard.h"
72
73
74class mephisto_state : public driver_device
75{
76public:
77   mephisto_state(const machine_config &mconfig, device_type type, const char *tag)
78      : driver_device(mconfig, type, tag),
79   m_maincpu(*this, "maincpu"),
80   m_beep(*this, BEEPER_TAG)
81   { }
82
83   required_device<cpu_device> m_maincpu;
84   required_device<device_t> m_beep;
85   DECLARE_WRITE8_MEMBER(write_lcd);
86   DECLARE_WRITE8_MEMBER(mephisto_NMI);
87   DECLARE_READ8_MEMBER(read_keys);
88   DECLARE_WRITE8_MEMBER(write_led);
89   DECLARE_WRITE8_MEMBER(write_led_mm2);
90   UINT8 m_lcd_shift_counter;
91   UINT8 m_led_status;
92   //UINT8 *m_p_ram;
93   UINT8 m_led7;
94   UINT8 m_allowNMI;
95};
96
97
98WRITE8_MEMBER( mephisto_state::write_lcd )
99{
100   if (m_led7 == 0) output_set_digit_value(m_lcd_shift_counter,data);   // 0x109 MM IV // 0x040 MM V
101
102   //output_set_digit_value(m_lcd_shift_counter,data ^ m_p_ram[0x165]);    // 0x109 MM IV // 0x040 MM V
103   m_lcd_shift_counter--;
104   m_lcd_shift_counter &= 3;
105}
106
107WRITE8_MEMBER( mephisto_state::mephisto_NMI )
108{
109   m_allowNMI = 1;
110}
111
112READ8_MEMBER( mephisto_state::read_keys )
113{
114   UINT8 data;
115   static const char *const keynames[2][8] =
116         {
117            { "KEY1_0", "KEY1_1", "KEY1_2", "KEY1_3", "KEY1_4", "KEY1_5", "KEY1_6", "KEY1_7" },
118            { "KEY2_0", "KEY2_1", "KEY2_2", "KEY2_3", "KEY2_4", "KEY2_5", "KEY2_6", "KEY2_7" }
119         };
120
121   data = 0xff;
122   if (((m_led_status & 0x80) == 0x00))
123      data=input_port_read(machine(), keynames[0][offset]);
124   else
125      data=input_port_read(machine(), keynames[1][offset]);
126
127   logerror("Keyboard Port = %s Data = %d\n  ", ((m_led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data);
128   return data | 0x7f;
129}
130
131WRITE8_MEMBER( mephisto_state::write_led )
132{
133   UINT8 LED_offset=100;
134   data &= 0x80;
135
136   if (data==0)m_led_status &= 255-(1<<offset) ; else m_led_status|=1<<offset;
137   if (offset<6)output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0);
138   if (offset==7) m_led7=data& 0x80 ? 0x00 :0xff;
139   logerror("LEDs  Offset = %d Data = %d\n",offset,data);
140}
141
142WRITE8_MEMBER( mephisto_state::write_led_mm2 )
143{
144   UINT8 LED_offset=100;
145   data &= 0x80;
146
147   if (data==0)
148      m_led_status &= 255-(1<<offset);
149   else
150      m_led_status|=1<<offset;
151
152   if (offset<6)
153      output_set_led_value(LED_offset+offset, m_led_status&1<<offset?1:0);
154
155   if (offset==7)
156      m_led7= BIT(data, 7) ? 0xff :0x00;   //MM2
157}
158
159static ADDRESS_MAP_START( rebel5_mem, AS_PROGRAM, 8, mephisto_state )
160   AM_RANGE( 0x0000, 0x1fff) AM_RAM                  // AM_BASE(m_p_ram)
161   AM_RANGE( 0x2000, 0x2007) AM_WRITE(write_led)         // Status LEDs+ buzzer
162   AM_RANGE( 0x3000, 0x3007) AM_READ(read_keys)         // Rebel 5.0
163   AM_RANGE( 0x3000, 0x4000) AM_READ_LEGACY(mboard_read_board_8)      // Chessboard
164   AM_RANGE( 0x5000, 0x5000) AM_WRITE(write_lcd)
165   AM_RANGE( 0x6000, 0x6000) AM_WRITE_LEGACY(mboard_write_LED_8)      // Chessboard
166   AM_RANGE( 0x7000, 0x7000) AM_WRITE_LEGACY(mboard_write_board_8)   // Chessboard
167   AM_RANGE( 0x8000, 0xffff) AM_ROM
168ADDRESS_MAP_END
169
170
171static ADDRESS_MAP_START( mephisto_mem, AS_PROGRAM, 8, mephisto_state )
172   AM_RANGE( 0x0000, 0x1fff) AM_RAM //AM_BASE(m_p_ram)
173   AM_RANGE( 0x2000, 0x2000) AM_WRITE(write_lcd)
174   AM_RANGE( 0x2400, 0x2407) AM_WRITE_LEGACY(mboard_write_LED_8)      // Chessboard
175   AM_RANGE( 0x2800, 0x2800) AM_WRITE_LEGACY(mboard_write_board_8)      // Chessboard
176   AM_RANGE( 0x2c00, 0x2c07) AM_READ(read_keys)
177   AM_RANGE( 0x3000, 0x3000) AM_READ_LEGACY(mboard_read_board_8)      // Chessboard
178   AM_RANGE( 0x3400, 0x3407) AM_WRITE(write_led)         // Status LEDs+ buzzer
179   AM_RANGE( 0x3800, 0x3800) AM_WRITE(mephisto_NMI)         // NMI enable
180   AM_RANGE( 0x4000, 0x7fff) AM_ROM                  // Opening Library
181   AM_RANGE( 0x8000, 0xffff) AM_ROM
182ADDRESS_MAP_END
183
184static ADDRESS_MAP_START( mm2_mem, AS_PROGRAM, 8, mephisto_state )
185   AM_RANGE( 0x0000, 0x0fff) AM_RAM //AM_BASE(m_p_ram)
186   AM_RANGE( 0x1000, 0x1007) AM_WRITE(write_led_mm2)      //Status LEDs
187   AM_RANGE( 0x1800, 0x1807) AM_READ(read_keys)
188   AM_RANGE( 0x2000, 0x2000) AM_READ_LEGACY(mboard_read_board_8)      //Chessboard
189   AM_RANGE( 0x2800, 0x2800) AM_WRITE(write_lcd)
190   AM_RANGE( 0x3000, 0x3000) AM_WRITE_LEGACY(mboard_write_LED_8)      //Chessboard
191   AM_RANGE( 0x3800, 0x3800) AM_WRITE_LEGACY(mboard_write_board_8)      //Chessboard
192   AM_RANGE( 0x4000, 0x7fff) AM_ROM                  // Opening Library ?
193   AM_RANGE( 0x8000, 0xffff) AM_ROM
194ADDRESS_MAP_END
195
196static INPUT_PORTS_START( board )
197   PORT_START("LINE2")
198   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
199   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
200   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
201   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
202   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
203   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
204   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
205   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
206   PORT_START("LINE3")
207   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
208   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
209   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
210   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
211   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
212   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
213   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
214   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
215   PORT_START("LINE4")
216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
219   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
220   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
224   PORT_START("LINE5")
225   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
226   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
227   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
228   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
229   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
230   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
231   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
232   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
233   PORT_START("LINE6")
234   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
235   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
236   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
237   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
238   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
239   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
240   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
241   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
242   PORT_START("LINE7")
243   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
244   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
245   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
246   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
247   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
248   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
249   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
250   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
251   PORT_START("LINE8")
252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
253   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
254   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
255   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
256   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
257   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
258   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
259   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
260   PORT_START("LINE9")
261   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD)
262   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD)
263   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD)
264   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD)
265   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD)
266   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD)
267   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD)
268   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD)
269
270   PORT_START("LINE10")
271   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD)
272
273   PORT_START("B_WHITE")
274   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
275   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
276   PORT_BIT(0x04,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
277   PORT_BIT(0x08,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
278   PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD)
279   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD)
280
281   PORT_START("B_BLACK")
282   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
283   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
284   PORT_BIT(0x04,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
285   PORT_BIT(0x08,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
286   PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_KEYBOARD)
287   PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_KEYBOARD)
288
289   PORT_START("B_BUTTONS")
290   PORT_BIT(0x01,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
291   PORT_BIT(0x02,  IP_ACTIVE_HIGH, IPT_KEYBOARD)
292INPUT_PORTS_END
293
294static INPUT_PORTS_START( mephisto )
295   PORT_START("KEY1_0") //Port $2c00
296   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLEAR") PORT_CODE(KEYCODE_F1)
297   PORT_START("KEY1_1") //Port $2c01
298   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("POS") PORT_CODE(KEYCODE_F2)
299   PORT_START("KEY1_2") //Port $2c02
300   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MEM") PORT_CODE(KEYCODE_F3)
301   PORT_START("KEY1_3") //Port $2c03
302   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INFO") PORT_CODE(KEYCODE_F4)
303   PORT_START("KEY1_4") //Port $2c04
304   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEV") PORT_CODE(KEYCODE_F5)
305   PORT_START("KEY1_5") //Port $2c05
306   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENT") PORT_CODE(KEYCODE_ENTER)
307   PORT_START("KEY1_6") //Port $2c06
308   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
309   PORT_START("KEY1_7") //Port $2c07
310   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
311
312   PORT_START("KEY2_0") //Port $2c08
313   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E 5") PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_5)
314   PORT_START("KEY2_1") //Port $2c09
315   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F 6") PORT_CODE(KEYCODE_F) PORT_CODE(KEYCODE_6)
316   PORT_START("KEY2_2") //Port $2c0a
317   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G 7") PORT_CODE(KEYCODE_G) PORT_CODE(KEYCODE_7)
318   PORT_START("KEY2_3") //Port $2c0b
319   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A 1") PORT_CODE(KEYCODE_A) PORT_CODE(KEYCODE_1)
320   PORT_START("KEY2_4") //Port $2c0c
321   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H 8") PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8)
322   PORT_START("KEY2_5") //Port $2c0d
323   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B 2") PORT_CODE(KEYCODE_B) PORT_CODE(KEYCODE_2)
324   PORT_START("KEY2_6") //Port $2c0e
325   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C 3") PORT_CODE(KEYCODE_C) PORT_CODE(KEYCODE_3)
326   PORT_START("KEY2_7") //Port $2c0f
327   PORT_BIT(0x080, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D 4") PORT_CODE(KEYCODE_D) PORT_CODE(KEYCODE_4)
328
329   PORT_INCLUDE( board )
330INPUT_PORTS_END
331
332
333static TIMER_DEVICE_CALLBACK( update_nmi )
334{
335   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
336   if (state->m_allowNMI)
337   {
338      state->m_allowNMI = 0;
339      cputag_set_input_line(timer.machine(), "maincpu", INPUT_LINE_NMI,PULSE_LINE);
340   }
341   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
342}
343
344static TIMER_DEVICE_CALLBACK( update_irq )      //only mm2
345{
346   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
347   cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, ASSERT_LINE);
348   cputag_set_input_line(timer.machine(), "maincpu", M6502_IRQ_LINE, CLEAR_LINE);
349
350   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
351}
352
353static MACHINE_START( mephisto )
354{
355   mephisto_state *state = machine.driver_data<mephisto_state>();
356   state->m_lcd_shift_counter = 3;
357   state->m_allowNMI = 1;
358   mboard_savestate_register(machine);
359}
360
361static MACHINE_START( mm2 )
362{
363   mephisto_state *state = machine.driver_data<mephisto_state>();
364   state->m_lcd_shift_counter = 3;
365   state->m_led7=0xff;
366
367   mboard_savestate_register(machine);
368}
369
370
371static MACHINE_RESET( mephisto )
372{
373   mephisto_state *state = machine.driver_data<mephisto_state>();
374   state->m_lcd_shift_counter = 3;
375   state->m_allowNMI = 1;
376   mboard_set_border_pieces();
377   mboard_set_board();
378
379/* adjust artwork depending on current emulation*/
380
381   if (!strcmp(machine.system().name,"mm2") )
382      output_set_value("MM",1);
383   else if (!strcmp(machine.system().name,"mm4") )
384      output_set_value("MM",2);
385   else if (!strcmp(machine.system().name,"mm4tk") )
386      output_set_value("MM",5);
387   else if (!strcmp(machine.system().name,"mm5tk") )
388      output_set_value("MM",5);
389   else if (!strcmp(machine.system().name,"mm5") )
390      output_set_value("MM",3);
391   else if (!strcmp(machine.system().name,"mm50") )
392      output_set_value("MM",3);
393   else if (!strcmp(machine.system().name,"rebel5") )
394      output_set_value("MM",4);
395}
396
397
398static MACHINE_CONFIG_START( mephisto, mephisto_state )
399   /* basic machine hardware */
400   MCFG_CPU_ADD("maincpu",M65C02,4915200)   /* 65C02 */
401   MCFG_CPU_PROGRAM_MAP(mephisto_mem)
402   MCFG_QUANTUM_TIME(attotime::from_hz(60))
403   MCFG_MACHINE_START( mephisto )
404   MCFG_MACHINE_RESET( mephisto )
405
406   /* sound hardware */
407   MCFG_SPEAKER_STANDARD_MONO("mono")
408   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
409   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
410
411   MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi, attotime::from_hz(600))
412   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
413MACHINE_CONFIG_END
414
415static MACHINE_CONFIG_DERIVED( rebel5, mephisto )
416   /* basic machine hardware */
417   MCFG_CPU_MODIFY("maincpu")
418   MCFG_CPU_PROGRAM_MAP(rebel5_mem)
419MACHINE_CONFIG_END
420
421static MACHINE_CONFIG_DERIVED( mm2, mephisto )
422   MCFG_CPU_REPLACE("maincpu", M65C02, 3700000)
423   MCFG_CPU_PROGRAM_MAP(mm2_mem)
424   MCFG_MACHINE_START( mm2 )
425
426   MCFG_DEVICE_REMOVE("nmi_timer")
427   MCFG_TIMER_ADD_PERIODIC("irq_timer", update_irq, attotime::from_hz(450))
428MACHINE_CONFIG_END
429
430static MACHINE_CONFIG_DERIVED( mm4tk, mephisto )
431   MCFG_CPU_MODIFY("maincpu")
432   MCFG_CPU_REPLACE("maincpu", M65C02, 18000000)
433   MCFG_CPU_PROGRAM_MAP(mephisto_mem)
434MACHINE_CONFIG_END
435
436ROM_START(rebel5)
437   ROM_REGION(0x10000,"maincpu",0)
438   ROM_LOAD("rebel5.rom", 0x8000, 0x8000, CRC(8d02e1ef) SHA1(9972c75936613bd68cfd3fe62bd222e90e8b1083))
439ROM_END
440
441ROM_START(mm2)
442   ROM_REGION(0x10000,"maincpu",0)
443   ROM_LOAD("mm2_1.bin", 0x8000, 0x4000, CRC(e2daac82) SHA1(c9fa59ca92362f8ee770733073bfa2ab8c7904ad))
444   ROM_LOAD("mm2_2.bin", 0xc000, 0x4000, CRC(5e296939) SHA1(badd2a377259cf738cd076d8fb245c3dc284c24d))
445ROM_END
446
447ROM_START(mm4)
448   ROM_REGION(0x10000,"maincpu",0)
449   ROM_LOAD("mephisto4.rom", 0x8000, 0x8000, CRC(f68a4124) SHA1(d1d03a9aacc291d5cb720d2ee2a209eeba13a36c))
450   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
451   ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
452   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(2))
453ROM_END
454
455ROM_START(mm4tk)
456   ROM_REGION(0x10000,"maincpu",0)
457   ROM_LOAD("mm4tk.rom", 0x8000, 0x8000, CRC(51cb36a4) SHA1(9e184b4e85bb721e794b88d8657ae8d2ff5a24af))
458   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
459   ROM_SYSTEM_BIOS( 1, "hg440", "HG440 Opening Library" )
460   ROMX_LOAD( "hg440.rom", 0x4000, 0x4000, CRC(81ffcdfd) SHA1(b0f7bcc11d1e821daf92cde31e3446c8be0bbe19), ROM_BIOS(0))
461ROM_END
462
463ROM_START(mm5tk)
464   ROM_REGION(0x10000,"maincpu",0)
465   ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, BAD_DUMP CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048))
466   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
467   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
468   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(0))
469ROM_END
470
471ROM_START(mm5)
472   ROM_REGION(0x10000,"maincpu",0)
473   ROM_LOAD("mephisto5.rom", 0x8000, 0x8000, CRC(89c3d9d2) SHA1(77cd6f8eeb03c713249db140d2541e3264328048))
474   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
475   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
476   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
477ROM_END
478
479ROM_START(mm50)
480   ROM_REGION(0x10000,"maincpu",0)
481   ROM_LOAD("mm50.rom", 0x8000, 0x8000, CRC(fcfa7e6e) SHA1(afeac3a8c957ba58cefaa27b11df974f6f2066da))
482   ROM_SYSTEM_BIOS( 0, "none", "No Opening Library" )
483   ROM_SYSTEM_BIOS( 1, "hg550", "HG550 Opening Library" )
484   ROMX_LOAD("hg550.rom", 0x4000, 0x4000, CRC(0359f13d) SHA1(833cef8302ad8d283d3f95b1d325353c7e3b8614),ROM_BIOS(2))
485ROM_END
486
487
488static DRIVER_INIT( mephisto )
489{
490   mephisto_state *state = machine.driver_data<mephisto_state>();
491   state->m_lcd_shift_counter = 3;
492}
493
494/***************************************************************************
495
496    Game driver(s)
497
498***************************************************************************/
499
500/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY             FULLNAME                            FLAGS */
501
502CONS( 1984, mm2,        mm4,   0,      mm2,        mephisto,   mephisto,   "Hegener & Glaser", "Mephisto MM2 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
503CONS( 1986, rebel5,     mm4,   0,      rebel5,     mephisto,   mephisto,   "Hegener & Glaser", "Mephisto Rebel 5 Schachcomputer", GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK|GAME_NOT_WORKING )
504CONS( 1987, mm4,        0,      0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 4 Schachcomputer",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
505CONS( 1987, mm4tk,      mm4,    0,      mm4tk,      mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 4 Schachcomputer Turbo Kit + HG440",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
506CONS( 1990, mm5,        mm4,   0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.1 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
507CONS( 1990, mm50,       mm4,   0,      mephisto,   mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.0 Schachcomputer",     GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
508CONS( 1990, mm5tk,      mm4,    0,      mm4tk,      mephisto,   mephisto,   "Hegener & Glaser", "Mephisto 5.1 Schachcomputer Turbo Kit + HG550",       GAME_SUPPORTS_SAVE|GAME_REQUIRES_ARTWORK )
artwork/mk1.zip
artwork/mk2.zip
artwork/ccmk1.zip
artwork/ccmk2.zip

Previous 15994 Revisions Next


© 1998-2018 The MESS Team