Previous 199869 Revisions Next

r32555 Sunday 5th October, 2014 at 14:50:37 UTC by David Haywood
some fuuki refactoring (nw)
[src/mame]mame.mak
[src/mame/drivers]fuukifg2.c fuukifg3.c
[src/mame/includes]fuukifg2.h fuukifg3.h
[src/mame/video]fuukifg.c* fuukifg.h* fuukifg2.c fuukifg3.c

trunk/src/mame/includes/fuukifg2.h
r32554r32555
11#include "sound/okim6295.h"
2#include "video/fuukifg.h"
23
34class fuuki16_state : public driver_device
45{
r32554r32555
1314   fuuki16_state(const machine_config &mconfig, device_type type, const char *tag)
1415      : driver_device(mconfig, type, tag),
1516      m_vram(*this, "vram"),
16      m_spriteram(*this, "spriteram"),
1717      m_vregs(*this, "vregs"),
1818      m_unknown(*this, "unknown"),
1919      m_priority(*this, "priority"),
r32554r32555
2222      m_oki(*this, "oki"),
2323      m_gfxdecode(*this, "gfxdecode"),
2424      m_screen(*this, "screen"),
25      m_palette(*this, "palette") { }
25      m_palette(*this, "palette"),
26      m_fuukivid(*this, "fuukivid")
27      { }
2628
2729   /* memory pointers */
2830   required_shared_ptr_array<UINT16,4> m_vram;
29   required_shared_ptr<UINT16> m_spriteram;
3031   required_shared_ptr<UINT16> m_vregs;
3132   required_shared_ptr<UINT16> m_unknown;
3233   required_shared_ptr<UINT16> m_priority;
r32554r32555
5960   UINT32 screen_update_fuuki16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6061   inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
6162   inline void fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
62   void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
6363   void fuuki16_draw_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri );
6464   DECLARE_WRITE_LINE_MEMBER(soundirq);
6565   required_device<okim6295_device> m_oki;
6666   required_device<gfxdecode_device> m_gfxdecode;
6767   required_device<screen_device> m_screen;
6868   required_device<palette_device> m_palette;
69   required_device<fuukivid_device> m_fuukivid;
6970protected:
7071   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
7172};
trunk/src/mame/includes/fuukifg3.h
r32554r32555
1#include "video/fuukifg.h"
12
2
33/* Define clocks based on actual OSC on the PCB */
44
55#define CPU_CLOCK       (XTAL_40MHz / 2)        /* clock for 68020 */
r32554r32555
2222   fuuki32_state(const machine_config &mconfig, device_type type, const char *tag)
2323      : driver_device(mconfig, type, tag),
2424      m_vram(*this, "vram"),
25      m_spriteram(*this, "spriteram"),
2625      m_vregs(*this, "vregs"),
2726      m_priority(*this, "priority"),
2827      m_tilebank(*this, "tilebank"),
r32554r32555
3029      m_soundcpu(*this, "soundcpu"),
3130      m_gfxdecode(*this, "gfxdecode"),
3231      m_screen(*this, "screen"),
33      m_palette(*this, "palette") { }
32      m_palette(*this, "palette"),
33      m_fuukivid(*this, "fuukivid")
34      { }
3435
3536   /* memory pointers */
3637   required_shared_ptr_array<UINT32,4> m_vram;
37   required_shared_ptr<UINT32> m_spriteram;
3838   required_shared_ptr<UINT32> m_vregs;
3939   required_shared_ptr<UINT32> m_priority;
4040   required_shared_ptr<UINT32> m_tilebank;
r32554r32555
5555   required_device<gfxdecode_device> m_gfxdecode;
5656   required_device<screen_device> m_screen;
5757   required_device<palette_device> m_palette;
58   required_device<fuukivid_device> m_fuukivid;
5859
59
6060   DECLARE_READ32_MEMBER(snd_020_r);
6161   DECLARE_WRITE32_MEMBER(snd_020_w);
6262   DECLARE_WRITE32_MEMBER(fuuki32_vregs_w);
trunk/src/mame/mame.mak
r32554r32555
11481148$(MAMEOBJ)/fuuki.a: \
11491149   $(DRIVERS)/fuukifg2.o $(VIDEO)/fuukifg2.o \
11501150   $(DRIVERS)/fuukifg3.o $(VIDEO)/fuukifg3.o \
1151   $(VIDEO)/fuukifg.o \
11511152
11521153$(MAMEOBJ)/gaelco.a: \
11531154   $(DRIVERS)/atvtrack.o \
trunk/src/mame/video/fuukifg2.c
r32554r32555
106106}
107107
108108
109/***************************************************************************
110109
111
112                                Sprites Drawing
113
114    Offset:     Bits:                   Value:
115
116        0.w     fedc ---- ---- ----     Number Of Tiles Along X - 1
117                ---- b--- ---- ----     Flip X
118                ---- -a-- ---- ----     1 = Don't Draw This Sprite
119                ---- --98 7654 3210     X (Signed)
120
121        2.w     fedc ---- ---- ----     Number Of Tiles Along Y - 1
122                ---- b--- ---- ----     Flip Y
123                ---- -a-- ---- ----
124                ---- --98 7654 3210     Y (Signed)
125
126        4.w     fedc ---- ---- ----     Zoom X ($0 = Full Size, $F = Half Size)
127                ---- ba98 ---- ----     Zoom Y ""
128                ---- ---- 76-- ----     Priority
129                ---- ---- --54 3210     Color
130
131        6.w                             Code
132
133
134***************************************************************************/
135
136void fuuki16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
137{
138   int offs;
139   gfx_element *gfx = m_gfxdecode->gfx(0);
140   bitmap_ind8 &priority_bitmap = screen.priority();
141   const rectangle &visarea = screen.visible_area();
142   UINT16 *spriteram16 = m_spriteram;
143   int max_x = visarea.max_x + 1;
144   int max_y = visarea.max_y + 1;
145
146   /* Draw them backwards, for pdrawgfx */
147   for ( offs = (m_spriteram.bytes() - 8) / 2; offs >=0; offs -= 8 / 2 )
148   {
149      int x, y, xstart, ystart, xend, yend, xinc, yinc;
150      int xnum, ynum, xzoom, yzoom, flipx, flipy;
151      int pri_mask;
152
153      int sx = spriteram16[offs + 0];
154      int sy = spriteram16[offs + 1];
155      int attr = spriteram16[offs + 2];
156      int code = spriteram16[offs + 3];
157
158      if (sx & 0x400)
159         continue;
160
161      flipx = sx & 0x0800;
162      flipy = sy & 0x0800;
163
164      xnum = ((sx >> 12) & 0xf) + 1;
165      ynum = ((sy >> 12) & 0xf) + 1;
166
167      xzoom = 16 * 8 - (8 * ((attr >> 12) & 0xf)) / 2;
168      yzoom = 16 * 8 - (8 * ((attr >>  8) & 0xf)) / 2;
169
170      switch ((attr >> 6) & 3)
171      {
172         case 3: pri_mask = 0xf0 | 0xcc | 0xaa;  break;  // behind all layers
173         case 2: pri_mask = 0xf0 | 0xcc;         break;  // behind fg + middle layer
174         case 1: pri_mask = 0xf0;                break;  // behind fg layer
175         case 0:
176         default:    pri_mask = 0;                       // above all
177      }
178
179      sx = (sx & 0x1ff) - (sx & 0x200);
180      sy = (sy & 0x1ff) - (sy & 0x200);
181
182      if (flip_screen())
183      {
184         flipx = !flipx;     sx = max_x - sx - xnum * 16;
185         flipy = !flipy;     sy = max_y - sy - ynum * 16;
186      }
187
188      if (flipx)  { xstart = xnum-1;  xend = -1;    xinc = -1; }
189      else        { xstart = 0;       xend = xnum;  xinc = +1; }
190
191      if (flipy)  { ystart = ynum-1;  yend = -1;    yinc = -1; }
192      else        { ystart = 0;       yend = ynum;  yinc = +1; }
193
194      for (y = ystart; y != yend; y += yinc)
195      {
196         for (x = xstart; x != xend; x += xinc)
197         {
198            if (xzoom == (16*8) && yzoom == (16*8))
199               gfx->prio_transpen(bitmap,cliprect,
200                           code++,
201                           attr & 0x3f,
202                           flipx, flipy,
203                           sx + x * 16, sy + y * 16,
204                           priority_bitmap,
205                           pri_mask,15 );
206            else
207               gfx->prio_zoom_transpen(bitmap,cliprect,
208                           code++,
209                           attr & 0x3f,
210                           flipx, flipy,
211                           sx + (x * xzoom) / 8, sy + (y * yzoom) / 8,
212                           (0x10000/0x10/8) * (xzoom + 8),(0x10000/0x10/8) * (yzoom + 8),  priority_bitmap,// nearest greater integer value to avoid holes
213                           pri_mask,15 );
214         }
215      }
216
217#ifdef MAME_DEBUG
218#if 0
219if (machine().input().code_pressed(KEYCODE_X))
220{   /* Display some info on each sprite */
221   char buf[40];
222   sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);
223   ui_draw_text(buf, sx, sy);
224}
225#endif
226#endif
227   }
228}
229
230
231110/***************************************************************************
232111
233112
r32554r32555
339218   fuuki16_draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2);
340219   fuuki16_draw_layer(screen, bitmap, cliprect, tm_front,  0, 4);
341220
342   draw_sprites(screen, bitmap, cliprect);
221   m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), 0);
343222
344223   return 0;
345224}
trunk/src/mame/video/fuukifg3.c
r32554r32555
9090
9191void fuuki32_state::video_start()
9292{
93   m_buf_spriteram = auto_alloc_array(machine(), UINT32, m_spriteram.bytes() / 4);
94   m_buf_spriteram2 = auto_alloc_array(machine(), UINT32, m_spriteram.bytes() / 4);
93//   m_buf_spriteram = auto_alloc_array(machine(), UINT32, m_spriteram.bytes() / 4);
94//   m_buf_spriteram2 = auto_alloc_array(machine(), UINT32, m_spriteram.bytes() / 4);
9595
96   save_pointer(NAME(m_buf_spriteram), m_spriteram.bytes() / 4);
97   save_pointer(NAME(m_buf_spriteram2), m_spriteram.bytes() / 4);
9896
97
9998   m_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(fuuki32_state::get_tile_info_0),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32);
10099   m_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(fuuki32_state::get_tile_info_1),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32);
101100   m_tilemap[2] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(fuuki32_state::get_tile_info_2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
r32554r32555
111110}
112111
113112
114/***************************************************************************
115113
116
117                                Sprites Drawing
118
119    Offset:     Bits:                   Value:
120
121        0.w     fedc ---- ---- ----     Number Of Tiles Along X - 1
122                ---- b--- ---- ----     Flip X
123                ---- -a-- ---- ----     1 = Don't Draw This Sprite
124                ---- --98 7654 3210     X (Signed)
125
126        2.w     fedc ---- ---- ----     Number Of Tiles Along Y - 1
127                ---- b--- ---- ----     Flip Y
128                ---- -a-- ---- ----
129                ---- --98 7654 3210     Y (Signed)
130
131        4.w     fedc ---- ---- ----     Zoom X ($0 = Full Size, $F = Half Size)
132                ---- ba98 ---- ----     Zoom Y ""
133                ---- ---- 76-- ----     Priority
134                ---- ---- --54 3210     Color
135
136        6.w     fe-- ---- ---- ----     Tile Bank
137                --dc ba98 7654 3210     Tile Code
138
139
140***************************************************************************/
141
142void fuuki32_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
143{
144   int offs;
145   gfx_element *gfx = m_gfxdecode->gfx(0);
146   bitmap_ind8 &priority_bitmap = screen.priority();
147   const rectangle &visarea = screen.visible_area();
148   int max_x = visarea.max_x + 1;
149   int max_y = visarea.max_y + 1;
150
151   UINT32 *src = m_buf_spriteram2; /* Use spriteram buffered by 2 frames, need palette buffered by one frame? */
152
153   /* Draw them backwards, for pdrawgfx */
154   for (offs = (m_spriteram.bytes() - 8) / 4; offs >= 0; offs -= 8/4)
155   {
156      int x, y, xstart, ystart, xend, yend, xinc, yinc;
157      int xnum, ynum, xzoom, yzoom, flipx, flipy;
158      int pri_mask;
159
160      int sx = (src[offs + 0]& 0xffff0000) >> 16;
161      int sy = (src[offs + 0]& 0x0000ffff);
162      int attr = (src[offs + 1]& 0xffff0000) >> 16;
163      int code = (src[offs + 1]& 0x0000ffff);
164
165      int bank = (code & 0xc000) >> 14;
166      int bank_lookedup;
167
168      bank_lookedup = ((m_spr_buffered_tilebank[1] & 0xffff0000) >> (16 + bank * 4)) & 0xf;
169      code &= 0x3fff;
170      code += bank_lookedup * 0x4000;
171
172      if (sx & 0x400)
173         continue;
174
175      flipx = sx & 0x0800;
176      flipy = sy & 0x0800;
177
178      xnum = ((sx >> 12) & 0xf) + 1;
179      ynum = ((sy >> 12) & 0xf) + 1;
180
181      xzoom = 16 * 8 - (8 * ((attr >> 12) & 0xf)) / 2;
182      yzoom = 16 * 8 - (8 * ((attr >>  8) & 0xf)) / 2;
183
184      switch( (attr >> 6) & 3 )
185      {
186         case 3: pri_mask = 0xf0 | 0xcc | 0xaa;  break;  // behind all layers
187         case 2: pri_mask = 0xf0 | 0xcc;         break;  // behind fg + middle layer
188         case 1: pri_mask = 0xf0;                break;  // behind fg layer
189         case 0:
190         default:    pri_mask = 0;                       // above all
191      }
192
193      sx = (sx & 0x1ff) - (sx & 0x200);
194      sy = (sy & 0x1ff) - (sy & 0x200);
195
196      if (flip_screen())
197      {
198         flipx = !flipx;     sx = max_x - sx - xnum * 16;
199         flipy = !flipy;     sy = max_y - sy - ynum * 16;
200      }
201
202      if (flipx)  { xstart = xnum-1;  xend = -1;    xinc = -1; }
203      else        { xstart = 0;       xend = xnum;  xinc = +1; }
204
205      if (flipy)  { ystart = ynum-1;  yend = -1;    yinc = -1; }
206      else        { ystart = 0;       yend = ynum;  yinc = +1; }
207
208#if 0
209      if(!( (screen.machine().input().code_pressed(KEYCODE_V) && (((attr >> 6)&3) == 0))
210         || (screen.machine().input().code_pressed(KEYCODE_B) && (((attr >> 6)&3) == 1))
211         || (screen.machine().input().code_pressed(KEYCODE_N) && (((attr >> 6)&3) == 2))
212         || (screen.machine().input().code_pressed(KEYCODE_M) && (((attr >> 6)&3) == 3))
213         ))
214#endif
215
216      for (y = ystart; y != yend; y += yinc)
217      {
218         for (x = xstart; x != xend; x += xinc)
219         {
220            if (xzoom == (16*8) && yzoom == (16*8))
221               gfx->prio_transpen(bitmap,cliprect,
222                           code++,
223                           attr & 0x3f,
224                           flipx, flipy,
225                           sx + x * 16, sy + y * 16,
226                           priority_bitmap,
227                           pri_mask,15 );
228            else
229               gfx->prio_zoom_transpen(bitmap,cliprect,
230                           code++,
231                           attr & 0x3f,
232                           flipx, flipy,
233                           sx + (x * xzoom) / 8, sy + (y * yzoom) / 8,
234                           (0x10000/0x10/8) * (xzoom + 8),(0x10000/0x10/8) * (yzoom + 8),  priority_bitmap,// nearest greater integer value to avoid holes
235                           pri_mask,15 );
236         }
237      }
238
239#ifdef MAME_DEBUG
240#if 0
241if (screen.machine().input().code_pressed(KEYCODE_X))
242{   /* Display some info on each sprite */
243   char buf[40];
244   sprintf(buf, "%Xx%X %X",xnum,ynum,(attr>>6)&3);
245   ui_draw_text(buf, sx, sy);
246}
247#endif
248#endif
249   }
250}
251
252
253114/***************************************************************************
254115
255116
r32554r32555
356217   fuuki32_draw_layer(screen, bitmap, cliprect, tm_middle, 0, 2);
357218   fuuki32_draw_layer(screen, bitmap, cliprect, tm_front,  0, 4);
358219
359   draw_sprites(screen, bitmap, cliprect);
220   m_fuukivid->draw_sprites(screen, bitmap, cliprect, flip_screen(), m_spr_buffered_tilebank);
360221   return 0;
361222}
362223
r32554r32555
368229      /* Buffer sprites and tilebank by 2 frames */
369230      m_spr_buffered_tilebank[1] = m_spr_buffered_tilebank[0];
370231      m_spr_buffered_tilebank[0] = m_tilebank[0];
371      memcpy(m_buf_spriteram2, m_buf_spriteram, m_spriteram.bytes());
372      memcpy(m_buf_spriteram, m_spriteram, m_spriteram.bytes());
232      m_fuukivid->buffer_sprites();
373233   }
374234}
trunk/src/mame/video/fuukifg.c
r0r32555
1/*
2*/
3
4#include "emu.h"
5#include "fuukifg.h"
6
7const device_type FUUKI_VIDEO = &device_creator<fuukivid_device>;
8
9fuukivid_device::fuukivid_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
10   : device_t(mconfig, FUUKI_VIDEO, "Fuuki Video", tag, owner, clock, "fuukivid", __FILE__),
11      device_video_interface(mconfig, *this),
12      m_gfxdecode(*this)
13{
14}
15
16void fuukivid_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
17{
18   downcast<fuukivid_device &>(device).m_gfxdecode.set_tag(tag);
19}
20
21
22void fuukivid_device::device_start()
23{
24   m_sprram = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2);
25
26   // fuukifg3 clearly has buffered ram, it is unclear if fuukifg2 has
27   // it is likely these render to a framebuffer as the tile bank (which is probably external hw) also needs to be banked
28   // suggesting that the sprites are rendered earlier, then displayed from a buffer
29
30   m_sprram_old = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2);
31   m_sprram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2);
32
33   save_pointer(NAME(m_sprram), 0x2000 / 2);
34   save_pointer(NAME(m_sprram_old), 0x2000 / 2);
35   save_pointer(NAME(m_sprram_old2), 0x2000 / 2);
36
37}
38
39void fuukivid_device::device_reset()
40{
41}
42
43
44/***************************************************************************
45
46
47                                Sprites Drawing
48
49    Offset:     Bits:                   Value:
50
51        0.w     fedc ---- ---- ----     Number Of Tiles Along X - 1
52                ---- b--- ---- ----     Flip X
53                ---- -a-- ---- ----     1 = Don't Draw This Sprite
54                ---- --98 7654 3210     X (Signed)
55
56        2.w     fedc ---- ---- ----     Number Of Tiles Along Y - 1
57                ---- b--- ---- ----     Flip Y
58                ---- -a-- ---- ----
59                ---- --98 7654 3210     Y (Signed)
60
61        4.w     fedc ---- ---- ----     Zoom X ($0 = Full Size, $F = Half Size)
62                ---- ba98 ---- ----     Zoom Y ""
63                ---- ---- 76-- ----     Priority
64                ---- ---- --54 3210     Color
65
66        6.w                             Tile Code
67
68      for FG3 hardware
69
70        6.w     fe-- ---- ---- ----     Tile Bank
71                --dc ba98 7654 3210     Tile Code
72
73***************************************************************************/
74
75void fuukivid_device::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip_screen , UINT32* tilebank)
76{
77   // as we're likely framebuffered (sprites are delayed by 2-3 frames, at least on FG3, and doing rasters on sprites causes glitches) we
78   // only draw the sprites when MAME wants to draw the final screen line.  Ideally we should framebuffer them instead.
79   if (cliprect.max_y != m_screen->visible_area().max_y)
80      return;
81
82   rectangle spriteclip = m_screen->visible_area();
83
84   int offs;
85   gfx_element *gfx = m_gfxdecode->gfx(0);
86   bitmap_ind8 &priority_bitmap = screen.priority();
87   const rectangle &visarea = screen.visible_area();
88
89   UINT16 *spriteram16 = m_sprram;
90
91   if (tilebank) spriteram16 = m_sprram_old2; // so that FG3 uses the buffered RAM
92
93   int max_x = visarea.max_x + 1;
94   int max_y = visarea.max_y + 1;
95
96   /* Draw them backwards, for pdrawgfx */
97   for ( offs = (0x2000 - 8) / 2; offs >=0; offs -= 8 / 2 )
98   {
99      int x, y, xstart, ystart, xend, yend, xinc, yinc;
100      int xnum, ynum, xzoom, yzoom, flipx, flipy;
101      int pri_mask;
102
103      int sx = spriteram16[offs + 0];
104      int sy = spriteram16[offs + 1];
105      int attr = spriteram16[offs + 2];
106      int code = spriteram16[offs + 3];
107
108      if (tilebank)
109      {
110         int bank = (code & 0xc000) >> 14;
111         int bank_lookedup;
112
113         bank_lookedup = ((tilebank[1] & 0xffff0000) >> (16 + bank * 4)) & 0xf;
114         code &= 0x3fff;
115         code += bank_lookedup * 0x4000;
116      }
117
118      if (sx & 0x400)
119         continue;
120
121      flipx = sx & 0x0800;
122      flipy = sy & 0x0800;
123
124      xnum = ((sx >> 12) & 0xf) + 1;
125      ynum = ((sy >> 12) & 0xf) + 1;
126
127      xzoom = 16 * 8 - (8 * ((attr >> 12) & 0xf)) / 2;
128      yzoom = 16 * 8 - (8 * ((attr >>  8) & 0xf)) / 2;
129
130      switch ((attr >> 6) & 3)
131      {
132         case 3: pri_mask = 0xf0 | 0xcc | 0xaa;  break;  // behind all layers
133         case 2: pri_mask = 0xf0 | 0xcc;         break;  // behind fg + middle layer
134         case 1: pri_mask = 0xf0;                break;  // behind fg layer
135         case 0:
136         default:    pri_mask = 0;                       // above all
137      }
138
139      sx = (sx & 0x1ff) - (sx & 0x200);
140      sy = (sy & 0x1ff) - (sy & 0x200);
141
142      if (flip_screen)
143      {
144         flipx = !flipx;     sx = max_x - sx - xnum * 16;
145         flipy = !flipy;     sy = max_y - sy - ynum * 16;
146      }
147
148      if (flipx)  { xstart = xnum-1;  xend = -1;    xinc = -1; }
149      else        { xstart = 0;       xend = xnum;  xinc = +1; }
150
151      if (flipy)  { ystart = ynum-1;  yend = -1;    yinc = -1; }
152      else        { ystart = 0;       yend = ynum;  yinc = +1; }
153
154      for (y = ystart; y != yend; y += yinc)
155      {
156         for (x = xstart; x != xend; x += xinc)
157         {
158            if (xzoom == (16*8) && yzoom == (16*8))
159               gfx->prio_transpen(bitmap,spriteclip,
160                           code++,
161                           attr & 0x3f,
162                           flipx, flipy,
163                           sx + x * 16, sy + y * 16,
164                           priority_bitmap,
165                           pri_mask,15 );
166            else
167               gfx->prio_zoom_transpen(bitmap,spriteclip,
168                           code++,
169                           attr & 0x3f,
170                           flipx, flipy,
171                           sx + (x * xzoom) / 8, sy + (y * yzoom) / 8,
172                           (0x10000/0x10/8) * (xzoom + 8),(0x10000/0x10/8) * (yzoom + 8),  priority_bitmap,// nearest greater integer value to avoid holes
173                           pri_mask,15 );
174         }
175      }
176   }
177}
178
179void fuukivid_device::buffer_sprites(void)
180{
181   memcpy(m_sprram_old2, m_sprram_old, 0x2000);
182   memcpy(m_sprram_old, m_sprram, 0x2000);
183}
No newline at end of file
Property changes on: trunk/src/mame/video/fuukifg.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mame/video/fuukifg.h
r0r32555
1
2
3
4class fuukivid_device : public device_t,
5                  public device_video_interface
6{
7public:
8   fuukivid_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9
10   // static configuration
11   static void static_set_gfxdecode_tag(device_t &device, const char *tag);
12   
13   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip_screen, UINT32* tilebank);
14   UINT16* m_sprram;
15   UINT16*   m_sprram_old;
16   UINT16* m_sprram_old2;
17
18
19   DECLARE_WRITE16_MEMBER(fuuki_sprram_w)
20   {
21      COMBINE_DATA(&m_sprram[offset]);
22   };
23
24   DECLARE_READ16_MEMBER(fuuki_sprram_r)
25   {
26      return m_sprram[offset];
27   }
28   
29   void buffer_sprites(void);
30
31protected:
32   virtual void device_start();
33   virtual void device_reset();
34
35private:
36   required_device<gfxdecode_device> m_gfxdecode;
37};
38
39extern const device_type FUUKI_VIDEO;
40
41#define MCFG_FUUKI_VIDEO_GFXDECODE(_gfxtag) \
42   fuukivid_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
43
Property changes on: trunk/src/mame/video/fuukifg.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mame/drivers/fuukifg3.c
r32554r32555
215215   AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(fuuki32_vram_2_w) AM_SHARE("vram.2")  // Tilemap bg
216216   AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(fuuki32_vram_3_w) AM_SHARE("vram.3")  // Tilemap bg2
217217   AM_RANGE(0x508000, 0x517fff) AM_RAM                                                                     // More tilemap, or linescroll? Seems to be empty all of the time
218   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_SHARE("spriteram") // Sprites
218   AM_RANGE(0x600000, 0x601fff) AM_RAM AM_DEVREADWRITE16("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w, 0xffffffff) // Sprites
219219   AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette",  palette_device, write) AM_SHARE("palette") // Palette
220220
221221   AM_RANGE(0x800000, 0x800003) AM_READ_PORT("800000") AM_WRITENOP                                         // Coin
r32554r32555
545545   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
546546}
547547
548static MACHINE_CONFIG_START( fuuki32, fuuki32_state )
548static MACHINE_CONFIG_START(fuuki32, fuuki32_state)
549549
550550   /* basic machine hardware */
551551   MCFG_CPU_ADD("maincpu", M68EC020, CPU_CLOCK) /* 20MHz verified */
r32554r32555
555555   MCFG_CPU_PROGRAM_MAP(fuuki32_sound_map)
556556   MCFG_CPU_IO_MAP(fuuki32_sound_io_map)
557557
558
559558   /* video hardware */
560559   MCFG_SCREEN_ADD("screen", RASTER)
561560   MCFG_SCREEN_REFRESH_RATE(60)
562   MCFG_SCREEN_SIZE(64*8, 32*8)
563   MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 30*8-1)
561   MCFG_SCREEN_SIZE(64 * 8, 32 * 8)
562   MCFG_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0, 30 * 8 - 1)
564563   MCFG_SCREEN_UPDATE_DRIVER(fuuki32_state, screen_update_fuuki32)
565564   MCFG_SCREEN_VBLANK_DRIVER(fuuki32_state, screen_eof_fuuki32)
566565   MCFG_SCREEN_PALETTE("palette")
567566
568567   MCFG_GFXDECODE_ADD("gfxdecode", "palette", fuuki32)
569   MCFG_PALETTE_ADD("palette", 0x4000/2)
568   MCFG_PALETTE_ADD("palette", 0x4000 / 2)
570569   MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
571570
571   MCFG_DEVICE_ADD("fuukivid", FUUKI_VIDEO, 0)
572   MCFG_FUUKI_VIDEO_GFXDECODE("gfxdecode")
573
572574   /* sound hardware */
573575   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
574576
trunk/src/mame/drivers/fuukifg2.c
r32554r32555
9090   AM_RANGE(0x502000, 0x503fff) AM_RAM_WRITE(fuuki16_vram_1_w) AM_SHARE("vram.1")                  //
9191   AM_RANGE(0x504000, 0x505fff) AM_RAM_WRITE(fuuki16_vram_2_w) AM_SHARE("vram.2")                  //
9292   AM_RANGE(0x506000, 0x507fff) AM_RAM_WRITE(fuuki16_vram_3_w) AM_SHARE("vram.3")                  //
93   AM_RANGE(0x600000, 0x601fff) AM_MIRROR(0x008000) AM_RAM AM_SHARE("spriteram")   // Sprites, mirrored?
93   AM_RANGE(0x600000, 0x601fff) AM_MIRROR(0x008000) AM_DEVREADWRITE("fuukivid", fuukivid_device, fuuki_sprram_r, fuuki_sprram_w) AM_SHARE("spriteram")   // Sprites, mirrored?
9494   AM_RANGE(0x700000, 0x703fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")    // Palette
9595   AM_RANGE(0x800000, 0x800001) AM_READ_PORT("SYSTEM")
9696   AM_RANGE(0x810000, 0x810001) AM_READ_PORT("P1_P2")
r32554r32555
464464   MCFG_PALETTE_ADD("palette", 0x800*4)
465465   MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
466466
467   MCFG_DEVICE_ADD("fuukivid", FUUKI_VIDEO, 0)
468   MCFG_FUUKI_VIDEO_GFXDECODE("gfxdecode")
467469
468470   /* sound hardware */
469471   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team