Fixed main CPU frequency for Commando.

Removed watchdog from GnG
This commit is contained in:
Jose Tejada 2019-09-04 15:47:37 +02:00
parent 80171a45ce
commit da027a5497
2 changed files with 24 additions and 3 deletions

View File

@ -44,6 +44,16 @@ Note : there is an ingame typo bug that doesn't display the bonus life values
***************************************************************************/
// Notes by Jose Tejada (jotego):
// The main CPU frequency is 3 MHz, after a two-stage FF clock divider.
// The CPU clock is gated by bus arbitrion logic. The CPU clock is halted until
// video hardware has an opening in memory access, then the CPU is allowed to
// access common memory. This slows down the CPU but doesn't alter its basic 3MHz frequency.
//
// There is also a DMA circuit that copies object data from the CPU RAM to a buffer
// this also slows down the CPU as it is halted during that time.
#include "emu.h"
#include "includes/commando.h"
@ -66,6 +76,7 @@ void commando_state::commando_map(address_map &map)
map(0xc004, 0xc004).portr("DSW2");
map(0xc800, 0xc800).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0xc804, 0xc804).w(FUNC(commando_state::commando_c804_w));
// 0xc806 triggers the DMA (not emulated)
map(0xc808, 0xc809).w(FUNC(commando_state::commando_scrollx_w));
map(0xc80a, 0xc80b).w(FUNC(commando_state::commando_scrolly_w));
map(0xd000, 0xd3ff).ram().w(FUNC(commando_state::commando_videoram2_w)).share("videoram2");
@ -225,7 +236,9 @@ GFXDECODE_END
#define XTAL 12000000
#define PHI_B XTAL/2/2
#define PHI_MAIN 4000000 // ??? too complicated to trace from schematics
#define PHI_MAIN XTAL/2/2 // As seen in the schematics:
// the signal goes into a bus arbitrion logic that doesn't affect its frequency
// although the CPU gets slowed down when accessing char/background memories
/* Interrupt Generator */
@ -255,7 +268,7 @@ void commando_state::machine_reset()
void commando_state::commando(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, PHI_MAIN); // ???
Z80(config, m_maincpu, PHI_MAIN); // 3 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &commando_state::commando_map);
m_maincpu->set_addrmap(AS_OPCODES, &commando_state::decrypted_opcodes_map);

View File

@ -20,6 +20,14 @@ Notes:
- Increased "gfx3" to address 0x400 sprites, to avoid Ghosts'n Goblins
from drawing a bad sprite. (18/08/2005 Pierpaolo Prazzoli)
Notes by Jose Tejada (jotego)
There is no watchdog in GnG, as previously stated in the MAME driver.
Instead, there is a DMA circuit that copies object data from the CPU RAM to a buffer
this also slows down the CPU as it is halted during that time.
The DMA is triggered when a certain memory location is addressed. That location was
thought to be a watchdog before.
***************************************************************************/
#include "emu.h"
@ -71,7 +79,7 @@ void gng_state::gng_map(address_map &map)
map(0x3a00, 0x3a00).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x3b08, 0x3b09).w(FUNC(gng_state::gng_bgscrollx_w));
map(0x3b0a, 0x3b0b).w(FUNC(gng_state::gng_bgscrolly_w));
map(0x3c00, 0x3c00).noprw(); /* watchdog? */
// 0x3c00 is the DMA trigger. Not emulated.
map(0x3d00, 0x3d07).w("mainlatch", FUNC(ls259_device::write_d0));
map(0x3e00, 0x3e00).w(FUNC(gng_state::gng_bankswitch_w));
map(0x4000, 0x5fff).bankr("bank1");