Previous 199869 Revisions Next

r22895 Saturday 18th May, 2013 at 13:57:09 UTC by David Haywood
stuntair - improved sprites
[src/mame/drivers]stuntair.c

trunk/src/mame/drivers/stuntair.c
r22894r22895
8787      m_sprram(*this, "sprram")
8888   {
8989      m_bg_xscroll = 0;
90      m_nmienable = 0;
91      m_spritebank0 = 0;
92      m_spritebank1 = 0;
9093   }
9194
9295   required_device<cpu_device> m_maincpu;
r22894r22895
100103   tilemap_t *m_bg_tilemap;
101104
102105   UINT8 m_bg_xscroll;
106   UINT8 m_nmienable;
107   UINT8 m_spritebank0;
108   UINT8 m_spritebank1;
103109
104110   DECLARE_WRITE8_MEMBER(stuntair_fgram_w);
105111   TILE_GET_INFO_MEMBER(get_stuntair_fg_tile_info);
r22894r22895
110116
111117   DECLARE_WRITE8_MEMBER(stuntair_bgxscroll_w);
112118
113   DECLARE_READ8_MEMBER(stuntair_unk_r)
119   DECLARE_WRITE8_MEMBER(stuntair_unk_w)
114120   {
115      return 0xff;
121      printf("unk %02x\n", data);
116122   }
117123
124   DECLARE_WRITE8_MEMBER(stuntair_f001_w)
125   {
126      m_nmienable = data&0x01; // guess
127
128      if (data&~0x01) printf("stuntair_f001_w %02x\n", data);
129   }
130   
131   DECLARE_WRITE8_MEMBER(stuntair_spritebank0_w)
132   {
133      m_spritebank0 = data&0x01;
134
135      if (data&~0x01) printf("stuntair_spritebank0_w %02x\n", data);
136   }
137
138   DECLARE_WRITE8_MEMBER(stuntair_spritebank1_w)
139   {
140      m_spritebank1 = data&0x01;
141
142      if (data&~0x01) printf("stuntair_spritebank1_w %02x\n", data);
143   }
144
145   DECLARE_WRITE8_MEMBER(stuntair_coin_w)
146   {
147      // lower 2 bits are coin counters
148      if (data&~0x3) printf("stuntair_coin_w %02x\n", data);
149   }
150   
151
118152   INTERRUPT_GEN_MEMBER(stuntair_irq);
119153
120154
r22894r22895
132166   AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(stuntair_bgram_w) AM_SHARE("bgram") // bg
133167   AM_RANGE(0xd800, 0xdfff) AM_RAM AM_SHARE("sprram")
134168
135   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSWB")
136   AM_RANGE(0xe800, 0xe800 )AM_READ_PORT("DSWA") AM_WRITE(stuntair_bgxscroll_w)
169   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSWB") AM_WRITE(stuntair_coin_w)
170   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("DSWA") AM_WRITE(stuntair_bgxscroll_w)
137171
138172   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN2")
139   AM_RANGE(0xf001, 0xf001) AM_WRITENOP // might be nmi enable
173   AM_RANGE(0xf001, 0xf001) AM_WRITE(stuntair_f001_w) // might be nmi enable
140174   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN3")
141   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("IN4")
175   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("IN4") AM_WRITE(stuntair_spritebank1_w)
142176//   AM_RANGE(0xf004, 0xf004) AM_WRITENOP
143//   AM_RANGE(0xf005, 0xf005) AM_WRITENOP
177   AM_RANGE(0xf005, 0xf005) AM_WRITE(stuntair_spritebank0_w)
144178//   AM_RANGE(0xf006, 0xf006) AM_WRITENOP
145179//   AM_RANGE(0xf007, 0xf007) AM_WRITENOP
146180
r22894r22895
388422
389423   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
390424   m_fg_tilemap->draw(bitmap, cliprect, 0, TILEMAP_PIXEL_LAYER0);
391   m_fg_tilemap->draw(bitmap, cliprect, 0, TILEMAP_PIXEL_LAYER1|TILEMAP_DRAW_OPAQUE);
392425
393426   gfx_element *gfx = machine().gfx[2];
394427
395   for (int i=0;i<0x200;i+=8)
428   /* there seem to be 2 spritelists with something else (fixed values) between them.. is that significant? */
429   for (int i=0;i<0x400/16;i++)
396430   {
397      int x = m_sprram[i+5];
398      int y = 240-m_sprram[i+0];
399     
400      drawgfx_transpen(bitmap,cliprect,gfx,2,0,0,0,x,y,0);
431      int x = m_sprram[(i*16)+5];
432      int y = 240-m_sprram[(i*16)+0];
433   
434      int tile;
435
436      tile = m_sprram[(i*16)+1] & 0x3f;
437
438      if (m_spritebank1) tile |= 0x40;
439      if (m_spritebank0) tile |= 0x80;
440
441      int flipx = (m_sprram[(i*16)+1] & 0x80)>>7; // used
442      int flipy = (m_sprram[(i*16)+1] & 0x40)>>6; // guessed
443
444
445      drawgfx_transpen(bitmap,cliprect,gfx,tile,0,flipx,flipy,x,y,0);
401446   }
402447
448   m_fg_tilemap->draw(bitmap, cliprect, 0, TILEMAP_PIXEL_LAYER1|TILEMAP_DRAW_OPAQUE);
449
450
403451   return 0;
404452}
405453
406454INTERRUPT_GEN_MEMBER(stuntair_state::stuntair_irq)
407455{
408//   if(m_nmi_enable)
456   if(m_nmienable)
409457      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
410458}
411459

Previous 199869 Revisions Next


© 1997-2024 The MAME Team