Previous 199869 Revisions Next

r36188 Monday 2nd March, 2015 at 17:40:59 UTC by Osso
tankbatt.c, tankbust.c: added save state support (nw)
[src/mame/drivers]tankbatt.c tankbust.c
[src/mame/includes]tankbatt.h tankbust.h
[src/mame/video]tankbatt.c tankbust.c

trunk/src/mame/drivers/tankbatt.c
r244699r244700
6262#include "includes/tankbatt.h"
6363
6464
65WRITE8_MEMBER(tankbatt_state::tankbatt_led_w)
65void tankbatt_state::machine_start()
6666{
67   save_item(NAME(m_nmi_enable));
68   save_item(NAME(m_sound_enable));
69}
70
71WRITE8_MEMBER(tankbatt_state::led_w)
72{
6773   set_led_status(machine(), offset,data & 1);
6874}
6975
70READ8_MEMBER(tankbatt_state::tankbatt_in0_r)
76READ8_MEMBER(tankbatt_state::in0_r)
7177{
7278   int val;
7379
r244699r244700
7581   return ((val << (7 - offset)) & 0x80);
7682}
7783
78READ8_MEMBER(tankbatt_state::tankbatt_in1_r)
84READ8_MEMBER(tankbatt_state::in1_r)
7985{
8086   int val;
8187
r244699r244700
8389   return ((val << (7 - offset)) & 0x80);
8490}
8591
86READ8_MEMBER(tankbatt_state::tankbatt_dsw_r)
92READ8_MEMBER(tankbatt_state::dsw_r)
8793{
8894   int val;
8995
r244699r244700
9197   return ((val << (7 - offset)) & 0x80);
9298}
9399
94WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w)
100WRITE8_MEMBER(tankbatt_state::interrupt_enable_w)
95101{
96102   m_nmi_enable = !data;
97103   m_sound_enable = !data;
r244699r244700
100106   if (data) m_samples->stop(2);
101107}
102108
103WRITE8_MEMBER(tankbatt_state::tankbatt_demo_interrupt_enable_w)
109WRITE8_MEMBER(tankbatt_state::demo_interrupt_enable_w)
104110{
105111   m_nmi_enable = data;
106112}
107113
108WRITE8_MEMBER(tankbatt_state::tankbatt_sh_expl_w)
114WRITE8_MEMBER(tankbatt_state::sh_expl_w)
109115{
110116   if (m_sound_enable)
111117   {
r244699r244700
113119   }
114120}
115121
116WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w)
122WRITE8_MEMBER(tankbatt_state::sh_engine_w)
117123{
118124   if (m_sound_enable)
119125   {
r244699r244700
125131   else m_samples->stop(2);
126132}
127133
128WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w)
134WRITE8_MEMBER(tankbatt_state::sh_fire_w)
129135{
130136   if (m_sound_enable)
131137   {
r244699r244700
133139   }
134140}
135141
136WRITE8_MEMBER(tankbatt_state::tankbatt_irq_ack_w)
142WRITE8_MEMBER(tankbatt_state::irq_ack_w)
137143{
138144   /* 0x6e written at the end of the irq routine, could be either irq ack or a coin sample */
139145   m_maincpu->set_input_line(0, CLEAR_LINE);
140146}
141147
142WRITE8_MEMBER(tankbatt_state::tankbatt_coin_counter_w)
148WRITE8_MEMBER(tankbatt_state::coincounter_w)
143149{
144150   coin_counter_w(machine(), 0,data & 1);
145151   coin_counter_w(machine(), 1,data & 1);
146152}
147153
148WRITE8_MEMBER(tankbatt_state::tankbatt_coin_lockout_w)
154WRITE8_MEMBER(tankbatt_state::coinlockout_w)
149155{
150156   coin_lockout_w(machine(), 0,data & 1);
151157   coin_lockout_w(machine(), 1,data & 1);
r244699r244700
155161   AM_RANGE(0x0000, 0x000f) AM_RAM AM_SHARE("bulletsram")
156162   AM_RANGE(0x0010, 0x01ff) AM_RAM
157163   AM_RANGE(0x0200, 0x07ff) AM_RAM
158   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(tankbatt_videoram_w) AM_SHARE("videoram")
159   AM_RANGE(0x0c00, 0x0c07) AM_READ(tankbatt_in0_r)
160   AM_RANGE(0x0c00, 0x0c01) AM_WRITE(tankbatt_led_w)
161   AM_RANGE(0x0c02, 0x0c02) AM_WRITE(tankbatt_coin_counter_w)
162   AM_RANGE(0x0c03, 0x0c03) AM_WRITE(tankbatt_coin_lockout_w)
163   AM_RANGE(0x0c08, 0x0c0f) AM_READ(tankbatt_in1_r)
164   AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
165   AM_RANGE(0x0c00, 0x0c07) AM_READ(in0_r)
166   AM_RANGE(0x0c00, 0x0c01) AM_WRITE(led_w)
167   AM_RANGE(0x0c02, 0x0c02) AM_WRITE(coincounter_w)
168   AM_RANGE(0x0c03, 0x0c03) AM_WRITE(coinlockout_w)
169   AM_RANGE(0x0c08, 0x0c0f) AM_READ(in1_r)
164170   AM_RANGE(0x0c08, 0x0c08) AM_WRITENOP //coin counter mirror?
165   AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(tankbatt_interrupt_enable_w)
166   AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(tankbatt_sh_engine_w)
167   AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(tankbatt_sh_fire_w)
168   AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(tankbatt_sh_expl_w) // bit 7 == led for the start 2 button
171   AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(interrupt_enable_w)
172   AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(sh_engine_w)
173   AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(sh_fire_w)
174   AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(sh_expl_w) // bit 7 == led for the start 2 button
169175   AM_RANGE(0x0c0e, 0x0c0e) AM_WRITENOP //bit 7 == led for the start 1 button
170   AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(tankbatt_demo_interrupt_enable_w)
171   AM_RANGE(0x0c10, 0x0c10) AM_WRITE(tankbatt_irq_ack_w)
172   AM_RANGE(0x0c18, 0x0c1f) AM_READ(tankbatt_dsw_r)
176   AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(demo_interrupt_enable_w)
177   AM_RANGE(0x0c10, 0x0c10) AM_WRITE(irq_ack_w)
178   AM_RANGE(0x0c18, 0x0c1f) AM_READ(dsw_r)
173179   AM_RANGE(0x0c18, 0x0c18) AM_WRITENOP    /* watchdog ?? */
174180   AM_RANGE(0x6000, 0x7fff) AM_ROM AM_REGION("maincpu",0)
175181   AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu",0) //mirror for the reset/irq vectors
176182   AM_RANGE(0x2000, 0xffff) AM_READNOP //anything else might be left-over for a diagnostic ROM or something related to the discrete sound HW
177183ADDRESS_MAP_END
178184
179INTERRUPT_GEN_MEMBER(tankbatt_state::tankbatt_interrupt)
185INTERRUPT_GEN_MEMBER(tankbatt_state::interrupt)
180186{
181187   if (m_nmi_enable) device.execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
182188}
r244699r244700
276282   /* basic machine hardware */
277283   MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1 MHz ???? */
278284   MCFG_CPU_PROGRAM_MAP(main_map)
279   MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state,  tankbatt_interrupt)
285   MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state,  interrupt)
280286
281287   /* video hardware */
282288   MCFG_SCREEN_ADD("screen", RASTER)
r244699r244700
284290   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
285291   MCFG_SCREEN_SIZE(32*8, 32*8)
286292   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
287   MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update_tankbatt)
293   MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update)
288294   MCFG_SCREEN_PALETTE("palette")
289295
290296   MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbatt)
r244699r244700
337343   ROM_LOAD( "bct1-1.l3", 0x0000, 0x0100, CRC(d17518bc) SHA1(f3b0deffa586808bc59e9a24ec1699c54ebe84cc) ) // dm74s287n.3l
338344ROM_END
339345
340GAME( 1980, tankbatt,  0,        tankbatt, tankbatt, driver_device, 0, ROT90, "Namco",   "Tank Battalion", GAME_IMPERFECT_SOUND )
341GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND )
346GAME( 1980, tankbatt,  0,        tankbatt, tankbatt, driver_device, 0, ROT90, "Namco",   "Tank Battalion", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
347GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/tankbust.c
r244699r244700
2626{
2727    membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
2828    membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x18000, 0x2000);
29   
30   save_item(NAME(m_latch));
31   save_item(NAME(m_timer1));
32   save_item(NAME(m_e0xx_data));
33   save_item(NAME(m_variable_data));
34   save_item(NAME(m_irq_mask));
2935}
3036
3137//port A of ay8910#0
r244699r244700
3541   m_latch = param;
3642}
3743
38WRITE8_MEMBER(tankbust_state::tankbust_soundlatch_w)
44WRITE8_MEMBER(tankbust_state::soundlatch_w)
3945{
4046   machine().scheduler().synchronize(timer_expired_delegate(FUNC(tankbust_state::soundlatch_callback),this), data);
4147}
4248
43READ8_MEMBER(tankbust_state::tankbust_soundlatch_r)
49READ8_MEMBER(tankbust_state::soundlatch_r)
4450{
4551   return m_latch;
4652}
4753
4854//port B of ay8910#0
49READ8_MEMBER(tankbust_state::tankbust_soundtimer_r)
55READ8_MEMBER(tankbust_state::soundtimer_r)
5056{
5157   int ret;
5258
r244699r244700
6571
6672
6773
68WRITE8_MEMBER(tankbust_state::tankbust_e0xx_w)
74WRITE8_MEMBER(tankbust_state::e0xx_w)
6975{
7076   m_e0xx_data[offset] = data;
7177
r244699r244700
183189   AM_RANGE(0x0000, 0x5fff) AM_ROM
184190   AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1")
185191   AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank2")
186   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(tankbust_background_videoram_r, tankbust_background_videoram_w) AM_SHARE("videoram")
187   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(tankbust_background_colorram_r, tankbust_background_colorram_w) AM_SHARE("colorram")
188   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tankbust_txtram_r, tankbust_txtram_w) AM_SHARE("txtram")
192   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(background_videoram_w) AM_SHARE("videoram")
193   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(background_colorram_w) AM_SHARE("colorram")
194   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txtram_w) AM_SHARE("txtram")
189195   AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_SHARE("spriteram")
190   AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, tankbust_e0xx_w)
191   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(tankbust_yscroll_w)
196   AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, e0xx_w)
197   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(yscroll_w)
192198   AM_RANGE(0xe801, 0xe801) AM_READ_PORT("SYSTEM")
193199   AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSW")
194   AM_RANGE(0xe801, 0xe802) AM_WRITE(tankbust_xscroll_w)
195   AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, tankbust_soundlatch_w)   /*unknown. Game expects this to change so this is not player input */
200   AM_RANGE(0xe801, 0xe802) AM_WRITE(xscroll_w)
201   AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, soundlatch_w)   /*unknown. Game expects this to change so this is not player input */
196202   AM_RANGE(0xe804, 0xe804) AM_WRITENOP    /* watchdog ? ; written in long-lasting loops */
197203   AM_RANGE(0xf000, 0xf7ff) AM_RAM
198204   //AM_RANGE(0xf800, 0xffff) AM_READ(read_from_unmapped_memory)   /* a bug in game code ? */
r244699r244700
341347   MCFG_SCREEN_SIZE   ( 64*8, 32*8 )
342348   MCFG_SCREEN_VISIBLE_AREA  ( 16*8, 56*8-1, 1*8, 31*8-1 )
343349//  MCFG_SCREEN_VISIBLE_AREA  (  0*8, 64*8-1, 1*8, 31*8-1 )
344   MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update_tankbust)
350   MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update)
345351   MCFG_SCREEN_PALETTE("palette")
346352
347353   MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbust )
r244699r244700
353359   MCFG_SPEAKER_STANDARD_MONO("mono")
354360
355361   MCFG_SOUND_ADD("ay1", AY8910, XTAL_14_31818MHz/16)  /* Verified on PCB */
356   MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, tankbust_soundlatch_r))
357   MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, tankbust_soundtimer_r))
362   MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, soundlatch_r))
363   MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, soundtimer_r))
358364   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
359365
360366   MCFG_SOUND_ADD("ay2", AY8910, XTAL_14_31818MHz/16)  /* Verified on PCB */
r244699r244700
409415ROM_END
410416
411417
412GAME( 1985, tankbust,    0,       tankbust, tankbust, driver_device,  0, ROT90, "Valadon Automation", "Tank Busters", 0 )
418GAME( 1985, tankbust,    0,       tankbust, tankbust, driver_device,  0, ROT90, "Valadon Automation", "Tank Busters", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/tankbatt.h
r244699r244700
44public:
55   tankbatt_state(const machine_config &mconfig, device_type type, const char *tag)
66      : driver_device(mconfig, type, tag),
7      m_bulletsram(*this, "bulletsram"),
8      m_videoram(*this, "videoram"),
97      m_maincpu(*this, "maincpu"),
108      m_samples(*this, "samples"),
119      m_gfxdecode(*this, "gfxdecode"),
12      m_palette(*this, "palette") { }
10      m_palette(*this, "palette"),
11      m_bulletsram(*this, "bulletsram"),
12      m_videoram(*this, "videoram") { }
1313
14   required_device<cpu_device> m_maincpu;
15   required_device<samples_device> m_samples;
16   required_device<gfxdecode_device> m_gfxdecode;
17   required_device<palette_device> m_palette;
18
1419   required_shared_ptr<UINT8> m_bulletsram;
1520   required_shared_ptr<UINT8> m_videoram;
21   
1622   int m_nmi_enable;
1723   int m_sound_enable;
18
1924   tilemap_t *m_bg_tilemap;
20   DECLARE_WRITE8_MEMBER(tankbatt_led_w);
21   DECLARE_READ8_MEMBER(tankbatt_in0_r);
22   DECLARE_READ8_MEMBER(tankbatt_in1_r);
23   DECLARE_READ8_MEMBER(tankbatt_dsw_r);
24   DECLARE_WRITE8_MEMBER(tankbatt_interrupt_enable_w);
25   DECLARE_WRITE8_MEMBER(tankbatt_demo_interrupt_enable_w);
26   DECLARE_WRITE8_MEMBER(tankbatt_sh_expl_w);
27   DECLARE_WRITE8_MEMBER(tankbatt_sh_engine_w);
28   DECLARE_WRITE8_MEMBER(tankbatt_sh_fire_w);
29   DECLARE_WRITE8_MEMBER(tankbatt_irq_ack_w);
30   DECLARE_WRITE8_MEMBER(tankbatt_coin_counter_w);
31   DECLARE_WRITE8_MEMBER(tankbatt_coin_lockout_w);
32   DECLARE_WRITE8_MEMBER(tankbatt_videoram_w);
25   
26   DECLARE_WRITE8_MEMBER(led_w);
27   DECLARE_READ8_MEMBER(in0_r);
28   DECLARE_READ8_MEMBER(in1_r);
29   DECLARE_READ8_MEMBER(dsw_r);
30   DECLARE_WRITE8_MEMBER(interrupt_enable_w);
31   DECLARE_WRITE8_MEMBER(demo_interrupt_enable_w);
32   DECLARE_WRITE8_MEMBER(sh_expl_w);
33   DECLARE_WRITE8_MEMBER(sh_engine_w);
34   DECLARE_WRITE8_MEMBER(sh_fire_w);
35   DECLARE_WRITE8_MEMBER(irq_ack_w);
36   DECLARE_WRITE8_MEMBER(coincounter_w);
37   DECLARE_WRITE8_MEMBER(coinlockout_w);
38   DECLARE_WRITE8_MEMBER(videoram_w);
39   
40   
41   INTERRUPT_GEN_MEMBER(interrupt);
3342   DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
43   
3444   TILE_GET_INFO_MEMBER(get_bg_tile_info);
45   
46   virtual void machine_start();
3547   virtual void video_start();
3648   DECLARE_PALETTE_INIT(tankbatt);
37   UINT32 screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
38   INTERRUPT_GEN_MEMBER(tankbatt_interrupt);
49   
50   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3951   void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
40   required_device<cpu_device> m_maincpu;
41   required_device<samples_device> m_samples;
42   required_device<gfxdecode_device> m_gfxdecode;
43   required_device<palette_device> m_palette;
4452};
trunk/src/mame/includes/tankbust.h
r244699r244700
33public:
44   tankbust_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_maincpu(*this, "maincpu"),
7      m_subcpu(*this, "sub"),
8      m_gfxdecode(*this, "gfxdecode"),
9      m_palette(*this, "palette"),
610      m_txtram(*this, "txtram"),
711      m_videoram(*this, "videoram"),
812      m_colorram(*this, "colorram"),
9      m_spriteram(*this, "spriteram"),
10      m_maincpu(*this, "maincpu"),
11      m_subcpu(*this, "sub"),
12      m_gfxdecode(*this, "gfxdecode"),
13      m_palette(*this, "palette")  { }
13      m_spriteram(*this, "spriteram") { }
1414
15   required_device<cpu_device> m_maincpu;
16   required_device<cpu_device> m_subcpu;
17   required_device<gfxdecode_device> m_gfxdecode;
18   required_device<palette_device> m_palette;
19
20   required_shared_ptr<UINT8> m_txtram;
21   required_shared_ptr<UINT8> m_videoram;
22   required_shared_ptr<UINT8> m_colorram;
23   required_shared_ptr<UINT8> m_spriteram;
24
1525   int m_latch;
1626   UINT32 m_timer1;
1727   int m_e0xx_data[8];
1828   UINT8 m_variable_data;
19   required_shared_ptr<UINT8> m_txtram;
20   required_shared_ptr<UINT8> m_videoram;
21   required_shared_ptr<UINT8> m_colorram;
2229   tilemap_t *m_bg_tilemap;
2330   tilemap_t *m_txt_tilemap;
2431   UINT8 m_xscroll[2];
2532   UINT8 m_yscroll[2];
26   required_shared_ptr<UINT8> m_spriteram;
27
2833   UINT8 m_irq_mask;
29   DECLARE_WRITE8_MEMBER(tankbust_soundlatch_w);
30   DECLARE_WRITE8_MEMBER(tankbust_e0xx_w);
34   
35   DECLARE_WRITE8_MEMBER(soundlatch_w);
36   DECLARE_WRITE8_MEMBER(e0xx_w);
3137   DECLARE_READ8_MEMBER(debug_output_area_r);
3238   DECLARE_READ8_MEMBER(read_from_unmapped_memory);
3339   DECLARE_READ8_MEMBER(some_changing_input);
34   DECLARE_WRITE8_MEMBER(tankbust_background_videoram_w);
35   DECLARE_READ8_MEMBER(tankbust_background_videoram_r);
36   DECLARE_WRITE8_MEMBER(tankbust_background_colorram_w);
37   DECLARE_READ8_MEMBER(tankbust_background_colorram_r);
38   DECLARE_WRITE8_MEMBER(tankbust_txtram_w);
39   DECLARE_READ8_MEMBER(tankbust_txtram_r);
40   DECLARE_WRITE8_MEMBER(tankbust_xscroll_w);
41   DECLARE_WRITE8_MEMBER(tankbust_yscroll_w);
42   DECLARE_READ8_MEMBER(tankbust_soundlatch_r);
43   DECLARE_READ8_MEMBER(tankbust_soundtimer_r);
40   DECLARE_WRITE8_MEMBER(background_videoram_w);
41   DECLARE_WRITE8_MEMBER(background_colorram_w);
42   DECLARE_WRITE8_MEMBER(txtram_w);
43   DECLARE_WRITE8_MEMBER(xscroll_w);
44   DECLARE_WRITE8_MEMBER(yscroll_w);
45   DECLARE_READ8_MEMBER(soundlatch_r);
46   DECLARE_READ8_MEMBER(soundtimer_r);
47   
4448   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4549   TILE_GET_INFO_MEMBER(get_txt_tile_info);
50   
4651    virtual void machine_start();
4752    virtual void machine_reset();
4853   virtual void video_start();
4954   DECLARE_PALETTE_INIT(tankbust);
50   UINT32 screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
55   
56   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
57   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
58   
5159   INTERRUPT_GEN_MEMBER(vblank_irq);
5260   TIMER_CALLBACK_MEMBER(soundlatch_callback);
5361   TIMER_CALLBACK_MEMBER(soundirqline_callback);
54   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
55   required_device<cpu_device> m_maincpu;
56   required_device<cpu_device> m_subcpu;
57   required_device<gfxdecode_device> m_gfxdecode;
58   required_device<palette_device> m_palette;
5962};
trunk/src/mame/video/tankbatt.c
r244699r244700
11/***************************************************************************
22
3  video.c
3  tankbatt.c
44
55  Functions to emulate the video hardware of the machine.
66
r244699r244700
5656   }
5757}
5858
59WRITE8_MEMBER(tankbatt_state::tankbatt_videoram_w)
59WRITE8_MEMBER(tankbatt_state::videoram_w)
6060{
61   UINT8 *videoram = m_videoram;
62   videoram[offset] = data;
61   m_videoram[offset] = data;
6362   m_bg_tilemap->mark_tile_dirty(offset);
6463}
6564
6665TILE_GET_INFO_MEMBER(tankbatt_state::get_bg_tile_info)
6766{
68   UINT8 *videoram = m_videoram;
69   int code = videoram[tile_index];
70   int color = videoram[tile_index] | 0x01;
67   int code = m_videoram[tile_index];
68   int color = m_videoram[tile_index] | 0x01;
7169
7270   SET_TILE_INFO_MEMBER(0, code, color, 0);
7371}
r244699r244700
7977
8078void tankbatt_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
8179{
82   int offs;
83
84   for (offs = 0;offs < m_bulletsram.bytes();offs += 2)
80   for (int offs = 0;offs < m_bulletsram.bytes();offs += 2)
8581   {
8682      int color = 0xff;   /* cyan, same color as the tanks */
8783      int x = m_bulletsram[offs + 1];
r244699r244700
9591   }
9692}
9793
98UINT32 tankbatt_state::screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
94UINT32 tankbatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
9995{
10096   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
10197   draw_bullets(bitmap, cliprect);
trunk/src/mame/video/tankbust.c
r244699r244700
4141   {
4242      color = ((int)rand()) & 0x0f;
4343   }
44   if (attr&0x80)  //al the roofs of all buildings have this bit set. What's this ???
44   if (attr&0x80)  //all the roofs of all buildings have this bit set. What's this ???
4545   {
4646      color = ((int)rand()) & 0x0f;
4747   }
r244699r244700
8282   /* scrollable */
8383   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tankbust_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,  8, 8, 64, 32);
8484
85
8685   m_txt_tilemap->set_transparent_pen(0);
86   
87   save_item(NAME(m_xscroll));
88   save_item(NAME(m_yscroll));
8789}
8890
8991
r244699r244700
9395
9496***************************************************************************/
9597
96WRITE8_MEMBER(tankbust_state::tankbust_background_videoram_w)
98WRITE8_MEMBER(tankbust_state::background_videoram_w)
9799{
98100   m_videoram[offset] = data;
99101   m_bg_tilemap->mark_tile_dirty(offset);
100102}
101READ8_MEMBER(tankbust_state::tankbust_background_videoram_r)
102{
103   return m_videoram[offset];
104}
105103
106WRITE8_MEMBER(tankbust_state::tankbust_background_colorram_w)
104WRITE8_MEMBER(tankbust_state::background_colorram_w)
107105{
108106   m_colorram[offset] = data;
109107   m_bg_tilemap->mark_tile_dirty(offset);
110108}
111READ8_MEMBER(tankbust_state::tankbust_background_colorram_r)
112{
113   return m_colorram[offset];
114}
115109
116WRITE8_MEMBER(tankbust_state::tankbust_txtram_w)
110WRITE8_MEMBER(tankbust_state::txtram_w)
117111{
118112   m_txtram[offset] = data;
119113   m_txt_tilemap->mark_tile_dirty(offset);
120114}
121READ8_MEMBER(tankbust_state::tankbust_txtram_r)
122{
123   return m_txtram[offset];
124}
125115
126
127
128WRITE8_MEMBER(tankbust_state::tankbust_xscroll_w)
116WRITE8_MEMBER(tankbust_state::xscroll_w)
129117{
130118   if( m_xscroll[offset] != data )
131119   {
r244699r244700
141129}
142130
143131
144WRITE8_MEMBER(tankbust_state::tankbust_yscroll_w)
132WRITE8_MEMBER(tankbust_state::yscroll_w)
145133{
146134   if( m_yscroll[offset] != data )
147135   {
r244699r244700
178166
179167void tankbust_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
180168{
181   UINT8 *spriteram = m_spriteram;
182   int offs;
183
184   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
169   for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
185170   {
186171      int code,color,sx,sy,flipx,flipy;
187172
188      code  = spriteram[offs+0] & 0x3f;
189      flipy = spriteram[offs+0] & 0x40;
190      flipx = spriteram[offs+0] & 0x80;
173      code  = m_spriteram[offs+0] & 0x3f;
174      flipy = m_spriteram[offs+0] & 0x40;
175      flipx = m_spriteram[offs+0] & 0x80;
191176
192      sy = (240- spriteram[offs+1]) - 14;
193      sx = (spriteram[offs+2] & 0x01) * 256 + spriteram[offs+3] - 7;
177      sy = (240- m_spriteram[offs+1]) - 14;
178      sx = (m_spriteram[offs+2] & 0x01) * 256 + m_spriteram[offs+3] - 7;
194179
195180      color = 0;
196181
r244699r244700
202187      //0x40 - not used
203188      //0x80 - not used
204189#if 0
205      if ((spriteram[offs+2] & 0x02))
190      if ((m_spriteram[offs+2] & 0x02))
206191      {
207192         code = ((int)rand()) & 63;
208193      }
209194#endif
210195
211      if ((spriteram[offs+1]!=4)) //otherwise - ghost sprites
196      if ((m_spriteram[offs+1]!=4)) //otherwise - ghost sprites
212197      {
213198         m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
214199            code, color,
r244699r244700
219204}
220205
221206
222UINT32 tankbust_state::screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
207UINT32 tankbust_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
223208{
224209#if 0
225   int i;
226
227   for (i=0; i<0x800; i++)
210   for (int i=0; i<0x800; i++)
228211   {
229212      int tile_attrib = m_colorram[i];
230213


Previous 199869 Revisions Next


© 1997-2024 The MAME Team