trunk/src/mame/drivers/fcrash.c
| r19327 | r19328 | |
| 30 | 30 | |
| 31 | 31 | --- |
| 32 | 32 | |
| 33 | kodb has various graphical issues, mainly with old info not being cleared away. |
| 34 | Also, when you are hit, you should flash, but you go invisible instead. |
| 35 | |
| 33 | 36 | */ |
| 34 | 37 | |
| 35 | 38 | #include "emu.h" |
| r19327 | r19328 | |
| 38 | 41 | #include "includes/cps1.h" |
| 39 | 42 | #include "sound/2203intf.h" |
| 40 | 43 | #include "sound/msm5205.h" |
| 44 | #include "sound/2151intf.h" |
| 45 | #include "sound/okim6295.h" |
| 41 | 46 | |
| 42 | 47 | |
| 43 | 48 | static WRITE16_HANDLER( fcrash_soundlatch_w ) |
| r19327 | r19328 | |
| 106 | 111 | } |
| 107 | 112 | |
| 108 | 113 | |
| 114 | WRITE16_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 | } |
| 109 | 128 | |
| 129 | |
| 110 | 130 | /* not verified */ |
| 111 | 131 | #define CPS1_ROWSCROLL_OFFS (0x20/2) /* base of row scroll offsets in other RAM */ |
| 112 | 132 | |
| r19327 | r19328 | |
| 148 | 168 | |
| 149 | 169 | for (pos = 0x1ffc; pos >= 0x0000; pos -= 4) |
| 150 | 170 | { |
| 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; |
| 152 | 172 | } |
| 153 | 173 | |
| 154 | 174 | for (pos = last_sprite_offset; pos >= 0x0000; pos -= 4) |
| r19327 | r19328 | |
| 240 | 260 | int layercontrol, l0, l1, l2, l3; |
| 241 | 261 | int videocontrol = m_cps_a_regs[0x22 / 2]; |
| 242 | 262 | |
| 243 | | |
| 244 | 263 | flip_screen_set(videocontrol & 0x8000); |
| 245 | 264 | |
| 246 | 265 | layercontrol = m_cps_b_regs[m_layer_enable_reg / 2]; |
| r19327 | r19328 | |
| 314 | 333 | return 0; |
| 315 | 334 | } |
| 316 | 335 | |
| 317 | | // doesn't have the scroll offsets like fcrash |
| 318 | | UINT32 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]; |
| 322 | 336 | |
| 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 | | |
| 398 | 337 | static ADDRESS_MAP_START( fcrash_map, AS_PROGRAM, 16, cps_state ) |
| 399 | | AM_RANGE(0x000000, 0x1fffff) AM_ROM |
| 338 | AM_RANGE(0x000000, 0x3fffff) AM_ROM |
| 400 | 339 | AM_RANGE(0x800030, 0x800031) AM_WRITE(cps1_coinctrl_w) |
| 401 | 340 | AM_RANGE(0x800100, 0x80013f) AM_RAM AM_SHARE("cps_a_regs") /* CPS-A custom */ |
| 402 | 341 | AM_RANGE(0x800140, 0x80017f) AM_RAM AM_SHARE("cps_b_regs") /* CPS-B custom */ |
| r19327 | r19328 | |
| 420 | 359 | AM_RANGE(0xec00, 0xec00) AM_WRITE_LEGACY(fcrash_msm5205_1_data_w) |
| 421 | 360 | ADDRESS_MAP_END |
| 422 | 361 | |
| 423 | | |
| 424 | | static 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 |
| 362 | static 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 */ |
| 439 | 369 | ADDRESS_MAP_END |
| 440 | 370 | |
| 441 | 371 | |
| r19327 | r19328 | |
| 804 | 734 | m_layer_scroll2x_offset = 60; |
| 805 | 735 | m_layer_scroll3x_offset = 64; |
| 806 | 736 | m_sprite_base = 0x50c8; |
| 737 | m_sprite_list_end_marker = 0x8000; |
| 807 | 738 | |
| 808 | 739 | save_item(NAME(m_sample_buffer1)); |
| 809 | 740 | save_item(NAME(m_sample_buffer2)); |
| r19327 | r19328 | |
| 811 | 742 | save_item(NAME(m_sample_select2)); |
| 812 | 743 | } |
| 813 | 744 | |
| 745 | MACHINE_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 | |
| 814 | 762 | MACHINE_START_MEMBER(cps_state, cawingbl) |
| 815 | 763 | { |
| 816 | 764 | MACHINE_START_CALL_MEMBER(fcrash); |
| r19327 | r19328 | |
| 826 | 774 | m_sprite_base = 0x1000; |
| 827 | 775 | } |
| 828 | 776 | |
| 829 | | MACHINE_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 | | |
| 836 | 777 | MACHINE_RESET_MEMBER(cps_state,fcrash) |
| 837 | 778 | { |
| 838 | | |
| 839 | 779 | m_sample_buffer1 = 0; |
| 840 | 780 | m_sample_buffer2 = 0; |
| 841 | 781 | m_sample_select1 = 0; |
| r19327 | r19328 | |
| 905 | 845 | |
| 906 | 846 | /* basic machine hardware */ |
| 907 | 847 | MCFG_CPU_ADD("maincpu", M68000, 10000000) |
| 908 | | MCFG_CPU_PROGRAM_MAP(kodb_map) |
| 848 | MCFG_CPU_PROGRAM_MAP(fcrash_map) |
| 909 | 849 | MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt) |
| 910 | 850 | |
| 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) |
| 913 | 853 | |
| 914 | 854 | MCFG_MACHINE_START_OVERRIDE(cps_state,kodb) |
| 915 | 855 | |
| r19327 | r19328 | |
| 919 | 859 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 920 | 860 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 921 | 861 | 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) |
| 923 | 863 | MCFG_SCREEN_VBLANK_DRIVER(cps_state, screen_eof_cps1) |
| 924 | 864 | |
| 925 | 865 | MCFG_GFXDECODE(cps1) |
| r19327 | r19328 | |
| 928 | 868 | MCFG_VIDEO_START_OVERRIDE(cps_state,cps1) |
| 929 | 869 | |
| 930 | 870 | /* sound hardware */ |
| 931 | | // MCFG_SPEAKER_STANDARD_MONO("mono") |
| 871 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 932 | 872 | |
| 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) |
| 937 | 877 | |
| 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) |
| 940 | 881 | MACHINE_CONFIG_END |
| 941 | 882 | |
| 942 | 883 | |
| 943 | 884 | |
| 944 | 885 | ROM_START( fcrash ) |
| 945 | | ROM_REGION( 0x200000, "maincpu", 0 ) /* 68000 code */ |
| 886 | ROM_REGION( 0x400000, "maincpu", 0 ) /* 68000 code */ |
| 946 | 887 | ROM_LOAD16_BYTE( "9.bin", 0x00000, 0x20000, CRC(c6854c91) SHA1(29f01cc65be5eaa3f86e99eebdd284104623abb0) ) |
| 947 | 888 | ROM_LOAD16_BYTE( "5.bin", 0x00001, 0x20000, CRC(77f7c2b3) SHA1(feea48d9555824a2e5bf5e99ce159edc015f0792) ) |
| 948 | 889 | ROM_LOAD16_BYTE( "8.bin", 0x40000, 0x20000, CRC(1895b3df) SHA1(415a26050c50ed79a7ee5ddd1b8d61593b1ce876) ) |
| r19327 | r19328 | |
| 1038 | 979 | ROM_LOAD( "2.ic19", 0x00000, 0x40000, CRC(a2db1575) SHA1(1a4a29e4b045af50700adf1665697feab12cc234) ) |
| 1039 | 980 | ROM_END |
| 1040 | 981 | |
| 1041 | | |
| 1042 | 982 | ROM_START( cawingbl ) |
| 1043 | 983 | ROM_REGION( 0x400000, "maincpu", 0 ) /* 68000 code */ |
| 1044 | 984 | ROM_LOAD16_BYTE( "caw2.bin", 0x00000, 0x80000, CRC(8125d3f0) SHA1(a0e48c326c6164ca189c9372f5c38a7c103772c1) ) |
| r19327 | r19328 | |
| 1096 | 1036 | static MACHINE_CONFIG_START( sgyxz, cps_state ) |
| 1097 | 1037 | /* basic machine hardware */ |
| 1098 | 1038 | MCFG_CPU_ADD("maincpu", M68000, 12000000) |
| 1099 | | MCFG_CPU_PROGRAM_MAP(kodb_map) |
| 1039 | MCFG_CPU_PROGRAM_MAP(fcrash_map) |
| 1100 | 1040 | MCFG_CPU_VBLANK_INT_DRIVER("screen", cps_state, cps1_interrupt) |
| 1101 | 1041 | |
| 1102 | 1042 | // MCFG_CPU_ADD("soundcpu", Z80, 3579545) |
| r19327 | r19328 | |
| 1110 | 1050 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1111 | 1051 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1112 | 1052 | 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) |
| 1114 | 1054 | MCFG_SCREEN_VBLANK_DRIVER(cps_state, screen_eof_cps1) |
| 1115 | 1055 | |
| 1116 | 1056 | MCFG_GFXDECODE(cps1) |
| r19327 | r19328 | |
| 1138 | 1078 | ROM_END |
| 1139 | 1079 | |
| 1140 | 1080 | |
| 1081 | DRIVER_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 | |
| 1141 | 1091 | DRIVER_INIT_MEMBER(cps_state, cawingbl) |
| 1142 | 1092 | { |
| 1143 | 1093 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x882000, 0x882001, "IN1"); |
| r19327 | r19328 | |
| 1149 | 1099 | |
| 1150 | 1100 | |
| 1151 | 1101 | GAME( 1990, fcrash, ffight, fcrash, fcrash, cps_state, cps1, ROT0, "bootleg (Playmark)", "Final Crash (bootleg of Final Fight)", GAME_SUPPORTS_SAVE ) |
| 1152 | | GAME( 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" |
| 1102 | GAME( 1991, kodb, kod, kodb, kodb, cps_state, kodb, ROT0, "bootleg (Playmark)", "The King of Dragons (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // 910731 "ETC" |
| 1153 | 1103 | GAME( 1990, cawingbl, cawing, cawingbl, cawingbl, cps_state, cawingbl, ROT0, "bootleg", "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM205 set 1)", GAME_SUPPORTS_SAVE ) |
| 1154 | 1104 | GAME( 1990, cawingb2, cawing, cawingbl, cawingbl, cps_state, cawingbl, ROT0, "bootleg", "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM205 set 2)", GAME_SUPPORTS_SAVE ) |
| 1155 | 1105 | GAME( 199?, sgyxz, wof, sgyxz, fcrash, cps_state, cps1, ROT0, "bootleg (All-In Electronic)", "Warriors of Fate ('sgyxz' bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND ) |