Previous 199869 Revisions Next

r34964 Wednesday 11th February, 2015 at 16:42:52 UTC by Osso
gsword.c: added save state support (nw)
tait8741.c: fixed an oversight in yesterday's commit (nw)
[src/mame/drivers]gsword.c
[src/mame/includes]gsword.h
[src/mame/machine]tait8741.c
[src/mame/video]gsword.c

trunk/src/mame/drivers/gsword.c
r243475r243476
44
55TODO:
66
7-joshi vollyball
7-joshi volleyball
88   -The incomplete graphic
99   -The implementation of DAC sound ?
1010   -MCU code DUMP and emulation
r243475r243476
1414Credits:
1515- Steve Ellenoff: Original emulation and Mame driver
1616- Jarek Parchanski: Dip Switch Fixes, Color improvements, ADPCM Interface code
17- Tatsuyuki Satoh: sound improvements, NEC 8741 emulation,adpcm improvements,
17- Tatsuyuki Satoh: sound improvements, NEC 8741 emulation, adpcm improvements,
1818            josvollyvall 8741 emulation
1919- Charlie Miltenberger: sprite colors improvements & precious hardware
2020            information and screenshots
r243475r243476
144144#include "emu.h"
145145#include "cpu/z80/z80.h"
146146#include "machine/tait8741.h"
147#include "sound/ay8910.h"
148147#include "sound/msm5205.h"
149148#include "includes/gsword.h"
150149
151150
152151#if 0
153int gsword_state::gsword_coins_in(void)
152int gsword_state::coins_in(void)
154153{
155154   /* emulate 8741 coin slot */
156155   if (ioport("IN4")->read() & 0xc0)
r243475r243476
165164
166165#include "cpu/z80/z80.h"
167166
167
168168/* CPU 2 memory hack */
169169/* (402E) timeout upcount must be under 0AH                         */
170170/* (4004,4005) clear down counter , if (4004,4005)==0 then (402E)=0 */
r243475r243476
174174
175175   /*if(offset==1)osd_printf_debug("CNT %02X%02X\n",m_cpu2_ram[5],m_cpu2_ram[4]); */
176176
177   /* speedup timeout cound down */
177   /* speedup timeout count down */
178178   if(m_protect_hack)
179179   {
180180      switch(offset)
r243475r243476
219219   return 0;
220220}
221221
222MACHINE_RESET_MEMBER(gsword_state,gsword)
222void gsword_state::machine_start()
223223{
224   save_item(NAME(m_fake8910_0));
225   save_item(NAME(m_fake8910_1));
226   save_item(NAME(m_nmi_enable));
227   save_item(NAME(m_protect_hack));
228}
229
230void gsword_state::machine_reset()
231{
224232   m_coins = 0;
225233
226234   /* snd CPU mask NMI during reset phase */
r243475r243476
228236   m_protect_hack = 0;
229237}
230238
231MACHINE_RESET_MEMBER(gsword_state,josvolly)
232{
233}
234
235239INTERRUPT_GEN_MEMBER(gsword_state::gsword_snd_interrupt)
236240{
237241   if(m_nmi_enable)
238242      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
239243}
240244
241WRITE8_MEMBER(gsword_state::gsword_nmi_set_w)
245WRITE8_MEMBER(gsword_state::nmi_set_w)
242246{
243247/*  osd_printf_debug("AY write %02X\n",data);*/
244248
r243475r243476
253257   switch(data)
254258   {
255259   case 0xff:
256      m_nmi_enable = 0; /* NMI must be disable */
260      m_nmi_enable = 0; /* NMI must be disabled */
257261      break;
258262   case 0x02:
259263      m_nmi_enable = 0; /* ANY */
r243475r243476
262266      m_nmi_enable = 1;
263267      break;
264268   case 0x0f:
265      m_nmi_enable = 1; /* NMI must be enable */
269      m_nmi_enable = 1; /* NMI must be enabled */
266270      break;
267271   case 0xfe:
268      m_nmi_enable = 1; /* NMI must be enable */
272      m_nmi_enable = 1; /* NMI must be enabled */
269273      break;
270274   }
271275   /* bit1= nmi disable , for ram check */
r243475r243476
273277#endif
274278}
275279
276WRITE8_MEMBER(gsword_state::gsword_AY8910_control_port_0_w)
280WRITE8_MEMBER(gsword_state::ay8910_control_port_0_w)
277281{
278   ay8910_device *ay8910 = machine().device<ay8910_device>("ay1");
279   ay8910->address_w(space,offset,data);
282   m_ay0->address_w(space,offset,data);
280283   m_fake8910_0 = data;
281284}
282WRITE8_MEMBER(gsword_state::gsword_AY8910_control_port_1_w)
285WRITE8_MEMBER(gsword_state::ay8910_control_port_1_w)
283286{
284   ay8910_device *ay8910 = machine().device<ay8910_device>("ay2");
285   ay8910->address_w(space,offset,data);
287   m_ay1->address_w(space,offset,data);
286288   m_fake8910_1 = data;
287289}
288290
289READ8_MEMBER(gsword_state::gsword_fake_0_r)
291READ8_MEMBER(gsword_state::fake_0_r)
290292{
291293   return m_fake8910_0+1;
292294}
293READ8_MEMBER(gsword_state::gsword_fake_1_r)
295READ8_MEMBER(gsword_state::fake_1_r)
294296{
295297   return m_fake8910_1+1;
296298}
r243475r243476
308310   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
309311}
310312
313
311314static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state )
312315   AM_RANGE(0x0000, 0x8fff) AM_ROM
313316   AM_RANGE(0x9000, 0x9fff) AM_RAM
r243475r243476
315318   AM_RANGE(0xa380, 0xa3ff) AM_RAM AM_SHARE("spritetile_ram")
316319   AM_RANGE(0xa400, 0xa77f) AM_RAM
317320   AM_RANGE(0xa780, 0xa7ff) AM_RAM AM_SHARE("spritexy_ram")
318   AM_RANGE(0xa980, 0xa980) AM_WRITE(gsword_charbank_w)
319   AM_RANGE(0xaa80, 0xaa80) AM_WRITE(gsword_videoctrl_w)   /* flip screen, char palette bank */
320   AM_RANGE(0xab00, 0xab00) AM_WRITE(gsword_scroll_w)
321   AM_RANGE(0xa980, 0xa980) AM_WRITE(charbank_w)
322   AM_RANGE(0xaa80, 0xaa80) AM_WRITE(videoctrl_w)   /* flip screen, char palette bank */
323   AM_RANGE(0xab00, 0xab00) AM_WRITE(scroll_w)
321324   AM_RANGE(0xab80, 0xabff) AM_WRITEONLY AM_SHARE("spriteattram")
322   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(gsword_videoram_w) AM_SHARE("videoram")
325   AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
323326ADDRESS_MAP_END
324327
325328static ADDRESS_MAP_START( cpu1_io_map, AS_IO, 8, gsword_state )
r243475r243476
344347   AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_2, write_2)
345348   AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_3, write_3)
346349   AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_1, write_1)
347   AM_RANGE(0x60, 0x60) AM_READWRITE(gsword_fake_0_r, gsword_AY8910_control_port_0_w)
350   AM_RANGE(0x60, 0x60) AM_READWRITE(fake_0_r, ay8910_control_port_0_w)
348351   AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w)
349   AM_RANGE(0x80, 0x80) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w)
352   AM_RANGE(0x80, 0x80) AM_READWRITE(fake_1_r, ay8910_control_port_1_w)
350353   AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w)
351354//
352355   AM_RANGE(0xe0, 0xe0) AM_READNOP /* ?? */
r243475r243476
378381
379382static ADDRESS_MAP_START( josvolly_cpu2_io_map, AS_IO, 8, gsword_state )
380383   ADDRESS_MAP_GLOBAL_MASK(0xff)
381   AM_RANGE(0x00, 0x00) AM_READWRITE(gsword_fake_0_r, gsword_AY8910_control_port_0_w)
384   AM_RANGE(0x00, 0x00) AM_READWRITE(fake_0_r, ay8910_control_port_0_w)
382385   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w)
383   AM_RANGE(0x40, 0x40) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w)
386   AM_RANGE(0x40, 0x40) AM_READWRITE(fake_1_r, ay8910_control_port_1_w)
384387   AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w)
385388
386389   AM_RANGE(0x81, 0x81) AM_DEVWRITE("josvolly_8741", josvolly8741_4pack_device, nmi_enable_w)
r243475r243476
638641
639642   MCFG_QUANTUM_TIME(attotime::from_hz(12000)) /* Allow time for 2nd cpu to interleave*/
640643
641   MCFG_MACHINE_RESET_OVERRIDE(gsword_state,gsword)
642
643644   MCFG_TAITO8741_ADD("taito8741")
644645   MCFG_TAITO8741_MODES(TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT)
645646   MCFG_TAITO8741_CONNECT(1,0,0,0)
r243475r243476
670671   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
671672
672673   MCFG_SOUND_ADD("ay2", AY8910, 1500000)
673   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, gsword_nmi_set_w)) /* portA write */
674   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, nmi_set_w)) /* portA write */
674675   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
675676
676677   MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb */
r243475r243476
691692   MCFG_CPU_IO_MAP(josvolly_cpu2_io_map)
692693   MCFG_CPU_VBLANK_INT_DRIVER("screen", gsword_state,  irq0_line_hold)
693694
694   MCFG_MACHINE_RESET_OVERRIDE(gsword_state,josvolly)
695
696695   MCFG_JOSVOLLY8741_ADD("josvolly_8741")
697696   MCFG_JOSVOLLY8741_CONNECT(1,0,0,0)
698697   MCFG_JOSVOLLY8741_PORT_HANDLERS(IOPORT("DSW1"),IOPORT("DSW2"),IOPORT("DSW1"),IOPORT("DSW2"))
r243475r243476
719718   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
720719
721720   MCFG_SOUND_ADD("ay2", AY8910, 1500000)
722   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, gsword_nmi_set_w)) /* portA write */
721   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, nmi_set_w)) /* portA write */
723722   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
724723
725724#if 0
r243475r243476
901900}
902901
903902
904GAME( 1983, josvolly, 0,      josvolly, josvolly, driver_device,  0,       ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
905GAME( 1984, gsword,   0,      gsword,   gsword,   gsword_state,   gsword,  ROT0,  "Allumer / Taito Corporation", "Great Swordsman (World?)", 0 )
906GAME( 1984, gsword2,  gsword, gsword,   gsword,   gsword_state,   gsword2, ROT0,  "Allumer / Taito Corporation", "Great Swordsman (Japan?)", 0 )
903GAME( 1983, josvolly, 0,      josvolly, josvolly, driver_device,  0,       ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
904GAME( 1984, gsword,   0,      gsword,   gsword,   gsword_state,   gsword,  ROT0,  "Allumer / Taito Corporation", "Great Swordsman (World?)", GAME_SUPPORTS_SAVE )
905GAME( 1984, gsword2,  gsword, gsword,   gsword,   gsword_state,   gsword2, ROT0,  "Allumer / Taito Corporation", "Great Swordsman (Japan?)", GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/gsword.h
r243475r243476
1#include "sound/ay8910.h"
12#include "sound/msm5205.h"
23
34class gsword_state : public driver_device
r243475r243476
56public:
67   gsword_state(const machine_config &mconfig, device_type type, const char *tag)
78      : driver_device(mconfig, type, tag),
8      m_spritetile_ram(*this, "spritetile_ram"),
9      m_spritexy_ram(*this, "spritexy_ram"),
10      m_spriteattrib_ram(*this, "spriteattram"),
11      m_videoram(*this, "videoram"),
12      m_cpu2_ram(*this, "cpu2_ram"),
139      m_maincpu(*this, "maincpu"),
1410      m_audiocpu(*this, "audiocpu"),
1511      m_subcpu(*this, "sub"),
12      m_ay0(*this, "ay1"),
13      m_ay1(*this, "ay2"),
1614      m_msm(*this, "msm"),
1715      m_gfxdecode(*this, "gfxdecode"),
18      m_palette(*this, "palette") { }
16      m_palette(*this, "palette"),
17      m_spritetile_ram(*this, "spritetile_ram"),
18      m_spritexy_ram(*this, "spritexy_ram"),
19      m_spriteattrib_ram(*this, "spriteattram"),
20      m_videoram(*this, "videoram"),
21      m_cpu2_ram(*this, "cpu2_ram") { }
1922
23   required_device<cpu_device> m_maincpu;
24   required_device<cpu_device> m_audiocpu;
25   optional_device<cpu_device> m_subcpu;
26   required_device<ay8910_device> m_ay0;
27   required_device<ay8910_device> m_ay1;
28   optional_device<msm5205_device> m_msm;
29   required_device<gfxdecode_device> m_gfxdecode;
30   required_device<palette_device> m_palette;
31
2032   required_shared_ptr<UINT8> m_spritetile_ram;
2133   required_shared_ptr<UINT8> m_spritexy_ram;
2234   required_shared_ptr<UINT8> m_spriteattrib_ram;
2335   required_shared_ptr<UINT8> m_videoram;
2436   required_shared_ptr<UINT8> m_cpu2_ram;
2537
26   int m_coins;
38   int m_coins; //currently initialized but not used
2739   int m_fake8910_0;
2840   int m_fake8910_1;
2941   int m_nmi_enable;
r243475r243476
3345   int m_flipscreen;
3446   tilemap_t *m_bg_tilemap;
3547
36   DECLARE_WRITE8_MEMBER(gsword_videoram_w);
37   DECLARE_WRITE8_MEMBER(gsword_charbank_w);
38   DECLARE_WRITE8_MEMBER(gsword_videoctrl_w);
39   DECLARE_WRITE8_MEMBER(gsword_scroll_w);
48   // common
49   DECLARE_WRITE8_MEMBER(videoram_w);
50   DECLARE_WRITE8_MEMBER(charbank_w);
51   DECLARE_WRITE8_MEMBER(videoctrl_w);
52   DECLARE_WRITE8_MEMBER(scroll_w);
53   DECLARE_WRITE8_MEMBER(adpcm_soundcommand_w);
54   DECLARE_WRITE8_MEMBER(nmi_set_w);
55   DECLARE_WRITE8_MEMBER(ay8910_control_port_0_w);
56   DECLARE_WRITE8_MEMBER(ay8910_control_port_1_w);
57   DECLARE_READ8_MEMBER(fake_0_r);
58   DECLARE_READ8_MEMBER(fake_1_r);
59   
60   // gsword specific
4061   DECLARE_READ8_MEMBER(gsword_hack_r);
41   DECLARE_WRITE8_MEMBER(adpcm_soundcommand_w);
42   DECLARE_WRITE8_MEMBER(gsword_nmi_set_w);
43   DECLARE_WRITE8_MEMBER(gsword_AY8910_control_port_0_w);
44   DECLARE_WRITE8_MEMBER(gsword_AY8910_control_port_1_w);
45   DECLARE_READ8_MEMBER(gsword_fake_0_r);
46   DECLARE_READ8_MEMBER(gsword_fake_1_r);
47   DECLARE_READ8_MEMBER( gsword_8741_2_r );
48   DECLARE_READ8_MEMBER( gsword_8741_3_r );
4962   DECLARE_WRITE8_MEMBER(gsword_adpcm_data_w);
63   DECLARE_READ8_MEMBER(gsword_8741_2_r);
64   DECLARE_READ8_MEMBER(gsword_8741_3_r);
65
66   TILE_GET_INFO_MEMBER(get_bg_tile_info);
67
5068   DECLARE_DRIVER_INIT(gsword);
5169   DECLARE_DRIVER_INIT(gsword2);
52   TILE_GET_INFO_MEMBER(get_bg_tile_info);
70   virtual void machine_start();
71   virtual void machine_reset();
5372   virtual void video_start();
54   DECLARE_MACHINE_RESET(gsword);
5573   DECLARE_PALETTE_INIT(gsword);
56   DECLARE_MACHINE_RESET(josvolly);
5774   DECLARE_PALETTE_INIT(josvolly);
75
5876   UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5977   INTERRUPT_GEN_MEMBER(gsword_snd_interrupt);
6078   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
61   int gsword_coins_in(void);
62   required_device<cpu_device> m_maincpu;
63   required_device<cpu_device> m_audiocpu;
64   optional_device<cpu_device> m_subcpu;
65   optional_device<msm5205_device> m_msm;
66   required_device<gfxdecode_device> m_gfxdecode;
67   required_device<palette_device> m_palette;
79   int coins_in(void); //if 0'd
6880};
trunk/src/mame/machine/tait8741.c
r243475r243476
371371      save_item(NAME(m_i8741[i].rst), i);
372372   };
373373   
374   //save_item(NAME(m_nmi_enable)); //never changes from 0?
374   save_item(NAME(m_nmi_enable));
375375}
376376
377377
trunk/src/mame/video/gsword.c
r243475r243476
8787   }
8888}
8989
90WRITE8_MEMBER(gsword_state::gsword_videoram_w)
90WRITE8_MEMBER(gsword_state::videoram_w)
9191{
92   UINT8 *videoram = m_videoram;
93   videoram[offset] = data;
92   m_videoram[offset] = data;
9493   m_bg_tilemap->mark_tile_dirty(offset);
9594}
9695
97WRITE8_MEMBER(gsword_state::gsword_charbank_w)
96WRITE8_MEMBER(gsword_state::charbank_w)
9897{
9998   if (m_charbank != data)
10099   {
r243475r243476
103102   }
104103}
105104
106WRITE8_MEMBER(gsword_state::gsword_videoctrl_w)
105WRITE8_MEMBER(gsword_state::videoctrl_w)
107106{
108107   if (data & 0x8f)
109108   {
r243475r243476
131130   /* other bits unused */
132131}
133132
134WRITE8_MEMBER(gsword_state::gsword_scroll_w)
133WRITE8_MEMBER(gsword_state::scroll_w)
135134{
136135   m_bg_tilemap->set_scrolly(0, data);
137136}
138137
139138TILE_GET_INFO_MEMBER(gsword_state::get_bg_tile_info)
140139{
141   UINT8 *videoram = m_videoram;
142   int code = videoram[tile_index] + ((m_charbank & 0x03) << 8);
140   int code = m_videoram[tile_index] + ((m_charbank & 0x03) << 8);
143141   int color = ((code & 0x3c0) >> 6) + 16 * m_charpalbank;
144142   int flags = m_flipscreen ? (TILE_FLIPX | TILE_FLIPY) : 0;
145143
r243475r243476
150148{
151149   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gsword_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS,
152150         8, 8, 32, 64);
151   
152   save_item(NAME(m_charbank));
153   save_item(NAME(m_charpalbank));
154   save_item(NAME(m_flipscreen));
153155}
154156
155157void gsword_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
156158{
157   int offs;
158
159   for (offs = 0; offs < m_spritexy_ram.bytes() - 1; offs+=2)
159   for (int offs = 0; offs < m_spritexy_ram.bytes() - 1; offs+=2)
160160   {
161161      int sx,sy,flipx,flipy,spritebank,tile,color;
162162


Previous 199869 Revisions Next


© 1997-2024 The MAME Team