Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbbert committed Dec 5, 2024
2 parents 4fdc6e6 + 2d00ba4 commit 6d71885
Show file tree
Hide file tree
Showing 6 changed files with 521 additions and 88 deletions.
98 changes: 63 additions & 35 deletions src/devices/cpu/mcs48/mcs48.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Dan Boris, Mirko Buffoni, Aaron Giles, Couriersud
/***************************************************************************
/*******************************************************************************
Intel MCS-48/UPI-41 Portable Emulator
Expand All @@ -10,13 +10,42 @@
TODO:
- add CMOS devices, 1 new opcode (01 IDL)
- add special 8022 opcodes (RAD, SEL AN0, SEL AN1, RETI)
- according to the user manual, some opcodes(dis/enable timer/interrupt)
don't increment the timer, does it affect the prescaler too?
Most likely, timer input (prescaler overflow or T1 edge) still occurs,
just that m_timer increment is delayed 1 opcode.
- IRQ timing is hacked due to WY-100 needing to take JNI branch before servicing interrupt
- IRQ and/or timer increment timing is wrong? See test below. After IRQ,
A = 0x20 on MAME, A = 0x22 on the real 8048 as tested by bataais.
****************************************************************************
stop tcnt
mov a,0xff
mov t,a
inc a
en tcnti
strt t
inc a
inc a
inc a
(etc.)
With the following test, on MAME, A = 0xff after 30 NOPs, A = 0 after 31
NOPs. On the real 8048, A = 0xff after 31 NOPs, A = 0 after 32 NOPs.
It can mean that STRT T has a 1 cycle delay, or simply that MOV A,T gets
the timer value pre-increment.
stop tcnt
mov a,0xff
mov t,a
strt t
nop
nop
nop
(etc.)
mov a,t
- IRQ timing is hacked due to WY-100 needing to take JNI branch before
servicing interrupt (see m_irq_polled), probably related to note above?
********************************************************************************
Note that the default internal divisor for this chip is by 3 and
then again by 5, or by 15 total.
Expand All @@ -41,7 +70,7 @@
8040 256 0 27 (external ROM)
8050 256 4k 27 (ROM)
****************************************************************************
********************************************************************************
UPI-41/42 chips are MCS-48 derived, with some opcode changes:
Expand Down Expand Up @@ -78,16 +107,16 @@
8742 128 2k (EPROM)
8742AH 256 2k (EPROM)
***************************************************************************/
*******************************************************************************/

#include "emu.h"
#include "mcs48.h"
#include "mcs48dsm.h"


/***************************************************************************
/*******************************************************************************
CONSTANTS
***************************************************************************/
*******************************************************************************/

// timer/counter enable bits
#define TIMER_ENABLED 0x01
Expand Down Expand Up @@ -121,9 +150,9 @@
#define I8048_FEATURE (MB_FEATURE | EXT_BUS_FEATURE)


/***************************************************************************
/*******************************************************************************
MACROS
***************************************************************************/
*******************************************************************************/

// r0-r7 map to memory via the regptr
#define R0 m_regptr[0]
Expand All @@ -136,9 +165,9 @@
#define R7 m_regptr[7]


/***************************************************************************
/*******************************************************************************
DEVICE TYPES
***************************************************************************/
*******************************************************************************/

DEFINE_DEVICE_TYPE(I8021, i8021_device, "i8021", "Intel 8021")
DEFINE_DEVICE_TYPE(I8022, i8022_device, "i8022", "Intel 8022")
Expand Down Expand Up @@ -166,9 +195,9 @@ DEFINE_DEVICE_TYPE(UPD7751, upd7751_device, "upd7751", "NEC uPD7751")
DEFINE_DEVICE_TYPE(M58715, m58715_device, "m58715", "Mitsubishi M58715")


/***************************************************************************
/*******************************************************************************
CONSTRUCTOR
***************************************************************************/
*******************************************************************************/

mcs48_cpu_device::mcs48_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int rom_size, int ram_size, u8 feature_mask, const mcs48_cpu_device::mcs48_ophandler *opcode_table)
: cpu_device(mconfig, type, tag, owner, clock)
Expand Down Expand Up @@ -340,9 +369,9 @@ std::unique_ptr<util::disasm_interface> mcs48_cpu_device::create_disassembler()
}


/***************************************************************************
/*******************************************************************************
ADDRESS MAPS
***************************************************************************/
*******************************************************************************/

void mcs48_cpu_device::program_map(address_map &map)
{
Expand All @@ -364,9 +393,9 @@ void mcs48_cpu_device::data_map(address_map &map)
}


/***************************************************************************
/*******************************************************************************
INLINE FUNCTIONS
***************************************************************************/
*******************************************************************************/

/*-------------------------------------------------
opcode_fetch - fetch an opcode byte
Expand Down Expand Up @@ -588,17 +617,17 @@ void mcs48_cpu_device::expander_operation(expander_op operation, u8 port)



/***************************************************************************
/*******************************************************************************
OPCODE HANDLERS
***************************************************************************/
*******************************************************************************/

#define OPHANDLER(_name) void mcs48_cpu_device::_name()


OPHANDLER( illegal )
{
burn_cycles(1);
logerror("MCS-48 PC:%04X - Illegal opcode = %02x\n", m_prevpc, program_r(m_prevpc));
logerror("Illegal opcode = %02x @ %04X\n", program_r(m_prevpc), m_prevpc);
}

