trunk/src/mame/drivers/btime.c
| r19861 | r19862 | |
| 142 | 142 | #include "sound/ay8910.h" |
| 143 | 143 | #include "sound/discrete.h" |
| 144 | 144 | #include "includes/btime.h" |
| 145 | #include "machine/decocpu7.h" |
| 146 | #include "machine/deco222.h" |
| 145 | 147 | |
| 146 | 148 | #define MASTER_CLOCK XTAL_12MHz |
| 147 | 149 | #define HCLK (MASTER_CLOCK/2) |
| r19861 | r19862 | |
| 156 | 158 | AUDIO_ENABLE_AY8910 /* via ay-8910 port A */ |
| 157 | 159 | }; |
| 158 | 160 | |
| 159 | | class deco_cpu7_device : public m6502_device { |
| 160 | | public: |
| 161 | | deco_cpu7_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 162 | 161 | |
| 163 | | protected: |
| 164 | | class mi_decrypt : public mi_default_normal { |
| 165 | | public: |
| 166 | | bool had_written; |
| 167 | | |
| 168 | | virtual ~mi_decrypt() {} |
| 169 | | virtual UINT8 read_decrypted(UINT16 adr); |
| 170 | | virtual void write(UINT16 adr, UINT8 val); |
| 171 | | }; |
| 172 | | |
| 173 | | virtual void device_start(); |
| 174 | | virtual void device_reset(); |
| 175 | | |
| 176 | | }; |
| 177 | | |
| 178 | | static const device_type DECO_CPU7 = &device_creator<deco_cpu7_device>; |
| 179 | | |
| 180 | | deco_cpu7_device::deco_cpu7_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 181 | | m6502_device(mconfig, DECO_CPU7, "DECO CPU-7", tag, owner, clock) |
| 182 | | { |
| 183 | | } |
| 184 | | |
| 185 | | void deco_cpu7_device::device_start() |
| 186 | | { |
| 187 | | mintf = new mi_decrypt; |
| 188 | | init(); |
| 189 | | } |
| 190 | | |
| 191 | | void deco_cpu7_device::device_reset() |
| 192 | | { |
| 193 | | m6502_device::device_reset(); |
| 194 | | static_cast<mi_decrypt *>(mintf)->had_written = false; |
| 195 | | } |
| 196 | | |
| 197 | | UINT8 deco_cpu7_device::mi_decrypt::read_decrypted(UINT16 adr) |
| 198 | | { |
| 199 | | UINT8 res = direct->read_raw_byte(adr); |
| 200 | | if(had_written) { |
| 201 | | had_written = false; |
| 202 | | if((adr & 0x0104) == 0x0104) |
| 203 | | res = BITSWAP8(res, 6,5,3,4,2,7,1,0); |
| 204 | | } |
| 205 | | return res; |
| 206 | | } |
| 207 | | |
| 208 | | void deco_cpu7_device::mi_decrypt::write(UINT16 adr, UINT8 val) |
| 209 | | { |
| 210 | | program->write_byte(adr, val); |
| 211 | | had_written = true; |
| 212 | | } |
| 213 | | |
| 214 | | |
| 215 | | class deco_c10707_device : public m6502_device { |
| 216 | | public: |
| 217 | | deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 218 | | |
| 219 | | protected: |
| 220 | | class mi_decrypt : public mi_default_normal { |
| 221 | | public: |
| 222 | | bool had_written; |
| 223 | | |
| 224 | | virtual ~mi_decrypt() {} |
| 225 | | virtual UINT8 read_decrypted(UINT16 adr); |
| 226 | | }; |
| 227 | | |
| 228 | | virtual void device_start(); |
| 229 | | virtual void device_reset(); |
| 230 | | |
| 231 | | }; |
| 232 | | |
| 233 | | static const device_type DECO_C10707 = &device_creator<deco_c10707_device>; |
| 234 | | |
| 235 | | deco_c10707_device::deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 236 | | m6502_device(mconfig, DECO_C10707, "DECO C10707", tag, owner, clock) |
| 237 | | { |
| 238 | | } |
| 239 | | |
| 240 | | void deco_c10707_device::device_start() |
| 241 | | { |
| 242 | | mintf = new mi_decrypt; |
| 243 | | init(); |
| 244 | | } |
| 245 | | |
| 246 | | void deco_c10707_device::device_reset() |
| 247 | | { |
| 248 | | m6502_device::device_reset(); |
| 249 | | static_cast<mi_decrypt *>(mintf)->had_written = false; |
| 250 | | } |
| 251 | | |
| 252 | | UINT8 deco_c10707_device::mi_decrypt::read_decrypted(UINT16 adr) |
| 253 | | { |
| 254 | | return BITSWAP8(direct->read_raw_byte(adr) ,7,5,6,4,3,2,1,0);; |
| 255 | | } |
| 256 | | |
| 257 | 162 | WRITE8_MEMBER(btime_state::audio_nmi_enable_w) |
| 258 | 163 | { |
| 259 | 164 | /* for most games, this serves as the NMI enable for the audio CPU; however, |
trunk/src/mame/drivers/progolf.c
| r19861 | r19862 | |
| 54 | 54 | #include "cpu/m6502/m6502.h" |
| 55 | 55 | #include "sound/ay8910.h" |
| 56 | 56 | #include "video/mc6845.h" |
| 57 | #include "machine/deco222.h" |
| 57 | 58 | |
| 58 | | |
| 59 | 59 | class progolf_state : public driver_device |
| 60 | 60 | { |
| 61 | 61 | public: |
| r19861 | r19862 | |
| 422 | 422 | |
| 423 | 423 | static MACHINE_CONFIG_START( progolf, progolf_state ) |
| 424 | 424 | /* basic machine hardware */ |
| 425 | | MCFG_CPU_ADD("maincpu", M6502, 3000000/2) /* guess, 3 Mhz makes the game to behave worse? */ |
| 425 | MCFG_CPU_ADD("maincpu", DECO_222, 3000000/2) /* guess, 3 Mhz makes the game to behave worse? */ |
| 426 | 426 | MCFG_CPU_PROGRAM_MAP(main_cpu) |
| 427 | 427 | MCFG_CPU_VBLANK_INT_DRIVER("screen", progolf_state, progolf_interrupt) |
| 428 | 428 | |
| r19861 | r19862 | |
| 454 | 454 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.23) |
| 455 | 455 | MACHINE_CONFIG_END |
| 456 | 456 | |
| 457 | static MACHINE_CONFIG_DERIVED( progolfa, progolf ) |
| 458 | MCFG_DEVICE_REMOVE("maincpu") /* different encrypted cpu to progolf */ |
| 459 | MCFG_CPU_ADD("maincpu", M6502, 3000000/2) /* guess, 3 Mhz makes the game to behave worse? */ |
| 460 | MCFG_CPU_PROGRAM_MAP(main_cpu) |
| 461 | MCFG_CPU_VBLANK_INT_DRIVER("screen", progolf_state, progolf_interrupt) |
| 462 | MACHINE_CONFIG_END |
| 457 | 463 | |
| 464 | |
| 458 | 465 | ROM_START( progolf ) |
| 459 | 466 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 460 | 467 | ROM_LOAD( "g4-m.2a", 0xb000, 0x1000, CRC(8f06ebc0) SHA1(c012dcaf06cbd9e49f3ae819d9cbed4df8751cec) ) |
| r19861 | r19862 | |
| 500 | 507 | ROM_END |
| 501 | 508 | |
| 502 | 509 | |
| 503 | | DRIVER_INIT_MEMBER(progolf_state,progolf) |
| 504 | | { |
| 505 | | int A; |
| 506 | | address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 507 | | UINT8 *rom = machine().root_device().memregion("maincpu")->base(); |
| 508 | | UINT8* decrypted = auto_alloc_array(machine(), UINT8, 0x10000); |
| 509 | 510 | |
| 510 | | space.set_decrypted_region(0x0000,0xffff, decrypted); |
| 511 | | |
| 512 | | /* Swap bits 5 & 6 for opcodes */ |
| 513 | | for (A = 0xb000 ; A < 0x10000 ; A++) |
| 514 | | decrypted[A] = BITSWAP8(rom[A],7,5,6,4,3,2,1,0); |
| 515 | | } |
| 516 | | |
| 517 | 511 | DRIVER_INIT_MEMBER(progolf_state,progolfa) |
| 518 | 512 | { |
| 519 | 513 | int A; |
| r19861 | r19862 | |
| 533 | 527 | } |
| 534 | 528 | } |
| 535 | 529 | |
| 536 | | /* Maybe progolf is a bootleg? progolfa uses DECO CPU-6 as custom module CPU (the same as Zoar) */ |
| 537 | | GAME( 1981, progolf, 0, progolf, progolf, progolf_state, progolf, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 1)", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) |
| 538 | | GAME( 1981, progolfa, progolf, progolf, progolf, progolf_state, progolfa, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) |
| 530 | // this uses DECO222 style encryption |
| 531 | GAME( 1981, progolf, 0, progolf, progolf, driver_device, 0, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 1)", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) |
| 532 | // this uses DECO CPU-6 as custom module CPU (the same as Zoar, are we sure? our Zoar has different encryption, CPU-6 style) |
| 533 | GAME( 1981, progolfa, progolf, progolfa,progolf, progolf_state, progolfa, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) |
trunk/src/mame/machine/decocpu7.c
| r0 | r19862 | |
| 1 | |
| 2 | #include "decocpu7.h" |
| 3 | |
| 4 | deco_cpu7_device::deco_cpu7_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 5 | m6502_device(mconfig, DECO_CPU7, "DECO CPU-7", tag, owner, clock) |
| 6 | { |
| 7 | } |
| 8 | |
| 9 | void deco_cpu7_device::device_start() |
| 10 | { |
| 11 | mintf = new mi_decrypt; |
| 12 | init(); |
| 13 | } |
| 14 | |
| 15 | void deco_cpu7_device::device_reset() |
| 16 | { |
| 17 | m6502_device::device_reset(); |
| 18 | static_cast<mi_decrypt *>(mintf)->had_written = false; |
| 19 | } |
| 20 | |
| 21 | UINT8 deco_cpu7_device::mi_decrypt::read_decrypted(UINT16 adr) |
| 22 | { |
| 23 | UINT8 res = direct->read_raw_byte(adr); |
| 24 | if(had_written) { |
| 25 | had_written = false; |
| 26 | if((adr & 0x0104) == 0x0104) |
| 27 | res = BITSWAP8(res, 6,5,3,4,2,7,1,0); |
| 28 | } |
| 29 | return res; |
| 30 | } |
| 31 | |
| 32 | void deco_cpu7_device::mi_decrypt::write(UINT16 adr, UINT8 val) |
| 33 | { |
| 34 | program->write_byte(adr, val); |
| 35 | had_written = true; |
| 36 | } |
trunk/src/mame/machine/deco222.c
| r19861 | r19862 | |
| 1 | 1 | |
| 2 | /* Data East encrypted CPU 222, aka C10707? |
| 3 | also sometimes implemented as basic logic outside the CPU on early revs and bootlegs */ |
| 4 | |
| 5 | |
| 2 | 6 | #include "deco222.h" |
| 3 | 7 | |
| 4 | 8 | |
| r19861 | r19862 | |
| 25 | 29 | } |
| 26 | 30 | |
| 27 | 31 | |
| 32 | |
| 33 | deco_c10707_device::deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 34 | m6502_device(mconfig, DECO_C10707, "DECO C10707", tag, owner, clock) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | void deco_c10707_device::device_start() |
| 39 | { |
| 40 | mintf = new mi_decrypt; |
| 41 | init(); |
| 42 | } |
| 43 | |
| 44 | void deco_c10707_device::device_reset() |
| 45 | { |
| 46 | m6502_device::device_reset(); |
| 47 | static_cast<mi_decrypt *>(mintf)->had_written = false; |
| 48 | } |
| 49 | |
| 50 | UINT8 deco_c10707_device::mi_decrypt::read_decrypted(UINT16 adr) |
| 51 | { |
| 52 | return BITSWAP8(direct->read_raw_byte(adr) ,7,5,6,4,3,2,1,0); |
| 53 | } |
trunk/src/mame/machine/deco222.h
| r19861 | r19862 | |
| 1 | 1 | |
| 2 | 2 | #include "emu.h" |
| 3 | | #include "cpu/hd6309/hd6309.h" |
| 4 | | #include "cpu/m6809/m6809.h" |
| 5 | 3 | #include "cpu/m6502/m6502.h" |
| 6 | 4 | |
| 7 | 5 | class deco_222_device : public m6502_device { |
| r19861 | r19862 | |
| 22 | 20 | |
| 23 | 21 | }; |
| 24 | 22 | |
| 25 | | static const device_type DECO_222 = &device_creator<deco_222_device>; |
| | No newline at end of file |
| 23 | static const device_type DECO_222 = &device_creator<deco_222_device>; |
| 24 | |
| 25 | |
| 26 | |
| 27 | class deco_c10707_device : public m6502_device { |
| 28 | public: |
| 29 | deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 30 | |
| 31 | protected: |
| 32 | class mi_decrypt : public mi_default_normal { |
| 33 | public: |
| 34 | bool had_written; |
| 35 | |
| 36 | virtual ~mi_decrypt() {} |
| 37 | virtual UINT8 read_decrypted(UINT16 adr); |
| 38 | }; |
| 39 | |
| 40 | virtual void device_start(); |
| 41 | virtual void device_reset(); |
| 42 | |
| 43 | }; |
| 44 | |
| 45 | static const device_type DECO_C10707 = &device_creator<deco_c10707_device>; |
| 46 | |