Previous 199869 Revisions Next

r17531 Tuesday 28th August, 2012 at 13:03:15 UTC by Angelo Salese
Made a shadow ROM copy, the charset is now more faithful to the original reference
[src/emu/video]m50458.c m50458.h

trunk/src/emu/video/m50458.c
r17530r17531
99     "worse" ways, the one currently implemented guesses that the screen is
1010      masked at the top and the end when in scrolling mode).
1111   - Understand what the "vertical start position" really does (vblank?)
12   - Check if the ROM source is actually 2bpp once that a redump is made
13     (the shadow ROM copy doesn't convince me 100%);
1214
1315***************************************************************************/
1416
r17530r17531
7981      int i;
8082
8183      for(i=0;i<0x120;i++)
82      {
83         write_word(i,0);
84      }
84         write_word(i,0x007f);
8585   }
8686}
8787
r17530r17531
160160
161161void m50458_device::device_start()
162162{
163   UINT16 tmp;
164   UINT8 *pcg = memregion("m50458")->base();
165   int tile;
166   int yi;
167   UINT16 src,dst;
163168
169   /* Create an array for shadow gfx */
170   /* this will spread the source ROM into four directions (up-left, up-right, down-left, down-right) thus creating a working shadow copy */
171   m_shadow_gfx = auto_alloc_array_clear(machine(), UINT8, 0x1200);
172
173   for(tile=0;tile<0x80;tile++)
174   {
175      for(yi=1;yi<17;yi++)
176      {
177         src = (tile & 0x7f)*36+yi*2; /* source offset */
178
179         dst = (tile & 0x7f)*36+(yi-1)*2; /* destination offset */
180
181         tmp = (((pcg[src]<<8)|(pcg[src+1]&0xff)) & 0xfffe) >> 1;
182
183         m_shadow_gfx[dst+1] |= tmp & 0xff;
184         m_shadow_gfx[dst] |= (tmp >> 8);
185
186         tmp = (((pcg[src]<<8)|(pcg[src+1]&0xff)) & 0x7fff) << 1;
187
188         m_shadow_gfx[dst+1] |= tmp & 0xff;
189         m_shadow_gfx[dst] |= (tmp >> 8);
190
191         dst = (tile & 0x7f)*36+(yi+1)*2; /* destination offset */
192
193         tmp = (((pcg[src]<<8)|(pcg[src+1]&0xff)) & 0xfffe) >> 1;
194
195         m_shadow_gfx[dst+1] |= tmp & 0xff;
196         m_shadow_gfx[dst] |= (tmp >> 8);
197
198         tmp = (((pcg[src]<<8)|(pcg[src+1]&0xff)) & 0x7fff) << 1;
199
200         m_shadow_gfx[dst+1] |= tmp & 0xff;
201         m_shadow_gfx[dst] |= (tmp >> 8);
202      }
203   }
164204}
165205
166206
r17530r17531
170210
171211void m50458_device::device_reset()
172212{
213   int i;
214
215   /* clear VRAM at boot */
216   for(i=0;i<0x120;i++)
217      write_word(i,0x007f);
173218}
174219
175220
r17530r17531
267312            for(xi=4;xi<16;xi++) /* TODO: remove 4 / 16 / -4 offset once that the ROM is fixed */
268313            {
269314               UINT8 pix;
270               UINT8 r,g,b;
315               UINT8 color = (tile & 0x700) >> 8;
271316               UINT16 offset = ((tile & 0x7f)*36+yi*2);
272317               int res_y;
273318
274319               /* TODO: blinking, bit 7 (RTC test in NSS) */
275320
276321               if(xi>=8)
277                  pix = (pcg[offset+1] >> (7-(xi & 0x7))) & 1;
322                  pix = ((pcg[offset+1] >> (7-(xi & 0x7))) & 1) << 1;
278323               else
279                  pix = (pcg[offset+0] >> (7-(xi & 0x7))) & 1;
324                  pix = ((pcg[offset+0] >> (7-(xi & 0x7))) & 1) << 1;
280325
326               if(xi>=8)
327                  pix |= ((m_shadow_gfx[offset+1] >> (7-(xi & 0x7))) & 1);
328               else
329                  pix |= ((m_shadow_gfx[offset+0] >> (7-(xi & 0x7))) & 1);
330
281331               if(yi == 17 && tile & 0x1000) /* underline? */
282332                  pix |= 1;
283333
284               r = (tile & 0x100 && pix) ? 0xff : 0x00;
285               g = (tile & 0x200 && pix) ? 0xff : 0x00;
286               b = (tile & 0x400 && pix) ? 0xff : 0x00;
287
288334               res_y = y*18+yi;
289335
290336               if(y != 0 && y != 11)
r17530r17531
294340                     res_y += 216;
295341               }
296342
297               if(r || g || b)
343               if(pix != 0)
344               {
345                  UINT8 r,g,b;
346
347                  if(pix & 2)
348                  {
349                     r = (color & 0x1) ? 0xff : 0x00;
350                     g = (color & 0x2) ? 0xff : 0x00;
351                     b = (color & 0x4) ? 0xff : 0x00;
352                  }
353                  else //if(pix & 1)
354                  {
355                     /* TODO: shadow parameter */
356                     r = 0x00;
357                     g = 0x00;
358                     b = 0x00;
359                  }
360
298361                  bitmap.pix32(res_y,x*12+(xi-4)) = r << 16 | g << 8 | b;
362               }
299363            }
300364         }
301365      }
trunk/src/emu/video/m50458.h
r17530r17531
6464   UINT16 m_current_cmd;
6565   int m_cmd_stream_pos;
6666   UINT16 m_osd_addr;
67   UINT8 *m_shadow_gfx;
68
6769   UINT8 m_bg_pen;
6870   UINT8 m_phase;
6971   UINT8 m_scrf,m_scrr;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team