diff --git a/.gitattributes b/.gitattributes index 054d1886ccf..6b9d30d0ed2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4687,6 +4687,8 @@ src/mame/machine/deco222.h svneol=native#text/plain src/mame/machine/decocass.c svneol=native#text/plain src/mame/machine/decocass_tape.c svneol=native#text/plain src/mame/machine/decocass_tape.h svneol=native#text/plain +src/mame/machine/decocpu6.c svneol=native#text/plain +src/mame/machine/decocpu6.h svneol=native#text/plain src/mame/machine/decocpu7.c svneol=native#text/plain src/mame/machine/decocpu7.h svneol=native#text/plain src/mame/machine/decocrpt.c svneol=native#text/plain diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c index cadf7987e5b..608e7d4fb11 100644 --- a/src/mame/drivers/progolf.c +++ b/src/mame/drivers/progolf.c @@ -55,6 +55,7 @@ Twenty four 8116 rams. #include "sound/ay8910.h" #include "video/mc6845.h" #include "machine/deco222.h" +#include "machine/decocpu6.h" class progolf_state : public driver_device { @@ -82,8 +83,6 @@ public: DECLARE_READ8_MEMBER(progolf_videoram_r); DECLARE_WRITE8_MEMBER(progolf_videoram_w); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); - DECLARE_DRIVER_INIT(progolfa); - DECLARE_DRIVER_INIT(progolf); virtual void video_start(); virtual void palette_init(); UINT32 screen_update_progolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -456,7 +455,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( progolfa, progolf ) MCFG_DEVICE_REMOVE("maincpu") /* different encrypted cpu to progolf */ - MCFG_CPU_ADD("maincpu", M6502, 3000000/2) /* guess, 3 Mhz makes the game to behave worse? */ + MCFG_CPU_ADD("maincpu", DECO_CPU6, 3000000/2) /* guess, 3 Mhz makes the game to behave worse? */ MCFG_CPU_PROGRAM_MAP(main_cpu) MCFG_CPU_VBLANK_INT_DRIVER("screen", progolf_state, progolf_interrupt) MACHINE_CONFIG_END @@ -508,26 +507,9 @@ ROM_END -DRIVER_INIT_MEMBER(progolf_state,progolfa) -{ - int A; - address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); - UINT8 *rom = machine().root_device().memregion("maincpu")->base(); - UINT8* decrypted = auto_alloc_array(machine(), UINT8, 0x10000); - space.set_decrypted_region(0x0000,0xffff, decrypted); - - /* data is likely to not be encrypted, just the opcodes are. */ - for (A = 0x0000 ; A < 0x10000 ; A++) - { - if (A & 1) - decrypted[A] = BITSWAP8(rom[A],6,4,7,5,3,2,1,0); - else - decrypted[A] = rom[A]; - } -} // this uses DECO222 style encryption 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 ) -// this uses DECO CPU-6 as custom module CPU (the same as Zoar, are we sure? our Zoar has different encryption, CPU-6 style) -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 ) +// this uses DECO CPU-6 as custom module CPU (the same as Zoar, are we sure? our Zoar has different encryption, CPU-7 style) +GAME( 1981, progolfa, progolf, progolfa,progolf, driver_device, 0, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) diff --git a/src/mame/machine/decocpu6.c b/src/mame/machine/decocpu6.c new file mode 100644 index 00000000000..37c5a3f8a8e --- /dev/null +++ b/src/mame/machine/decocpu6.c @@ -0,0 +1,32 @@ +/* apparently Deco CPU-6 used by ProGolf + just seems to be a bitswap on the opcodes like 222, but not the same one + not a complex scheme like CPU-7? +*/ + + +#include "decocpu6.h" + +deco_cpu6_device::deco_cpu6_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + m6502_device(mconfig, DECO_CPU6, "DECO CPU-6", tag, owner, clock) +{ +} + +void deco_cpu6_device::device_start() +{ + mintf = new mi_decrypt; + init(); +} + +void deco_cpu6_device::device_reset() +{ + m6502_device::device_reset(); +} + +UINT8 deco_cpu6_device::mi_decrypt::read_decrypted(UINT16 adr) +{ + if (adr&1) + return BITSWAP8(direct->read_raw_byte(adr),6,4,7,5,3,2,1,0); + else + return direct->read_raw_byte(adr); +} + diff --git a/src/mame/machine/decocpu6.h b/src/mame/machine/decocpu6.h new file mode 100644 index 00000000000..4a3571e9632 --- /dev/null +++ b/src/mame/machine/decocpu6.h @@ -0,0 +1,24 @@ + + +#include "emu.h" +#include "cpu/m6502/m6502.h" + +class deco_cpu6_device : public m6502_device { +public: + deco_cpu6_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + class mi_decrypt : public mi_default_normal { + public: + virtual ~mi_decrypt() {} + virtual UINT8 read_decrypted(UINT16 adr); + }; + + virtual void device_start(); + virtual void device_reset(); + +}; + +static const device_type DECO_CPU6 = &device_creator; + + diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 1998cc4f172..86f7c7b0e49 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -630,6 +630,7 @@ $(MAMEOBJ)/dataeast.a: \ $(DRIVERS)/dec8.o $(VIDEO)/dec8.o \ $(MACHINE)/deco222.o \ $(MACHINE)/decocpu7.o \ + $(MACHINE)/decocpu6.o \ $(DRIVERS)/deco_ld.o \ $(DRIVERS)/deco_mlc.o $(VIDEO)/deco_mlc.o \ $(DRIVERS)/deco156.o $(MACHINE)/deco156.o \