OPHANDLER( add_a_r0 ) { burn_cycles(1); execute_add(R0); }
Expand Down Expand Up @@ -873,7 +902,6 @@ OPHANDLER( out_dbb_a )
port_w(2, m_p2 |= P2_OBF);
}


OPHANDLER( ret ) { burn_cycles(2); pull_pc(); }
OPHANDLER( retr )
{
Expand Down Expand Up @@ -937,9 +965,9 @@ OPHANDLER( xrl_a_n ) { burn_cycles(2); m_a ^= argument_fetch(); }



/***************************************************************************
/*******************************************************************************
OPCODE TABLES
***************************************************************************/
*******************************************************************************/

#define OP(_a) &mcs48_cpu_device::_a

Expand Down Expand Up @@ -1089,9 +1117,9 @@ const mcs48_cpu_device::mcs48_ophandler mcs48_cpu_device::s_i8022_opcodes[256] =



/***************************************************************************
/*******************************************************************************
INITIALIZATION/RESET
***************************************************************************/
*******************************************************************************/

void mcs48_cpu_device::device_config_complete()
{
Expand Down Expand Up @@ -1244,9 +1272,9 @@ void mcs48_cpu_device::device_reset()
}


/***************************************************************************
/*******************************************************************************
EXECUTION
***************************************************************************/
*******************************************************************************/

/*-------------------------------------------------
check_irqs - check for and process IRQs
Expand Down Expand Up @@ -1374,9 +1402,9 @@ void mcs48_cpu_device::execute_run()



/***************************************************************************
/*******************************************************************************
DATA ACCESS HELPERS
***************************************************************************/
*******************************************************************************/

/*-------------------------------------------------
upi41_master_r - master CPU data/status
Expand Down Expand Up @@ -1429,9 +1457,9 @@ void upi41_cpu_device::upi41_master_w(offs_t offset, u8 data)
}


/***************************************************************************
/*******************************************************************************
GENERAL CONTEXT ACCESS
***************************************************************************/
*******************************************************************************/

/*-------------------------------------------------
mcs48_import_state - import state from the
Expand Down
103 changes: 103 additions & 0 deletions src/mame/capcom/chakumelo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// license:BSD-3-Clause
// copyright-holders:

/*
Chaku Melo Collection
Capcom 99705-01 PCB
Cellphone ring-tone vending machine.
Main components:
Capcom DL-3229 SCU (encryption unused)
6.14SC9K XTAL (near SCU)
4x 5264805DLTTA60 PC100-222-60 RAM (near SCU)
2x PC16552DV DUART
18.4SC9K XTAL (near PC16552DV 1)
18.4SC9K XTAL (near PC16552DV 2)
HD64412F GFX chip
33.0000 MHz XTAL (near HD64412F)
2x M5118165D-60J RAM (near HD64412F)
MC44200FT Triple 8-bit video DAC
2x SP232ACN RS-232 Line Drivers/Receivers
12.5984 MHz XTAL (near SP232ACN and DAC)
M4T28-BR12SH1 timekeeper (marked M48T58Y on PCB)
XC9536 CPLD
YMZ705-F sound chip
2x HM62W8512BLTTI7 RAM (near YMZ705-F)
6.14SC9K XTAL (near YMZ705-F)
TODO: everything (only BIOS is dumped, needs HD dump)
*/


#include "emu.h"

#include "cpu/sh/sh7604.h"
#include "machine/ins8250.h"
#include "machine/timekpr.h"

#include "emupal.h"
#include "screen.h"
#include "speaker.h"


namespace {

class chakumelo_state : public driver_device
{
public:
chakumelo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu")
{ }

void chakumel(machine_config &config);

private:
required_device<cpu_device> m_maincpu;

void program_map(address_map &map) ATTR_COLD;
};


void chakumelo_state::program_map(address_map &map)
{
map(0x00000000, 0x0007ffff).rom();
}


static INPUT_PORTS_START( chakumel )
INPUT_PORTS_END


void chakumelo_state::chakumel(machine_config &config)
{
SH7604(config, m_maincpu, 6'140'000);
m_maincpu->set_addrmap(AS_PROGRAM, &chakumelo_state::program_map);

PC16552D(config, "duart0", 0);

PC16552D(config, "duart1", 0);

// HD64412F(config, "hd64412f", 33_MHz_XTAL);

SPEAKER(config, "mono").front_center();

// YMZ705-F(config, "ymz", 6'140'000);
}


ROM_START( chakumel )
ROM_REGION( 0x80000, "maincpu", 0 )
ROM_LOAD16_WORD_SWAP( "cmcja.6c", 0x00000, 0x80000, CRC(becd3703) SHA1(41a4e512ee6129029161d342fb46351a0737822b) ) // 11xxxxxxxxxxxxxxxxx = 0xFF

ROM_REGION( 0x600, "plds", ROMREGION_ERASE00 ) // all PALCE16V8H
ROM_LOAD( "cmc4b.4b", 0x000, 0x117, NO_DUMP )
ROM_LOAD( "cmc4c.4c", 0x200, 0x117, NO_DUMP )
ROM_LOAD( "cmc5c.5c", 0x400, 0x117, NO_DUMP )
ROM_END

} // anonymous namespace


GAME( 1999, chakumel, 0, chakumel, chakumel, chakumelo_state, empty_init, ROT0, "Capcom", "Chaku Melo Collection", MACHINE_IS_SKELETON )
Loading

0 comments on commit 6d71885

Please sign in to comment.