Previous 199869 Revisions Next

r17522 Tuesday 28th August, 2012 at 03:30:17 UTC by Angelo Salese
Improved vertical scrolling, now it's more or less reasonable
[src/emu/video]m50458.c

trunk/src/emu/video/m50458.c
r17521r17522
11/***************************************************************************
22
3Mitsubishi M50458 OSD chip
3   Mitsubishi M50458 OSD chip
44
5preliminary device by Angelo Salese
5   preliminary device by Angelo Salese
66
7   TODO:
8   - vertical scrolling needs references (might work differently and/or in
9     "worse" ways, the one currently implemented guesses that the screen is
10      masked at the top and the end when in scrolling mode).
11   - Understand what the "vertical start position" really does (vblank?)
12
713***************************************************************************/
814
915#include "emu.h"
r17521r17522
5460   /* char part of vertical scrolling */
5561   m_scrr = (data & 0x0f00) >> 8;
5662
57   printf("%02x %02x %02x\n",m_scrr,m_scrf,m_space);
63//   printf("%02x %02x %02x\n",m_scrr,m_scrf,m_space);
5864}
5965
6066WRITE16_MEMBER( m50458_device::vreg_126_w)
r17521r17522
211217                  break;
212218               case OSD_SET_DATA:
213219                  //if(m_osd_addr >= 0x120)
214                  printf("%04x %04x\n",m_osd_addr,m_current_cmd);
220                  //printf("%04x %04x\n",m_osd_addr,m_current_cmd);
215221                  write_word(m_osd_addr,m_current_cmd);
216222                  m_osd_addr++;
217223                  /* Presumably wraps at 0x127? */
r17521r17522
242248   bg_b = m_phase & 4 ? 0xdf : 0;
243249   bitmap.fill(MAKE_ARGB(0xff,bg_r,bg_g,bg_b),cliprect);
244250
245
246251   for(y=0;y<12;y++)
247252   {
248253      for(x=0;x<24;x++)
r17521r17522
251256         UINT16 tile;
252257         int y_base = y;
253258
254         /* TODO: needs improvements */
255         if(y != 0 && m_scrr)
256            y_base+=(m_scrr - 1);
259         if(y != 0 && m_scrr > 1) { y_base+=(m_scrr - 1); }
260         if(y_base > 11)        { y_base -= 11; }
261         if(m_scrr && y == 11)    { y_base = 0; } /* Guess: repeat line 0 if scrolling is active */
257262
258         if(y != 0 && y_base == 0)
259            y_base ++;
260
261         if(y_base >= 12)
262            y_base -= 11;
263
264
265263         tile = read_word(x+y_base*24);
266264
267265         for(yi=0;yi<18;yi++)
r17521r17522
271269               UINT8 pix;
272270               UINT8 r,g,b;
273271               UINT16 offset = ((tile & 0x7f)*36+yi*2);
272               int res_y;
274273
275274               /* TODO: blinking, bit 7 (RTC test in NSS) */
276275
r17521r17522
286285               g = (tile & 0x200 && pix) ? 0xff : 0x00;
287286               b = (tile & 0x400 && pix) ? 0xff : 0x00;
288287
288               res_y = y*18+yi;
289
290               if(y != 0 && y != 11)
291               {
292                  res_y -= m_scrf;
293                  if(res_y < 18) /* wrap-around */
294                     res_y += 216;
295               }
296
289297               if(r || g || b)
290                  bitmap.pix32(y*18+yi,x*12+(xi-4)) = r << 16 | g << 8 | b;
298                  bitmap.pix32(res_y,x*12+(xi-4)) = r << 16 | g << 8 | b;
291299            }
292300         }
293301      }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team