Update SAME_CDi core to upstream MAME. (#26)

* Cherry-pick from recent CD-i driver changes.

* Move over CD-i changes to new branch.

* Revert cdicdic and cdislavehle to original state.

* Backport fix for Hotel Mario.

* Backport reworked play_xa_group.

* Increment disc_spinup_counter from 1 to 6, reworked m_xa_last.

* Reworked m_xa_last.

* Remove references to audio attenuation.

* Include cstdint in osdlib.h

* Set interface to cdrom in cdimono1

* Revert CD-i driver to previous state, without Quizard references.

* New mcd212 driver.

* Use older timer function for mcd212 + revert update to device.h

* Revert back to old mcd212 driver, as that makes RetroArch crash.

* Add workflow to core0287-v5 branch.

* Use macos-14 instead of macos-latest for workflow.

* mcd212 updates.

* mcd212 updates.

* mcd212 updates.

* Change define from MAME_PHILIPS_MCD212_H to MAME_VIDEO_MCD212_H.

* Update mcd212 driver again. No interlacing involved.

* Remove all logging references. Not used here, it seems.

* Update monitor_retro.cpp

* Update screen driver

* Update rendering.

* Update diimage.

* Revert update to diimage.

* Revert updates.

* Revert updates.

This reverts commit cf04e0fd88.

* Revert updates.

This reverts commit 27bfc22efd.

* Revert updates.

This reverts commit 45d64b0804.

* Revert updates.

This reverts commit bf2d3c85a9.

* Update monitor_retro.cpp

* Update monitor_retro.cpp

* Revert mcd212 driver update. Will pick changes by hand.

* Add mcd212 driver changes by hand instead of just checkout.

* Various fixes.

* Various fixes.

* Even more fixes.

* Fixes.

* FIXES.

* No fixes?

This reverts commit b3509eaf1d.

* Update mcd212.cpp driver AGAIN. This is driving me insane...

* NO WAY THAT WORKED

mcd212 driver updated by changing just three lines of code in the header. I'm so freaking baffled...

* Bump version to 0.287.

* Make the gameName variable store more data so the program doesn't crash on longer filenames (hopefully)

* Revert monitor_retro.cpp update.

* Backport audio attenuation.

---------

Co-authored-by: Vincent-Halver <[email protected]>
This commit is contained in:
OM3GAZXandVincent-Halver authored and GitHub committed 2026-08-04 00:02:54 +02:00
1 parent f551b7735e
commit f333ba7cc8
14 files changed
+706 -1424

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
name: Build SAME_CDi iOS dylib
on:
workflow_dispatch:
jobs:
build:
runs-on: macos-14
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Xcode
run: |
sudo xcode-select -s /Applications/Xcode.app
xcodebuild -version
- name: Install Dependencies
run: |
brew install coreutils
# MAME requires Python for build scripts (GENie)
echo "PYTHON_EXECUTABLE=python3" >> $GITHUB_ENV
- name: Compile SAME_CDi Libretro Core (iOS arm64)
run: |
# Get iOS SDK path dynamically
IOS_SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-path)
# Run the Libretro Makefile with explicit iOS overrides
# Using SUBTARGET=arcade keeps compilation faster and prevents GitHub runner timeouts
make -f Makefile.libretro -j$(sysctl -n hw.ncpu) \
platform=ios-arm64 \
IOS_SDK_PATH="$IOS_SDK_PATH"
- name: Locate and Rename Artifact
run: |
mkdir -p output/
# Libretro cores traditionally output as mame_libretro_ios.dylib or similar
find . -name "*.dylib" -exec cp {} output/ \;
ls -la output/
- name: Upload Built Binaries
uses: actions/upload-artifact@v4
with:
name: samecdi-libretro-ios
path: output/
@@ -5,7 +5,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mamedev.mame"
android:versionCode="239"
android:versionName="0.239"
android:versionName="0.287"
android:installLocation="auto">
<!-- OpenGL ES 2.0 -->
+2 -2
View File
@@ -1490,7 +1490,7 @@ endif
ifeq (posix,$(SHELLTYPE))
$(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS)
@echo '#define BARE_BUILD_VERSION "0.239"' > $@
@echo '#define BARE_BUILD_VERSION "0.287"' > $@
@echo '#define BARE_VCS_REVISION "$(NEW_GIT_VERSION)"' >> $@
@echo 'extern const char bare_build_version[];' >> $@
@echo 'extern const char bare_vcs_revision[];' >> $@
@@ -1500,7 +1500,7 @@ $(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS)
@echo 'const char build_version[] = BARE_BUILD_VERSION " (" BARE_VCS_REVISION ")";' >> $@
else
$(GENDIR)/version.cpp: makefile $(GENDIR)/git_desc | $(GEN_FOLDERS)
@echo #define BARE_BUILD_VERSION "0.239" > $@
@echo #define BARE_BUILD_VERSION "0.287" > $@
@echo #define BARE_VCS_REVISION "$(NEW_GIT_VERSION)" >> $@
@echo extern const char bare_build_version[]; >> $@
@echo extern const char bare_vcs_revision[]; >> $@
+1 -360
View File
@@ -68,9 +68,6 @@ TODO:
#define CLOCK_A 30_MHz_XTAL
#define LOG_DVC (1 << 1)
#define LOG_QUIZARD_READS (1 << 2)
#define LOG_QUIZARD_WRITES (1 << 3)
#define LOG_QUIZARD_OTHER (1 << 4)
#define LOG_UART (1 << 5)
#define VERBOSE (0)
@@ -139,38 +136,6 @@ INPUT_PORTS_END
static INPUT_PORTS_START( cdimono2 )
INPUT_PORTS_END
static INPUT_PORTS_START( quizard )
PORT_START("P0")
PORT_DIPNAME( 0x07, 0x05, "Settings" )
PORT_DIPSETTING( 0x00, "1 Coin, 0 Bonus Limit, 0 Bonus Number" )
PORT_DIPSETTING( 0x01, "2 Coins, 0 Bonus Limit, 0 Bonus Number" )
PORT_DIPSETTING( 0x02, "1 Coin, 2 Bonus Limit, 1 Bonus Number" )
PORT_DIPSETTING( 0x03, "1 Coin, 3 Bonus Limit, 1 Bonus Number" )
PORT_DIPSETTING( 0x04, "1 Coin, 5 Bonus Limit, 1 Bonus Number" )
PORT_DIPSETTING( 0x05, "1 Coin, 5 Bonus Limit, 2 Bonus Number" )
PORT_DIPSETTING( 0x06, "1 Coin, 10 Bonus Limit, 2 Bonus Number" )
PORT_DIPSETTING( 0x07, "2 Coins, 4 Bonus Limit, 1 Bonus Number" )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0xc8, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("P1")
PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_START("P2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 A")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Player 1 B")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Player 1 C")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Player 2 A")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Player 2 B")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Player 2 C")
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
/***************************
* Machine Initialization *
***************************/
@@ -182,21 +147,6 @@ void cdi_state::machine_reset()
memcpy(dst, src, 0x8);
}
void quizard_state::machine_start()
{
save_item(NAME(m_mcu_rx_from_cpu));
save_item(NAME(m_mcu_initial_byte));
}
void quizard_state::machine_reset()
{
cdi_state::machine_reset();
m_mcu_rx_from_cpu = 0x00;
m_mcu_initial_byte = true;
}
/***************************
* Wait-State Handling *
***************************/
@@ -247,82 +197,6 @@ void cdi_state::bus_error_w(offs_t offset, uint16_t data)
}
}
/**********************
* Quizard Protection *
**********************/
void quizard_state::mcu_rtsn_from_cpu(int state)
{
}
void quizard_state::mcu_rx_from_cpu(uint8_t data)
{
if (m_mcu_initial_byte)
{
m_mcu_initial_byte = false;
return;
}
m_mcu_rx_from_cpu = data;
m_mcu->set_input_line(MCS51_RX_LINE, ASSERT_LINE);
m_mcu->set_input_line(MCS51_RX_LINE, CLEAR_LINE);
}
uint8_t quizard_state::mcu_p0_r()
{
const uint8_t data = m_inputs[0]->read();
return data;
}
uint8_t quizard_state::mcu_p1_r()
{
uint8_t data = m_inputs[1]->read();
if (BIT(~m_inputs[0]->read(), 4))
data &= ~(1 << 4);
return data;
}
uint8_t quizard_state::mcu_p2_r()
{
const uint8_t data = m_inputs[2]->read();
return data;
}
uint8_t quizard_state::mcu_p3_r()
{
return 0x04;
}
void quizard_state::mcu_p0_w(uint8_t data)
{
}
void quizard_state::mcu_p1_w(uint8_t data)
{
}
void quizard_state::mcu_p2_w(uint8_t data)
{
}
void quizard_state::mcu_p3_w(uint8_t data)
{
m_maincpu->uart_ctsn(BIT(data, 6));
}
void quizard_state::mcu_tx(uint8_t data)
{
m_maincpu->uart_rx(data);
}
uint8_t quizard_state::mcu_rx()
{
uint8_t data = m_mcu_rx_from_cpu;
return data;
}
/*************************
* DVC cartridge *
*************************/
@@ -435,6 +309,7 @@ void cdi_state::cdimono1_base(machine_config &config)
CDI_SLAVE_HLE(config, m_slave_hle, 0);
m_slave_hle->int_callback().set(m_maincpu, FUNC(scc68070_device::in2_w));
m_slave_hle->atten_callback().set(m_cdic, FUNC(cdicdic_device::atten_w));
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -547,26 +422,6 @@ void cdi_state::cdimono1(machine_config &config)
SOFTWARE_LIST(config, "cd_list").set_original("cdi").set_filter("!DVC");
}
void quizard_state::quizard(machine_config &config)
{
cdimono1_base(config);
m_maincpu->set_addrmap(AS_PROGRAM, &quizard_state::cdimono1_mem);
m_maincpu->uart_rtsn_callback().set(FUNC(quizard_state::mcu_rtsn_from_cpu));
m_maincpu->uart_tx_callback().set(FUNC(quizard_state::mcu_rx_from_cpu));
I8751(config, m_mcu, 8000000);
m_mcu->port_in_cb<0>().set(FUNC(quizard_state::mcu_p0_r));
m_mcu->port_in_cb<1>().set(FUNC(quizard_state::mcu_p1_r));
m_mcu->port_in_cb<2>().set(FUNC(quizard_state::mcu_p2_r));
m_mcu->port_in_cb<3>().set(FUNC(quizard_state::mcu_p3_r));
m_mcu->port_out_cb<0>().set(FUNC(quizard_state::mcu_p0_w));
m_mcu->port_out_cb<1>().set(FUNC(quizard_state::mcu_p1_w));
m_mcu->port_out_cb<2>().set(FUNC(quizard_state::mcu_p2_w));
m_mcu->port_out_cb<3>().set(FUNC(quizard_state::mcu_p3_w));
m_mcu->serial_tx_cb().set(FUNC(quizard_state::mcu_tx));
m_mcu->serial_rx_cb().set(FUNC(quizard_state::mcu_rx));
}
/*************************
* Rom Load *
*************************/
@@ -627,198 +482,6 @@ ROM_START( cdi490a )
ROM_LOAD( "vmpega.rom", 0x0000, 0x40000, CRC(db264e8b) SHA1(be407fbc102f1731a0862554855e963e5a47c17b) )
ROM_END
ROM_START( cdibios ) // for the quizard sets
ROM_REGION(0x80000, "maincpu", 0)
ROM_SYSTEM_BIOS( 0, "mcdi200", "Magnavox CD-i 200" )
ROMX_LOAD( "cdi200.rom", 0x000000, 0x80000, CRC(40c4e6b9) SHA1(d961de803c89b3d1902d656ceb9ce7c02dccb40a), ROM_BIOS(0) )
ROM_SYSTEM_BIOS( 1, "pcdi220", "Philips CD-i 220 F2" )
ROMX_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e), ROM_BIOS(1) )
// The MCU dump below is taken from the cdi910. We still need a dump from a Mono-I board SLAVE MCU in case the revisions are different.
ROM_REGION(0x2000, "slave", 0)
ROM_LOAD( "zx405042p__cdi_slave_2.0__b43t__zzmk9213.mc68hc705c8a_withtestrom.7206", 0x0000, 0x2000, CRC(688cda63) SHA1(56d0acd7caad51c7de703247cd6d842b36173079) BAD_DUMP )
ROM_END
/* Quizard notes
The MCU controls the protection sequence, which in turn controls the game display language.
Each Quizard game (1,2,3,4) requires its own MCU, you can upgrade between revisions by changing
just the CD, but not between games as a new MCU is required.
MCU Notes:
i8751 MCU dumps confirmed good on original hardware
German language MCUs for Quizard 1 through 4 are dumped
Czech language MCU for Quizard 4 is dumped
Italian language MCU for Quizard 1 is known to exist (IT 11 L2, not dumped)
Alt. German language MCU for Quizard 2 is known to exist (DE 122 D3, not dumped)
*/
//********************************************************
// Quizard (1)
//********************************************************
ROM_START( quizard ) /* CD-ROM printed ??/?? */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard18", 0, BAD_DUMP SHA1(ede873b22957f2a707bbd3039e962ef2ca5aedbd) )
ROM_REGION(0x1000, "mcu", 0)
ROM_LOAD( "de_11_d3.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // German language
ROM_END
ROM_START( quizard_17 )
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard17", 0, BAD_DUMP SHA1(4bd698f076505b4e17be978481bce027eb47123b) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_11_d3.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // German language
ROM_END
ROM_START( quizard_12 ) /* CD-ROM printed 01/95 */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard12", 0, BAD_DUMP SHA1(6e41683b96b74e903040842aeb18437ad7813c82) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_11_d3.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // German language
ROM_END
ROM_START( quizard_10 )
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
// software: BurnAtOnce 0.99.5 / CHDMAN 0.163
// Drive: TS-L633R
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard10", 0, SHA1(5715db50f0d5ffe06f47c0943f4bf0481ab6048e) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_11_d3.bin", 0x0000, 0x1000, CRC(95f45b6b) SHA1(51b34956539b1e2cf0306f243a970750f1e18d01) ) // German language
ROM_END
//********************************************************
// Quizard 2
//********************************************************
ROM_START( quizard2 ) /* CD-ROM printed ??/?? */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard23", 0, BAD_DUMP SHA1(cd909d9a54275d6f2d36e03e83eea996e781b4d3) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "dn_122_d3.bin", 0x0000, 0x1000, CRC(d48063ea) SHA1(b512fa5e53f296a180340e09b53613dd1c0d38bc) ) // German language - DE 122 D3 known to exist
ROM_END
ROM_START( quizard2_22 )
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard22", 0, BAD_DUMP SHA1(03c8fdcf27ead6e221691111e8c679b551099543) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "dn_122_d3.bin", 0x0000, 0x1000, CRC(d48063ea) SHA1(b512fa5e53f296a180340e09b53613dd1c0d38bc) ) // German language - DE 122 D3 known to exist
ROM_END
//********************************************************
// Quizard 3
//********************************************************
ROM_START( quizard3 ) /* CD-ROM printed ??/?? */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard34", 0, BAD_DUMP SHA1(37ad49b72b5175afbb87141d57bc8604347fe032) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_132_d3.bin", 0x0000, 0x1000, CRC(8858251e) SHA1(2c1005a74bb6f0c2918dff4ab6326528eea48e1f) ) // German language
ROM_END
ROM_START( quizard3a ) /* CD-ROM printed ??/?? */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard34", 0, BAD_DUMP SHA1(37ad49b72b5175afbb87141d57bc8604347fe032) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_132_a1.bin", 0x0000, 0x1000, CRC(313ac673) SHA1(cb0ee7e9a6eaa5f4d000f5ea99b7ee4c440b31d1) ) // German language - earlier version of MCU code
ROM_END
ROM_START( quizard3_32 )
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard32", 0, BAD_DUMP SHA1(31e9fa2169aa44d799c37170b238134ab738e1a1) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_132_d3.bin", 0x0000, 0x1000, CRC(8858251e) SHA1(2c1005a74bb6f0c2918dff4ab6326528eea48e1f) ) // German language
ROM_END
//********************************************************
// Quizard 4
//********************************************************
ROM_START( quizard4 ) /* CD-ROM printed 09/98 */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard4r42", 0, BAD_DUMP SHA1(a5d5c8950b4650b8753f9119dc7f1ccaa2aa5442) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_142_d3.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // German language
ROM_END
ROM_START( quizard4cz ) /* CD-ROM printed 09/98 */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard4r42", 0, BAD_DUMP SHA1(a5d5c8950b4650b8753f9119dc7f1ccaa2aa5442) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "ts142_cz1.bin", 0x0000, 0x1000, CRC(fdc1f457) SHA1(5169c4d2ea4073a854c3f619205161386c9af8af) ) // Czech language - works with all Quizard 4 versions
ROM_END
ROM_START( quizard4_41 )
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard4r41", 0, BAD_DUMP SHA1(2c0484c6545aac8e00b318328c6edce6f5dde43d) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_142_d3.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // German language
ROM_END
ROM_START( quizard4_40 ) /* CD-ROM printed 07/97 */
ROM_REGION(0x80000, "maincpu", 0)
ROM_LOAD( "cdi220b.rom", 0x000000, 0x80000, CRC(279683ca) SHA1(53360a1f21ddac952e95306ced64186a3fc0b93e) )
DISK_REGION( "cdrom" )
DISK_IMAGE_READONLY( "quizard4r40", 0, BAD_DUMP SHA1(288cc37a994e4f1cbd47aa8c92342879c6fc0b87) )
ROM_REGION(0x1000, "mcu", 0) // Intel D8751H MCU
ROM_LOAD( "de_142_d3.bin", 0x0000, 0x1000, CRC(77be0b40) SHA1(113b5c239480a2259f55e411ba8fb3972e6d4301) ) // German language
ROM_END
/*************************
* Game driver(s) *
@@ -830,25 +493,3 @@ CONS( 1991, cdimono1, 0, 0, cdimono1, cdi, cdi_state, empty_init,
CONS( 1991, cdimono2, 0, 0, cdimono2, cdimono2, cdi_state, empty_init, "Philips", "CD-i (Mono-II) (NTSC)", MACHINE_NOT_WORKING )
CONS( 1991, cdi910, 0, 0, cdi910, cdimono2, cdi_state, empty_init, "Philips", "CD-i 910-17P Mini-MMC (PAL)", MACHINE_NOT_WORKING )
CONS( 1991, cdi490a, 0, 0, cdimono1, cdi, cdi_state, empty_init, "Philips", "CD-i 490", MACHINE_NOT_WORKING )
// The Quizard games are retail CD-i units in a cabinet, with an additional JAMMA adapter and dongle for protection, hence being clones of the system.
/* YEAR NAME PARENT MACHINE INPUT DEVICE INIT MONITOR COMPANY FULLNAME */
GAME( 1995, cdibios, 0, cdimono1, quizard, cdi_state, empty_init, ROT0, "Philips", "CD-i (Mono-I) (PAL) BIOS", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IS_BIOS_ROOT )
GAME( 1995, quizard, cdibios, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard (v1.8, German, i8751 DE 11 D3)", MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard_17, quizard, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard (v1.7, German, i8751 DE 11 D3)", MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard_12, quizard, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard (v1.2, German, i8751 DE 11 D3)", MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard_10, quizard, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard (v1.0, German, i8751 DE 11 D3)", MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard2, cdibios, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 2 (v2.3, German, i8751 DN 122 D3)", MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard2_22, quizard2, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 2 (v2.2, German, i8751 DN 122 D3)", MACHINE_IMPERFECT_SOUND )
// Quizard 3 and 4 will hang after starting a game (CDIC issues?)
GAME( 1995, quizard3, cdibios, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 3 (v3.4, German, i8751 DE 132 D3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1995, quizard3a, quizard3, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 3 (v3.4, German, i8751 DE 132 A1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1996, quizard3_32, quizard3, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 3 (v3.2, German, i8751 DE 132 D3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1998, quizard4, cdibios, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 4 Rainbow (v4.2, German, i8751 DE 142 D3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1998, quizard4cz, quizard4, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 4 Rainbow (v4.2, Czech, i8751 TS142 CZ1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1998, quizard4_41, quizard4, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 4 Rainbow (v4.1, German, i8751 DE 142 D3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
GAME( 1997, quizard4_40, quizard4, quizard, quizard, quizard_state, empty_init, ROT0, "TAB Austria", "Quizard 4 Rainbow (v4.0, German, i8751 DE 142 D3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND )
+26 -67
View File
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
#ifndef MAME_INCLUDES_CDI_H
#define MAME_INCLUDES_CDI_H
#ifndef MAME_PHILIPS_CDI_H
#define MAME_PHILIPS_CDI_H
#include "machine/scc68070.h"
#include "machine/cdislavehle.h"
@@ -11,6 +11,7 @@
#include "video/mcd212.h"
#include "cpu/mcs51/mcs51.h"
#include "cpu/m6805/m68hc05.h"
#include "diserial.h"
#include "screen.h"
/*----------- driver state -----------*/
@@ -23,11 +24,12 @@ public:
, m_maincpu(*this, "maincpu")
, m_main_rom(*this, "maincpu")
, m_lcd(*this, "lcd")
, m_plane_ram(*this, "plane%u", 0U)
, m_slave_hle(*this, "slave_hle")
, m_plane_ram(*this, "plane%u", 0U)
, m_servo(*this, "servo")
, m_slave(*this, "slave")
, m_cdic(*this, "cdic")
, m_cdrom(*this, "cdrom")
, m_mcd212(*this, "mcd212")
, m_dmadac(*this, "dac%u", 1U)
{ }
@@ -38,15 +40,6 @@ public:
void cdi910(machine_config &config);
protected:
virtual void machine_reset() override;
void cdimono1_mem(address_map &map);
required_device<scc68070_device> m_maincpu;
required_region_ptr<uint16_t> m_main_rom;
optional_device<screen_device> m_lcd;
private:
enum servo_portc_bit_t
{
INV_JUC_OUT = (1 << 2),
@@ -54,11 +47,27 @@ private:
INV_CADDYSWITCH_IN = (1 << 7)
};
uint32_t screen_update_cdimono1_lcd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<scc68070_device> m_maincpu;
required_region_ptr<uint16_t> m_main_rom;
optional_device<screen_device> m_lcd;
optional_device<cdislave_hle_device> m_slave_hle;
required_shared_ptr_array<uint16_t, 2> m_plane_ram;
optional_device<m68hc05c8_device> m_servo;
optional_device<m68hc05c8_device> m_slave;
optional_device<cdicdic_device> m_cdic;
required_device<cdrom_image_device> m_cdrom;
required_device<mcd212_device> m_mcd212;
void cdi910_mem(address_map &map);
void cdimono2_mem(address_map &map);
void cdi070_cpuspace(address_map &map);
required_device_array<dmadac_sound_device, 2> m_dmadac;
uint32_t screen_update_cdimono1_lcd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual void machine_reset() override ATTR_COLD;
void cdimono1_mem(address_map &map) ATTR_COLD;
void cdi910_mem(address_map &map) ATTR_COLD;
void cdimono2_mem(address_map &map) ATTR_COLD;
void cdi070_cpuspace(address_map &map) ATTR_COLD;
template<int Channel> uint16_t plane_r(offs_t offset, uint16_t mem_mask = ~0);
template<int Channel> void plane_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
@@ -70,56 +79,6 @@ private:
uint16_t bus_error_r(offs_t offset);
void bus_error_w(offs_t offset, uint16_t data);
required_shared_ptr_array<uint16_t, 2> m_plane_ram;
optional_device<cdislave_hle_device> m_slave_hle;
optional_device<m68hc05c8_device> m_servo;
optional_device<m68hc05c8_device> m_slave;
optional_device<cdicdic_device> m_cdic;
required_device<mcd212_device> m_mcd212;
required_device_array<dmadac_sound_device, 2> m_dmadac;
};
class quizard_state : public cdi_state
{
public:
quizard_state(const machine_config &mconfig, device_type type, const char *tag)
: cdi_state(mconfig, type, tag)
, m_mcu(*this, "mcu")
, m_inputs(*this, "P%u", 0U)
{ }
void quizard(machine_config &config);
private:
virtual void machine_start() override;
virtual void machine_reset() override;
uint8_t mcu_p0_r();
uint8_t mcu_p1_r();
uint8_t mcu_p2_r();
uint8_t mcu_p3_r();
void mcu_p0_w(uint8_t data);
void mcu_p1_w(uint8_t data);
void mcu_p2_w(uint8_t data);
void mcu_p3_w(uint8_t data);
void mcu_tx(uint8_t data);
uint8_t mcu_rx();
void mcu_rx_from_cpu(uint8_t data);
void mcu_rtsn_from_cpu(int state);
required_device<i8751_device> m_mcu;
required_ioport_array<3> m_inputs;
uint8_t m_mcu_rx_from_cpu;
bool m_mcu_initial_byte;
};
// Quizard 2 language values:
// 0x2b1: Italian
// 0x001: French
// 0x188: German
#endif // MAME_INCLUDES_CDI_H
#endif // MAME_PHILIPS_CDI_H
+93 -269
View File
@@ -42,6 +42,17 @@ TODO:
#define VERBOSE (0)
#include "logmacro.h"
namespace {
constexpr int16_t clip_int16(int32_t sample)
{
return int16_t(std::clamp<int32_t>(sample, -32768, 32767));
}
} // anonymous namespace
// device type definition
DEFINE_DEVICE_TYPE(CDI_CDIC, cdicdic_device, "cdicdic", "CD-i CDIC")
@@ -257,248 +268,38 @@ const uint8_t cdicdic_device::s_sector_scramble[2448] =
// MEMBER FUNCTIONS
//**************************************************************************
void cdicdic_device::decode_xa_mono(int16_t *cdic_xa_last, const uint8_t *xa, int16_t *dp)
void cdicdic_device::decode_xa_unit(const uint8_t param, int16_t sample, int16_t &sample0, int16_t &sample1, int16_t &out_buffer)
{
int16_t l0 = cdic_xa_last[0];
int16_t l1 = cdic_xa_last[1];
const int16_t *const filter = s_xa_filter_coef[(param >> 4) & 3]; // High bits are reserved.
const uint8_t range = std::min<uint8_t>(param & 0xf, 12); // Should be at most 8. Some decoders set 13..15 to 9.
for (int32_t b = 0; b < 18; b++)
{
for (int32_t s = 0; s < 4; s++)
{
uint8_t flags = xa[4 + (s << 1)];
uint8_t shift = flags & 0xf;
uint8_t filter = (flags >> 4) & 3;
int16_t f0 = s_xa_filter_coef[filter][0];
int16_t f1 = s_xa_filter_coef[filter][1];
int32_t sample32 = sample; // Work in 32-bit, clamp to avoid peaking audio.
sample32 = (sample32 >> range) + ((int32_t(filter[0]) * sample0 + int32_t(filter[1]) * sample1 + 128) >> 8);
for (int32_t i = 0; i < 28; i++)
{
int16_t d = (xa[16 + (i << 2) + s] & 0xf) << 12;
d = (d >> shift) + (((l0 * f0) + (l1 * f1) + 128) >> 8);
*dp = d;
dp++;
l1 = l0;
l0 = d;
}
flags = xa[5 + (s << 1)];
shift = flags & 0xf;
filter = flags >> 4;
f0 = s_xa_filter_coef[filter][0];
f1 = s_xa_filter_coef[filter][1];
for (int32_t i = 0; i < 28; i++)
{
int16_t d = (xa[16 + (i << 2) + s] >> 4) << 12;
d = (d >> shift) + (((l0 * f0) + (l1 * f1) + 128) >> 8);
*dp = d;
dp++;
l1 = l0;
l0 = d;
}
}
xa += 128;
}
cdic_xa_last[0] = l0;
cdic_xa_last[1] = l1;
}
void cdicdic_device::decode_xa_mono8(int16_t *cdic_xa_last, const unsigned char *xa, signed short *dp)
{
int16_t l0 = cdic_xa_last[0];
int16_t l1 = cdic_xa_last[1];
for (int32_t b = 0; b < 18; b++)
{
for (int32_t s = 0; s < 4; s++)
{
uint8_t flags = xa[4 + s];
uint8_t shift = flags & 0xf;
uint8_t filter = (flags >> 4) & 3;
int16_t f0 = s_xa_filter_coef[filter][0];
int16_t f1 = s_xa_filter_coef[filter][1];
for (int32_t i = 0; i < 28; i++)
{
int16_t d = (xa[16 + (i << 2) + s] << 8);
d = (d >> shift) + (((l0 * f0) + (l1 * f1) + 128) >> 8);
*dp = d;
dp++;
l1 = l0;
l0 = d;
}
}
xa += 128;
}
cdic_xa_last[0] = l0;
cdic_xa_last[1] = l1;
}
void cdicdic_device::decode_xa_stereo(int16_t *cdic_xa_last, const uint8_t *xa, int16_t *dp)
{
int16_t l0 = cdic_xa_last[0];
int16_t l1 = cdic_xa_last[1];
int16_t l2 = cdic_xa_last[2];
int16_t l3 = cdic_xa_last[3];
for (int32_t b = 0; b < 18; b++)
{
for (int32_t s = 0; s < 4; s++)
{
uint8_t flags0 = xa[4 + (s << 1)];
uint8_t shift0 = flags0 & 0xf;
uint8_t filter0 = (flags0 >> 4) & 3;
uint8_t flags1 = xa[5 + (s << 1)];
uint8_t shift1 = flags1 & 0xf;
uint8_t filter1 = (flags1 >> 4) & 3;
int16_t f0 = s_xa_filter_coef[filter0][0];
int16_t f1 = s_xa_filter_coef[filter0][1];
int16_t f2 = s_xa_filter_coef[filter1][0];
int16_t f3 = s_xa_filter_coef[filter1][1];
for (int32_t i = 0; i < 28; i++)
{
int16_t d = xa[16 + (i << 2) + s];
int16_t d0 = (d & 0xf) << 12;
int16_t d1 = (d >> 4) << 12;
d0 = (d0 >> shift0) + (((l0 * f0) + (l1 * f1) + 128) >> 8);
*dp = d0;
dp++;
l1 = l0;
l0 = d0;
d1 = (d1 >> shift1) + (((l2 * f2) + (l3 * f3) + 128) >> 8);
*dp = d1;
dp++;
l3 = l2;
l2 = d1;
}
}
xa += 128;
}
cdic_xa_last[0] = l0;
cdic_xa_last[1] = l1;
cdic_xa_last[2] = l2;
cdic_xa_last[3] = l3;
}
void cdicdic_device::decode_xa_stereo8(int16_t *cdic_xa_last, const uint8_t *xa, int16_t *dp)
{
int16_t l0 = cdic_xa_last[0];
int16_t l1 = cdic_xa_last[1];
int16_t l2 = cdic_xa_last[2];
int16_t l3 = cdic_xa_last[3];
for (int32_t b = 0; b < 18; b++)
{
for (int32_t s = 0; s < 4; s += 2)
{
uint8_t flags0 = xa[4 + s];
uint8_t shift0 = flags0 & 0xf;
uint8_t filter0 = (flags0 >> 4) & 3;
uint8_t flags1 = xa[5 + s];
uint8_t shift1 = flags1 & 0xf;
uint8_t filter1 = (flags1 >> 4) & 3;
int16_t f0 = s_xa_filter_coef[filter0][0];
int16_t f1 = s_xa_filter_coef[filter0][1];
int16_t f2 = s_xa_filter_coef[filter1][0];
int16_t f3 = s_xa_filter_coef[filter1][1];
for (int32_t i = 0; i < 28; i++)
{
int16_t d0 = (xa[16 + (i << 2) + s + 0] << 8);
int16_t d1 = (xa[16 + (i << 2) + s + 1] << 8);
d0 = (d0 >> shift0) + (((l0 * f0) + (l1 * f1) + 128) >> 8);
*dp = d0;
dp++;
l1 = l0;
l0 = d0;
d1 = (d1 >> shift1) + (((l2 * f2) + (l3 * f3) + 128) >> 8);
*dp = d1;
dp++;
l3 = l2;
l2 = d1;
}
}
xa += 128;
}
cdic_xa_last[0] = l0;
cdic_xa_last[1] = l1;
cdic_xa_last[2] = l2;
cdic_xa_last[3] = l3;
sample = clip_int16(sample32);
sample1 = std::exchange(sample0, sample);
out_buffer = sample;
}
void cdicdic_device::decode_8bit_xa_unit(int channel, uint8_t param, const uint8_t *data, int16_t *out_buffer)
{
int gain_shift = 8 - (param & 0xf);
const int16_t *filter = s_xa_filter_coef[(param >> 4) & 3];
int16_t *old_samples = &m_xa_last[channel << 1];
int16_t *const old_samples = &m_xa_last[channel << 1];
for (int i = 0; i < 28; i++)
{
int32_t sample = *data;
if (sample >= 128)
sample -= 256;
int16_t sample = int16_t(uint16_t(*data) << 8);
decode_xa_unit(param, sample, old_samples[0], old_samples[1], out_buffer[i]);
data += 4;
sample <<= gain_shift;
sample += (filter[0] * old_samples[0] + filter[1] * old_samples[1] + 128) / 256;
int16_t sample16 = (int16_t)sample;
if (sample < -32768)
sample16 = -32768;
else if (sample > 32767)
sample16 = 32767;
old_samples[1] = old_samples[0];
old_samples[0] = sample16;
out_buffer[i] = sample16;
}
}
void cdicdic_device::decode_4bit_xa_unit(int channel, uint8_t param, const uint8_t *data, uint8_t shift, int16_t *out_buffer)
{
int gain_shift = 12 - (param & 0xf);
const int16_t *filter = s_xa_filter_coef[(param >> 4) & 3];
int16_t *old_samples = &m_xa_last[channel << 1];
int16_t *const old_samples = &m_xa_last[channel << 1];
for (int i = 0; i < 28; i++)
{
int32_t sample = (*data >> shift) & 0xf;
if (BIT(sample, 3))
sample -= 16;
int16_t sample = int16_t(uint16_t((*data >> shift) & 0xf) << 12);
decode_xa_unit(param, sample, old_samples[0], old_samples[1], out_buffer[i]);
data += 4;
sample <<= gain_shift;
sample += (filter[0] * old_samples[0] + filter[1] * old_samples[1] + 128) / 256;
int16_t sample16 = (int16_t)(uint16_t)(sample & 0xffff);
if (sample < -32768)
sample16 = -32768;
else if (sample > 32767)
sample16 = 32767;
old_samples[1] = old_samples[0];
old_samples[0] = sample16;
out_buffer[i] = sample16;
}
}
@@ -515,50 +316,35 @@ void cdicdic_device::play_raw_group(const uint8_t *data)
m_dmadac[1]->transfer(0, 1, 1, 28, samples);
}
void cdicdic_device::play_xa_group(const uint8_t coding, const uint8_t *data)
void cdicdic_device::play_xa_group(const uint8_t coding, const uint8_t *data, const uint16_t idx)
{
static const uint16_t s_4bit_header_offsets[8] = { 0, 1, 2, 3, 8, 9, 10, 11 };
static const uint16_t s_8bit_header_offsets[4] = { 0, 1, 2, 3 };
static const uint16_t s_4bit_data_offsets[8] = { 16, 16, 17, 17, 18, 18, 19, 19 };
static const uint16_t s_8bit_data_offsets[4] = { 16, 17, 18, 19 };
static const uint16_t HEADER_OFFSET_4BIT[8] = { 4, 5, 6, 7, 12, 13, 14, 15 };
static const uint16_t HEADER_OFFSET_8BIT[4] = { 4, 5, 6, 7 };
static const uint16_t DATA_OFFSET_4BIT[8] = { 16, 16, 17, 17, 18, 18, 19, 19 };
static const uint16_t DATA_OFFSET_8BIT[4] = { 16, 17, 18, 19 };
int16_t samples[28];
const uint8_t num_samples = coding & CODING_8BPS ? 4 : 8;
switch (coding & (CODING_BPS_MASK | CODING_CHAN_MASK))
for (uint8_t i = 0; i < num_samples; i++)
{
switch (coding & (CODING_BPS_MASK | CODING_CHAN_MASK))
{
case CODING_4BPS | CODING_MONO:
for (uint8_t i = 0; i < 8; i++)
{
decode_4bit_xa_unit(0, data[s_4bit_header_offsets[i]], data + s_4bit_data_offsets[i], (i & 1) ? 4 : 0, samples);
m_dmadac[0]->transfer(0, 1, 1, 28, samples);
m_dmadac[1]->transfer(0, 1, 1, 28, samples);
}
return;
decode_4bit_xa_unit(0, data[HEADER_OFFSET_4BIT[i]], data + DATA_OFFSET_4BIT[i], (i & 1) ? 4 : 0, &m_samples[0][idx + i * 28]);
break;
case CODING_4BPS | CODING_STEREO:
for (uint8_t i = 0; i < 8; i++)
{
decode_4bit_xa_unit(i & 1, data[s_4bit_header_offsets[i]], data + s_4bit_data_offsets[i], (i & 1) ? 4 : 0, samples);
m_dmadac[i & 1]->transfer(0, 1, 1, 28, samples);
}
return;
decode_4bit_xa_unit(i & 1, data[HEADER_OFFSET_4BIT[i]], data + DATA_OFFSET_4BIT[i], (i & 1) ? 4 : 0, &m_samples[i & 1][idx + (i >> 1) * 28]);
break;
case CODING_8BPS | CODING_MONO:
for (uint8_t i = 0; i < 4; i++)
{
decode_8bit_xa_unit(0, data[s_8bit_header_offsets[i]], data + s_8bit_data_offsets[i], samples);
m_dmadac[0]->transfer(0, 1, 1, 28, samples);
m_dmadac[1]->transfer(0, 1, 1, 28, samples);
}
return;
decode_8bit_xa_unit(0, data[HEADER_OFFSET_8BIT[i]], data + DATA_OFFSET_8BIT[i], &m_samples[0][idx + i * 28]);
break;
case CODING_8BPS | CODING_STEREO:
for (uint8_t i = 0; i < 4; i++)
{
decode_8bit_xa_unit(i & 1, data[s_8bit_header_offsets[i]], data + s_8bit_data_offsets[i], samples);
m_dmadac[i & 1]->transfer(0, 1, 1, 28, samples);
}
return;
decode_8bit_xa_unit(i & 1, data[HEADER_OFFSET_8BIT[i]], data + DATA_OFFSET_8BIT[i], &m_samples[i & 1][idx + (i >> 1) * 28]);
break;
}
}
}
@@ -569,21 +355,26 @@ void cdicdic_device::play_cdda_sector(const uint8_t *data)
m_dmadac[0]->set_volume(0x100);
m_dmadac[1]->set_volume(0x100);
int16_t samples[2][2352/4];
for (uint16_t i = 0; i < 2352/4; i++)
const uint16_t NUM_SAMPLES = SECTOR_SIZE / 4;
for (uint16_t i = 0; i < NUM_SAMPLES; i++)
{
samples[0][i] = (int16_t)((data[(i * 4) + 1] << 8) | data[(i * 4) + 0]);
samples[1][i] = (int16_t)((data[(i * 4) + 3] << 8) | data[(i * 4) + 2]);
m_samples[0][i] = (int16_t)((data[(i * 4) + 1] << 8) | data[(i * 4) + 0]);
m_samples[1][i] = (int16_t)((data[(i * 4) + 3] << 8) | data[(i * 4) + 2]);
}
m_dmadac[0]->transfer(0, 1, 1, SECTOR_SIZE/4, samples[0]);
m_dmadac[1]->transfer(0, 1, 1, SECTOR_SIZE/4, samples[1]);
m_dmadac[0]->transfer(0, 1, 1, NUM_SAMPLES, &m_samples[0][0]);
m_dmadac[1]->transfer(0, 1, 1, NUM_SAMPLES, &m_samples[1][0]);
}
void cdicdic_device::play_audio_sector(const uint8_t coding, const uint8_t *data)
{
if ((coding & CODING_CHAN_MASK) > CODING_STEREO || (coding & CODING_BPS_MASK) == CODING_BPS_MPEG || (coding & CODING_RATE_MASK) == CODING_RATE_RESV)
return;
{
}
if (coding & 0x40)
{
}
int channels = 2;
//offs_t buffer_length = 1;
@@ -631,6 +422,10 @@ void cdicdic_device::play_audio_sector(const uint8_t coding, const uint8_t *data
m_dmadac[0]->set_volume(0x100);
m_dmadac[1]->set_volume(0x100);
const uint16_t bps = ((coding & CODING_BPS_MASK) == CODING_8BPS);
const uint16_t chan = ((coding & CODING_CHAN_MASK) == CODING_STEREO);
const uint16_t num_samples = 8 >> (bps + chan);
if (bits == 16 && channels == 2)
{
for (uint16_t i = 0; i < SECTOR_AUDIO_SIZE; i += 112, data += 112)
@@ -640,9 +435,29 @@ void cdicdic_device::play_audio_sector(const uint8_t coding, const uint8_t *data
}
else
{
uint16_t offset = 0;
for (uint16_t i = 0; i < SECTOR_AUDIO_SIZE; i += 128, data += 128)
{
play_xa_group(coding, data);
play_xa_group(coding, data, offset);
offset += 28 * num_samples;
}
int16_t sampleL = 0, sampleR = 0, outL = 0, outR = 0;
// Attenuation is logarithmic (decibels).
// Floats are not chip accurate, but the formula is correct.
float scaleLL = powf(10.0f, -m_atten[0] / 20.0f);
float scaleLR = powf(10.0f, -m_atten[1] / 20.0f);
float scaleRR = powf(10.0f, -m_atten[2] / 20.0f);
float scaleRL = powf(10.0f, -m_atten[3] / 20.0f);
for (uint16_t i = 0; i < 18 * 28 * num_samples; i++)
{
sampleL = m_samples[0][i];
sampleR = m_samples[coding & CODING_STEREO][i];
outL = (sampleL * scaleLL + sampleR * scaleRL) * 0.25;
outR = (sampleL * scaleLR + sampleR * scaleRR) * 0.25;
m_dmadac[0]->transfer(0, 1, 1, 1, &outL);
m_dmadac[1]->transfer(0, 1, 1, 1, &outR);
}
}
}
@@ -695,7 +510,7 @@ void cdicdic_device::process_audio_map()
else
{
m_decode_addr = 0xffff;
m_audio_sector_counter = m_audio_format_sectors;
m_audio_sector_counter = 0;
}
if (was_decoding)
@@ -1252,7 +1067,7 @@ void cdicdic_device::regs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
m_audio_format_sectors = 0;
m_audio_sector_counter = 1;
m_decoding_audio_map = true;
std::fill_n(&m_xa_last[0], 4, 0);
std::fill_n(m_xa_last, 4, 0);
}
break;
@@ -1278,12 +1093,19 @@ void cdicdic_device::regs_w(offs_t offset, uint16_t data, uint16_t mem_mask)
}
}
void cdicdic_device::atten_w(uint32_t state) {
m_atten[0] = (state & 0xFF000000) >> 24;
m_atten[1] = (state & 0x00FF0000) >> 16;
m_atten[2] = (state & 0x0000FF00) >> 8;
m_atten[3] = (state & 0x000000FF);
}
void cdicdic_device::init_disc_read(uint8_t disc_mode)
{
m_disc_command = m_command;
m_disc_mode = disc_mode;
m_curr_lba = lba_from_time();
m_disc_spinup_counter = 1;
m_disc_spinup_counter = 6;
}
void cdicdic_device::cancel_disc_read()
@@ -1425,6 +1247,7 @@ void cdicdic_device::device_start()
save_item(NAME(m_decoding_audio_map));
save_item(NAME(m_decode_addr));
save_item(NAME(m_atten));
save_item(NAME(m_xa_last));
m_audio_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdicdic_device::audio_tick), this));
@@ -1482,7 +1305,8 @@ void cdicdic_device::device_reset()
m_dmadac[0]->enable(1);
m_dmadac[1]->enable(1);
std::fill_n(m_atten, 4, 0);
std::fill_n(&m_xa_last[0], 4, 0);
}
+5 -1
View File
@@ -59,6 +59,7 @@ public:
void ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint8_t intack_r();
void atten_w(uint32_t state);
protected:
// device-level overrides
@@ -189,14 +190,17 @@ private:
bool m_decoding_audio_map;
uint16_t m_decode_addr;
// Audio Attenuation (L->L, L->R, R->R, R->L)
uint8_t m_atten[4];
int16_t m_xa_last[4];
std::unique_ptr<uint8_t[]> m_ram;
std::unique_ptr<int16_t[]> m_samples[2];
void decode_xa_unit(const uint8_t param, int16_t sample, int16_t &sample0, int16_t &sample1, int16_t &out_buffer);
void decode_8bit_xa_unit(int channel, uint8_t param, const uint8_t *data, int16_t *out_buffer);
void decode_4bit_xa_unit(int channel, uint8_t param, const uint8_t *data, uint8_t shift, int16_t *out_buffer);
void play_raw_group(const uint8_t *data);
void play_xa_group(const uint8_t coding, const uint8_t *data);
void play_xa_group(const uint8_t coding, const uint8_t *data, const uint16_t idx);
void play_audio_sector(const uint8_t coding, const uint8_t *data);
void play_cdda_sector(const uint8_t *data);
void process_audio_map();
+17 -5
View File
@@ -240,14 +240,18 @@ void cdislave_hle_device::slave_w(offs_t offset, uint16_t data)
}
break;
case 2:
if (m_in_index)
if (m_in_index > 1)
{
m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++;
if (m_in_index == m_in_count)
{
switch (m_in_buf[0])
{
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
m_atten_w((((u32)m_in_buf[1]) << 24) | (((u32)m_in_buf[2]) << 16) | (((u32)m_in_buf[3]) << 8) | (((u32)m_in_buf[4])));
m_in_index = 0;
m_in_count = 0;
break;
case 0xf0: // Set Front Panel LCD
memset(m_in_buf + 1, 0, 16);
m_in_count = 17;
@@ -262,12 +266,11 @@ void cdislave_hle_device::slave_w(offs_t offset, uint16_t data)
}
else
{
m_in_buf[m_in_index] = data & 0x00ff;
m_in_index++;
switch (data & 0x00ff)
{
case 0x82: // Mute Audio
{
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Mute Audio (0x82)\n", offset);
m_dmadac[0]->set_volume(0);
m_dmadac[1]->set_volume(0);
m_in_index = 0;
@@ -277,16 +280,24 @@ void cdislave_hle_device::slave_w(offs_t offset, uint16_t data)
}
case 0x83: // Unmute Audio
{
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset);
m_dmadac[0]->set_volume(0x100);
m_dmadac[1]->set_volume(0x100);
m_in_index = 0;
m_in_count = 0;
break;
}
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Set Attenuation Audio\n", offset);
m_in_count = 5;
break;
case 0xf0: // Set Front Panel LCD
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset);
m_in_count = 17;
break;
default:
LOGMASKED(LOG_COMMANDS | LOG_UNKNOWNS, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff);
memset(m_in_buf, 0, 17);
m_in_index = 0;
m_in_count = 0;
@@ -385,6 +396,7 @@ cdislave_hle_device::cdislave_hle_device(const machine_config &mconfig, const ch
, m_mousex(*this, "MOUSEX")
, m_mousey(*this, "MOUSEY")
, m_mousebtn(*this, "MOUSEBTN")
, m_atten_w(*this)
{
}
+3
View File
@@ -34,6 +34,7 @@ public:
// construction/destruction
cdislave_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto atten_callback() { return m_atten_w.bind(); }
auto int_callback() { return m_int_callback.bind(); }
// external callbacks
@@ -43,6 +44,7 @@ public:
uint16_t slave_r(offs_t offset);
void slave_w(offs_t offset, uint16_t data);
void slave_w_mouse(offs_t offset, uint16_t data);
protected:
// device-level overrides
@@ -61,6 +63,7 @@ private:
devcb_write_line m_int_callback;
required_device_array<dmadac_sound_device, 2> m_dmadac;
devcb_write32 m_atten_w;
required_ioport m_mousex;
required_ioport m_mousey;
-14
View File
@@ -12,19 +12,5 @@
@source:cdi.cpp
cdi490a //
cdi910 //
cdibios // Base unit
cdimono1 // Philips CD-i model 200 (Mono-I board, PAL)
cdimono2 // Philips CD-i model 220 (Mono-II board, NTSC)
quizard // (c) TAB Austria 199?
quizard_10 // (c) TAB Austria 1996
quizard_12 // (c) TAB Austria 1996
quizard_17 // (c) TAB Austria 1996
quizard2 // (c) TAB Austria 1995
quizard2_22 // (c) TAB Austria 199?
quizard3 // (c) TAB Austria 1996
quizard3_32 // (c) TAB Austria 1996
quizard3a // (c) TAB Austria 1996
quizard4 // (c) TAB Austria 1998
quizard4_40 // (c) TAB Austria 1997
quizard4_41 // (c) TAB Austria 1998
quizard4cz // (c) TAB Austria 1998
+426 -627
View File
File diff suppressed because it is too large. Load diff
+83 -77
View File
@@ -21,8 +21,8 @@ TODO:
*******************************************************************************/
#ifndef MAME_VIDEO_MCD212_H
#define MAME_VIDEO_MCD212_H
#ifndef MAME_PHILIPS_MCD212_H
#define MAME_PHILIPS_MCD212_H
#pragma once
@@ -49,12 +49,13 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void map(address_map &map);
void map(address_map &map) ATTR_COLD;
template <int Channel> int ram_dtack_cycle_count();
template <int Path> int ram_dtack_cycle_count();
int rom_dtack_cycle_count();
protected:
// device_t implementation
// device-level overrides
virtual void device_resolve_objects() override;
virtual void device_start() override;
@@ -89,10 +90,11 @@ protected:
{
CURCNT_COLOR = 0x00000f, // Cursor color
CURCNT_CUW = 0x008000, // Cursor width
CURCNT_COF = 0x070000, // Cursor off time
CURCNT_COF_SHIFT = 16,
CURCNT_CON = 0x280000, // Cursor on time
CURCNT_COF = 0b111 << CURCNT_COF_SHIFT, // Cursor off time
CURCNT_CON_SHIFT = 19,
CURCNT_CON = 0b111 << CURCNT_CON_SHIFT, // Cursor on time
CURCNT_BLKC_SHIFT = 22,
CURCNT_BLKC = 0x400000, // Blink type
CURCNT_EN = 0x800000, // Cursor enable
@@ -101,40 +103,42 @@ protected:
ICM_MODE2 = 0x000f00, // Plane 2
ICM_MODE2_SHIFT = 8,
ICM_EV = 0x040000, // External video
ICM_NR = 0x080000, // Number of region flags
ICM_NR_BIT = 19,
ICM_EV_BIT = 18,
ICM_NM = 0x080000, // Number of Matte flags
ICM_NM_BIT = 19,
ICM_CS = 0x400000, // CLUT select
ICM_CS_BIT = 22,
TCR_TA = 0x00000f, // Plane A
TCR_TB = 0x000f00, // Plane B
TCR_TB_SHIFT = 8,
TCR_COND_1 = 0x0, // Transparent if: Always (Plane Disabled)
TCR_COND_KEY_1 = 0x1, // Transparent if: Color Key = True
TCR_COND_XLU_1 = 0x2, // Transparent if: Transparency Bit = 1
TCR_COND_RF0_1 = 0x3, // Transparent if: Region Flag 0 = True
TCR_COND_RF1_1 = 0x4, // Transparent if: Region Flag 1 = True
TCR_COND_RF0KEY_1 = 0x5, // Transparent if: Region Flag 0 = True || Color Key = True
TCR_COND_RF1KEY_1 = 0x6, // Transparent if: Region Flag 1 = True || Color Key = True
TCR_ALWAYS = 0x0, // Transparent if: Always (Plane Disabled)
TCR_KEY = 0x1, // Transparent if: Color Key = True
TCR_RGB = 0x2, // Transparent if: Transparency Bit = 1 (RGB Only)
TCR_MF0 = 0x3, // Transparent if: Matte Flag 0 = True
TCR_MF1 = 0x4, // Transparent if: Matte Flag 1 = True
TCR_MF0_KEY1 = 0x5, // Transparent if: Matte Flag 0 = True || Color Key = True
TCR_MF1_KEY1 = 0x6, // Transparent if: Matte Flag 1 = True || Color Key = True
TCR_COND_UNUSED0 = 0x7, // Unused
TCR_COND_0 = 0x8, // Transparent if: Never (No Transparent Area)
TCR_COND_KEY_0 = 0x9, // Transparent if: Color Key = False
TCR_COND_XLU_0 = 0xa, // Transparent if: Transparency Bit = 0
TCR_COND_RF0_0 = 0xb, // Transparent if: Region Flag 0 = False
TCR_COND_RF1_0 = 0xc, // Transparent if: Region Flag 1 = False
TCR_COND_RF0KEY_0 = 0xd, // Transparent if: Region Flag 0 = False && Color Key = False
TCR_COND_RF1KEY_0 = 0xe, // Transparent if: Region Flag 1 = False && Color Key = False
TCR_NEVER = 0x8, // Transparent if: Never (No Transparent Area)
TCR_NOT_KEY = 0x9, // Transparent if: Color Key = False
TCR_NOT_RGB = 0xa, // Transparent if: Transparency Bit = 0 (RGB Only)
TCR_NOT_MF0 = 0xb, // Transparent if: Matte Flag 0 = False
TCR_NOT_MF1 = 0xc, // Transparent if: Matte Flag 1 = False
TCR_NOT_MF0_KEY = 0xd, // Transparent if: Matte Flag 0 = False || Color Key = False
TCR_NOT_MF1_KEY = 0xe, // Transparent if: Matte Flag 1 = False || Color Key = False
TCR_COND_UNUSED1 = 0xf, // Unused
TCR_DISABLE_MX = 0x800000, // Mix disable
POR_AB = 0, // Plane A in front of Plane B
POR_BA = 1, // Plane B in front of Plane A
RC_X = 0x0003ff, // X position
RC_WF = 0x00fc00, // Weight position
RC_WF_SHIFT = 10,
RC_RF_BIT = 16, // Region flag bit
RC_OP = 0xf00000, // Operation
RC_OP_SHIFT = 20,
MC_X = 0x0003ff, // X position
MC_WF = 0x00fc00, // Weight position
MC_WF_SHIFT = 10,
MC_MF_BIT = 16, // Matte flag bit
MC_OP = 0xf00000, // Operation
MC_OP_SHIFT = 20,
CSR1R_PA = 0x20, // Parity
CSR1R_DA = 0x80, // Display Active
@@ -172,40 +176,38 @@ protected:
ICM_OFF = 0x0,
ICM_CLUT8 = 0x1,
ICM_RGB555 = 0x2,
ICM_RGB555 = 0x1,
ICM_CLUT7 = 0x3,
ICM_CLUT77 = 0x4,
ICM_DYUV = 0x5,
ICM_CLUT4 = 0xb
};
uint8_t m_csrr[2];
uint16_t m_csrw[2];
uint16_t m_dcr[2];
uint16_t m_vsr[2];
uint16_t m_ddr[2];
uint16_t m_dcp[2];
uint32_t m_dca[2];
uint32_t m_clut[256];
uint32_t m_image_coding_method;
uint32_t m_transparency_control;
uint32_t m_plane_order;
uint32_t m_clut_bank[2];
uint32_t m_transparent_color[2];
uint32_t m_mask_color[2];
uint32_t m_dyuv_abs_start[2];
uint32_t m_cursor_position;
uint32_t m_cursor_control;
uint32_t m_cursor_pattern[16];
uint32_t m_region_control[8];
uint32_t m_backdrop_color;
uint32_t m_mosaic_hold[2];
uint8_t m_weight_factor[2][768];
uint8_t m_csrr[2]{};
uint16_t m_csrw[2]{};
uint16_t m_dcr[2]{};
uint16_t m_vsr[2]{};
uint16_t m_ddr[2]{};
uint16_t m_dcp[2]{};
uint32_t m_dca[2]{};
uint32_t m_clut[256]{};
uint32_t m_image_coding_method = 0;
uint32_t m_transparency_control = 0;
uint32_t m_plane_order = 0;
uint32_t m_clut_bank[2]{};
uint32_t m_transparent_color[2]{};
uint32_t m_mask_color[2]{};
uint32_t m_dyuv_abs_start[2]{};
uint32_t m_cursor_position = 0;
uint32_t m_cursor_control = 0;
uint32_t m_cursor_pattern[16]{};
uint32_t m_matte_control[8]{};
uint32_t m_backdrop_color = 0;
uint32_t m_mosaic_hold[2]{};
uint8_t m_weight_factor[2][768]{};
// DYUV color limit arrays.
uint32_t m_dyuv_limit_r_lut[3 * 0xff];
uint32_t m_dyuv_limit_g_lut[3 * 0xff];
uint32_t m_dyuv_limit_b_lut[3 * 0xff];
uint32_t m_dyuv_limit_lut[0x300];
// DYUV delta-Y decoding array
uint8_t m_delta_y_lut[0x100];
@@ -232,40 +234,44 @@ protected:
required_shared_ptr<uint16_t> m_planeb;
// internal state
bool m_region_flag[2][768];
int m_ica_height;
int m_total_height;
emu_timer *m_ica_timer;
emu_timer *m_dca_timer;
bool m_matte_flag[2][768]{};
int m_ica_height = 0;
int m_total_height = 0;
emu_timer *m_ica_timer = nullptr;
emu_timer *m_dca_timer = nullptr;
// Cursor State
uint16_t m_blink_time; // Counter that tracks how long since the last m_blink_active last changed.
bool m_blink_active = false;
static const uint32_t s_4bpp_color[16];
uint8_t get_weight_factor(const uint32_t region_idx);
uint8_t get_region_op(const uint32_t region_idx);
void update_region_arrays();
uint8_t get_weight_factor(const uint32_t Matte_idx);
uint8_t get_matte_op(const uint32_t Matte_idx);
void update_matte_arrays();
int get_screen_width();
int get_border_width();
template <int Channel> int get_plane_width();
uint32_t get_backdrop_plane();
template <int Channel> void set_vsr(uint32_t value);
template <int Channel> uint32_t get_vsr();
template <int Path> void set_vsr(uint32_t value);
template <int Path> uint32_t get_vsr();
template <int Channel> void set_dcp(uint32_t value);
template <int Channel> uint32_t get_dcp();
template <int Path> void set_dcp(uint32_t value);
template <int Path> uint32_t get_dcp();
template <int Channel> void set_display_parameters(uint8_t value);
template <int Path> void set_display_parameters(uint8_t value);
template <int Channel> void process_ica();
template <int Channel> void process_dca();
template <int Path> void process_ica();
template <int Path> void process_dca();
template <int Channel> uint8_t get_transparency_control();
template <int Channel> uint8_t get_icm();
template <int Channel> bool get_mosaic_enable();
template <int Channel> uint8_t get_mosaic_factor();
template <int Channel> void process_vsr(uint32_t *pixels, bool *transparent);
template <int Path> uint8_t get_transparency_control();
template <int Path> uint8_t get_icm();
template <int Path> bool get_mosaic_enable();
template <int Path> uint8_t get_mosaic_factor();
template <int Path> void process_vsr(uint32_t *pixels, bool *transparent);
template <int Channel> void set_register(uint8_t reg, uint32_t value);
template <int Path> void set_register(uint8_t reg, uint32_t value);
template <bool MosaicA, bool MosaicB, bool OrderAB> void mix_lines(uint32_t *plane_a, bool *transparent_a, uint32_t *plane_b, bool *transparent_b, uint32_t *out);
@@ -275,4 +281,4 @@ protected:
// device type definition
DECLARE_DEVICE_TYPE(MCD212, mcd212_device)
#endif // MAME_VIDEO_MCD212_H
#endif // MAME_PHILIPS_MCD212_H
@@ -82,7 +82,7 @@ static char MgamePath[1024];
static char MparentPath[1024];
static char MgameName[512];
static char MsystemName[512];
static char gameName[1024];
static char gameName[4096];
static char forcedSystem[9] = "cdimono1";
// args for cores
+1
View File
@@ -21,6 +21,7 @@
#include <type_traits>
#include <vector>
#include <memory>
#include <cstdint>
/*-----------------------------------------------------------------------------
osd_process_kill: kill the current process