Previous 199869 Revisions Next

r34494 Monday 19th January, 2015 at 17:46:05 UTC by Osso
bogeyman.c: added missing save state, fixing noted save state regression. Also removed unneeded prefixes. (nw)
[src/mame/drivers]bogeyman.c
[src/mame/includes]bogeyman.h
[src/mame/video]bogeyman.c

trunk/src/mame/drivers/bogeyman.c
r243005r243006
1313
1414#include "emu.h"
1515#include "cpu/m6502/m6502.h"
16#include "sound/ay8910.h"
1716#include "includes/bogeyman.h"
1817
1918
r243005r243006
2120
2221// Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad
2322
24WRITE8_MEMBER(bogeyman_state::bogeyman_8910_latch_w)
23WRITE8_MEMBER(bogeyman_state::ay8910_latch_w)
2524{
2625   m_psg_latch = data;
2726}
2827
29WRITE8_MEMBER(bogeyman_state::bogeyman_8910_control_w)
28WRITE8_MEMBER(bogeyman_state::ay8910_control_w)
3029{
3130   // bit 0 is flipscreen
3231   flip_screen_set(data & 0x01);
3332
3433   // bit 5 goes to 8910 #0 BDIR pin
3534   if ((m_last_write & 0x20) == 0x20 && (data & 0x20) == 0x00)
36      machine().device<ay8910_device>("ay1")->data_address_w(space, m_last_write >> 4, m_psg_latch);
35      m_ay1->data_address_w(space, m_last_write >> 4, m_psg_latch);
3736
3837   // bit 7 goes to 8910 #1 BDIR pin
3938   if ((m_last_write & 0x80) == 0x80 && (data & 0x80) == 0x00)
40      machine().device<ay8910_device>("ay2")->data_address_w(space, m_last_write >> 6, m_psg_latch);
39      m_ay2->data_address_w(space, m_last_write >> 6, m_psg_latch);
4140
4241   m_last_write = data;
4342}
r243005r243006
4645
4746static ADDRESS_MAP_START( bogeyman_map, AS_PROGRAM, 8, bogeyman_state )
4847   AM_RANGE(0x0000, 0x17ff) AM_RAM
49   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(bogeyman_videoram2_w) AM_SHARE("videoram2")
50   AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(bogeyman_colorram2_w) AM_SHARE("colorram2")
51   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(bogeyman_videoram_w) AM_SHARE("videoram")
52   AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(bogeyman_colorram_w) AM_SHARE("colorram")
48   AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2")
49   AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(colorram2_w) AM_SHARE("colorram2")
50   AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
51   AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
5352   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_SHARE("spriteram")
54   AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(bogeyman_paletteram_w) AM_SHARE("palette")
55   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(bogeyman_8910_control_w)
56   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(bogeyman_8910_latch_w)
53   AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(paletteram_w) AM_SHARE("palette")
54   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(ay8910_control_w)
55   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(ay8910_latch_w)
5756   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW1")
5857   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW2") AM_WRITENOP // ??? sound
5958   AM_RANGE(0x4000, 0xffff) AM_ROM
r243005r243006
205204{
206205   save_item(NAME(m_psg_latch));
207206   save_item(NAME(m_last_write));
207   save_item(NAME(m_colbank));
208208}
209209
210210void bogeyman_state::machine_reset()
211211{
212212   m_psg_latch = 0;
213213   m_last_write = 0;
214   m_colbank = 0;
214215}
215216
216WRITE8_MEMBER(bogeyman_state::bogeyman_colbank_w)
217WRITE8_MEMBER(bogeyman_state::colbank_w)
217218{
218219   if((data & 1) != (m_colbank & 1))
219220   {
r243005r243006
237238   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
238239   MCFG_SCREEN_SIZE(32*8, 32*8)
239240   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
240   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update_bogeyman)
241   MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update)
241242   MCFG_SCREEN_PALETTE("palette")
242243
243244   MCFG_GFXDECODE_ADD("gfxdecode", "palette", bogeyman)
r243005r243006
249250   MCFG_SPEAKER_STANDARD_MONO("mono")
250251
251252   MCFG_SOUND_ADD("ay1", AY8910, 1500000)  /* Verified */
252   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, bogeyman_colbank_w))
253   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(bogeyman_state, colbank_w))
253254   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
254255
255256   MCFG_SOUND_ADD("ay2", AY8910, 1500000)  /* Verified */
trunk/src/mame/includes/bogeyman.h
r243005r243006
44
55*************************************************************************/
66
7#include "sound/ay8910.h"
8
79class bogeyman_state : public driver_device
810{
911public:
1012   bogeyman_state(const machine_config &mconfig, device_type type, const char *tag)
1113      : driver_device(mconfig, type, tag),
14      m_maincpu(*this, "maincpu"),
15      m_gfxdecode(*this, "gfxdecode"),
16      m_palette(*this, "palette"),
17      m_ay1(*this, "ay1"),
18      m_ay2(*this, "ay2"),
1219      m_videoram(*this, "videoram"),
1320      m_videoram2(*this, "videoram2"),
1421      m_colorram(*this, "colorram"),
1522      m_colorram2(*this, "colorram2"),
16      m_spriteram(*this, "spriteram"),
17      m_maincpu(*this, "maincpu"),
18      m_gfxdecode(*this, "gfxdecode"),
19      m_palette(*this, "palette") { }
20
23      m_spriteram(*this, "spriteram")  { }
24   
25   /* devices */
26   required_device<cpu_device> m_maincpu;
27   required_device<gfxdecode_device> m_gfxdecode;
28   required_device<palette_device> m_palette;
29   required_device<ay8910_device> m_ay1;
30   required_device<ay8910_device> m_ay2;
31   
2132   /* memory pointers */
2233   required_shared_ptr<UINT8> m_videoram;
2334   required_shared_ptr<UINT8> m_videoram2;
r243005r243006
3445   int        m_psg_latch;
3546   int        m_last_write;
3647   int        m_colbank;
37   DECLARE_WRITE8_MEMBER(bogeyman_8910_latch_w);
38   DECLARE_WRITE8_MEMBER(bogeyman_8910_control_w);
39   DECLARE_WRITE8_MEMBER(bogeyman_videoram_w);
40   DECLARE_WRITE8_MEMBER(bogeyman_colorram_w);
41   DECLARE_WRITE8_MEMBER(bogeyman_videoram2_w);
42   DECLARE_WRITE8_MEMBER(bogeyman_colorram2_w);
43   DECLARE_WRITE8_MEMBER(bogeyman_paletteram_w);
44   DECLARE_WRITE8_MEMBER(bogeyman_colbank_w);
48   
49   DECLARE_WRITE8_MEMBER(ay8910_latch_w);
50   DECLARE_WRITE8_MEMBER(ay8910_control_w);
51   DECLARE_WRITE8_MEMBER(videoram_w);
52   DECLARE_WRITE8_MEMBER(colorram_w);
53   DECLARE_WRITE8_MEMBER(videoram2_w);
54   DECLARE_WRITE8_MEMBER(colorram2_w);
55   DECLARE_WRITE8_MEMBER(paletteram_w);
56   DECLARE_WRITE8_MEMBER(colbank_w);
57   
4558   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4659   TILE_GET_INFO_MEMBER(get_fg_tile_info);
60   
4761   virtual void machine_start();
4862   virtual void machine_reset();
4963   virtual void video_start();
64   
5065   DECLARE_PALETTE_INIT(bogeyman);
51   UINT32 screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
52   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
53   required_device<cpu_device> m_maincpu;
54   required_device<gfxdecode_device> m_gfxdecode;
55   required_device<palette_device> m_palette;
66   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
5668};
trunk/src/mame/video/bogeyman.c
r243005r243006
3636   }
3737}
3838
39WRITE8_MEMBER(bogeyman_state::bogeyman_videoram_w)
39WRITE8_MEMBER(bogeyman_state::videoram_w)
4040{
4141   m_videoram[offset] = data;
4242   m_bg_tilemap->mark_tile_dirty(offset);
4343}
4444
45WRITE8_MEMBER(bogeyman_state::bogeyman_colorram_w)
45WRITE8_MEMBER(bogeyman_state::colorram_w)
4646{
4747   m_colorram[offset] = data;
4848   m_bg_tilemap->mark_tile_dirty(offset);
4949}
5050
51WRITE8_MEMBER(bogeyman_state::bogeyman_videoram2_w)
51WRITE8_MEMBER(bogeyman_state::videoram2_w)
5252{
5353   m_videoram2[offset] = data;
5454   m_fg_tilemap->mark_tile_dirty(offset);
5555}
5656
57WRITE8_MEMBER(bogeyman_state::bogeyman_colorram2_w)
57WRITE8_MEMBER(bogeyman_state::colorram2_w)
5858{
5959   m_colorram2[offset] = data;
6060   m_fg_tilemap->mark_tile_dirty(offset);
6161}
6262
63WRITE8_MEMBER(bogeyman_state::bogeyman_paletteram_w)
63WRITE8_MEMBER(bogeyman_state::paletteram_w)
6464{
6565   /* RGB output is inverted */
6666   m_palette->write(space, offset, UINT8(~data));
r243005r243006
9494   m_fg_tilemap->set_transparent_pen(0);
9595}
9696
97void bogeyman_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
97void bogeyman_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
9898{
99   int offs;
100
101   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
99   for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
102100   {
103101      int attr = m_spriteram[offs];
104102
r243005r243006
139137   }
140138}
141139
142UINT32 bogeyman_state::screen_update_bogeyman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
140UINT32 bogeyman_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
143141{
144142   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
145143   draw_sprites(bitmap, cliprect);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team