Previous 199869 Revisions Next

r29234 Friday 4th April, 2014 at 00:51:15 UTC by David Haywood
some misc Kaneko refactor, preparation for further work (nw)
[src/mame/drivers]kaneko16.c
[src/mame/includes]kaneko16.h
[src/mame/video]kaneko16.c kaneko_spr.c kaneko_spr.h kaneko_tmap.c kaneko_tmap.h

trunk/src/mame/drivers/kaneko16.c
r29233r29234
232232                                The Berlin Wall
233233***************************************************************************/
234234
235READ16_MEMBER(kaneko16_berlwall_state::berlwall_oki_r)
236{
237   UINT16 ret;
238
239   if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte.
240   {
241      mem_mask >>= 8;
242   }
243
244   ret = m_oki->read(space, offset, mem_mask);
245   ret = ret | ret << 8;
246
247   return ret;
248}
249
250WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_oki_w)
251{
252   if (mem_mask == 0xff00) // reads / writes to the upper byte only appear to act as a mirror to the lower byte, 16-bit reads/writes only access the lower byte.
253   {
254      data >>= 8;
255      mem_mask >>= 8;
256   }
257
258   m_oki->write(space, offset, data, mem_mask);
259}
260
235261static ADDRESS_MAP_START( berlwall, AS_PROGRAM, 16, kaneko16_berlwall_state )
236262   AM_RANGE(0x000000, 0x03ffff) AM_ROM     // ROM
237263   AM_RANGE(0x200000, 0x20ffff) AM_RAM     // Work RAM
r29233r29234
251277   AM_RANGE(0x800000, 0x80001f) AM_READWRITE(kaneko16_ay1_YM2149_r, kaneko16_ay1_YM2149_w) // Sound
252278   AM_RANGE(0x800200, 0x80021f) AM_READWRITE(kaneko16_ay2_YM2149_r, kaneko16_ay2_YM2149_w)
253279   AM_RANGE(0x8003fe, 0x8003ff) AM_NOP // for OKI when accessed as .l
254   AM_RANGE(0x800400, 0x800401) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
280   AM_RANGE(0x800400, 0x800401) AM_READWRITE( berlwall_oki_r, berlwall_oki_w )
255281   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device,  kaneko_tmap_vram_r, kaneko_tmap_vram_w )
256282   AM_RANGE(0xd00000, 0xd0001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device,  kaneko_tmap_regs_r, kaneko_tmap_regs_w)
257283ADDRESS_MAP_END
r29233r29234
16301656   MCFG_SCREEN_SIZE(256, 256)
16311657   MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1)
16321658   MCFG_SCREEN_UPDATE_DRIVER(kaneko16_berlwall_state, screen_update_berlwall)
1633   MCFG_SCREEN_PALETTE("palette")
1659//   MCFG_SCREEN_PALETTE("palette")
16341660
16351661   MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit)
1636   MCFG_PALETTE_ADD("palette", 2048 + 32768)   /* 32768 static colors for the bg */
1662   MCFG_PALETTE_ADD("palette", 2048 )   
16371663   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
1664
1665   MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */
1666   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
16381667   MCFG_PALETTE_INIT_OWNER(kaneko16_berlwall_state,berlwall)
16391668
16401669   MCFG_DEVICE_ADD("view2_0", KANEKO_TMAP, 0)
r29233r29234
17641793   MCFG_GFXDECODE_ADD("gfxdecode", "palette", 1x4bit_1x4bit)
17651794   MCFG_PALETTE_ADD("palette", 2048)
17661795   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
1767
1796   
17681797   MCFG_DEVICE_ADD("view2_0", KANEKO_TMAP, 0)
17691798   kaneko_view2_tilemap_device::set_gfx_region(*device, 1);
17701799   kaneko_view2_tilemap_device::set_offset(*device, 0x33, 0x8, 320, 240);
r29233r29234
24862515ROM_END
24872516
24882517
2518
24892519/***************************************************************************
24902520
24912521                            Blaze On (Japan version)
r29233r29234
38543884GAME( 1991, berlwall, 0,        berlwall, berlwall, kaneko16_berlwall_state, berlwall, ROT0,  "Kaneko", "The Berlin Wall", 0 )
38553885GAME( 1991, berlwallt,berlwall, berlwall, berlwalt, kaneko16_berlwall_state, berlwall, ROT0,  "Kaneko", "The Berlin Wall (bootleg ?)", 0 )
38563886
3887
38573888GAME( 1991, mgcrystl, 0,        mgcrystl, mgcrystl, kaneko16_state,          kaneko16, ROT0,  "Kaneko", "Magical Crystals (World, 92/01/10)", 0 )
38583889GAME( 1991, mgcrystlo,mgcrystl, mgcrystl, mgcrystl, kaneko16_state,          kaneko16, ROT0,  "Kaneko", "Magical Crystals (World, 91/12/10)", 0 )
38593890GAME( 1991, mgcrystlj,mgcrystl, mgcrystl, mgcrystl, kaneko16_state,          kaneko16, ROT0,  "Kaneko (Atlus license)", "Magical Crystals (Japan, 92/01/13)", 0 )
trunk/src/mame/includes/kaneko16.h
r29233r29234
3131      m_view2_0(*this, "view2_0"),
3232      m_view2_1(*this, "view2_1"),
3333      m_kaneko_spr(*this, "kan_spr"),
34      m_pandora(*this, "pandora")
34      m_pandora(*this, "pandora"),
35      m_palette(*this, "palette")
3536      { }
3637
3738   required_device<cpu_device> m_maincpu;
r29233r29234
4546   optional_device<kaneko_view2_tilemap_device> m_view2_1;
4647   optional_device<kaneko16_sprite_device> m_kaneko_spr;
4748   optional_device<kaneko_pandora_device> m_pandora;
49   required_device<palette_device> m_palette;
4850
4951   UINT16 m_disp_enable;
5052
r29233r29234
7274   DECLARE_VIDEO_START(kaneko16);
7375   DECLARE_MACHINE_RESET(mgcrystl);
7476   UINT32 screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75   UINT32 screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
77   
78   template<class _BitmapClass>
79   UINT32 screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect);
80
81
82
7683   TIMER_DEVICE_CALLBACK_MEMBER(kaneko16_interrupt);
7784   TIMER_DEVICE_CALLBACK_MEMBER(shogwarr_interrupt);
78   void kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
85   
86   template<class _BitmapClass>
87   void kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect);
88
89
7990   void kaneko16_common_oki_bank_w(  const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize );
8091   void kaneko16_unscramble_tiles(const char *region);
8192   void kaneko16_expand_sample_banks(const char *region);
r29233r29234
111122   kaneko16_berlwall_state(const machine_config &mconfig, device_type type, const char *tag)
112123      : kaneko16_state(mconfig, type, tag),
113124      m_bg15_reg(*this, "bg15_reg"),
114      m_bg15_select(*this, "bg15_select")
125      m_bg15_select(*this, "bg15_select"),
126      m_bgpalette(*this, "bgpalette")
127
115128   {
116129   }
117130
118131   optional_shared_ptr<UINT16> m_bg15_reg;
119132   optional_shared_ptr<UINT16> m_bg15_select;
133   required_device<palette_device> m_bgpalette;
120134
121135   bitmap_ind16 m_bg15_bitmap;
122136
r29233r29234
125139   DECLARE_READ16_MEMBER(kaneko16_bg15_reg_r);
126140   DECLARE_WRITE16_MEMBER(kaneko16_bg15_reg_w);
127141
142   DECLARE_READ16_MEMBER(berlwall_oki_r);
143   DECLARE_WRITE16_MEMBER(berlwall_oki_w);
144
128145   DECLARE_DRIVER_INIT(berlwall);
129146   DECLARE_PALETTE_INIT(berlwall);
130147   DECLARE_VIDEO_START(berlwall);
131   UINT32 screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
132   void kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
148   UINT32 screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
149   void kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
133150};
134151
135152class kaneko16_shogwarr_state : public kaneko16_state
trunk/src/mame/video/kaneko_spr.c
r29233r29234
229229}
230230
231231// custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities
232void kaneko16_sprite_device::kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
232
233
234
235
236template<class _BitmapClass>
237void kaneko16_sprite_device::kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
233238      UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
234239      bitmap_ind8 &priority_bitmap, int priority)
235240{
r29233r29234
294299         ey -= pixels;
295300      }
296301
297      if( ex>sx )
302      if (ex > sx)
298303      { /* skip if inner loop doesn't draw anything */
299         int y;
300304
301         for( y=sy; y<ey; y++ )
305         typename _BitmapClass::pixel_t *dest;
306         int rgb;
307         if (sizeof(*dest) == 2) rgb = 0;
308         else rgb = 1;
309
310         const pen_t *pal = gfx->palette()->pens();
311
312         for (int y = sy; y < ey; y++)
302313         {
303            const UINT8 *source = source_base + (y_index>>16) * gfx->rowbytes();
304            UINT16 *dest = &dest_bmp.pix16(y);
314            const UINT8 *source = source_base + (y_index >> 16) * gfx->rowbytes();
315            dest = &dest_bmp.pix(y);
305316            UINT8 *pri = &priority_bitmap.pix8(y);
306317
307            int x, x_index = x_index_base;
308            for( x=sx; x<ex; x++ )
318            int x_index = x_index_base;
319            for (int x = sx; x < ex; x++)
309320            {
310               int c = source[x_index>>16];
311               if( c != 0 )
321               int c = source[x_index >> 16];
322               if (c != 0)
312323               {
313324                  if (pri[x] < priority)
314                     dest[x] = pen_base + c;
315                  pri[x] = 0xff; // mark it "already drawn"
325                  {
326
327                     if (!rgb) dest[x] = pen_base + c;
328                     else dest[x] = pal[pen_base + c];
329
330                     pri[x] = 0xff; // mark it "already drawn"
331                  }
316332               }
317333               x_index += dx;
318334            }
r29233r29234
323339   }
324340}
325341
342
343
344
326345/* Build a list of sprites to display & draw them */
327
328void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes)
346template<class _BitmapClass>
347void kaneko16_sprite_device::kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes)
329348{
330349   /* Sprites *must* be parsed from the first in RAM to the last,
331350      because of the multisprite feature. But they *must* be drawn
r29233r29234
550569}
551570
552571
572void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
573{
574   copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0);
575}
553576
554void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes)
577void kaneko16_sprite_device::kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
555578{
579   const pen_t *pal = m_gfxdecode->gfx(0)->palette()->pens();
580   UINT16* srcbitmap;
581   UINT32* dstbitmap;
582
583   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
584   {
585      srcbitmap = &m_sprites_bitmap.pix16(y);
586      dstbitmap = &bitmap.pix32(y);
587
588      for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
589      {
590         UINT16 pix = srcbitmap[x];
591         if (pix) dstbitmap[x] = pal[pix];
592      }
593   }
594}
595
596
597
598void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); }
599void kaneko16_sprite_device::kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes) { kaneko16_render_sprites_common(machine, bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes); }
600
601template<class _BitmapClass>
602void kaneko16_sprite_device::kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes)
603{
556604   /* Sprites last (rendered with pdrawgfx, so they can slip
557605      in between the layers) */
558606
559607   if(m_keep_sprites)
560608   {
561      /* keep sprites on screen */
609      /* keep sprites on screen - used by mgcrystl when you get the first gem and it shows instructions */
562610      kaneko16_draw_sprites(machine,m_sprites_bitmap, cliprect, priority_bitmap, spriteram16, spriteram16_bytes);
563      copybitmap_trans(bitmap,m_sprites_bitmap,0,0,0,0,cliprect,0);
611      kaneko16_copybitmap(bitmap,cliprect);
564612   }
565613   else
566614   {
trunk/src/mame/video/kaneko_spr.h
r29233r29234
4242   virtual int get_sprite_type(void) =0;
4343
4444   void kaneko16_render_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes);
45   void kaneko16_render_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes);
4546
4647
48   template<class _BitmapClass>
49   void kaneko16_render_sprites_common(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes);
50
51
4752   DECLARE_READ16_MEMBER(kaneko16_sprites_regs_r);
4853   DECLARE_WRITE16_MEMBER(kaneko16_sprites_regs_w);
4954
r29233r29234
8186   int m_keep_sprites;
8287   bitmap_ind16 m_sprites_bitmap;
8388
84   void kaneko16_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes);
8589
86   void kaneko16_draw_sprites_custom(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
90   template<class _BitmapClass>
91   void kaneko16_draw_sprites(running_machine &machine, _BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, UINT16* spriteram16, int spriteram16_bytes);
92
93   
94   template<class _BitmapClass>
95   void kaneko16_draw_sprites_custom(_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx,
8796         UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
8897         bitmap_ind8 &priority_bitmap, int priority);
8998
9099   int kaneko16_parse_sprite_type012(running_machine &machine, int i, struct tempsprite *s, UINT16* spriteram16, int spriteram16_bytes);
91100
101   void kaneko16_copybitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
102   void kaneko16_copybitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
92103
93104   required_device<gfxdecode_device> m_gfxdecode;
94105
trunk/src/mame/video/kaneko_tmap.c
r29233r29234
195195   m_tmap[_N_]->mark_tile_dirty(offset/2);
196196}
197197
198void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); };
199void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect) { kaneko16_prepare_common(bitmap, cliprect); };
198200
199void kaneko_view2_tilemap_device::kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect)
201template<class _BitmapClass>
202void kaneko_view2_tilemap_device::kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect)
200203{
201204   int layers_flip_0;
202205   UINT16 layer0_scrollx, layer0_scrolly;
r29233r29234
244247   }
245248}
246249
247void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri)
250void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); }
251void kaneko_view2_tilemap_device::render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri) { render_tilemap_chip_common(screen, bitmap, cliprect, pri); }
252
253template<class _BitmapClass>
254void kaneko_view2_tilemap_device::render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri)
248255{
249256   m_tmap[0]->draw(screen, bitmap, cliprect, pri, pri, 0);
250257   m_tmap[1]->draw(screen, bitmap, cliprect, pri, pri, 0);
251258}
252259
253void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri)
260void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); }
261void kaneko_view2_tilemap_device::render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri) { render_tilemap_chip_alt_common(screen, bitmap, cliprect, pri, v2pri); }
262
263template<class _BitmapClass>
264void kaneko_view2_tilemap_device::render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri)
254265{
255266   m_tmap[0]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0);
256267   m_tmap[1]->draw(screen, bitmap, cliprect, pri, v2pri ? pri : 0, 0);
trunk/src/mame/video/kaneko_tmap.h
r29233r29234
2626   void kaneko16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
2727
2828   // call to do the rendering etc.
29   template<class _BitmapClass>
30   void kaneko16_prepare_common(_BitmapClass &bitmap, const rectangle &cliprect);
31   template<class _BitmapClass>
32   void render_tilemap_chip_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri);
33   template<class _BitmapClass>
34   void render_tilemap_chip_alt_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri, int v2pri);
35
2936   void kaneko16_prepare(bitmap_ind16 &bitmap, const rectangle &cliprect);
37   void kaneko16_prepare(bitmap_rgb32 &bitmap, const rectangle &cliprect);
3038   void render_tilemap_chip(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri);
39   void render_tilemap_chip(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri);
3140   void render_tilemap_chip_alt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int v2pri);
41   void render_tilemap_chip_alt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri, int v2pri);
3242
43
3344   // access
3445   DECLARE_READ16_MEMBER( kaneko_tmap_vram_r );
3546   DECLARE_WRITE16_MEMBER( kaneko_tmap_vram_w );
trunk/src/mame/video/kaneko16.c
r29233r29234
2424
2525
2626
27void kaneko16_state::kaneko16_fill_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
27/* Fill the bitmap with a single colour. This is wrong, but will work most of
28   the times. To do it right, each pixel should be drawn with pen 0
29   of the bottomost tile that covers it (which is pretty tricky to do) */
30template<class _BitmapClass>
31void kaneko16_state::kaneko16_fill_bitmap(palette_device* palette, _BitmapClass &bitmap, const rectangle &cliprect)
2832{
33   int pen = 0;
34
2935   if (m_kaneko_spr)
30      if(m_kaneko_spr->get_sprite_type()== 1)
36   {
37      if (m_kaneko_spr->get_sprite_type() == 1)
3138      {
32         bitmap.fill(0x7f00, cliprect);
33         return;
39         pen = 0x7f00;
3440      }
41   }
3542
3643
44   typename _BitmapClass::pixel_t *dest;
45   if (sizeof(*dest) == 2)
46   {
47      bitmap.fill(pen, cliprect);
48   }
49   else
50   {
51      const pen_t *pal = palette->pens();
52      bitmap.fill(pal[pen], cliprect);
53   }
54}
3755
38   /* Fill the bitmap with pen 0. This is wrong, but will work most of
39      the times. To do it right, each pixel should be drawn with pen 0
40      of the bottomost tile that covers it (which is pretty tricky to do) */
41   bitmap.fill(0, cliprect);
4256
43}
4457
45UINT32 kaneko16_state::screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
58
59template<class _BitmapClass>
60UINT32 kaneko16_state::screen_update_common(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect)
4661{
4762   int i;
4863
r29233r29234
6681
6782UINT32 kaneko16_state::screen_update_kaneko16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6883{
69   kaneko16_fill_bitmap(bitmap,cliprect);
84   kaneko16_fill_bitmap(m_palette, bitmap,cliprect);
7085
7186   // if the display is disabled, do nothing?
7287   if (!m_disp_enable) return 0;
r29233r29234
91106
92107   /* initialize 555 RGB lookup */
93108   for (i = 0; i < 32768; i++)
94      palette.set_pen_color(2048 + i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
109      palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
95110}
96111
97112VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall)
r29233r29234
134149         if ((r & 0x10) && (b & 0x10))
135150            g = (g - 1) & 0x1f;     /* decrease with wraparound */
136151
137         m_bg15_bitmap.pix16(y, sx * 256 + x) = 2048 + ((g << 10) | (r << 5) | b);
152         m_bg15_bitmap.pix16(y, sx * 256 + x) = ((g << 10) | (r << 5) | b);
138153      }
139154
140155   VIDEO_START_CALL_MEMBER(kaneko16);
r29233r29234
164179WRITE16_MEMBER(kaneko16_berlwall_state::kaneko16_bg15_reg_w)
165180{
166181   COMBINE_DATA(&m_bg15_reg[0]);
182//   printf("kaneko16_bg15_reg_w %04x\n", m_bg15_reg[0]);
183   double brt1 = data & 0xff;
184   brt1 = brt1 / 255.0;
185
186   for (int i = 0; i < 0x8000;i++)
187      m_bgpalette->set_pen_contrast(i, brt1);
167188}
168189
169190
170void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
191void kaneko16_berlwall_state::kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
171192{
172193   if (m_bg15_bitmap.valid())
173194   {
174195      int select  =   m_bg15_select[ 0 ];
175196//      int reg     =   m_bg15_reg[ 0 ];
176197      int flip    =   select & 0x20;
177      int sx, sy;
198      int sx;//, sy;
178199
179      if (flip)   select ^= 0x1f;
200   //   if (flip)   select ^= 0x1f;
180201
181202      sx      =   (select & 0x1f) * 256;
182      sy      =   0;
203   //   sy      =   0;
183204
184      copybitmap(bitmap, m_bg15_bitmap, flip, flip, -sx, -sy, cliprect);
205      const pen_t *pal = m_bgpalette->pens();
206      UINT16* srcbitmap;
207      UINT32* dstbitmap;
185208
209      for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
210      {
211         if (!flip) srcbitmap = &m_bg15_bitmap.pix16(y);
212         else srcbitmap =  &m_bg15_bitmap.pix16(255-y);
213         dstbitmap = &bitmap.pix32(y);
214
215         for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
216         {
217            UINT16 pix = srcbitmap[x + sx];
218            dstbitmap[x] = pal[pix&0x7fff];
219         }
220      }
221
186222//      flag = 0;
187223   }
188224}
189UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
225UINT32 kaneko16_berlwall_state::screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
190226{
191227   // berlwall uses a 15bpp bitmap as a bg, not a solid fill
192228   kaneko16_render_15bpp_bitmap(bitmap,cliprect);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team