Previous 199869 Revisions Next

r29592 Sunday 13th April, 2014 at 07:33:30 UTC by Fabio Priuli
s2636: converted to use inline configs. nw.
[src/emu/machine]s2636.c s2636.h
[src/mame/drivers]cvs.c galaxia.c laserbat.c malzak.c quasar.c seabattl.c zac2650.c

trunk/src/emu/machine/s2636.c
r29591r29592
9494      m_channel(NULL),
9595      m_size(0),
9696      m_pos(0),
97      m_level(0)
97      m_level(0),
98      m_work_ram_size(0),
99      m_y_offset(0),
100      m_x_offset(0)
98101{
99102   for (int i = 0; i < 1; i++)
100   m_reg[i] = 0;
103      m_reg[i] = 0;
101104}
102105
103106//-------------------------------------------------
104//  device_config_complete - perform any
105//  operations now that the configuration is
106//  complete
107//-------------------------------------------------
108
109void s2636_device::device_config_complete()
110{
111   // inherit a copy of the static data
112   const s2636_interface *intf = reinterpret_cast<const s2636_interface *>(static_config());
113   if (intf != NULL)
114      *static_cast<s2636_interface *>(this) = *intf;
115
116   // or initialize to defaults if none provided
117   else
118   {
119      m_work_ram_size = 0;
120      m_y_offset = 0;
121      m_x_offset = 0;
122   }
123}
124
125//-------------------------------------------------
126107//  device_start - device-specific startup
127108//-------------------------------------------------
128109
r29591r29592
135116   m_bitmap.resize(width, height);
136117   m_collision_bitmap.resize(width, height);
137118
138   save_item(NAME(m_x_offset));
139   save_item(NAME(m_y_offset));
140119   save_item(NAME(m_work_ram));
141120   save_item(NAME(m_bitmap));
142121   save_item(NAME(m_collision_bitmap));
143122
144
145123   m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate(), this);
146124   save_item(NAME(m_size));
147125   save_item(NAME(m_pos));
148126   save_item(NAME(m_level));
149
150   for (int i = 0; i < 1; i++)
151   save_item(NAME(m_reg[i]), i);
127   save_item(NAME(m_reg));
152128}
153129
154130/*************************************
r29591r29592
171147
172148static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or_mode, bitmap_ind16 &bitmap, const rectangle &cliprect )
173149{
174   int sy;
175
176150   /* for each row */
177   for (sy = 0; sy < SPRITE_HEIGHT; sy++)
151   for (int sy = 0; sy < SPRITE_HEIGHT; sy++)
178152   {
179      int sx;
180
181153      /* for each pixel on the row */
182      for (sx = 0; sx < SPRITE_WIDTH; sx++)
154      for (int sx = 0; sx < SPRITE_WIDTH; sx++)
183155      {
184         int ey;
185
186156         /* each pixel can be expanded */
187         for (ey = 0; ey <= expand; ey++)
157         for (int ey = 0; ey <= expand; ey++)
188158         {
189            int ex;
190
191            for (ex = 0; ex <= expand; ex++)
159            for (int ex = 0; ex <= expand; ex++)
192160            {
193161               /* compute effective destination pixel */
194162               int ty = y + sy * (expand + 1) + ey;
r29591r29592
213181}
214182
215183
216
217184/*************************************
218185 *
219186 *  Collision detection
trunk/src/emu/machine/s2636.h
r29591r29592
88#define __S2636_H__
99
1010
11
1211#define S2636_IS_PIXEL_DRAWN(p)     (((p) & 0x08) ? TRUE : FALSE)
1312#define S2636_PIXEL_COLOR(p)        ((p) & 0x07)
1413
1514/*************************************
1615 *
17 *  Type definitions
18 *
19 *************************************/
20
21struct s2636_interface
22{
23   int        m_work_ram_size;
24   int        m_y_offset;
25   int        m_x_offset;
26};
27
28/*************************************
29 *
3016 *  Device configuration macros
3117 *
3218 *************************************/
3319
3420class s2636_device : public device_t,
3521            public device_video_interface,
36            public device_sound_interface,
37            public s2636_interface
22            public device_sound_interface
3823{
3924public:
4025   s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4126   ~s2636_device() {}
4227
43   /* returns a BITMAP_FORMAT_IND16 bitmap the size of the screen
44      D0-D2 of each pixel is the pixel color
45      D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn */
28   static void set_workram_size(device_t &device, int size) { downcast<s2636_device &>(device).m_work_ram_size = size; }
29   static void set_offsets(device_t &device, int y_offset, int x_offset)
30   {
31      s2636_device &dev = downcast<s2636_device &>(device);
32      dev.m_x_offset = x_offset;
33      dev.m_y_offset = y_offset;
34   }
35   
36   // returns a BITMAP_FORMAT_IND16 bitmap the size of the screen
37   // D0-D2 of each pixel is the pixel color
38   // D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn
39   bitmap_ind16 &update(const rectangle &cliprect);
4640
47   bitmap_ind16 &update( const rectangle &cliprect );
4841   DECLARE_WRITE8_MEMBER( work_ram_w );
4942   DECLARE_READ8_MEMBER( work_ram_r );
5043
51   void soundport_w (int mode, int data);
44   void soundport_w(int mode, int data);
5245
5346protected:
5447   // device-level overrides
55   virtual void device_config_complete();
5648   virtual void device_start();
5749
5850   // sound stream update overrides
r29591r29592
6557   bitmap_ind16 m_collision_bitmap;
6658
6759   sound_stream *m_channel;
68   UINT8 m_reg[1];
69   int m_size;
70   int m_pos;
71   unsigned m_level;
60   UINT8      m_reg[1];
61   int        m_size;
62   int        m_pos;
63   unsigned   m_level;
7264
65   int        m_work_ram_size;
66   int        m_y_offset;
67   int        m_x_offset;
68   
7369   int check_collision( int spriteno1, int spriteno2, const rectangle &cliprect );
7470};
7571
7672extern const device_type S2636;
7773
7874
79#define MCFG_S2636_ADD(_tag, _interface) \
80   MCFG_DEVICE_ADD(_tag, S2636, 0) \
81   MCFG_DEVICE_CONFIG(_interface)
75#define MCFG_S2636_OFFSETS(_yoffs, _xoffs) \
76   s2636_device::set_offsets(*device, _yoffs, _xoffs);
8277
78#define MCFG_S2636_WORKRAM_SIZE(_size) \
79   s2636_device::set_workram_size(*device, _size);
8380
81
8482#endif /* __S2636_H__ */
trunk/src/mame/drivers/quasar.c
r29591r29592
270270   device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x03);
271271}
272272
273static const s2636_interface s2636_0_config =
274{
275   0x100,
276   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
277};
278
279static const s2636_interface s2636_1_config =
280{
281   0x100,
282   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
283};
284
285static const s2636_interface s2636_2_config =
286{
287   0x100,
288   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
289};
290
291273// ****************************************
292274// Quasar S2650 Main CPU, I8035 sound board
293275// ****************************************
r29591r29592
342324   MCFG_PALETTE_INDIRECT_ENTRIES(0x500)
343325   MCFG_PALETTE_INIT_OWNER(quasar_state,quasar)
344326
345   MCFG_S2636_ADD("s2636_0", s2636_0_config)
346   MCFG_S2636_ADD("s2636_1", s2636_1_config)
347   MCFG_S2636_ADD("s2636_2", s2636_2_config)
327   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
328   MCFG_S2636_WORKRAM_SIZE(0x100)
329   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
348330
331   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
332   MCFG_S2636_WORKRAM_SIZE(0x100)
333   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
334
335   MCFG_DEVICE_ADD("s2636_2", S2636, 0)
336   MCFG_S2636_WORKRAM_SIZE(0x100)
337   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
338
349339   MCFG_VIDEO_START_OVERRIDE(quasar_state,quasar)
350340
351341   /* sound hardware */
trunk/src/mame/drivers/seabattl.c
r29591r29592
472472   GFXDECODE_ENTRY( "gfx3", 0, tiles8x8_layout, 24, 1 )
473473GFXDECODE_END
474474
475static const s2636_interface s2636_config =
476{
477   0x100,
478   3, -21,
479   //"s2636snd"
480};
481
482475static MACHINE_CONFIG_START( seabattl, seabattl_state )
483476
484477   /* basic machine hardware */
r29591r29592
487480   MCFG_CPU_IO_MAP(seabattl_io_map)
488481   MCFG_CPU_VBLANK_INT_DRIVER("screen", seabattl_state, seabattl_interrupt)
489482
490   MCFG_S2636_ADD("s2636", s2636_config)
483   MCFG_DEVICE_ADD("s2636", S2636, 0)
484   MCFG_S2636_WORKRAM_SIZE(0x100)
485   MCFG_S2636_OFFSETS(3, -21)
491486   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
492487
493488   MCFG_DEVICE_ADD("sc_thousand", DM9368, 0)
trunk/src/mame/drivers/zac2650.c
r29591r29592
193193   palette.set_pen_color(3,rgb_t::black);
194194}
195195
196static const s2636_interface s2636_config =
197{
198   0x100,
199   0, 0
200};
201
202196/************************************************************************************************
203197
204198 Video is slightly odd on these zac boards
r29591r29592
264258   /* sound hardware */
265259   MCFG_SPEAKER_STANDARD_MONO("mono")
266260
267   MCFG_S2636_ADD("s2636", s2636_config)
261   MCFG_DEVICE_ADD("s2636", S2636, 0)
262   MCFG_S2636_WORKRAM_SIZE(0x100)
268263   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
269264MACHINE_CONFIG_END
270265
trunk/src/mame/drivers/cvs.c
r29591r29592
936936 *
937937 *************************************/
938938
939static const s2636_interface s2636_0_config =
940{
941   0x100,
942   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
943};
944
945static const s2636_interface s2636_1_config =
946{
947   0x100,
948   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
949};
950
951static const s2636_interface s2636_2_config =
952{
953   0x100,
954   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
955};
956
957
958939MACHINE_START_MEMBER(cvs_state,cvs)
959940{
960941   /* allocate memory */
r29591r29592
10321013   MCFG_SCREEN_UPDATE_DRIVER(cvs_state, screen_update_cvs)
10331014   MCFG_SCREEN_PALETTE("palette")
10341015
1035   MCFG_S2636_ADD("s2636_0", s2636_0_config)
1036   MCFG_S2636_ADD("s2636_1", s2636_1_config)
1037   MCFG_S2636_ADD("s2636_2", s2636_2_config)
1016   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
1017   MCFG_S2636_WORKRAM_SIZE(0x100)
1018   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
10381019
1020   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
1021   MCFG_S2636_WORKRAM_SIZE(0x100)
1022   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
1023
1024   MCFG_DEVICE_ADD("s2636_2", S2636, 0)
1025   MCFG_S2636_WORKRAM_SIZE(0x100)
1026   MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
1027
10391028   /* audio hardware */
10401029   MCFG_SPEAKER_STANDARD_MONO("mono")
10411030
trunk/src/mame/drivers/malzak.c
r29591r29592
298298   1                   /* 9     enable          */
299299};
300300
301
302static const s2636_interface malzac_s2636_0_config =
303{
304   0x100,
305   0, -16 /* -8, -16 */
306};
307
308static const s2636_interface malzac_s2636_1_config =
309{
310   0x100,
311   0, -16 /* -9, -16 */
312};
313
314301READ8_MEMBER(malzak_state::videoram_r)
315302{
316303   return m_videoram[offset];
r29591r29592
342329   MCFG_CPU_PROGRAM_MAP(malzak_map)
343330   MCFG_CPU_IO_MAP(malzak_io_map)
344331
345
346332   /* video hardware */
347333   MCFG_SCREEN_ADD("screen", RASTER)
348334   MCFG_SCREEN_REFRESH_RATE(50)
r29591r29592
355341   MCFG_PALETTE_ADD("palette", 128)
356342   MCFG_PALETTE_INIT_OWNER(malzak_state, malzak)
357343
358   MCFG_S2636_ADD("s2636_0", malzac_s2636_0_config)
344   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
345   MCFG_S2636_WORKRAM_SIZE(0x100)
346   MCFG_S2636_OFFSETS(0, -16)   // -8, -16
359347   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
360   MCFG_S2636_ADD("s2636_1", malzac_s2636_1_config)
348
349   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
350   MCFG_S2636_WORKRAM_SIZE(0x100)
351   MCFG_S2636_OFFSETS(0, -16)   // -9, -16
361352   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
362353
363354   MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000)
trunk/src/mame/drivers/laserbat.c
r29591r29592
634634   m_cb1_toggle ^= 1;
635635}
636636
637
638static const s2636_interface s2636_1_config =
639{
640   0x100,
641   0, -19
642};
643
644static const s2636_interface s2636_2_config =
645{
646   0x100,
647   0, -19
648};
649
650static const s2636_interface s2636_3_config =
651{
652   0x100,
653   0, -19
654};
655
656637void laserbat_state::machine_start()
657638{
658639   m_pia = machine().device<pia6821_device>("pia");
r29591r29592
726707   MCFG_GFXDECODE_ADD("gfxdecode", "palette", laserbat)
727708   MCFG_PALETTE_ADD("palette", 1024)
728709
729   MCFG_S2636_ADD("s2636_1", s2636_1_config)
730   MCFG_S2636_ADD("s2636_2", s2636_2_config)
731   MCFG_S2636_ADD("s2636_3", s2636_3_config)
710   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
711   MCFG_S2636_WORKRAM_SIZE(0x100)
712   MCFG_S2636_OFFSETS(0, -19)
732713
714   MCFG_DEVICE_ADD("s2636_2", S2636, 0)
715   MCFG_S2636_WORKRAM_SIZE(0x100)
716   MCFG_S2636_OFFSETS(0, -19)
733717
718   MCFG_DEVICE_ADD("s2636_3", S2636, 0)
719   MCFG_S2636_WORKRAM_SIZE(0x100)
720   MCFG_S2636_OFFSETS(0, -19)
721
734722   /* sound hardware */
735723   MCFG_SPEAKER_STANDARD_MONO("mono")
736724
r29591r29592
775763   MCFG_GFXDECODE_ADD("gfxdecode", "palette", laserbat)
776764   MCFG_PALETTE_ADD("palette", 1024)
777765
778   MCFG_S2636_ADD("s2636_1", s2636_1_config)
779   MCFG_S2636_ADD("s2636_2", s2636_2_config)
780   MCFG_S2636_ADD("s2636_3", s2636_3_config)
766   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
767   MCFG_S2636_WORKRAM_SIZE(0x100)
768   MCFG_S2636_OFFSETS(0, -19)
781769
770   MCFG_DEVICE_ADD("s2636_2", S2636, 0)
771   MCFG_S2636_WORKRAM_SIZE(0x100)
772   MCFG_S2636_OFFSETS(0, -19)
782773
774   MCFG_DEVICE_ADD("s2636_3", S2636, 0)
775   MCFG_S2636_WORKRAM_SIZE(0x100)
776   MCFG_S2636_OFFSETS(0, -19)
777
783778   /* sound hardware */
784779   MCFG_SPEAKER_STANDARD_MONO("mono")
785780
trunk/src/mame/drivers/galaxia.c
r29591r29592
272272GFXDECODE_END
273273
274274
275static const s2636_interface galaxia_s2636_config[3] =
276{
277   { 0x100, 3, -26 },
278   { 0x100, 3, -26 },
279   { 0x100, 3, -26 }
280};
281
282static const s2636_interface astrowar_s2636_config =
283{
284   0x100,
285   3, 0
286};
287
288
289275static MACHINE_CONFIG_START( galaxia, galaxia_state )
290276
291277   /* basic machine hardware */
r29591r29592
311297   MCFG_PALETTE_INIT_OWNER(galaxia_state,galaxia)
312298   MCFG_VIDEO_START_OVERRIDE(galaxia_state,galaxia)
313299
314   MCFG_S2636_ADD("s2636_0", galaxia_s2636_config[0])
300   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
301   MCFG_S2636_WORKRAM_SIZE(0x100)
302   MCFG_S2636_OFFSETS(3, -26)
315303   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
316   MCFG_S2636_ADD("s2636_1", galaxia_s2636_config[1])
304
305   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
306   MCFG_S2636_WORKRAM_SIZE(0x100)
307   MCFG_S2636_OFFSETS(3, -26)
317308   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
318   MCFG_S2636_ADD("s2636_2", galaxia_s2636_config[2])
309
310   MCFG_DEVICE_ADD("s2636_2", S2636, 0)
311   MCFG_S2636_WORKRAM_SIZE(0x100)
312   MCFG_S2636_OFFSETS(3, -26)
319313   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
320314
321315   /* sound hardware */
r29591r29592
348342   MCFG_PALETTE_INIT_OWNER(galaxia_state,astrowar)
349343   MCFG_VIDEO_START_OVERRIDE(galaxia_state,astrowar)
350344
351   MCFG_S2636_ADD("s2636_0", astrowar_s2636_config)
345   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
346   MCFG_S2636_WORKRAM_SIZE(0x100)
347   MCFG_S2636_OFFSETS(3, 0)
352348   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
353349
354350   /* sound hardware */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team