Previous 199869 Revisions Next

r33626 Tuesday 2nd December, 2014 at 17:37:32 UTC by David Haywood
use RGB32 for galpani2, it has blending, very evident in the videos available.
I also wonder if the rgb15 layer is 256 pixels stretched to the same size as 320 pixels, the data written during the RAM test compared to what is shown on YouTube videos is suggestive of that.

I guess I should try and find the gal images in the data roms to see what format they're stored in too.

no real improvement, just the result of me studying it for a bit (nw)
[src/mame/drivers]galpani2.c
[src/mame/includes]galpani2.h
[src/mame/video]galpani2.c

trunk/src/mame/drivers/galpani2.c
r242137r242138
337337   AM_RANGE(0x300000, 0x301fff) AM_RAM                                             // ?
338338   AM_RANGE(0x302000, 0x303fff) AM_RAM AM_SHARE("spriteram")   // Sprites
339339   AM_RANGE(0x304000, 0x30401f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
340   AM_RANGE(0x308000, 0x308001) AM_WRITENOP                                        // ? 0 at startup
341   AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP                                        // ? hblank effect ?
342   AM_RANGE(0x310000, 0x3101ff) AM_RAM_WRITE(galpani2_palette_0_w) AM_SHARE("palette.0")    // ?
340//   AM_RANGE(0x308000, 0x308001) AM_WRITENOP                                        // ? 0 at startup
341//   AM_RANGE(0x30c000, 0x30c001) AM_WRITENOP                                        // ? hblank effect ?
342   AM_RANGE(0x310000, 0x3101ff) AM_RAM_DEVWRITE("bg8palette", palette_device, write) AM_SHARE("bg8palette")    // ?
343343   AM_RANGE(0x314000, 0x314001) AM_WRITENOP                                        // ? flip backgrounds ?
344344   AM_RANGE(0x318000, 0x318001) AM_READWRITE(galpani2_eeprom_r, galpani2_eeprom_w) // EEPROM
345345   AM_RANGE(0x380000, 0x387fff) AM_RAM                                             // Palette?
346346   AM_RANGE(0x388000, 0x38ffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")   // Palette
347   AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP                                        // ? at startup of service mode
347//   AM_RANGE(0x390000, 0x3901ff) AM_WRITENOP                                        // ? at startup of service mode
348348
349   AM_RANGE(0x400000, 0x43ffff) AM_RAM_WRITE(galpani2_bg8_0_w) AM_SHARE("bg8.0")    // Background 0
349   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_SHARE("bg8.0")    // Background 0
350350   AM_RANGE(0x440000, 0x440001) AM_RAM AM_SHARE("bg8_scrollx.0")           // Background 0 Scroll X
351351   AM_RANGE(0x480000, 0x480001) AM_RAM AM_SHARE("bg8_scrolly.0")           // Background 0 Scroll Y
352   AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP                                        // ? 0 at startup only
353   AM_RANGE(0x500000, 0x53ffff) AM_RAM_WRITE(galpani2_bg8_1_w) AM_SHARE("bg8.1")    // Background 1
352//   AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP                                        // ? 0 at startup only
353   AM_RANGE(0x500000, 0x53ffff) AM_RAM AM_SHARE("bg8.1")    // Background 1
354354   AM_RANGE(0x540000, 0x540001) AM_RAM AM_SHARE("bg8_scrollx.1")           // Background 1 Scroll X
355   AM_RANGE(0x580000, 0x580001) AM_RAM AM_SHARE("bg8_scrolly.1")           // Background 1 Scroll Y
356//   AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP                                        // ? 0 at startup only
355357
356358   AM_RANGE(0x540572, 0x540573) AM_READNOP                                         // ? galpani2 at F0A4
357359   AM_RANGE(0x54057a, 0x54057b) AM_READNOP                                         // ? galpani2 at F148
r242137r242138
363365   AM_RANGE(0x5405c2, 0x5405c3) AM_READNOP                                         // ? galpani2 at F0A4 and F148
364366   AM_RANGE(0x5405ca, 0x5405cb) AM_READNOP                                         // ? galpani2 at F148
365367
366   AM_RANGE(0x580000, 0x580001) AM_RAM AM_SHARE("bg8_scrolly.1")           // Background 1 Scroll Y
367   AM_RANGE(0x5c0000, 0x5c0001) AM_WRITENOP                                        // ? 0 at startup only
368   AM_RANGE(0x600000, 0x600001) AM_WRITENOP                                        // Watchdog
368   AM_RANGE(0x600000, 0x600001) AM_NOP                                        // Watchdog
369369   AM_RANGE(0x640000, 0x640001) AM_WRITE8(galpani2_mcu_init_w, 0x00ff          )   // ? 0 before resetting and at startup, Reset mcu ?
370370   AM_RANGE(0x680000, 0x680001) AM_WRITE8(galpani2_mcu_nmi1_w, 0x00ff)             // ? 0 -> 1 -> 0 (lev 5) / 0 -> $10 -> 0
371371   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITE8(galpani2_coin_lockout_w, 0xff00      )   // Coin + Card Lockout
r242137r242138
403403static ADDRESS_MAP_START( galpani2_mem2, AS_PROGRAM, 16, galpani2_state )
404404   AM_RANGE(0x000000, 0x03ffff) AM_ROM                                                             // ROM
405405   AM_RANGE(0x100000, 0x13ffff) AM_RAM AM_SHARE("ram2")                                        // Work RAM
406   AM_RANGE(0x400000, 0x4fffff) AM_RAM_WRITE(galpani2_bg15_w) AM_SHARE("bg15")  // bg15
407   AM_RANGE(0x500000, 0x5fffff) AM_RAM                                                             // bg15
408   AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only
409   AM_RANGE(0x640000, 0x640001) AM_WRITENOP                                // ? 0 at startup only
410   AM_RANGE(0x680000, 0x680001) AM_WRITENOP                                // ? 0 at startup only
411   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP                                // ? 0 at startup only
412   AM_RANGE(0x700000, 0x700001) AM_WRITENOP                                // Watchdog
406   AM_RANGE(0x400000, 0x5fffff) AM_RAM AM_SHARE("bg15")  // bg15
407//   AM_RANGE(0x600000, 0x600001) AM_NOP // ? 0 at startup only
408//   AM_RANGE(0x640000, 0x640001) AM_WRITENOP                                // ? 0 at startup only
409//   AM_RANGE(0x680000, 0x680001) AM_WRITENOP                                // ? 0 at startup only
410//   AM_RANGE(0x6c0000, 0x6c0001) AM_WRITENOP                                // ? 0 at startup only
411   AM_RANGE(0x700000, 0x700001) AM_NOP                                 // Watchdog
413412//  AM_RANGE(0x740000, 0x740001) AM_WRITENOP                                // ? Reset mcu
414413   AM_RANGE(0x780000, 0x780001) AM_WRITE8(galpani2_mcu_nmi2_w, 0x00ff)             // ? 0 -> 1 -> 0 (lev 5)
415414   AM_RANGE(0x7c0000, 0x7c0001) AM_WRITEONLY AM_SHARE("rombank")   // Rom Bank
r242137r242138
626625   MCFG_SCREEN_SIZE(320, 256)
627626   MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1-16)
628627   MCFG_SCREEN_UPDATE_DRIVER(galpani2_state, screen_update_galpani2)
629   MCFG_SCREEN_PALETTE("palette")
630628
631629   MCFG_GFXDECODE_ADD("gfxdecode", "palette", galpani2)
632   MCFG_PALETTE_ADD("palette", 0x4000 + 0x200 + 0x8000)    // sprites, bg8, bg15
630   MCFG_PALETTE_ADD("palette", 0x4000)    // sprites
633631   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
634   MCFG_PALETTE_INIT_OWNER(galpani2_state, galpani2)
635632
633   MCFG_PALETTE_ADD("bg8palette", 0x200/2) // bg8
634   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
635
636   MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */
637   MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
638   MCFG_PALETTE_INIT_OWNER(galpani2_state,galpani2)
639
636640   MCFG_DEVICE_ADD_KC002_SPRITES
637641   kaneko16_sprite_device::set_offsets(*device, 0x10000 - 0x16c0 + 0xc00, 0);
638642   MCFG_KANEKO16_SPRITE_GFXDECODE("gfxdecode")
trunk/src/mame/includes/galpani2.h
r242137r242138
2121      m_spriteram(*this, "spriteram"),
2222      m_oki2(*this, "oki2"),
2323      m_eeprom(*this, "eeprom"),
24      m_palette(*this, "palette")
25      { }
24      m_palette(*this, "palette"),
25      m_bg15palette(*this, "bgpalette"),
26      m_bg8palette(*this, "bg8palette")
27   { }
2628
2729   required_shared_ptr_array<UINT16, 2> m_bg8;
2830   optional_shared_ptr_array<UINT16, 2> m_palette_val;
r242137r242138
3537   UINT16 m_old_mcu_nmi1;
3638   UINT16 m_old_mcu_nmi2;
3739   required_shared_ptr<UINT16> m_rombank;
38   bitmap_ind16 *m_bg8_bitmap[2];
39   bitmap_ind16 *m_bg15_bitmap;
4040
4141   required_device<cpu_device> m_maincpu;
4242   required_device<cpu_device> m_subcpu;
r242137r242138
5555   virtual void machine_reset();
5656   virtual void video_start();
5757   DECLARE_PALETTE_INIT(galpani2);
58   UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
58   UINT32 screen_update_galpani2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
59   void copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer);
60   void copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
61
5962   TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1);
6063   TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2);
6164   void galpani2_mcu_nmi1();
6265   void galpani2_mcu_nmi2();
6366   /*----------- defined in video/galpani2.c -----------*/
64   inline void galpani2_bg8_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_);
65   inline void galpani2_palette_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_);
6667
67   DECLARE_WRITE16_MEMBER( galpani2_palette_0_w );
68   DECLARE_WRITE16_MEMBER( galpani2_palette_1_w );
69
70   DECLARE_WRITE16_MEMBER( galpani2_bg8_0_w );
71   DECLARE_WRITE16_MEMBER( galpani2_bg8_1_w );
72
73   DECLARE_WRITE16_MEMBER( galpani2_bg15_w );
7468   required_device<okim6295_device> m_oki2;
7569   required_device<eeprom_serial_93cxx_device> m_eeprom;
7670   required_device<palette_device> m_palette;
71   required_device<palette_device> m_bg15palette;
72   required_device<palette_device> m_bg8palette;
73
7774};
trunk/src/mame/video/galpani2.c
r242137r242138
5555WRITE16_MEMBER( galpani2_bg8_regs_1_w ) { galpani2_bg8_regs_w(space, offset, data, mem_mask, 1); }
5656#endif
5757
58inline void galpani2_state::galpani2_bg8_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_)
59{
60   int x,y,pen;
61   UINT16 newword = COMBINE_DATA(&m_bg8[_n_][offset]);
62   pen =   newword & 0xff;
63   x   =   (offset % 512); /* 512 x 256 */
64   y   =   (offset / 512);
65   m_bg8_bitmap[_n_]->pix16(y, x) = 0x4000 + pen;
66}
6758
68WRITE16_MEMBER( galpani2_state::galpani2_bg8_0_w ) { galpani2_bg8_w(offset, data, mem_mask, 0); }
69WRITE16_MEMBER( galpani2_state::galpani2_bg8_1_w ) { galpani2_bg8_w(offset, data, mem_mask, 1); }
7059
71inline void galpani2_state::galpani2_palette_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _n_)
72{
73   UINT16 newword = COMBINE_DATA(&m_palette_val[_n_][offset]);
74   m_palette->set_pen_color( offset + 0x4000 + _n_ * 0x100, pal5bit(newword >> 5), pal5bit(newword >> 10), pal5bit(newword >> 0) );
75}
76
77WRITE16_MEMBER( galpani2_state::galpani2_palette_0_w ) { galpani2_palette_w(offset, data, mem_mask, 0); }
78WRITE16_MEMBER( galpani2_state::galpani2_palette_1_w ) { galpani2_palette_w(offset, data, mem_mask, 1); }
79
80
8160/***************************************************************************
8261
8362
84                            xRGB  Background Layer
85
86
87***************************************************************************/
88
89/* 8 horizontal pages of 256x256 pixels? */
90WRITE16_MEMBER( galpani2_state::galpani2_bg15_w )
91{
92   UINT16 newword = COMBINE_DATA(&m_bg15[offset]);
93
94   int x = (offset % 256) + (offset / (256*256)) * 256 ;
95   int y = (offset / 256) % 256;
96
97   m_bg15_bitmap->pix16(y, x) = 0x4200 + (newword & 0x7fff);
98}
99
100
101/***************************************************************************
102
103
10463                            Video Init Functions
10564
10665
r242137r242138
11372
11473   /* initialize 555 RGB lookup */
11574   for (i = 0; i < 0x8000; i++)
116      palette.set_pen_color(0x4200+i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
75      palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
11776}
11877
11978void galpani2_state::video_start()
12079{
121   m_bg15_bitmap  = auto_bitmap_ind16_alloc(machine(), 256*8, 256);
122   m_bg8_bitmap[0] = auto_bitmap_ind16_alloc(machine(), 512, 256);
123   m_bg8_bitmap[1] = auto_bitmap_ind16_alloc(machine(), 512, 256);
12480}
12581
12682
r242137r242138
13288
13389***************************************************************************/
13490
135UINT32 galpani2_state::screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
91// based on videos these 8-bit layers actually get *blended* against the RGB555 layer
92// it should be noted that in the layer at 0x500000 the upper 8 bits are set too, this could be related
93void galpani2_state::copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer)
13694{
95   int x = - ( *m_bg8_scrollx[layer] + 0x200 - 0x0f5 );
96   int y = - ( *m_bg8_scrolly[layer] + 0x200 - 0x1be );
97   UINT16* ram = m_bg8[layer];
98
99   const pen_t *clut = &m_bg8palette->pen(0);
100   for (int xx = 0; xx < 320; xx++)
101   {
102      for (int yy = 0; yy < 240; yy++)
103      {
104         UINT16 pen = ram[(((y + yy) & 0xff) * 512) + ((x + xx) & 0x1ff)];
105         if (pen) bitmap.pix32(yy, xx) = clut[pen & 0xff];
106      }
107   }
108}
109
110// this seems to be 256x256 pages (arranged as 1024*256), but the game resolution is 320x240
111// https://www.youtube.com/watch?v=2b2SLFtC0uA is a video of the galpanic2j set, and shows the RGB pattern at
112// startup covering all screen lines - is the hardware mixing bitmaps of different resolutions or is there a
113// line select somewhere?  I should find the gal images and find what resolution they're stored at too.
114// (or is this just wrong format / layout due to protection?)
115void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
116{
117   UINT16* ram = m_bg15 + 0x40000/2;
118   
119   //int x = 0;
120   //int y = 0;
121
122   const pen_t *clut = &m_bg15palette->pen(0);
123   for (int xx = 0; xx < 320; xx++)
124   {
125      for (int yy = 0; yy < 240; yy++)
126      {
127         UINT16 pen = ram[(xx * 0x800) + yy];
128         bitmap.pix32(yy, xx) = clut[pen & 0x7fff];
129      }
130   }
131}
132
133UINT32 galpani2_state::screen_update_galpani2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
134{
137135   int layers_ctrl = -1;
138136
139#ifdef MAME_DEBUG
137#if 1 // MAME_DEBUG
140138if (machine().input().code_pressed(KEYCODE_Z))
141139{
142140   int msk = 0;
r242137r242138
151149   bitmap.fill(0, cliprect);
152150   screen.priority().fill(0, cliprect);
153151
154   if (layers_ctrl & 0x1)
155   {
156      int x = 0;
157      int y = 0;
158      copyscrollbitmap_trans(bitmap, *m_bg15_bitmap,
159                        1, &x, 1, &y,
160                        cliprect,0x4200 + 0);
161   }
162
163152/*  test mode:
164153    304000:0040 0000 0100 0000-0000 0000 0000 0000      (Sprite regs)
165154    304010:16C0 0200 16C0 0200-16C0 0200 16C0 0200
166155    16c0/40 = 5b        200/40 = 8
167156    scrollx = f5, on screen x should be 0 (f5+5b = 150) */
168157
169   if (layers_ctrl & 0x2)
170   {
171      int x = - ( *m_bg8_scrollx[0] + 0x200 - 0x0f5 );
172      int y = - ( *m_bg8_scrolly[0] + 0x200 - 0x1be );
173      copyscrollbitmap_trans(bitmap, *m_bg8_bitmap[0],
174                        1, &x, 1, &y,
175                        cliprect,0x4000 + 0);
176   }
177
178   if (layers_ctrl & 0x4)
179   {
180      int x = - ( *m_bg8_scrollx[1] + 0x200 - 0x0f5 );
181      int y = - ( *m_bg8_scrolly[1] + 0x200 - 0x1be );
182      copyscrollbitmap_trans(bitmap, *m_bg8_bitmap[1],
183                        1, &x, 1, &y,
184                        cliprect,0x4000 + 0);
185   }
186
158   if (layers_ctrl & 0x1) copybg15(screen, bitmap, cliprect);
159   if (layers_ctrl & 0x2) copybg8(screen, bitmap, cliprect, 0);
160   if (layers_ctrl & 0x4) copybg8(screen, bitmap, cliprect, 1);
187161   if (layers_ctrl & 0x8) m_kaneko_spr->kaneko16_render_sprites(bitmap, cliprect, screen.priority(), m_spriteram, m_spriteram.bytes());
188162   return 0;
189163}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team