Previous 199869 Revisions Next

r35114 Wednesday 18th February, 2015 at 17:36:35 UTC by Osso
scotrsht,c: added save state support (nw)
[src/mame/drivers]scotrsht.c
[src/mame/includes]scotrsht.h
[src/mame/video]scotrsht.c

trunk/src/mame/drivers/scotrsht.c
r243625r243626
4545   flip_screen_set(data & 0x08);
4646}
4747
48INTERRUPT_GEN_MEMBER(scotrsht_state::scotrsht_interrupt)
48INTERRUPT_GEN_MEMBER(scotrsht_state::interrupt)
4949{
5050   if (m_irq_enable)
51      device.execute().set_input_line(0, HOLD_LINE);
51      m_maincpu->set_input_line(0, HOLD_LINE);
5252}
5353
54WRITE8_MEMBER(scotrsht_state::scotrsht_soundlatch_w)
54WRITE8_MEMBER(scotrsht_state::soundlatch_w)
5555{
5656   soundlatch_byte_w(space, 0, data);
5757   m_audiocpu->set_input_line(0, HOLD_LINE);
5858}
5959
6060static ADDRESS_MAP_START( scotrsht_map, AS_PROGRAM, 8, scotrsht_state )
61   AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(scotrsht_colorram_w) AM_SHARE("colorram")
62   AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(scotrsht_videoram_w) AM_SHARE("videoram")
61   AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
62   AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
6363   AM_RANGE(0x1000, 0x10bf) AM_RAM AM_SHARE("spriteram") /* sprites */
6464   AM_RANGE(0x10c0, 0x1fff) AM_RAM /* work ram */
6565   AM_RANGE(0x2000, 0x201f) AM_RAM AM_SHARE("scroll") /* scroll registers */
6666   AM_RANGE(0x2040, 0x2040) AM_WRITENOP
6767   AM_RANGE(0x2041, 0x2041) AM_WRITENOP
6868   AM_RANGE(0x2042, 0x2042) AM_WRITENOP  /* it should be -> bit 2 = scroll direction like in jailbrek, but it's not used */
69   AM_RANGE(0x2043, 0x2043) AM_WRITE(scotrsht_charbank_w)
69   AM_RANGE(0x2043, 0x2043) AM_WRITE(charbank_w)
7070   AM_RANGE(0x2044, 0x2044) AM_WRITE(ctrl_w)
71   AM_RANGE(0x3000, 0x3000) AM_WRITE(scotrsht_palettebank_w)
72   AM_RANGE(0x3100, 0x3100) AM_WRITE(scotrsht_soundlatch_w)
71   AM_RANGE(0x3000, 0x3000) AM_WRITE(palettebank_w)
72   AM_RANGE(0x3100, 0x3100) AM_WRITE(soundlatch_w)
7373   AM_RANGE(0x3200, 0x3200) AM_WRITENOP /* it writes 0, 1 */
7474   AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW2")
7575   AM_RANGE(0x3200, 0x3200) AM_READ_PORT("DSW3")
r243625r243626
182182   /* basic machine hardware */
183183   MCFG_CPU_ADD("maincpu", M6809, 18432000/6)        /* 3.072 MHz */
184184   MCFG_CPU_PROGRAM_MAP(scotrsht_map)
185   MCFG_CPU_VBLANK_INT_DRIVER("screen", scotrsht_state, scotrsht_interrupt)
185   MCFG_CPU_VBLANK_INT_DRIVER("screen", scotrsht_state, interrupt)
186186
187187   MCFG_CPU_ADD("audiocpu", Z80, 18432000/6)        /* 3.072 MHz */
188188   MCFG_CPU_PROGRAM_MAP(scotrsht_sound_map)
r243625r243626
194194   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
195195   MCFG_SCREEN_SIZE(32*8, 32*8)
196196   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
197   MCFG_SCREEN_UPDATE_DRIVER(scotrsht_state, screen_update_scotrsht)
197   MCFG_SCREEN_UPDATE_DRIVER(scotrsht_state, screen_update)
198198   MCFG_SCREEN_PALETTE("palette")
199199
200200   MCFG_GFXDECODE_ADD("gfxdecode", "palette", scotrsht)
r243625r243626
240240   ROM_LOAD( "gx545_6301_8f.bin", 0x0400, 0x0100, CRC(c1c7cf58) SHA1(08452228bf13e43ce4a05806f79e9cd1542416f1) ) /* sprites lookup */
241241ROM_END
242242
243GAME( 1985, scotrsht, 0, scotrsht, scotrsht, driver_device, 0, ROT90,"Konami", "Scooter Shooter", 0 )
243GAME( 1985, scotrsht, 0, scotrsht, scotrsht, driver_device, 0, ROT90,"Konami", "Scooter Shooter", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/scotrsht.h
r243625r243626
33public:
44   scotrsht_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_maincpu(*this, "maincpu"),
7      m_audiocpu(*this, "audiocpu"),
8      m_gfxdecode(*this, "gfxdecode"),
9      m_palette(*this, "palette"),
610      m_colorram(*this, "colorram"),
711      m_videoram(*this, "videoram"),
812      m_spriteram(*this, "spriteram"),
9      m_scroll(*this, "scroll"),
10      m_maincpu(*this, "maincpu"),
11      m_audiocpu(*this, "audiocpu"),
12      m_gfxdecode(*this, "gfxdecode"),
13      m_palette(*this, "palette")  { }
13      m_scroll(*this, "scroll")  { }
1414
15   int m_irq_enable;
15   required_device<cpu_device> m_maincpu;
16   required_device<cpu_device> m_audiocpu;
17   required_device<gfxdecode_device> m_gfxdecode;
18   required_device<palette_device> m_palette;
19
1620   required_shared_ptr<UINT8> m_colorram;
1721   required_shared_ptr<UINT8> m_videoram;
1822   required_shared_ptr<UINT8> m_spriteram;
1923   required_shared_ptr<UINT8> m_scroll;
24
2025   tilemap_t *m_bg_tilemap;
26
27   int m_irq_enable;
2128   int m_charbank;
2229   int m_palette_bank;
30
2331   DECLARE_WRITE8_MEMBER(ctrl_w);
24   DECLARE_WRITE8_MEMBER(scotrsht_soundlatch_w);
25   DECLARE_WRITE8_MEMBER(scotrsht_videoram_w);
26   DECLARE_WRITE8_MEMBER(scotrsht_colorram_w);
27   DECLARE_WRITE8_MEMBER(scotrsht_charbank_w);
28   DECLARE_WRITE8_MEMBER(scotrsht_palettebank_w);
29   TILE_GET_INFO_MEMBER(scotrsht_get_bg_tile_info);
32   DECLARE_WRITE8_MEMBER(soundlatch_w);
33   DECLARE_WRITE8_MEMBER(videoram_w);
34   DECLARE_WRITE8_MEMBER(colorram_w);
35   DECLARE_WRITE8_MEMBER(charbank_w);
36   DECLARE_WRITE8_MEMBER(palettebank_w);
37
38   TILE_GET_INFO_MEMBER(get_bg_tile_info);
39   
40   INTERRUPT_GEN_MEMBER(interrupt);
41
3042   virtual void video_start();
3143   DECLARE_PALETTE_INIT(scotrsht);
32   UINT32 screen_update_scotrsht(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
33   INTERRUPT_GEN_MEMBER(scotrsht_interrupt);
44
45   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3446   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
35   required_device<cpu_device> m_maincpu;
36   required_device<cpu_device> m_audiocpu;
37   required_device<gfxdecode_device> m_gfxdecode;
38   required_device<palette_device> m_palette;
3947};
trunk/src/mame/video/scotrsht.c
r243625r243626
3434   }
3535}
3636
37WRITE8_MEMBER(scotrsht_state::scotrsht_videoram_w)
37WRITE8_MEMBER(scotrsht_state::videoram_w)
3838{
3939   m_videoram[offset] = data;
4040   m_bg_tilemap->mark_tile_dirty(offset);
4141}
4242
43WRITE8_MEMBER(scotrsht_state::scotrsht_colorram_w)
43WRITE8_MEMBER(scotrsht_state::colorram_w)
4444{
4545   m_colorram[offset] = data;
4646   m_bg_tilemap->mark_tile_dirty(offset);
4747}
4848
49WRITE8_MEMBER(scotrsht_state::scotrsht_charbank_w)
49WRITE8_MEMBER(scotrsht_state::charbank_w)
5050{
5151   if (m_charbank != (data & 0x01))
5252   {
r243625r243626
5757   /* other bits unknown */
5858}
5959
60WRITE8_MEMBER(scotrsht_state::scotrsht_palettebank_w)
60WRITE8_MEMBER(scotrsht_state::palettebank_w)
6161{
6262   if (m_palette_bank != ((data & 0x70) >> 4))
6363   {
r243625r243626
7272}
7373
7474
75TILE_GET_INFO_MEMBER(scotrsht_state::scotrsht_get_bg_tile_info)
75TILE_GET_INFO_MEMBER(scotrsht_state::get_bg_tile_info)
7676{
7777   int attr = m_colorram[tile_index];
7878   int code = m_videoram[tile_index] + (m_charbank << 9) + ((attr & 0x40) << 2);
r243625r243626
9090/* Same as Jailbreak + palette bank */
9191void scotrsht_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
9292{
93   UINT8 *spriteram = m_spriteram;
94   int i;
95
96   for (i = 0; i < m_spriteram.bytes(); i += 4)
93   for (int i = 0; i < m_spriteram.bytes(); i += 4)
9794   {
98      int attr = spriteram[i + 1];    // attributes = ?tyxcccc
99      int code = spriteram[i] + ((attr & 0x40) << 2);
95      int attr = m_spriteram[i + 1];    // attributes = ?tyxcccc
96      int code = m_spriteram[i] + ((attr & 0x40) << 2);
10097      int color = (attr & 0x0f) + m_palette_bank * 16;
10198      int flipx = attr & 0x10;
10299      int flipy = attr & 0x20;
103      int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
104      int sy = spriteram[i + 3];
100      int sx = m_spriteram[i + 2] - ((attr & 0x80) << 1);
101      int sy = m_spriteram[i + 3];
105102
106103      if (flip_screen())
107104      {
r243625r243626
119116
120117void scotrsht_state::video_start()
121118{
122   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(scotrsht_state::scotrsht_get_bg_tile_info),this), TILEMAP_SCAN_ROWS,  8, 8, 64, 32);
119   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(scotrsht_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,  8, 8, 64, 32);
123120
124121   m_bg_tilemap->set_scroll_cols(64);
122   
123   save_item(NAME(m_irq_enable));
124   save_item(NAME(m_charbank));
125   save_item(NAME(m_palette_bank));
125126}
126127
127UINT32 scotrsht_state::screen_update_scotrsht(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
128UINT32 scotrsht_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
128129{
129   int col;
130
131   for (col = 0; col < 32; col++)
130   for (int col = 0; col < 32; col++)
132131      m_bg_tilemap->set_scrolly(col, m_scroll[col]);
133132
134133   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team