Previous 199869 Revisions Next

r19328 Wednesday 5th December, 2012 at 11:39:11 UTC by Robbbert
kodb : fixed sound [Barry Harris]
[src/mame/drivers]fcrash.c
[src/mame/includes]cps1.h

trunk/src/mame/includes/cps1.h
r19327r19328
147147   int          m_layer_scroll2x_offset;
148148   int          m_layer_scroll3x_offset;
149149   int          m_sprite_base;
150   int          m_sprite_list_end_marker;
150151
151152   /* devices */
152153   cpu_device *m_maincpu;
r19327r19328
225226   TIMER_DEVICE_CALLBACK_MEMBER(cps2_interrupt);
226227   
227228   /* fcrash handlers */
229   DECLARE_DRIVER_INIT(kodb);
228230   DECLARE_DRIVER_INIT(cawingbl);
229231   DECLARE_MACHINE_START(fcrash);
230232   DECLARE_MACHINE_RESET(fcrash);
231233   DECLARE_MACHINE_START(kodb);
232234   DECLARE_MACHINE_START(cawingbl);
235   DECLARE_WRITE16_MEMBER(kodb_layer_w);
233236   DECLARE_WRITE16_MEMBER(cawingbl_soundlatch_w);
234237   UINT32 screen_update_fcrash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
235   UINT32 screen_update_kodb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
236238};
237239
238240/*----------- defined in drivers/cps1.c -----------*/
trunk/src/mame/drivers/fcrash.c
r19327r19328
3030
3131---
3232
33kodb has various graphical issues, mainly with old info not being cleared away.
34Also, when you are hit, you should flash, but you go invisible instead.
35
3336*/
3437
3538#include "emu.h"
r19327r19328
3841#include "includes/cps1.h"
3942#include "sound/2203intf.h"
4043#include "sound/msm5205.h"
44#include "sound/2151intf.h"
45#include "sound/okim6295.h"
4146
4247
4348static WRITE16_HANDLER( fcrash_soundlatch_w )
r19327r19328
106111}
107112
108113
114WRITE16_MEMBER(cps_state::kodb_layer_w)
115{
116   cps_state *state = space.machine().driver_data<cps_state>();
117   
118   /* layer enable and mask 1&2 registers are written here - passing them to m_cps_b_regs for now for drawing routines */
119   if (offset == 0x06)
120      state->m_cps_b_regs[m_layer_enable_reg / 2] = data;
121   else
122   if (offset == 0x10)
123      state->m_cps_b_regs[state->m_layer_mask_reg[1] / 2] = data;
124   else
125   if (offset == 0x11)
126      state->m_cps_b_regs[state->m_layer_mask_reg[2] / 2] = data;
127}
109128
129
110130/* not verified */
111131#define CPS1_ROWSCROLL_OFFS     (0x20/2)    /* base of row scroll offsets in other RAM */
112132
r19327r19328
148168   
149169   for (pos = 0x1ffc; pos >= 0x0000; pos -= 4)
150170   {
151      if (state->m_gfxram[base + pos - 1] == 0x8000) last_sprite_offset = pos;
171      if (state->m_gfxram[base + pos - 1] == state->m_sprite_list_end_marker) last_sprite_offset = pos;
152172   }
153173
154174   for (pos = last_sprite_offset; pos >= 0x0000; pos -= 4)
r19327r19328
240260   int layercontrol, l0, l1, l2, l3;
241261   int videocontrol = m_cps_a_regs[0x22 / 2];
242262
243
244263   flip_screen_set(videocontrol & 0x8000);
245264
246265   layercontrol = m_cps_b_regs[m_layer_enable_reg / 2];
r19327r19328
314333   return 0;
315334}
316335
317// doesn't have the scroll offsets like fcrash
318UINT32 cps_state::screen_update_kodb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
319{
320   int layercontrol, l0, l1, l2, l3;
321   int videocontrol = m_cps_a_regs[0x22 / 2];
322336
323   flip_screen_set(videocontrol & 0x8000);
324
325   layercontrol = m_cps_b_regs[0x20 / 2];
326
327   /* Get video memory base registers */
328   cps1_get_video_base(machine());
329
330   /* Build palette */
331   fcrash_build_palette(machine());
332
333   fcrash_update_transmasks(machine());
334
335   m_bg_tilemap[0]->set_scrollx(0, m_scroll1x);
336   m_bg_tilemap[0]->set_scrolly(0, m_scroll1y);
337
338   if (videocontrol & 0x01)   /* linescroll enable */
339   {
340      int scrly= -m_scroll2y;
341      int i;
342      int otheroffs;
343
344      m_bg_tilemap[1]->set_scroll_rows(1024);
345
346      otheroffs = m_cps_a_regs[CPS1_ROWSCROLL_OFFS];
347
348      for (i = 0; i < 256; i++)
349         m_bg_tilemap[1]->set_scrollx((i - scrly) & 0x3ff, m_scroll2x + m_other[(i + otheroffs) & 0x3ff]);
350   }
351   else
352   {
353      m_bg_tilemap[1]->set_scroll_rows(1);
354      m_bg_tilemap[1]->set_scrollx(0, m_scroll2x);
355   }
356
357   m_bg_tilemap[1]->set_scrolly(0, m_scroll2y);
358   m_bg_tilemap[2]->set_scrollx(0, m_scroll3x);
359   m_bg_tilemap[2]->set_scrolly(0, m_scroll3y);
360
361
362   /* turn all tilemaps on regardless of settings in get_video_base() */
363   /* write a custom get_video_base for this bootleg hardware? */
364   m_bg_tilemap[0]->enable(1);
365   m_bg_tilemap[1]->enable(1);
366   m_bg_tilemap[2]->enable(1);
367
368   /* Blank screen */
369   bitmap.fill(0xbff, cliprect);
370
371   machine().priority_bitmap.fill(0, cliprect);
372   l0 = (layercontrol >> 0x06) & 03;
373   l1 = (layercontrol >> 0x08) & 03;
374   l2 = (layercontrol >> 0x0a) & 03;
375   l3 = (layercontrol >> 0x0c) & 03;
376
377   fcrash_render_layer(machine(), bitmap, cliprect, l0, 0);
378
379   if (l1 == 0)
380      fcrash_render_high_layer(machine(), bitmap, cliprect, l0);
381
382   fcrash_render_layer(machine(), bitmap, cliprect, l1, 0);
383
384   if (l2 == 0)
385      fcrash_render_high_layer(machine(), bitmap, cliprect, l1);
386
387   fcrash_render_layer(machine(), bitmap, cliprect, l2, 0);
388
389   if (l3 == 0)
390      fcrash_render_high_layer(machine(), bitmap, cliprect, l2);
391
392   fcrash_render_layer(machine(), bitmap, cliprect, l3, 0);
393
394   return 0;
395}
396
397
398337static ADDRESS_MAP_START( fcrash_map, AS_PROGRAM, 16, cps_state )
399   AM_RANGE(0x000000, 0x1fffff) AM_ROM
338   AM_RANGE(0x000000, 0x3fffff) AM_ROM
400339   AM_RANGE(0x800030, 0x800031) AM_WRITE(cps1_coinctrl_w)
401340   AM_RANGE(0x800100, 0x80013f) AM_RAM AM_SHARE("cps_a_regs")   /* CPS-A custom */
402341   AM_RANGE(0x800140, 0x80017f) AM_RAM AM_SHARE("cps_b_regs")   /* CPS-B custom */
r19327r19328
420359   AM_RANGE(0xec00, 0xec00) AM_WRITE_LEGACY(fcrash_msm5205_1_data_w)
421360ADDRESS_MAP_END
422361
423
424static ADDRESS_MAP_START( kodb_map, AS_PROGRAM, 16, cps_state )
425   AM_RANGE(0x000000, 0x3fffff) AM_ROM
426   AM_RANGE(0x800000, 0x800007) AM_READ_PORT("IN1")         /* Player input ports */
427   /* forgottn, willow, cawing, nemo, varth read from 800010. Probably debug input leftover from development */
428   AM_RANGE(0x800018, 0x80001f) AM_READ(cps1_dsw_r)         /* System input ports / Dip Switches */
429   AM_RANGE(0x800020, 0x800021) AM_READNOP                  /* ? Used by Rockman ? not mapped according to PAL */
430   AM_RANGE(0x800030, 0x800037) AM_WRITE(cps1_coinctrl_w)
431   /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See DRIVER_INIT */
432   AM_RANGE(0x800100, 0x80013f) AM_WRITE(cps1_cps_a_w) AM_SHARE("cps_a_regs")   /* CPS-A custom */
433   AM_RANGE(0x800140, 0x80017f) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w) AM_SHARE("cps_b_regs")   /* CPS-B custom */
434//  AM_RANGE(0x800180, 0x800187) AM_WRITE_LEGACY(cps1_soundlatch_w)    /* Sound command */
435//  AM_RANGE(0x800188, 0x80018f) AM_WRITE_LEGACY(cps1_soundlatch2_w)   /* Sound timer fade */
436   AM_RANGE(0x8001c0, 0x8001ff) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w)   /* mirror (SF2 revision "E" US 910228) */
437   AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE(cps1_gfxram_w) AM_SHARE("gfxram")   /* SF2CE executes code from here */
438   AM_RANGE(0xff0000, 0xffffff) AM_RAM
362static ADDRESS_MAP_START( kodb_sound_map, AS_PROGRAM, 8, cps_state )
363   AM_RANGE(0x0000, 0x7fff) AM_ROM
364   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
365   AM_RANGE(0xd000, 0xd7ff) AM_RAM
366   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE("2151", ym2151_device, read, write)
367   AM_RANGE(0xe400, 0xe400) AM_DEVREADWRITE("oki", okim6295_device, read, write)
368   AM_RANGE(0xe800, 0xe800) AM_READ(soundlatch_byte_r)   /* Sound command */
439369ADDRESS_MAP_END
440370
441371
r19327r19328
804734   m_layer_scroll2x_offset = 60;
805735   m_layer_scroll3x_offset = 64;
806736   m_sprite_base = 0x50c8;
737   m_sprite_list_end_marker = 0x8000;
807738
808739   save_item(NAME(m_sample_buffer1));
809740   save_item(NAME(m_sample_buffer2));
r19327r19328
811742   save_item(NAME(m_sample_select2));
812743}
813744
745MACHINE_START_MEMBER(cps_state,kodb)
746{
747   m_maincpu = machine().device<cpu_device>("maincpu");
748   m_audiocpu = machine().device<cpu_device>("soundcpu");
749   
750   m_layer_enable_reg = 0x20;
751   m_layer_mask_reg[0] = 0x2e;
752   m_layer_mask_reg[1] = 0x2c;
753   m_layer_mask_reg[2] = 0x2a;
754   m_layer_mask_reg[3] = 0x28;
755   m_layer_scroll1x_offset = 0;
756   m_layer_scroll2x_offset = 0;
757   m_layer_scroll3x_offset = 0;
758   m_sprite_base = 0x50c8;
759   m_sprite_list_end_marker = 0xffff;
760}
761
814762MACHINE_START_MEMBER(cps_state, cawingbl)
815763{
816764   MACHINE_START_CALL_MEMBER(fcrash);
r19327r19328
826774   m_sprite_base = 0x1000;
827775}
828776
829MACHINE_START_MEMBER(cps_state,kodb)
830{
831
832   m_maincpu = machine().device<cpu_device>("maincpu");
833   m_audiocpu = machine().device<cpu_device>("soundcpu");
834}
835
836777MACHINE_RESET_MEMBER(cps_state,fcrash)
837778{
838
839779   m_sample_buffer1 = 0;
840780   m_sample_buffer2 = 0;
841781   m_sample_select1 = 0;
r19327r19328
905845
906846   /* basic machine hardware */
907847   MCFG_CPU_ADD("maincpu", M68000, 10000000)
908   MCFG_CPU_PROGRAM_MAP(kodb_map)
848   MCFG_CPU_PROGRAM_MAP(fcrash_map)
909849   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state,  cps1_interrupt)
910850
911//  MCFG_CPU_ADD("soundcpu", Z80, 3579545)
912//  MCFG_CPU_PROGRAM_MAP(sub_map)
851   MCFG_CPU_ADD("soundcpu", Z80, 3579545)
852   MCFG_CPU_PROGRAM_MAP(kodb_sound_map)
913853
914854   MCFG_MACHINE_START_OVERRIDE(cps_state,kodb)
915855
r19327r19328
919859   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
920860   MCFG_SCREEN_SIZE(64*8, 32*8)
921861   MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
922   MCFG_SCREEN_UPDATE_DRIVER(cps_state, screen_update_kodb)
862   MCFG_SCREEN_UPDATE_DRIVER(cps_state, screen_update_fcrash)
923863   MCFG_SCREEN_VBLANK_DRIVER(cps_state, screen_eof_cps1)
924864
925865   MCFG_GFXDECODE(cps1)
r19327r19328
928868   MCFG_VIDEO_START_OVERRIDE(cps_state,cps1)
929869
930870   /* sound hardware */
931//  MCFG_SPEAKER_STANDARD_MONO("mono")
871   MCFG_SPEAKER_STANDARD_MONO("mono")
932872
933//  MCFG_YM2151_ADD("2151", 3579545)
934//  MCFG_SOUND_CONFIG(ym2151_config)
935//  MCFG_SOUND_ROUTE(0, "mono", 0.35)
936//  MCFG_SOUND_ROUTE(1, "mono", 0.35)
873   MCFG_YM2151_ADD("2151", XTAL_3_579545MHz)  /* verified on pcb */
874   MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
875   MCFG_SOUND_ROUTE(0, "mono", 0.35)
876   MCFG_SOUND_ROUTE(1, "mono", 0.35)
937877
938//  MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH) // pin 7 can be changed by the game code, see f006 on z80
939//  MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
878   /* CPS PPU is fed by a 16mhz clock,pin 117 outputs a 4mhz clock which is divided by 4 using 2 74ls74 */
879   MCFG_OKIM6295_ADD("oki", XTAL_16MHz/4/4, OKIM6295_PIN7_HIGH) // pin 7 can be changed by the game code, see f006 on z80
880   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
940881MACHINE_CONFIG_END
941882
942883
943884
944885ROM_START( fcrash )
945   ROM_REGION( 0x200000, "maincpu", 0 )      /* 68000 code */
886   ROM_REGION( 0x400000, "maincpu", 0 )      /* 68000 code */
946887   ROM_LOAD16_BYTE( "9.bin",  0x00000, 0x20000, CRC(c6854c91) SHA1(29f01cc65be5eaa3f86e99eebdd284104623abb0) )
947888   ROM_LOAD16_BYTE( "5.bin",  0x00001, 0x20000, CRC(77f7c2b3) SHA1(feea48d9555824a2e5bf5e99ce159edc015f0792) )
948889   ROM_LOAD16_BYTE( "8.bin",  0x40000, 0x20000, CRC(1895b3df) SHA1(415a26050c50ed79a7ee5ddd1b8d61593b1ce876) )
r19327r19328
1038979   ROM_LOAD( "2.ic19",      0x00000, 0x40000, CRC(a2db1575) SHA1(1a4a29e4b045af50700adf1665697feab12cc234) )
1039980ROM_END
1040981
1041
1042982ROM_START( cawingbl )
1043983   ROM_REGION( 0x400000, "maincpu", 0 )      /* 68000 code */
1044984   ROM_LOAD16_BYTE( "caw2.bin",    0x00000, 0x80000, CRC(8125d3f0) SHA1(a0e48c326c6164ca189c9372f5c38a7c103772c1) )
r19327r19328
10961036static MACHINE_CONFIG_START( sgyxz, cps_state )
10971037   /* basic machine hardware */
10981038   MCFG_CPU_ADD("maincpu", M68000, 12000000)
1099   MCFG_CPU_PROGRAM_MAP(kodb_map)
1039   MCFG_CPU_PROGRAM_MAP(fcrash_map)
11001040   MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state,  cps1_interrupt)
11011041
11021042//  MCFG_CPU_ADD("soundcpu", Z80, 3579545)
r19327r19328
11101050   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
11111051   MCFG_SCREEN_SIZE(64*8, 32*8)
11121052   MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
1113   MCFG_SCREEN_UPDATE_DRIVER(cps_state, screen_update_kodb)
1053   MCFG_SCREEN_UPDATE_DRIVER(cps_state, screen_update_fcrash)
11141054   MCFG_SCREEN_VBLANK_DRIVER(cps_state, screen_eof_cps1)
11151055
11161056   MCFG_GFXDECODE(cps1)
r19327r19328
11381078ROM_END
11391079
11401080
1081DRIVER_INIT_MEMBER(cps_state, kodb)
1082{
1083   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x800000, 0x800007, "IN1");
1084   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800018, 0x80001f, read16_delegate(FUNC(cps_state::cps1_dsw_r),this));
1085   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800180, 0x800187, write16_delegate(FUNC(cps_state::cps1_soundlatch_w),this));
1086   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x980000, 0x98002f, write16_delegate(FUNC(cps_state::kodb_layer_w),this));
1087
1088   DRIVER_INIT_CALL(cps1);
1089}
1090
11411091DRIVER_INIT_MEMBER(cps_state, cawingbl)
11421092{
11431093   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x882000, 0x882001, "IN1");
r19327r19328
11491099
11501100
11511101GAME( 1990, fcrash,    ffight,  fcrash,    fcrash,   cps_state, cps1,     ROT0,   "bootleg (Playmark)", "Final Crash (bootleg of Final Fight)", GAME_SUPPORTS_SAVE )
1152GAME( 1991, kodb,      kod,     kodb,      kodb,     cps_state, cps1,     ROT0,   "bootleg (Playmark)", "The King of Dragons (bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )   // 910731  "ETC"
1102GAME( 1991, kodb,      kod,     kodb,      kodb,     cps_state, kodb,     ROT0,   "bootleg (Playmark)", "The King of Dragons (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )   // 910731  "ETC"
11531103GAME( 1990, cawingbl,  cawing,  cawingbl,  cawingbl, cps_state, cawingbl, ROT0,   "bootleg", "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM205 set 1)", GAME_SUPPORTS_SAVE )
11541104GAME( 1990, cawingb2,  cawing,  cawingbl,  cawingbl, cps_state, cawingbl, ROT0,   "bootleg", "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM205 set 2)", GAME_SUPPORTS_SAVE )
11551105GAME( 199?, sgyxz,     wof,     sgyxz,     fcrash,   cps_state, cps1,     ROT0,   "bootleg (All-In Electronic)", "Warriors of Fate ('sgyxz' bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team