Previous 199869 Revisions Next

r30961 Friday 13th June, 2014 at 17:20:57 UTC by David Haywood
reorganize some code for gstriker (no functional change) (nw)
[src/mame]mame.mak
[src/mame/drivers]gstriker.c
[src/mame/includes]gstriker.h
[src/mame/video]excellent_spr.c gstriker.c mb60553.c* mb60553.h* vs920a.c* vs920a.h*

trunk/src/mame/drivers/gstriker.c
r30960r30961
2828Tilemap scrolling/rotation/zooming or whatever effect it needs
2929Priorities are wrong. I suspect they need sprite orthogonality
3030Missing mixer registers (mainly layer enable/disable)
31Merge with other Video System games ?
3231
3332******************************************************************************/
3433
r30960r30961
273272
274273static ADDRESS_MAP_START( gstriker_map, AS_PROGRAM, 16, gstriker_state )
275274   AM_RANGE(0x000000, 0x0fffff) AM_ROM
276   AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(MB60553_0_vram_w) AM_SHARE("mb60553_vram")
277   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_vram")
278   AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_SHARE("vs920a_vram")
279   AM_RANGE(0x181000, 0x181fff) AM_RAM AM_SHARE("lineram")
275   AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  vram_r, vram_w )
276   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_m_vram")
277   AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device,  vram_r, vram_w )
278   AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  line_r, line_w )
280279   AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
281280
282   AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w)
281   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  regs_r, regs_w )
283282   AM_RANGE(0x200040, 0x20005f) AM_RAM
284283   AM_RANGE(0x200060, 0x20007f) AM_RAM
285284   AM_RANGE(0x200080, 0x200081) AM_READ_PORT("P1")
r30960r30961
310309
311310static ADDRESS_MAP_START( vgoal_map, AS_PROGRAM, 16, gstriker_state )
312311   AM_RANGE(0x000000, 0x0fffff) AM_ROM
313   AM_RANGE(0x100000, 0x103fff) AM_RAM_WRITE(MB60553_0_vram_w) AM_SHARE("mb60553_vram")
314   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_vram")
315   AM_RANGE(0x180000, 0x180fff) AM_RAM_WRITE(VS920A_0_vram_w) AM_SHARE("vs920a_vram")
316   AM_RANGE(0x181000, 0x181fff) AM_RAM AM_SHARE("lineram")
312   AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  vram_r, vram_w )
313   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_m_vram")
314   AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device,  vram_r, vram_w )
315   AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  line_r, line_w )
317316   AM_RANGE(0x1c0000, 0x1c4fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
318   AM_RANGE(0x200000, 0x20000f) AM_RAM_WRITE(MB60553_0_regs_w)
317   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  regs_r, regs_w )
319318   AM_RANGE(0x200040, 0x20005f) AM_RAM
320319
321320   AM_RANGE(0x200080, 0x200081) AM_READ_PORT("P1")
r30960r30961
556555   MCFG_PALETTE_ADD("palette", 0x800)
557556   MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
558557
558
559   MCFG_DEVICE_ADD("zoomtilemap", MB60553, 0)
560   MCFG_MB60553_GFXDECODE("gfxdecode")
561
562   MCFG_DEVICE_ADD("texttilemap", VS920A, 0)
563   MCFG_VS920A_GFXDECODE("gfxdecode")
564
565
559566   MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
560567   MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
561568   MCFG_VSYSTEM_SPR_SET_PALBASE(0x10)
r30960r30961
607614   MCFG_PALETTE_ADD("palette", 0x2000)
608615   MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
609616
617   MCFG_DEVICE_ADD("zoomtilemap", MB60553, 0)
618   MCFG_MB60553_GFXDECODE("gfxdecode")
619
620   MCFG_DEVICE_ADD("texttilemap", VS920A, 0)
621   MCFG_VS920A_GFXDECODE("gfxdecode")
622
610623   MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
611624   MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
612625   MCFG_VSYSTEM_SPR_SET_PALBASE(0x00)
r30960r30961
783796   ROM_LOAD( "vgoalc16.u17", 0x000000, 0x200000, CRC(2b211fb2) SHA1(4e04e099a1dae7abdb0732808a5d74fdc7afcf45) ) // same content, dif pos on board
784797
785798   ROM_REGION( 0x400000, "gfx3", 0 )
786   ROM_LOAD( "vgoalc16.u11", 0x000000, 0x200000, CRC(5bc3146c) SHA1(ede4def1ddc4390fed8fd89643900967faff3640) )
799   //ROM_LOAD( "vgoalc16.u11", 0x000000, 0x200000, CRC(5bc3146c) SHA1(ede4def1ddc4390fed8fd89643900967faff3640) ) // this is just a bad dump, are the above roms too?
800   ROM_LOAD( "c13_u11.u11",  0x000000, 0x200000, CRC(76d09f27) SHA1(ffef83954426f9e56bbe2d98b32cea675c063fab) )
787801   ROM_LOAD( "c13_u12.u12",  0x200000, 0x200000, CRC(a3874419) SHA1(c9fa283106ada3419e311f400fcf4251b32318c4) )
788802
789803   ROM_REGION( 0x40000, "ymsnd.deltat", 0 )
trunk/src/mame/includes/gstriker.h
r30960r30961
22#define __GSTRIKER_H
33
44#include "video/vsystem_spr.h"
5#include "video/mb60553.h"
6#include "video/vs920a.h"
57
6/*** VS920A **********************************************/
78
8#define MAX_VS920A 2
99
10struct sVS920A
11{
12   tilemap_t* tmap;
13   UINT16* vram;
14   UINT16 pal_base;
15   UINT8 gfx_region;
16
17};
18
19/*** MB60553 **********************************************/
20
21#define MAX_MB60553 2
22
23struct tMB60553
24{
25   tilemap_t* tmap;
26   UINT16* vram;
27   UINT16 regs[8];
28   UINT8 bank[8];
29   UINT16 pal_base;
30   UINT8 gfx_region;
31
32};
33
34
35
3610class gstriker_state : public driver_device
3711{
3812public:
3913   gstriker_state(const machine_config &mconfig, device_type type, const char *tag)
4014      : driver_device(mconfig, type, tag),
41      m_MB60553_vram(*this, "mb60553_vram"),
42      m_CG10103_vram(*this, "cg10103_vram"),
43      m_VS920A_vram(*this, "vs920a_vram"),
15      m_CG10103_m_vram(*this, "cg10103_m_vram"),
4416      m_work_ram(*this, "work_ram"),
45      m_lineram(*this, "lineram"),
4617      m_spr(*this, "vsystem_spr"),
18      m_bg(*this, "zoomtilemap"),
19      m_tx(*this, "texttilemap"),
4720      m_maincpu(*this, "maincpu"),
4821      m_audiocpu(*this, "audiocpu"),
4922      m_gfxdecode(*this, "gfxdecode"),
r30960r30961
5225
5326   virtual void machine_start()
5427   {
55      m_MB60553[0].vram = m_MB60553_vram;
56      m_VS920A[0].vram = m_VS920A_vram;
5728   }
5829
59   required_shared_ptr<UINT16> m_MB60553_vram;
60   required_shared_ptr<UINT16> m_CG10103_vram;
61   required_shared_ptr<UINT16> m_VS920A_vram;
30   required_shared_ptr<UINT16> m_CG10103_m_vram;
6231   required_shared_ptr<UINT16> m_work_ram;
63   required_shared_ptr<UINT16> m_lineram;
6432   required_device<vsystem_spr_device> m_spr;
33   required_device<mb60553_zooming_tilemap_device> m_bg;
34   required_device<vs920a_text_tilemap_device> m_tx;
6535
6636   UINT16 m_dmmy_8f_ret;
6737   int m_pending_command;
r30960r30961
7040   UINT16 m_mcu_data;
7141   UINT16 m_prot_reg[2];
7242
73   sVS920A m_VS920A[MAX_VS920A];
74   tMB60553 m_MB60553[MAX_MB60553];
75   sVS920A* m_VS920A_cur_chip;
76   tMB60553 *m_MB60553_cur_chip;
43
7744   DECLARE_READ16_MEMBER(dmmy_8f);
7845   DECLARE_WRITE16_MEMBER(sound_command_w);
7946   DECLARE_READ16_MEMBER(pending_command_r);
r30960r30961
8552   DECLARE_READ16_MEMBER(twrldc94_prot_reg_r);
8653   DECLARE_READ16_MEMBER(vbl_toggle_r);
8754   DECLARE_WRITE16_MEMBER(vbl_toggle_w);
88   DECLARE_WRITE16_MEMBER(VS920A_0_vram_w);
89   DECLARE_WRITE16_MEMBER(VS920A_1_vram_w);
90   DECLARE_WRITE16_MEMBER(MB60553_0_regs_w);
91   DECLARE_WRITE16_MEMBER(MB60553_1_regs_w);
92   DECLARE_WRITE16_MEMBER(MB60553_0_vram_w);
93   DECLARE_WRITE16_MEMBER(MB60553_1_vram_w);
94   DECLARE_WRITE16_MEMBER(gsx_videoram3_w);
95   void MB60553_reg_written(int numchip, int num_reg);
55
56   
9657   DECLARE_DRIVER_INIT(twrldc94a);
9758   DECLARE_DRIVER_INIT(vgoalsoc);
9859   DECLARE_DRIVER_INIT(twrldc94);
99   TILE_GET_INFO_MEMBER(VS920A_get_tile_info);
100   TILE_GET_INFO_MEMBER(MB60553_get_tile_info);
101   TILEMAP_MAPPER_MEMBER(twc94_scan);
10260   DECLARE_VIDEO_START(gstriker);
10361   DECLARE_VIDEO_START(vgoalsoc);
10462   DECLARE_VIDEO_START(twrldc94);
10563   UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
106   void VS920A_init(int numchips);
107   tilemap_t* VS920A_get_tilemap(int numchip);
108   void VS920A_set_pal_base(int numchip, int pal_base);
109   void VS920A_set_gfx_region(int numchip, int gfx_region);
110   void VS920A_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
111   void MB60553_init(int numchips);
112   void MB60553_set_pal_base(int numchip, int pal_base);
113   void MB60553_set_gfx_region(int numchip, int gfx_region);
114   void MB60553_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
115   tilemap_t* MB60553_get_tilemap(int numchip);
64
65
11666   void mcu_init(  );
11767   DECLARE_WRITE_LINE_MEMBER(gs_ym2610_irq);
11868   required_device<cpu_device> m_maincpu;
trunk/src/mame/mame.mak
r30960r30961
20592059   $(DRIVERS)/fromance.o $(VIDEO)/fromance.o \
20602060   $(DRIVERS)/fromanc2.o $(VIDEO)/fromanc2.o \
20612061   $(DRIVERS)/gstriker.o $(VIDEO)/gstriker.o \
2062   $(VIDEO)/mb60553.o $(VIDEO)/vs920a.o \
20622063   $(DRIVERS)/inufuku.o $(VIDEO)/inufuku.o \
20632064   $(DRIVERS)/ojankohs.o $(VIDEO)/ojankohs.o \
20642065   $(DRIVERS)/pipedrm.o \
trunk/src/mame/video/gstriker.c
r30960r30961
22#include "includes/gstriker.h"
33
44
5/*** VS920A (score tilemap) **********************************************/
65
7/*
8
9    VS920A - (Very) Simple tilemap chip
10    -----------------------------------
11
12- 1 Plane
13- Tiles 8x8, 4bpp
14- Map 64x64
15- No scrolling or other effects (at least in gstriker)
16
17
18    Videoram format:
19    ----------------
20
21pppp tttt tttt tttt
22
23t=tile, p=palette
24
25*/
26
27
28TILE_GET_INFO_MEMBER(gstriker_state::VS920A_get_tile_info)
29{
30   int data;
31   int tileno, pal;
32
33   data = m_VS920A_cur_chip->vram[tile_index];
34
35   tileno = data & 0xFFF;
36   pal =   (data >> 12) & 0xF;
37
38   SET_TILE_INFO_MEMBER(m_VS920A_cur_chip->gfx_region, tileno, m_VS920A_cur_chip->pal_base + pal, 0);
39}
40
41WRITE16_MEMBER(gstriker_state::VS920A_0_vram_w)
42{
43   COMBINE_DATA(&m_VS920A[0].vram[offset]);
44   m_VS920A[0].tmap->mark_tile_dirty(offset);
45}
46
47WRITE16_MEMBER(gstriker_state::VS920A_1_vram_w)
48{
49   COMBINE_DATA(&m_VS920A[1].vram[offset]);
50   m_VS920A[1].tmap->mark_tile_dirty(offset);
51}
52
53void gstriker_state::VS920A_init(int numchips)
54{
55   int i;
56
57   if (numchips > MAX_VS920A)
58      numchips = MAX_VS920A;
59
60   for (i=0;i<numchips;i++)
61   {
62      m_VS920A[i].tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
63
64      m_VS920A[i].tmap->set_transparent_pen(0);
65   }
66}
67
68tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip)
69{
70   return m_VS920A[numchip].tmap;
71}
72
73void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base)
74{
75   m_VS920A[numchip].pal_base = pal_base;
76}
77
78void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region)
79{
80   m_VS920A[numchip].gfx_region = gfx_region;
81}
82
83void gstriker_state::VS920A_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority)
84{
85   m_VS920A_cur_chip = &m_VS920A[numchip];
86
87   m_VS920A_cur_chip->tmap->draw(screen, bitmap, cliprect, 0, priority);
88}
89
90
91
92/*** Fujitsu MB60553 (screen tilemap) **********************************************/
93
94/*
95
96    Fujitsu MB60553 - Tilemap chip
97    ------------------------------
98
99- 1 Plane
100- Tiles 16x16, 4bpp
101- Map 64x64
102- Scrolling
103- Indexed banking (8 banks)
104- Surely another effect like roz/tilezoom, yet to be implemented
105
106
107    Videoram format
108    ---------------
109
110pppp bbbt tttt tttt
111
112t=tile, b=bank, p=palette
113
114
115    Registers
116    ---------
117
1180 - Scroll X
119Fixed point 12.4 (seems wrong)
120
1211 - Scroll Y
122Fixed point 12.4 (seems wrong)
123
1242 - ????
125
1263 - ????
127
1284 - Tilebank #0/#1   ---a aaaa  ---b bbbb
1295 - Tilebank #2/#3   ---a aaaa  ---b bbbb
1306 - Tilebank #4/#5   ---a aaaa  ---b bbbb
1317 - Tilebank #6/#7   ---a aaaa  ---b bbbb
132
133Indexed tilebank. Each bank is 0x200 tiles wide. Notice that within each register, the bank with the lower
134index is in the MSB. gstriker uses 5 bits for banking, but the chips could be able to do more.
135
136*/
137
138
139
140TILE_GET_INFO_MEMBER(gstriker_state::MB60553_get_tile_info)
141{
142   int data, bankno;
143   int tileno, pal;
144
145   data = m_MB60553_cur_chip->vram[tile_index];
146
147   tileno = data & 0x1FF;
148   pal = (data >> 12) & 0xF;
149   bankno = (data >> 9) & 0x7;
150
151   SET_TILE_INFO_MEMBER(m_MB60553->gfx_region, tileno + m_MB60553_cur_chip->bank[bankno] * 0x200, pal + m_MB60553->pal_base, 0);
152}
153
154void gstriker_state::MB60553_reg_written(int numchip, int num_reg)
155{
156   tMB60553* cur = &m_MB60553[numchip];
157
158   switch (num_reg)
159   {
160   case 0:
161      cur->tmap->set_scrollx(0, cur->regs[0]>>4);
162      break;
163
164   case 1:
165      cur->tmap->set_scrolly(0, cur->regs[1]>>4);
166      break;
167
168   case 2:
169      osd_printf_debug("MB60553_reg chip %d, reg 2 %04x\n",numchip, cur->regs[2]);
170      break;
171
172   case 3:
173      osd_printf_debug("MB60553_reg chip %d, reg 3 %04x\n",numchip, cur->regs[3]);
174      break;
175
176   case 4:
177      cur->bank[0] = (cur->regs[4] >> 8) & 0x1F;
178      cur->bank[1] = (cur->regs[4] >> 0) & 0x1F;
179      cur->tmap->mark_all_dirty();
180      break;
181
182   case 5:
183      cur->bank[2] = (cur->regs[5] >> 8) & 0x1F;
184      cur->bank[3] = (cur->regs[5] >> 0) & 0x1F;
185      cur->tmap->mark_all_dirty();
186      break;
187
188   case 6:
189      cur->bank[4] = (cur->regs[6] >> 8) & 0x1F;
190      cur->bank[5] = (cur->regs[6] >> 0) & 0x1F;
191      cur->tmap->mark_all_dirty();
192      break;
193
194   case 7:
195      cur->bank[6] = (cur->regs[7] >> 8) & 0x1F;
196      cur->bank[7] = (cur->regs[7] >> 0) & 0x1F;
197      cur->tmap->mark_all_dirty();
198      break;
199   }
200}
201
202/* twc94 has the tilemap made of 2 pages .. it needs this */
203TILEMAP_MAPPER_MEMBER(gstriker_state::twc94_scan)
204{
205   /* logical (col,row) -> memory offset */
206   return (row*64) + (col&63) + ((col&64)<<6);
207}
208
209void gstriker_state::MB60553_init(int numchips)
210{
211   int i;
212
213   if (numchips > MAX_MB60553)
214      numchips = MAX_MB60553;
215
216   for (i=0;i<numchips;i++)
217   {
218      m_MB60553[i].tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64);
219
220      m_MB60553[i].tmap->set_transparent_pen(0);
221   }
222}
223
224void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base)
225{
226   m_MB60553[numchip].pal_base = pal_base;
227}
228
229void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region)
230{
231   m_MB60553[numchip].gfx_region = gfx_region;
232}
233
234/* THIS IS STILL WRONG! */
235void gstriker_state::MB60553_draw(int numchip, screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority)
236{
237   int line;
238   rectangle clip;
239   m_MB60553_cur_chip = &m_MB60553[numchip];
240
241   clip.min_x = m_screen->visible_area().min_x;
242   clip.max_x = m_screen->visible_area().max_x;
243
244   for (line = 0; line < 224;line++)
245   {
246//      int scrollx;
247//      int scrolly;
248
249      UINT32 startx,starty;
250
251      UINT32 incxx,incyy;
252
253      startx = m_MB60553_cur_chip->regs[0];
254      starty = m_MB60553_cur_chip->regs[1];
255
256      startx += (24<<4); // maybe not..
257
258      startx -=  m_lineram[(line)*8+7]/2;
259
260      incxx = m_lineram[(line)*8+0]<<4;
261      incyy = m_lineram[(line)*8+3]<<4;
262
263      clip.min_y = clip.max_y = line;
264
265      m_MB60553_cur_chip->tmap->draw_roz(screen, bitmap, clip, startx<<12,starty<<12,
266            incxx,0,0,incyy,
267            1,
268            0,priority);
269
270   }
271
272
273
274}
275
276tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip)
277{
278   return m_MB60553[numchip].tmap;
279}
280
281
282WRITE16_MEMBER(gstriker_state::MB60553_0_regs_w)
283{
284   UINT16 oldreg = m_MB60553[0].regs[offset];
285
286   COMBINE_DATA(&m_MB60553[0].regs[offset]);
287
288   if (m_MB60553[0].regs[offset] != oldreg)
289      MB60553_reg_written(0, offset);
290}
291
292WRITE16_MEMBER(gstriker_state::MB60553_1_regs_w)
293{
294   UINT16 oldreg = m_MB60553[1].regs[offset];
295
296   COMBINE_DATA(&m_MB60553[1].regs[offset]);
297
298   if (m_MB60553[1].regs[offset] != oldreg)
299      MB60553_reg_written(1, offset);
300}
301
302WRITE16_MEMBER(gstriker_state::MB60553_0_vram_w)
303{
304   COMBINE_DATA(&m_MB60553[0].vram[offset]);
305
306   m_MB60553[0].tmap->mark_tile_dirty(offset);
307}
308
309WRITE16_MEMBER(gstriker_state::MB60553_1_vram_w)
310{
311   COMBINE_DATA(&m_MB60553[1].vram[offset]);
312
313   m_MB60553[1].tmap->mark_tile_dirty(offset);
314}
315
316
317
318
319
3206/*** VIDEO UPDATE/START **********************************************/
3217
3228
323#ifdef UNUSED_FUNCTION
324WRITE16_MEMBER(gstriker_state::gsx_videoram3_w)
325{
326   // This memory appears to be empty in gstriker
327   gs_videoram3[offset] = data;
328}
329#endif
3309
331
33210UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
33311{
33412   bitmap.fill(m_palette->black_pen(), cliprect);
335
13   
33614   // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably
33715   //  needs sprite orthogonality
338   MB60553_draw(0, screen, bitmap,cliprect, 0);
16   m_bg->draw( screen, bitmap,cliprect, 0);
33917
340   m_spr->draw_sprites(m_CG10103_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x0);
18   m_spr->draw_sprites(m_CG10103_m_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x0);
34119
342   VS920A_draw(0, screen, bitmap, cliprect, 0);
20   m_tx->draw( screen, bitmap, cliprect, 0);
34321
344   m_spr->draw_sprites(m_CG10103_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x2);
22   m_spr->draw_sprites(m_CG10103_m_vram, 0x2000, screen, bitmap, cliprect, 0x2, 0x2);
34523
346#if 0
347   popmessage("%04x %04x %04x %04x %04x %04x %04x %04x",
348      (UINT16)m_MB60553[0].regs[0], (UINT16)m_MB60553[0].regs[1], (UINT16)m_MB60553[0].regs[2], (UINT16)m_MB60553[0].regs[3],
349      (UINT16)m_MB60553[0].regs[4], (UINT16)m_MB60553[0].regs[5], (UINT16)m_MB60553[0].regs[6], (UINT16)m_MB60553[0].regs[7]
350   );
351#endif
352
353#if 0
354   popmessage("%04x %04x %04x %04x %04x %04x %04x %04x",
355      (UINT16)gs_mixer_regs[8], (UINT16)gs_mixer_regs[9], (UINT16)gs_mixer_regs[10], (UINT16)gs_mixer_regs[11],
356      (UINT16)gs_mixer_regs[12], (UINT16)gs_mixer_regs[13], (UINT16)gs_mixer_regs[14], (UINT16)gs_mixer_regs[15]
357   );
358#endif
35924   return 0;
36025}
36126
r30960r30961
36429   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
36530
36631   // Initalize the chip for the score plane
367   VS920A_init(1);
368   VS920A_set_gfx_region(0, 0);
369   VS920A_set_pal_base(0, 0x30);
370   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
32   m_tx->set_gfx_region(0);
33   m_tx->set_pal_base(0x30);
34   m_tx->get_tilemap()->set_transparent_pen(0xf);
37135
37236   // Initalize the chip for the screen plane
373   MB60553_init(1);
374   MB60553_set_gfx_region(0, 1);
375   MB60553_set_pal_base(0, 0);
376   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
37   m_bg->set_gfx_region( 1);
38   m_bg->set_pal_base( 0);
39   m_bg->get_tilemap()->set_transparent_pen(0xf);
37740}
37841
37942VIDEO_START_MEMBER(gstriker_state,twrldc94)
r30960r30961
38144   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
38245
38346   // Initalize the chip for the score plane
384   VS920A_init(1);
385   VS920A_set_gfx_region(0, 0);
386   VS920A_set_pal_base(0, 0x40);
387   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
47   m_tx->set_gfx_region(0);
48   m_tx->set_pal_base(0x40);
49   m_tx->get_tilemap()->set_transparent_pen(0xf);
38850
38951   // Initalize the chip for the screen plane
390   MB60553_init(1);
391   MB60553_set_gfx_region(0, 1);
392   MB60553_set_pal_base(0, 0x50);
393   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
52   m_bg->set_gfx_region( 1);
53   m_bg->set_pal_base( 0x50);
54   m_bg->get_tilemap()->set_transparent_pen(0xf);
39455}
39556
39657VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
r30960r30961
39859   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
39960
40061   // Initalize the chip for the score plane
401   VS920A_init(1);
402   VS920A_set_gfx_region(0, 0);
403   VS920A_set_pal_base(0, 0x30);
404   VS920A_get_tilemap(0)->set_transparent_pen(0xf);
62   m_tx->set_gfx_region(0);
63   m_tx->set_pal_base(0x30);
64   m_tx->get_tilemap()->set_transparent_pen(0xf);
40565
40666   // Initalize the chip for the screen plane
407   MB60553_init(1);
408   MB60553_set_gfx_region(0, 1);
409   MB60553_set_pal_base(0, 0x20);
410   MB60553_get_tilemap(0)->set_transparent_pen(0xf);
67   m_bg->set_gfx_region( 1);
68   m_bg->set_pal_base( 0x20);
69   m_bg->get_tilemap()->set_transparent_pen(0xf);
41170}
trunk/src/mame/video/mb60553.c
r0r30961
1/* This is the tilemap chip used by Grand Striker, Tecmo World Cup '94 and V Goal Soccer for the backgrounds
2
3  the actual line scroll / zoom is not properly understood
4
5  interestingly the chip seems to require doubled up ROMs (2 copies of each ROM) to draw just the single layer.
6
7*/
8
9#include "emu.h"
10#include "mb60553.h"
11
12
13const device_type MB60553 = &device_creator<mb60553_zooming_tilemap_device>;
14
15mb60553_zooming_tilemap_device::mb60553_zooming_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
16   : device_t(mconfig, MB60553, "MB60553 Zooming Tilemap", tag, owner, clock, "mb60553", __FILE__),
17   m_m_gfx_region(0),
18   m_gfxdecode(*this)
19{
20}
21
22
23void mb60553_zooming_tilemap_device::device_start()
24{
25   if(!m_gfxdecode->started())
26      throw device_missing_dependencies();
27
28   m_lineram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2);
29   m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x4000/2);
30
31   save_pointer(NAME(m_lineram), 0x1000/2);
32   save_pointer(NAME(m_vram), 0x4000/2);
33
34
35   m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(mb60553_zooming_tilemap_device::get_tile_info),this),tilemap_mapper_delegate(FUNC(mb60553_zooming_tilemap_device::twc94_scan),this), 16,16,128,64);
36   m_tmap->set_transparent_pen(0);
37}
38
39void mb60553_zooming_tilemap_device::device_reset()
40{
41
42}
43
44
45void mb60553_zooming_tilemap_device::set_gfx_region(device_t &device, int gfxregion)
46{
47   mb60553_zooming_tilemap_device &dev = downcast<mb60553_zooming_tilemap_device &>(device);
48   dev.m_m_gfx_region = gfxregion;
49}
50
51void mb60553_zooming_tilemap_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
52{
53   downcast<mb60553_zooming_tilemap_device &>(device).m_gfxdecode.set_tag(tag);
54}
55
56
57
58/*** Fujitsu MB60553 (screen tilemap) **********************************************/
59
60/*
61
62    Fujitsu MB60553 - Tilemap chip
63    ------------------------------
64
65- 1 Plane
66- Tiles 16x16, 4bpp
67- Map 64x64
68- Scrolling
69- Indexed banking (8 banks)
70- Surely another effect like roz/tilezoom, yet to be implemented
71
72
73    Videoram format
74    ---------------
75
76pppp bbbt tttt tttt
77
78t=tile, b=bank, p=palette
79
80
81    Registers
82    ---------
83
840 - Scroll X
85Fixed point 12.4 (seems wrong)
86
871 - Scroll Y
88Fixed point 12.4 (seems wrong)
89
902 - ????
91
923 - ????
93
944 - Tilebank #0/#1   ---a aaaa  ---b bbbb
955 - Tilebank #2/#3   ---a aaaa  ---b bbbb
966 - Tilebank #4/#5   ---a aaaa  ---b bbbb
977 - Tilebank #6/#7   ---a aaaa  ---b bbbb
98
99Indexed tilebank. Each bank is 0x200 tiles wide. Notice that within each register, the bank with the lower
100index is in the MSB. gstriker uses 5 bits for banking, but the chips could be able to do more.
101
102*/
103
104
105
106TILE_GET_INFO_MEMBER(mb60553_zooming_tilemap_device::get_tile_info)
107{
108   int data, bankno;
109   int tileno, pal;
110
111   data = m_vram[tile_index];
112
113   tileno = data & 0x1FF;
114   pal = (data >> 12) & 0xF;
115   bankno = (data >> 9) & 0x7;
116
117   SET_TILE_INFO_MEMBER(m_m_gfx_region, tileno + m_bank[bankno] * 0x200, pal + m_pal_base, 0);
118}
119
120void mb60553_zooming_tilemap_device::reg_written( int num_reg)
121{
122
123   switch (num_reg)
124   {
125   case 0:
126      m_tmap->set_scrollx(0, m_regs[0]>>4);
127      break;
128
129   case 1:
130      m_tmap->set_scrolly(0, m_regs[1]>>4);
131      break;
132
133   case 2:
134      osd_printf_debug("reg , reg 2 %04x\n", m_regs[2]);
135      break;
136
137   case 3:
138      osd_printf_debug("reg , reg 3 %04x\n", m_regs[3]);
139      break;
140
141   case 4:
142      m_bank[0] = (m_regs[4] >> 8) & 0x1F;
143      m_bank[1] = (m_regs[4] >> 0) & 0x1F;
144      m_tmap->mark_all_dirty();
145      break;
146
147   case 5:
148      m_bank[2] = (m_regs[5] >> 8) & 0x1F;
149      m_bank[3] = (m_regs[5] >> 0) & 0x1F;
150      m_tmap->mark_all_dirty();
151      break;
152
153   case 6:
154      m_bank[4] = (m_regs[6] >> 8) & 0x1F;
155      m_bank[5] = (m_regs[6] >> 0) & 0x1F;
156      m_tmap->mark_all_dirty();
157      break;
158
159   case 7:
160      m_bank[6] = (m_regs[7] >> 8) & 0x1F;
161      m_bank[7] = (m_regs[7] >> 0) & 0x1F;
162      m_tmap->mark_all_dirty();
163      break;
164   }
165}
166
167/* twc94 has the tilemap made of 2 pages .. it needs this */
168TILEMAP_MAPPER_MEMBER(mb60553_zooming_tilemap_device::twc94_scan)
169{
170   /* logical (col,row) -> memory offset */
171   return (row*64) + (col&63) + ((col&64)<<6);
172}
173
174void mb60553_zooming_tilemap_device::set_pal_base( int pal_base)
175{
176   m_pal_base = pal_base;
177}
178
179void mb60553_zooming_tilemap_device::set_gfx_region( int gfx_region)
180{
181   m_m_gfx_region = gfx_region;
182}
183
184/* THIS IS STILL WRONG! */
185void mb60553_zooming_tilemap_device::draw( screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority)
186{
187   int line;
188   rectangle clip;
189
190   clip.min_x = screen.visible_area().min_x;
191   clip.max_x = screen.visible_area().max_x;
192
193   for (line = 0; line < 224;line++)
194   {
195//      int scrollx;
196//      int scrolly;
197
198      UINT32 startx,starty;
199
200      UINT32 incxx,incyy;
201
202      startx = m_regs[0];
203      starty = m_regs[1];
204
205      startx += (24<<4); // maybe not..
206
207      startx -=  m_lineram[(line)*8+7]/2;
208
209      incxx = m_lineram[(line)*8+0]<<4;
210      incyy = m_lineram[(line)*8+3]<<4;
211
212      clip.min_y = clip.max_y = line;
213
214      m_tmap->draw_roz(screen, bitmap, clip, startx<<12,starty<<12,
215            incxx,0,0,incyy,
216            1,
217            0,priority);
218
219   }
220
221
222
223}
224
225tilemap_t* mb60553_zooming_tilemap_device::get_tilemap()
226{
227   return m_tmap;
228}
229
230
231WRITE16_MEMBER(mb60553_zooming_tilemap_device::regs_w)
232{
233   UINT16 oldreg = m_regs[offset];
234
235   COMBINE_DATA(&m_regs[offset]);
236
237   if (m_regs[offset] != oldreg)
238      reg_written(offset);
239}
240
241WRITE16_MEMBER(mb60553_zooming_tilemap_device::vram_w)
242{
243   COMBINE_DATA(&m_vram[offset]);
244
245   m_tmap->mark_tile_dirty(offset);
246}
247
248WRITE16_MEMBER(mb60553_zooming_tilemap_device::line_w)
249{
250   COMBINE_DATA(&m_lineram[offset]);
251}
252
253
254READ16_MEMBER(mb60553_zooming_tilemap_device::regs_r)
255{
256   return m_regs[offset];
257}
258
259READ16_MEMBER(mb60553_zooming_tilemap_device::vram_r)
260{
261   return m_vram[offset];
262}
263
264READ16_MEMBER(mb60553_zooming_tilemap_device::line_r)
265{
266   return m_lineram[offset];
267}
268
269
270
Property changes on: trunk/src/mame/video/mb60553.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mame/video/mb60553.h
r0r30961
1
2/*** MB60553 **********************************************/
3
4
5class mb60553_zooming_tilemap_device : public device_t
6{
7public:
8   mb60553_zooming_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9   static void static_set_gfxdecode_tag(device_t &device, const char *tag);
10   static void set_gfx_region(device_t &device, int gfxregion);
11   
12   tilemap_t* m_tmap;
13   UINT16* m_vram;
14   UINT16 m_regs[8];
15   UINT8 m_bank[8];
16   UINT16 m_pal_base;
17   void reg_written( int num_reg);
18   TILE_GET_INFO_MEMBER(get_tile_info);
19   void set_pal_base( int m_pal_base);
20   void set_gfx_region( int m_gfx_region);
21   void draw( screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
22   tilemap_t* get_tilemap();
23
24   UINT16* m_lineram;
25
26   TILEMAP_MAPPER_MEMBER(twc94_scan);
27
28   DECLARE_WRITE16_MEMBER(regs_w);
29   DECLARE_WRITE16_MEMBER(vram_w);
30   DECLARE_WRITE16_MEMBER(line_w);
31
32   DECLARE_READ16_MEMBER(regs_r);
33   DECLARE_READ16_MEMBER(vram_r);
34   DECLARE_READ16_MEMBER(line_r);
35
36protected:
37   virtual void device_start();
38   virtual void device_reset();
39
40
41private:
42   UINT8 m_m_gfx_region;
43
44   required_device<gfxdecode_device> m_gfxdecode;
45
46};
47
48extern const device_type MB60553;
49
50
51#define MCFG_MB60553_GFX_REGION(_region) \
52   mb60553_zooming_tilemap_device::set_gfx_region(*device, _region);
53
54#define MCFG_MB60553_GFXDECODE(_gfxtag) \
55   mb60553_zooming_tilemap_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
Property changes on: trunk/src/mame/video/mb60553.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mame/video/vs920a.c
r0r30961
1
2// currently used by gstriker.c, apparently inufuku uses the same chip
3
4/*** VS920A (score tilemap) **********************************************/
5
6/*
7
8    VS920A - (Very) Simple tilemap chip
9    -----------------------------------
10
11- 1 Plane
12- Tiles 8x8, 4bpp
13- Map 64x64
14- No scrolling or other effects (at least in gstriker)
15
16
17    Videoram format:
18    ----------------
19
20pppp tttt tttt tttt
21
22t=tile, p=palette
23
24*/
25
26
27#include "emu.h"
28#include "vs920a.h"
29
30
31const device_type VS920A = &device_creator<vs920a_text_tilemap_device>;
32
33vs920a_text_tilemap_device::vs920a_text_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
34   : device_t(mconfig, VS920A, "VS920A Text Tilemap", tag, owner, clock, "vs920a", __FILE__),
35   m_gfx_region(0),
36   m_gfxdecode(*this)
37
38{
39}
40
41
42void vs920a_text_tilemap_device::device_start()
43{
44   if(!m_gfxdecode->started())
45      throw device_missing_dependencies();
46
47   m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2);
48   save_pointer(NAME(m_vram), 0x1000/2);
49
50
51   m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(vs920a_text_tilemap_device::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
52   m_tmap->set_transparent_pen(0);
53}
54
55void vs920a_text_tilemap_device::device_reset()
56{
57}
58
59
60void vs920a_text_tilemap_device::set_gfx_region(device_t &device, int gfxregion)
61{
62   vs920a_text_tilemap_device &dev = downcast<vs920a_text_tilemap_device &>(device);
63   dev.m_gfx_region = gfxregion;
64}
65
66void vs920a_text_tilemap_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
67{
68   downcast<vs920a_text_tilemap_device &>(device).m_gfxdecode.set_tag(tag);
69}
70
71
72
73TILE_GET_INFO_MEMBER(vs920a_text_tilemap_device::get_tile_info)
74{
75   int data;
76   int tileno, pal;
77
78   data = m_vram[tile_index];
79
80   tileno = data & 0xFFF;
81   pal =   (data >> 12) & 0xF;
82
83   SET_TILE_INFO_MEMBER(m_gfx_region, tileno, m_pal_base + pal, 0);
84}
85
86WRITE16_MEMBER(vs920a_text_tilemap_device::vram_w)
87{
88   COMBINE_DATA(&m_vram[offset]);
89   m_tmap->mark_tile_dirty(offset);
90}
91
92
93READ16_MEMBER(vs920a_text_tilemap_device::vram_r)
94{
95   return m_vram[offset];
96}
97
98
99tilemap_t* vs920a_text_tilemap_device::get_tilemap()
100{
101   return m_tmap;
102}
103
104void vs920a_text_tilemap_device::set_pal_base(int pal_base)
105{
106   m_pal_base = pal_base;
107}
108
109void vs920a_text_tilemap_device::set_gfx_region(int gfx_region)
110{
111   m_gfx_region = gfx_region;
112}
113
114void vs920a_text_tilemap_device::draw(screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority)
115{
116   m_tmap->draw(screen, bitmap, cliprect, 0, priority);
117}
Property changes on: trunk/src/mame/video/vs920a.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mame/video/vs920a.h
r0r30961
1
2
3class vs920a_text_tilemap_device : public device_t
4{
5public:
6   vs920a_text_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
7   static void static_set_gfxdecode_tag(device_t &device, const char *tag);
8   static void set_gfx_region(device_t &device, int gfxregion);
9
10   tilemap_t* m_tmap;
11   UINT16* m_vram;
12   UINT16 m_pal_base;
13
14   TILE_GET_INFO_MEMBER(get_tile_info);
15   tilemap_t* get_tilemap();
16   void set_pal_base(int m_pal_base);
17   void set_gfx_region(int m_gfx_region);
18   void draw(screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority);
19
20   DECLARE_WRITE16_MEMBER(vram_w);
21   DECLARE_READ16_MEMBER(vram_r);
22
23
24protected:
25   virtual void device_start();
26   virtual void device_reset();
27
28
29private:
30   UINT8 m_gfx_region;
31
32   required_device<gfxdecode_device> m_gfxdecode;
33};
34
35extern const device_type VS920A;
36
37
38#define MCFG_VS920A_GFX_REGION(_region) \
39   vs920a_text_tilemap_device::set_gfx_region(*device, _region);
40
41#define MCFG_VS920A_GFXDECODE(_gfxtag) \
42   vs920a_text_tilemap_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
43
44
45
Property changes on: trunk/src/mame/video/vs920a.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mame/video/excellent_spr.c
r30960r30961
2929void excellent_spr_device::device_start()
3030{
3131   m_ram = auto_alloc_array_clear(this->machine(), UINT8, 0x1000);
32   save_pointer(NAME(m_ram), 0x1000);
3233}
3334
3435

Previous 199869 Revisions Next


© 1997-2024 The MAME Team