Previous 199869 Revisions Next

r36605 Tuesday 24th March, 2015 at 16:22:00 UTC by David Haywood
hmm pen based blending too.. ok ... (nw)
[src/mame/drivers]ttchamp.c

trunk/src/mame/drivers/ttchamp.c
r245116r245117
9999   DECLARE_WRITE16_MEMBER(ttchamp_mem_w);
100100
101101   UINT16 m_videoram0[0x10000 / 2];
102   UINT16 m_videoram1[0x10000 / 2];
102//   UINT16 m_videoram1[0x10000 / 2];
103103   UINT16 m_videoram2[0x10000 / 2];
104104
105105
r245116r245117
141141   static const int xxx=320,yyy=204;
142142
143143   bitmap.fill(m_palette->black_pen());
144   UINT8 *videoramfg;
145   UINT8* videorambg;
146   
147   count=0;
148   videorambg = (UINT8*)m_videoram0;
149   videoramfg = (UINT8*)m_videoram2;
144150
145   count=0;
146   UINT8 *videoram = (UINT8*)m_videoram0;
147151   for (y=0;y<yyy;y++)
148152   {
149153      for(x=0;x<xxx;x++)
150154      {
151         /*if(hotblock_port0&0x40)*/bitmap.pix16(y, x) = videoram[BYTE_XOR_LE(count)]+0x300;
155         bitmap.pix16(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300;
152156         count++;
153157      }
154158   }
155
159   
160   /*
156161   count=0;
157162   videoram = (UINT8*)m_videoram1;
158163   for (y=0;y<yyy;y++)
r245116r245117
164169         count++;
165170      }
166171   }
167
172   */
173   
168174   count=0;
169   videoram = (UINT8*)m_videoram2;
170175   for (y=0;y<yyy;y++)
171176   {
172177      for(x=0;x<xxx;x++)
173178      {
174         UINT8 pix = videoram[BYTE_XOR_LE(count)];
175         if (pix) bitmap.pix16(y, x) = pix+0x000;
179         UINT8 pix = videoramfg[BYTE_XOR_LE(count)];
180         if (pix)
181         {
182            // first pen values seem to be special
183            // see char select and shadows ingame
184            // pen 0 = transparent
185            // pen 1 = blend 1
186            // pen 2 = blend 2
187            // pen 3 = ??
188
189            if (pix == 0x01) // blend mode 1
190            {
191               UINT8 pix = videorambg[BYTE_XOR_LE(count)];
192               bitmap.pix16(y, x) = pix + 0x200;
193            }
194            else if (pix == 0x02) // blend mode 2
195            {
196               UINT8 pix = videorambg[BYTE_XOR_LE(count)];
197               bitmap.pix16(y, x) = pix + 0x100;
198            }
199            else
200            {
201               bitmap.pix16(y, x) = pix + 0x000;
202            }
203         }
176204         count++;
177205      }
178206   }
207   
179208
180209   for (int i = 0; i < 0x8000; i++)
181210   {
r245116r245117
183212      // I think it actually does more blit operations with
184213      // different bits of m_port10 set to redraw the backgrounds using the video ram data as a source rather than ROM - notice the garbage you see behind 'sprites' right now
185214      // this method also removes the text layer, which we don't want
186      m_videoram1[i] = 0x0000;
187      m_videoram2[i] = 0x0000;
215   //   m_videoram1[i] = 0x0000;
216   //   m_videoram2[i] = 0x0000;
188217   }
189218
190219   return 0;
r245116r245117
199228
200229WRITE16_MEMBER(ttchamp_state::paldat_w)
201230{
202   // maybe 4 layers of 0x100 each?
203   // middle palettes seem to have special meaning tho, maybe blending? it's a darker copy ingame, and red/blue shades on char select
204   // based on screenshot references the highlighted player portraits should be appear in shades of red/blue
205
206231   // 0x8000 of offset is sometimes set
207232   m_palette->set_pen_color(m_paloff & 0x3ff,pal5bit(data>>0),pal5bit(data>>5),pal5bit(data>>10));
208233}
r245116r245117
216241   if ((m_port10&0xf) == 0x00)
217242      vram = m_videoram0;
218243   else if ((m_port10&0xf)  == 0x01)
219      vram = m_videoram1;
244      vram = m_videoram2;
220245   else if ((m_port10&0xf)  == 0x03)
221246      vram = m_videoram2;
222247   else
r245116r245117
251276   if ((m_port10&0xf)  == 0x00)
252277      vram = m_videoram0;
253278   else if ((m_port10&0xf)  == 0x01)
254      vram = m_videoram1;
279      vram = m_videoram2;
255280   else if ((m_port10&0xf)  == 0x03)
256281      vram = m_videoram2;
257282   else
r245116r245117
272297   {
273298   //   printf("%06x: spider_blitter_w %08x %04x %04x (init2) (width?)\n", space.device().safe_pc(), offset * 2, data, mem_mask);
274299      m_spriteswidth = offset & 0xff;
275      if (m_spriteswidth == 0)
276         m_spriteswidth = 80;
277300
278301      m_spritesinit = 0;
279302
r245116r245117
303326
304327         for (int i = 0; i < m_spriteswidth; i++)
305328         {
306            UINT8 data;
307           
308            data = (src[(m_spritesaddr * 2) + 1]);
309   
310            if (data)
311               vram[offset] = (vram[offset] & 0x00ff) | data << 8;
329            if ((m_port10 & 0xf) == 0x01) // this is set when moving objects are cleared, although not screen clears?
330            {
331               vram[offset] = 0x0000;
332               offset++;
333            }
334            else
335            {
336               UINT8 data;
312337
338               data = (src[(m_spritesaddr * 2) + 1]);
313339
314            data = src[(m_spritesaddr*2)];
315         
316            if (data)
317               vram[offset] = (vram[offset] & 0xff00) | data;
340               if (data)
341                  vram[offset] = (vram[offset] & 0x00ff) | data << 8;
318342
319343
320            m_spritesaddr ++;           
321            offset++;
344               data = src[(m_spritesaddr * 2)];
322345
346               if (data)
347                  vram[offset] = (vram[offset] & 0xff00) | data;
348
349
350               m_spritesaddr++;
351               offset++;
352            }
353
323354            offset &= 0x7fff;
324355         }
325356      }
r245116r245117
356387WRITE16_MEMBER(ttchamp_state::port20_w)
357388{
358389   printf("%06x: port20_w %04x %04x\n", space.device().safe_pc(), data, mem_mask);
390   // seems to somehow be tied to layer clear
391   // might also depend on layer selected with 0x10 tho? written after it
392   for (int i = 0; i < 0x8000; i++)
393   {
394   //   m_videoram0[i] = 0x0000;
395      m_videoram2[i] = 0x0000;
396   }
397
359398}
360399
361400WRITE16_MEMBER(ttchamp_state::port62_w)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team