Previous 199869 Revisions Next

r34504 Tuesday 20th January, 2015 at 00:21:24 UTC by Angelo Salese
Palette check
[src/mame/drivers]aleck64.c

trunk/src/mame/drivers/aleck64.c
r243015r243016
179179   aleck64_state(const machine_config &mconfig, device_type type, const char *tag)
180180      : n64_state(mconfig, type, tag),
181181        m_e90_vram(*this,"e90vram"),
182        m_e90_pal(*this,"e90pal"),
182183         m_dip_read_offset(0) { }
183184
184185   optional_shared_ptr<UINT32> m_e90_vram;
186   optional_shared_ptr<UINT32> m_e90_pal;
185187   DECLARE_DRIVER_INIT(aleck64);
186188   DECLARE_WRITE32_MEMBER(aleck_dips_w);
187189   DECLARE_READ32_MEMBER(aleck_dips_r);
r243015r243016
353355static ADDRESS_MAP_START( e90_map, AS_PROGRAM, 32, aleck64_state )
354356   AM_IMPORT_FROM( n64_map )
355357   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM AM_SHARE("e90vram")// x/y offsets
356   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM // RGB555 palette
358   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM AM_SHARE("e90pal")// RGB555 palette
357359   AM_RANGE(0xd0030000, 0xd003001f) AM_READWRITE16(e90_prot_r, e90_prot_w,0xffffffff)
358360ADDRESS_MAP_END
359361
r243015r243016
878880
879881UINT32 aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
880882{
881   static int testx,testy;
882883   bitmap.fill(0, cliprect);
883884   screen_update_n64(screen,bitmap,cliprect);
884885   
885   if(machine().input().code_pressed(KEYCODE_Z))
886      testx++;
887
888   if(machine().input().code_pressed(KEYCODE_X))
889      testx--;
890
891   if(machine().input().code_pressed_once(KEYCODE_A))
892      testy++;
893
894   if(machine().input().code_pressed_once(KEYCODE_S))
895      testy--;
896     
897   popmessage("%d %d",testx,testy);
898886   for(int offs=0;offs<0x1000/4;offs+=2)
899887   {
900888      int xi,yi;
889      int r,g,b;
890      int pal_offs;
891      int pal_shift;
901892      //UINT16 tile = m_e90_vram[offs] >> 16;
902      UINT16 pal = m_e90_vram[offs] & 0x7f; // guess: 0x1000 entries / word / 4bpp = 0x7f
893      UINT16 pal = m_e90_vram[offs] & 0x3f; // guess: 0x1000 entries / word / 4bpp = 0x7f, bit 6 seems to have some special meaning tho ...
903894      INT16 x = m_e90_vram[offs+1] >> 16;
904895      INT16 y = m_e90_vram[offs+1] & 0xffff;
905896      x>>=1;
906     
897      pal_offs = (pal*0x20);
898      pal_offs+= 1; // edit this to get the other colors in the range
899      pal_shift = pal_offs & 1 ? 0 : 16;
900      r = m_e90_pal[pal_offs>>1] >> pal_shift;
901      g = (m_e90_pal[pal_offs>>1] >> (5+pal_shift));
902      b = (m_e90_pal[pal_offs>>1] >> (10+pal_shift));
903      r&=0x1f;
904      g&=0x1f;
905      b&=0x1f;
906      r = (r << 3) | (r >> 2);
907      g = (g << 3) | (g >> 2);
908      b = (b << 3) | (b >> 2);
907909      for(yi=0;yi<8;yi++)
908910         for(xi=0;xi<8;xi++)
909911         {
r243015r243016
912914            res_y = y+yi + 7;
913915           
914916            if(cliprect.contains(res_x, res_y))
915               bitmap.pix32(res_y, res_x) = pal << 16;
917               bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b;
916918         }
917919   }
918920   return 0;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team