Previous 199869 Revisions Next

r24878 Tuesday 13th August, 2013 at 22:42:48 UTC by Osso
Merged s2636 video and sound implementations and moved them to machine/ (nw)
[src/emu/machine]machine.mak
[src/emu/sound]s2636.c s2636.h sound.mak
[src/emu/video]s2636.c s2636.h video.mak
[src/mame]mame.mak
[src/mame/drivers]cvs.c galaxia.c laserbat.c malzak.c quasar.c seabattl.c zac2650.c
[src/mame/includes]cvs.h galaxia.h laserbat.h malzak.h zac2650.h

trunk/src/mame/includes/galaxia.h
r24877r24878
1212   galaxia_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : cvs_state(mconfig, type, tag) { }
1414
15   
1516   tilemap_t *m_bg_tilemap;
1617   bitmap_ind16 m_temp_bitmap;
1718   DECLARE_WRITE8_MEMBER(galaxia_video_w);
trunk/src/mame/includes/zac2650.h
r24877r24878
1#include "sound/s2636.h"
1#include "machine/s2636.h"
22
33class zac2650_state : public driver_device
44{
r24877r24878
1414   required_shared_ptr<UINT8> m_s2636_0_ram;
1515   
1616   required_device<cpu_device> m_maincpu;
17   required_device<s2636_sound_device> m_s2636_sound;
17   required_device<s2636_device> m_s2636_sound;
1818   
1919   bitmap_ind16 m_bitmap;
2020   bitmap_ind16 m_spritebitmap;
trunk/src/mame/includes/cvs.h
r24877r24878
66
77#include "sound/dac.h"
88#include "sound/tms5110.h"
9#include "video/s2636.h"
9#include "machine/s2636.h"
1010
1111#define CVS_S2636_Y_OFFSET     (3)
1212#define CVS_S2636_X_OFFSET     (-26)
trunk/src/mame/includes/malzak.h
r24877r24878
44
55*************************************************************************/
66
7#include "video/s2636.h"
7#include "machine/s2636.h"
88#include "video/saa5050.h"
99
1010class malzak_state : public driver_device
trunk/src/mame/includes/laserbat.h
r24877r24878
66
77#include "machine/6821pia.h"
88#include "sound/ay8910.h"
9#include "video/s2636.h"
9#include "machine/s2636.h"
1010
1111class laserbat_state : public driver_device
1212{
trunk/src/mame/mame.mak
r24877r24878
248248SOUNDS += CDP1864
249249SOUNDS += ZSG2
250250SOUNDS += MOS656X
251SOUNDS += S2636
252251SOUNDS += ASC
253252SOUNDS += MAS3507D
254253SOUNDS += SOCRATES
r24877r24878
305304VIDEOS += POLY
306305VIDEOS += PSX
307306VIDEOS += RAMDAC
308VIDEOS += S2636
309307VIDEOS += SAA5050
310308#VIDEOS += SED1330
311309VIDEOS += STVVDP
r24877r24878
442440MACHINES += RTC4543
443441MACHINES += RTC65271
444442MACHINES += RTC9701
443MACHINES += S2636
445444MACHINES += S3520CF
446445MACHINES += S3C2400
447446MACHINES += S3C2410
trunk/src/mame/drivers/zac2650.c
r24877r24878
252252   /* sound hardware */
253253   MCFG_SPEAKER_STANDARD_MONO("mono")
254254
255   MCFG_SOUND_ADD("s2636snd", S2636_SOUND, 0)
255   MCFG_SOUND_ADD("s2636snd", S2636, 0)
256256   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
257257MACHINE_CONFIG_END
258258
trunk/src/mame/drivers/laserbat.c
r24877r24878
657657static const s2636_interface s2636_1_config =
658658{
659659   0x100,
660   0, -19,
661   NULL
660   0, -19
662661};
663662
664663static const s2636_interface s2636_2_config =
665664{
666665   0x100,
667   0, -19,
668   NULL
666   0, -19
669667};
670668
671669static const s2636_interface s2636_3_config =
672670{
673671   0x100,
674   0, -19,
675   NULL
672   0, -19
676673};
677674
678675void laserbat_state::machine_start()
trunk/src/mame/drivers/galaxia.c
r24877r24878
6161*/
6262
6363#include "emu.h"
64#include "sound/s2636.h"
64#include "machine/s2636.h"
6565#include "cpu/s2650/s2650.h"
6666#include "includes/galaxia.h"
6767
r24877r24878
276276
277277static const s2636_interface galaxia_s2636_config[3] =
278278{
279   { 0x100, 3, -26, "s2636snd_0" },
280   { 0x100, 3, -26, "s2636snd_1" },
281   { 0x100, 3, -26, "s2636snd_2" }
279   { 0x100, 3, -26 },
280   { 0x100, 3, -26 },
281   { 0x100, 3, -26 }
282282};
283283
284284static const s2636_interface astrowar_s2636_config =
285285{
286286   0x100,
287   3, 0,
288   "s2636snd_0"
287   3, 0
289288};
290289
291290
r24877r24878
312311   MCFG_VIDEO_START_OVERRIDE(galaxia_state,galaxia)
313312
314313   MCFG_S2636_ADD("s2636_0", galaxia_s2636_config[0])
314   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
315315   MCFG_S2636_ADD("s2636_1", galaxia_s2636_config[1])
316   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
316317   MCFG_S2636_ADD("s2636_2", galaxia_s2636_config[2])
317
318   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
319   
318320   /* sound hardware */
319321   MCFG_SPEAKER_STANDARD_MONO("mono")
320322
321   MCFG_SOUND_ADD("s2636snd_0", S2636_SOUND, 0)
322   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
323
324   MCFG_SOUND_ADD("s2636snd_1", S2636_SOUND, 0)
325   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
326
327   MCFG_SOUND_ADD("s2636snd_2", S2636_SOUND, 0)
328   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
329323MACHINE_CONFIG_END
330324
331325
r24877r24878
352346   MCFG_VIDEO_START_OVERRIDE(galaxia_state,astrowar)
353347
354348   MCFG_S2636_ADD("s2636_0", astrowar_s2636_config)
349   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
355350
356351   /* sound hardware */
357352   MCFG_SPEAKER_STANDARD_MONO("mono")
358353
359   MCFG_SOUND_ADD("s2636snd_0", S2636_SOUND, 0)
360   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
354
361355MACHINE_CONFIG_END
362356
363357
trunk/src/mame/drivers/quasar.c
r24877r24878
274274static const s2636_interface s2636_0_config =
275275{
276276   0x100,
277   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
278   NULL
277   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
279278};
280279
281280static const s2636_interface s2636_1_config =
282281{
283282   0x100,
284   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
285   NULL
283   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
286284};
287285
288286static const s2636_interface s2636_2_config =
289287{
290288   0x100,
291   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
292   NULL
289   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
293290};
294291
295292// ****************************************
trunk/src/mame/drivers/cvs.c
r24877r24878
944944static const s2636_interface s2636_0_config =
945945{
946946   0x100,
947   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
948   NULL
947   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
949948};
950949
951950static const s2636_interface s2636_1_config =
952951{
953952   0x100,
954   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
955   NULL
953   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
956954};
957955
958956static const s2636_interface s2636_2_config =
959957{
960958   0x100,
961   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET,
962   NULL
959   CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
963960};
964961
965962
trunk/src/mame/drivers/seabattl.c
r24877r24878
3131
3232#include "emu.h"
3333#include "cpu/s2650/s2650.h"
34#include "sound/s2636.h"
35#include "video/s2636.h"
34#include "machine/s2636.h"
3635#include "video/dm9368.h"
3736#include "seabattl.lh"
3837
r24877r24878
471470{
472471   0x100,
473472   3, -21,
474   "s2636snd"
473   //"s2636snd"
475474};
476475
477476static DM9368_INTERFACE( digit_score_thousand_intf )
r24877r24878
525524   MCFG_CPU_VBLANK_INT_DRIVER("screen", seabattl_state, seabattl_interrupt)
526525
527526   MCFG_S2636_ADD("s2636", s2636_config)
528
527   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
528   
529529   MCFG_DM9368_ADD("sc_thousand", digit_score_thousand_intf)
530530   MCFG_DM9368_ADD("sc_hundred", digit_score_hundred_intf)
531531   MCFG_DM9368_ADD("sc_half", digit_score_half_a_score_intf)
r24877r24878
547547
548548   /* sound hardware */
549549   MCFG_SPEAKER_STANDARD_MONO("mono")
550   MCFG_SOUND_ADD("s2636snd", S2636_SOUND, 0)
551   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
552550
553551   /* discrete sound */
554552MACHINE_CONFIG_END
trunk/src/mame/drivers/malzak.c
r24877r24878
6565#include "emu.h"
6666#include "cpu/s2650/s2650.h"
6767#include "sound/sn76477.h"
68#include "sound/s2636.h"
6968#include "video/saa5050.h"
7069#include "machine/nvram.h"
7170#include "includes/malzak.h"
r24877r24878
303302static const s2636_interface malzac_s2636_0_config =
304303{
305304   0x100,
306   0, -16, /* -8, -16 */
307   "s2636snd_0"
305   0, -16 /* -8, -16 */
308306};
309307
310308static const s2636_interface malzac_s2636_1_config =
311309{
312310   0x100,
313   0, -16, /* -9, -16 */
314   "s2636snd_1"
311   0, -16 /* -9, -16 */
315312};
316313
317314READ8_MEMBER(malzak_state::videoram_r)
r24877r24878
364361   MCFG_PALETTE_LENGTH(128)
365362
366363   MCFG_S2636_ADD("s2636_0", malzac_s2636_0_config)
364   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
367365   MCFG_S2636_ADD("s2636_1", malzac_s2636_1_config)
368
366   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
367   
369368   MCFG_SAA5050_ADD("saa5050", 6000000, malzac_saa5050_intf)
370369
371370   /* sound hardware */
r24877r24878
379378   MCFG_SOUND_CONFIG(sn76477_intf)
380379   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
381380
382   MCFG_SOUND_ADD("s2636snd_0", S2636_SOUND, 0)
383   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
384
385   MCFG_SOUND_ADD("s2636snd_1", S2636_SOUND, 0)
386   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
387381MACHINE_CONFIG_END
388382
389383static MACHINE_CONFIG_DERIVED( malzak2, malzak )
trunk/src/emu/video/s2636.c
r24877r24878
1/**********************************************************************
2
3    Signetics 2636 video chip
4
5    Copyright Nicola Salmoria and the MAME Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8
9    PVI REGISTER DESCRIPTION
10    ------------------------
11
12          |              bit              |R/W| description
13    byte  | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |   |
14          |                               |   |
15    FC0   | size 4| size 3| size 2| size 1| W | size of the 4 objects(=sprites)
16          |                               |   |
17    FC1   |       |C1 |C2 |C3 |C1 |C2 |C3 | W | colors of the 4 objects
18          |       |  color 1  |  color 2  |   |
19    FC2   |       |C1 |C2 |C3 |C1 |C2 |C3 | W |
20          |       |  color 3  |  color 4  |   |
21          |                               |   |
22    FC3   |                       |sh |pos| W | 1=shape 0=position
23          |                               |   | display format and position
24    FC4   |            (free)             |   |
25    FC5   |            (free)             |   |
26          |                               |   |
27    FC6   |   |C1 |C2 |C3 |BG |scrn colr  | W | background lock and color
28          |   |backg colr |enb|C1 |C2 |C3 |   | 3="enable"
29          |                               |   |
30    FC7   |            sound              | W | squarewave output
31          |                               |   |
32    FC8   |       N1      |      N2       | W | range of the 4 display digits
33    FC9   |       N3      |      N4       | W |
34          |                               |   |
35          |obj/backgrnd   |complete object| R |
36    FCA   | 1 | 2 | 3 | 4 | 1 | 2 | 3 | 4 |   |
37          |                               |   |
38    FCB   |   |VR-|   object collisions   | R | Composition of object and back-
39          |   |LE |1/2|1/3|1/3|1/4|2/4|3/4|   | ground,collision detection and
40          |                               |   | object display as a state display
41          |                               |   | for the status register.Set VRLE.
42          |                               |   | wait for VRST.Read out or transmit
43          |                               |   | [copy?] all bits until reset by
44          |                               |   | VRST.
45          |                               |   |
46    FCC   |            PORT1              | R | PORT1 and PORT2 for the range of
47    FCD   |            PORT2              |   | the A/D conversion.Cleared by VRST
48    FCE   |            (free)             |   |
49    FCF   |            (free)             |   |
50
51
52    Size control by byte FC0
53
54     bit  matrix
55    |0|0|  8x10
56    |0|1| 16x20
57    |1|0| 32x40
58    |1|1| 64x80
59
60    CE1 and not-CE2 are outputs from the PVI.$E80..$EFF also controls the
61    analog multiplexer.
62
63
64    SPRITES
65    -------
66
67    each object field: (=sprite data structure)
68
69    0 \ 10 bytes of bitmap (Each object is 8 pixels wide.)
70    9 /
71    A   HC  horizontal object coordinate
72    B   HCB horizontal duplicate coordinate
73    C   VC  vertical object coordinate
74    D   VCB vertical duplicate coordinate
75
76*************************************************************/
77
78#include "emu.h"
79#include "video/s2636.h"
80#include "sound/s2636.h"
81
82
83
84/*************************************
85 *
86 *  Device interface
87 *
88 *************************************/
89
90const device_type S2636 = &device_creator<s2636_device>;
91
92s2636_device::s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
93   : device_t(mconfig, S2636, "Signetics 2636", tag, owner, clock, "s2636", __FILE__),
94      device_video_interface(mconfig, *this),
95      m_work_ram(NULL),
96      m_bitmap(NULL),
97      m_collision_bitmap(NULL)
98{
99}
100
101//-------------------------------------------------
102//  device_config_complete - perform any
103//  operations now that the configuration is
104//  complete
105//-------------------------------------------------
106
107void s2636_device::device_config_complete()
108{
109   // inherit a copy of the static data
110   const s2636_interface *intf = reinterpret_cast<const s2636_interface *>(static_config());
111   if (intf != NULL)
112      *static_cast<s2636_interface *>(this) = *intf;
113
114   // or initialize to defaults if none provided
115   else
116   {
117      m_work_ram_size = 0;
118      m_y_offset = 0;
119      m_x_offset = 0;
120      m_sound_tag = "";
121   }
122}
123
124//-------------------------------------------------
125//  device_start - device-specific startup
126//-------------------------------------------------
127
128void s2636_device::device_start()
129{
130   int width = m_screen->width();
131   int height = m_screen->height();
132
133   m_work_ram = auto_alloc_array_clear(machine(), UINT8, m_work_ram_size);
134   m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
135   m_collision_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
136
137   save_item(NAME(m_x_offset));
138   save_item(NAME(m_y_offset));
139   save_pointer(NAME(m_work_ram), m_work_ram_size);
140   save_item(NAME(*m_bitmap));
141   save_item(NAME(*m_collision_bitmap));
142}
143
144/*************************************
145 *
146 *  Constants
147 *
148 *************************************/
149
150#define SPRITE_WIDTH    (8)
151#define SPRITE_HEIGHT   (10)
152
153static const int sprite_offsets[4] = { 0x00, 0x10, 0x20, 0x40 };
154
155
156
157
158/*************************************
159 *
160 *  Draw a sprite
161 *
162 *************************************/
163
164static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or_mode, bitmap_ind16 &bitmap, const rectangle &cliprect )
165{
166   int sy;
167
168   /* for each row */
169   for (sy = 0; sy < SPRITE_HEIGHT; sy++)
170   {
171      int sx;
172
173      /* for each pixel on the row */
174      for (sx = 0; sx < SPRITE_WIDTH; sx++)
175      {
176         int ey;
177
178         /* each pixel can be expanded */
179         for (ey = 0; ey <= expand; ey++)
180         {
181            int ex;
182
183            for (ex = 0; ex <= expand; ex++)
184            {
185               /* compute effective destination pixel */
186               int ty = y + sy * (expand + 1) + ey;
187               int tx = x + sx * (expand + 1) + ex;
188
189               /* get out if outside the drawing region */
190               if (!cliprect.contains(tx, ty))
191                  continue;
192
193               /* get out if current image bit is transparent */
194               if (((gfx[sy] << sx) & 0x80) == 0x00)
195                  continue;
196
197               if (or_mode)
198                  bitmap.pix16(ty, tx) = 0x08 | bitmap.pix16(ty, tx) | color;
199               else
200                  bitmap.pix16(ty, tx) = 0x08 | color;
201            }
202         }
203      }
204   }
205}
206
207
208
209/*************************************
210 *
211 *  Collision detection
212 *
213 *************************************/
214
215int s2636_device::check_collision( int spriteno1, int spriteno2, const rectangle &cliprect )
216{
217   int checksum = 0;
218
219   UINT8* attr1 = &m_work_ram[sprite_offsets[spriteno1]];
220   UINT8* attr2 = &m_work_ram[sprite_offsets[spriteno2]];
221
222   /* TODO: does not check shadow sprites yet */
223
224   m_collision_bitmap->fill(0, cliprect);
225
226   if ((attr1[0x0a] != 0xff) && (attr2[0x0a] != 0xff))
227   {
228      int x, y;
229
230      int x1 = attr1[0x0a] + m_x_offset;
231      int y1 = attr1[0x0c] + m_y_offset;
232      int x2 = attr2[0x0a] + m_x_offset;
233      int y2 = attr2[0x0c] + m_y_offset;
234
235      int expand1 = (m_work_ram[0xc0] >> (spriteno1 << 1)) & 0x03;
236      int expand2 = (m_work_ram[0xc0] >> (spriteno2 << 1)) & 0x03;
237
238      /* draw first sprite */
239      draw_sprite(attr1, 1, y1, x1, expand1, FALSE, *m_collision_bitmap, cliprect);
240
241      /* get fingerprint */
242      for (x = x1; x < x1 + SPRITE_WIDTH; x++)
243         for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
244         {
245            if (!cliprect.contains(x, y))
246               continue;
247
248            checksum = checksum + m_collision_bitmap->pix16(y, x);
249         }
250
251      /* black out second sprite */
252      draw_sprite(attr2, 0, y2, x2, expand2, FALSE, *m_collision_bitmap, cliprect);
253
254      /* remove fingerprint */
255      for (x = x1; x < x1 + SPRITE_WIDTH; x++)
256         for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
257         {
258            if (!cliprect.contains(x, y))
259               continue;
260
261            checksum = checksum - m_collision_bitmap->pix16(y, x);
262         }
263   }
264
265   return (checksum != 0);
266}
267
268
269
270/*************************************
271 *
272 *  Main drawing
273 *
274 *************************************/
275
276bitmap_ind16 &s2636_device::update( const rectangle &cliprect )
277{
278   UINT8 collision = 0;
279   int spriteno;
280
281   m_bitmap->fill(0, cliprect);
282
283   for (spriteno = 0; spriteno < 4; spriteno++)
284   {
285      int color, expand, x, y;
286      UINT8* attr = &m_work_ram[sprite_offsets[spriteno]];
287
288      /* get out if sprite is turned off */
289      if (attr[0x0a] == 0xff)
290         continue;
291
292      x = attr[0x0a] + m_x_offset;
293      y = attr[0x0c] + m_y_offset;
294
295      color = (m_work_ram[0xc1 + (spriteno >> 1)] >> ((spriteno & 1) ? 0 : 3)) & 0x07;
296      expand = (m_work_ram[0xc0] >> (spriteno << 1)) & 0x03;
297
298      draw_sprite(attr, color, y, x, expand, TRUE, *m_bitmap, cliprect);
299
300      /* bail if no shadow sprites */
301      if ((attr[0x0b] == 0xff) || (attr[0x0d] == 0xfe))
302         continue;
303
304      x = attr[0x0b] + m_x_offset;
305
306      while (y < 0xff)
307      {
308         y = y + SPRITE_HEIGHT + attr[0x0d];
309
310         draw_sprite(attr, color, y, x, expand, TRUE, *m_bitmap, cliprect);
311      }
312   }
313
314   /* collision detection */
315   if (check_collision(0, 1, cliprect))  collision |= 0x20;
316   if (check_collision(0, 2, cliprect))  collision |= 0x10;
317   if (check_collision(0, 3, cliprect))  collision |= 0x08;
318   if (check_collision(1, 2, cliprect))  collision |= 0x04;
319   if (check_collision(1, 3, cliprect))  collision |= 0x02;
320   if (check_collision(2, 3, cliprect))  collision |= 0x01;
321
322   m_work_ram[0xcb] = collision;
323
324   return *m_bitmap;
325}
326
327
328/*************************************
329 *
330 *  Work RAM access handlers
331 *
332 *************************************/
333
334WRITE8_MEMBER( s2636_device::work_ram_w )
335{
336   assert(offset < m_work_ram_size);
337
338   if ( offset == 0xc7 )
339   {
340      if ( m_sound_tag && *m_sound_tag )
341      {
342         machine().device<s2636_sound_device>(m_sound_tag)->soundport_w(0, data);
343      }
344   }
345
346   m_work_ram[offset] = data;
347}
348
349
350READ8_MEMBER( s2636_device::work_ram_r )
351{
352   assert(offset < m_work_ram_size);
353
354   return m_work_ram[offset];
355}
trunk/src/emu/video/s2636.h
r24877r24878
1/**********************************************************************
2
3    Signetics 2636 video chip
4
5**********************************************************************/
6
7#ifndef __S2636_H__
8#define __S2636_H__
9
10
11
12#define S2636_IS_PIXEL_DRAWN(p)     (((p) & 0x08) ? TRUE : FALSE)
13#define S2636_PIXEL_COLOR(p)        ((p) & 0x07)
14
15/*************************************
16 *
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   const char *m_sound_tag;
27};
28
29/*************************************
30 *
31 *  Device configuration macros
32 *
33 *************************************/
34
35class s2636_device : public device_t,
36            public device_video_interface,
37            public s2636_interface
38{
39public:
40   s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
41   ~s2636_device() {}
42
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 */
46
47   bitmap_ind16 &update( const rectangle &cliprect );
48   DECLARE_WRITE8_MEMBER( work_ram_w );
49   DECLARE_READ8_MEMBER( work_ram_r );
50
51protected:
52   // device-level overrides
53   virtual void device_config_complete();
54   virtual void device_start();
55
56private:
57   // internal state
58   UINT8     *m_work_ram;
59   bitmap_ind16 *m_bitmap;
60   bitmap_ind16 *m_collision_bitmap;
61   
62   int check_collision( int spriteno1, int spriteno2, const rectangle &cliprect );
63};
64
65extern const device_type S2636;
66
67
68#define MCFG_S2636_ADD(_tag, _interface) \
69   MCFG_DEVICE_ADD(_tag, S2636, 0) \
70   MCFG_DEVICE_CONFIG(_interface)
71
72
73#endif /* __S2636_H__ */
trunk/src/emu/video/video.mak
r24877r24878
334334
335335#-------------------------------------------------
336336#
337#@src/emu/video/s2636.h,VIDEOS += S2636
338#-------------------------------------------------
339
340ifneq ($(filter S2636,$(VIDEOS)),)
341VIDEOOBJS+= $(VIDEOOBJ)/s2636.o
342endif
343
344#-------------------------------------------------
345#
346337#@src/emu/video/saa5050.h,VIDEOS += SAA5050
347338#-------------------------------------------------
348339
trunk/src/emu/sound/s2636.c
r24877r24878
1/***************************************************************************
2
3  PeT mess@utanet.at
4
5***************************************************************************/
6
7#include "emu.h"
8#include "sound/s2636.h"
9
10const device_type S2636_SOUND = &device_creator<s2636_sound_device>;
11
12s2636_sound_device::s2636_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
13   : device_t(mconfig, S2636_SOUND, "S2636", tag, owner, clock, "s2636", __FILE__),
14      device_sound_interface(mconfig, *this),
15      m_channel(NULL),
16      m_size(0),
17      m_pos(0),
18      m_level(0)
19{
20   for (int i = 0; i < 1; i++)
21   m_reg[i] = 0;
22}
23
24//-------------------------------------------------
25//  device_config_complete - perform any
26//  operations now that the configuration is
27//  complete
28//-------------------------------------------------
29
30void s2636_sound_device::device_config_complete()
31{
32}
33
34//-------------------------------------------------
35//  device_start - device-specific startup
36//-------------------------------------------------
37
38void s2636_sound_device::device_start()
39{
40   m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate(), this);
41   save_item(NAME(m_size));
42   save_item(NAME(m_pos));
43   save_item(NAME(m_level));
44   
45   for (int i = 0; i < 1; i++)
46   save_item(NAME(m_reg[i]), i);
47}
48
49
50void s2636_sound_device::soundport_w (int offset, int data)
51{
52   m_channel->update();
53   m_reg[offset] = data;
54   switch (offset)
55   {
56      case 0:
57         m_pos = 0;
58         m_level = TRUE;
59         // frequency 7874/(data+1)
60         m_size = machine().sample_rate() * (data + 1) /7874;
61         break;
62   }
63}
64
65
66//-------------------------------------------------
67//  sound_stream_update - handle a stream update
68//-------------------------------------------------
69
70void s2636_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
71{
72   int i;
73   stream_sample_t *buffer = outputs[0];
74
75   for (i = 0; i < samples; i++, buffer++)
76   {
77      *buffer = 0;
78      if (m_reg[0] && m_pos <= m_size / 2)
79      {
80         *buffer = 0x7fff;
81      }
82      if (m_pos <= m_size)
83         m_pos++;
84      if (m_pos > m_size)
85         m_pos = 0;
86   }
87}
trunk/src/emu/sound/s2636.h
r24877r24878
1/*****************************************************************************
2 *
3 * sound/s2636.h
4 *
5 ****************************************************************************/
6
7#ifndef S2636_SOUND_H_
8#define S2636_SOUND_H_
9
10
11
12class s2636_sound_device : public device_t,
13                           public device_sound_interface
14{
15public:
16   s2636_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
17   ~s2636_sound_device() {}
18
19   void soundport_w (int mode, int data);
20   
21protected:
22   // device-level overrides
23   virtual void device_config_complete();
24   virtual void device_start();
25
26   // sound stream update overrides
27   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
28
29private:
30   // internal state
31   sound_stream *m_channel;
32   UINT8 m_reg[1];
33   int m_size;
34   int m_pos;
35   unsigned m_level;
36};
37
38extern const device_type S2636_SOUND;
39
40
41#endif /* S2636_SOUND_H_ */
trunk/src/emu/sound/sound.mak
r24877r24878
504504
505505
506506#-------------------------------------------------
507# S2636 wave generator
508#@src/emu/sound/s2636.h,SOUNDS += S2636
509#-------------------------------------------------
510
511ifneq ($(filter S2636,$(SOUNDS)),)
512SOUNDOBJS += $(SOUNDOBJ)/s2636.o
513endif
514
515
516
517#-------------------------------------------------
518507# Sega custom sound chips
519508#@src/emu/sound/segapcm.h,SOUNDS += SEGAPCM
520509#@src/emu/sound/multipcm.h,SOUNDS += MULTIPCM
trunk/src/emu/machine/machine.mak
r24877r24878
11111111
11121112#-------------------------------------------------
11131113#
1114#@src/emu/machine/s2636.h,MACHINES += S2636
1115#-------------------------------------------------
1116
1117ifneq ($(filter S2636,$(MACHINES)),)
1118MACHINEOBJS+= $(MACHINEOBJ)/s2636.o
1119endif
1120
1121#-------------------------------------------------
1122#
11141123#@src/emu/machine/s3520cf.h,MACHINES += S3520CF
11151124#-------------------------------------------------
11161125

Previous 199869 Revisions Next


© 1997-2024 The MAME Team