From 424a3a6605c0a2bfaf9181f8f28aad69da576be0 Mon Sep 17 00:00:00 2001 From: David Haywood <28625134+DavidHaywood@users.noreply.github.com> Date: Tue, 26 Jul 2022 21:06:26 +0100 Subject: Monon / AX208 - load internal AX208 ROM in device [Peter Wilhelmson, David Haywood] (#10131) --- src/devices/cpu/mcs51/axc51-core.cpp | 54 ++++++++++++++++++++++++++++++++---- src/devices/cpu/mcs51/axc51-core.h | 21 +++++++++++++- src/devices/cpu/mcs51/mcs51.cpp | 12 ++++++-- src/devices/cpu/mcs51/mcs51.h | 1 + src/mame/skeleton/monon_color.cpp | 8 ++---- 5 files changed, 81 insertions(+), 15 deletions(-) diff --git a/src/devices/cpu/mcs51/axc51-core.cpp b/src/devices/cpu/mcs51/axc51-core.cpp index 486722b09ab..16739ee7419 100644 --- a/src/devices/cpu/mcs51/axc51-core.cpp +++ b/src/devices/cpu/mcs51/axc51-core.cpp @@ -27,16 +27,17 @@ DEFINE_DEVICE_TYPE(AXC51CORE, axc51core_cpu_device, "axc51core", "AppoTech AXC51-CORE") DEFINE_DEVICE_TYPE(AX208, ax208_cpu_device, "ax208", "AppoTech AX208 (AXC51-CORE)") +DEFINE_DEVICE_TYPE(AX208P, ax208p_cpu_device, "ax208p", "AppoTech AX208 (AXC51-CORE) (prototype?)") // AXC51CORE (base device) -axc51core_cpu_device::axc51core_cpu_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, int program_width, int data_width, uint8_t features) - : mcs51_cpu_device(mconfig, type, tag, owner, clock, program_width, data_width, features) +axc51core_cpu_device::axc51core_cpu_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, address_map_constructor program_map, address_map_constructor data_map, int program_width, int data_width, uint8_t features) + : mcs51_cpu_device(mconfig, type, tag, owner, clock, program_map, data_map, program_width, data_width, features) { } axc51core_cpu_device::axc51core_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : axc51core_cpu_device(mconfig, AXC51CORE, tag, owner, clock, 0, 7) + : axc51core_cpu_device(mconfig, AXC51CORE, tag, owner, clock, address_map_constructor(FUNC(axc51core_cpu_device::program_internal), this), address_map_constructor(FUNC(axc51core_cpu_device::data_internal), this), 0, 8) { } @@ -47,22 +48,63 @@ std::unique_ptr axc51core_cpu_device::create_disassemble // AX208 (specific CPU) +ax208_cpu_device::ax208_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : axc51core_cpu_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(ax208_cpu_device::ax208_internal_program_mem), this), address_map_constructor(FUNC(ax208_cpu_device::ax208_internal_data_mem), this), 0, 8) +{ +} + ax208_cpu_device::ax208_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : axc51core_cpu_device(mconfig, AX208, tag, owner, clock, 0, 7) + : ax208_cpu_device(mconfig, AX208, tag, owner, clock) { } + std::unique_ptr ax208_cpu_device::create_disassembler() { return std::make_unique(); } -ROM_START( ax208 ) +void ax208_cpu_device::ax208_internal_program_mem(address_map &map) +{ + map(0x8000, 0x9fff).rom().region("rom", 0); // this can only be read from code running within the same region +} + +void ax208_cpu_device::ax208_internal_data_mem(address_map &map) +{ + map(0x0000, 0x00ff).ram().share("scratchpad"); + map(0x0100, 0x01ff).ram().share("sfr_ram"); /* SFR */ +} + + +ROM_START( ax208 ) // assume all production ax208 chips use this internal ROM ROM_REGION( 0x2000, "rom", 0 ) - ROM_LOAD("ax208.rom", 0x0000, 0x2000, NO_DUMP ) + ROM_LOAD("ax208.bin", 0x0000, 0x2000, CRC(b85f954a) SHA1(0dc7ab9bdaf73231d4d6627fe6308fe8103e1bbc) ) ROM_END const tiny_rom_entry *ax208_cpu_device::device_rom_region() const { return ROM_NAME( ax208 ); } + +void ax208_cpu_device::device_reset() +{ + axc51core_cpu_device::device_reset(); + set_state_int(MCS51_PC, 0x8000); +} + + +ax208p_cpu_device::ax208p_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : ax208_cpu_device(mconfig, AX208P, tag, owner, clock) +{ +} + +ROM_START( ax208p ) // this is an early revision of the internal AX208 code, some functions are moved around so it isn't entirely compatible + ROM_REGION( 0x2000, "rom", 0 ) + ROM_LOAD("mask208.bin", 0x0000, 0x2000, CRC(52396183) SHA1(b119000f93251894a352ecf675ee42f2e5c347bd) ) +ROM_END + +const tiny_rom_entry *ax208p_cpu_device::device_rom_region() const +{ + return ROM_NAME( ax208p ); +} + diff --git a/src/devices/cpu/mcs51/axc51-core.h b/src/devices/cpu/mcs51/axc51-core.h index f225fecd4da..2198acae356 100644 --- a/src/devices/cpu/mcs51/axc51-core.h +++ b/src/devices/cpu/mcs51/axc51-core.h @@ -19,13 +19,14 @@ DECLARE_DEVICE_TYPE(AXC51CORE, axc51core_cpu_device) DECLARE_DEVICE_TYPE(AX208, ax208_cpu_device) +DECLARE_DEVICE_TYPE(AX208P, ax208p_cpu_device) class axc51core_cpu_device : public mcs51_cpu_device { public: // construction/destruction axc51core_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - axc51core_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width, uint8_t features = 0); + axc51core_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map, address_map_constructor data_map, int program_width, int data_width, uint8_t features = 0); protected: virtual std::unique_ptr create_disassembler() override; @@ -39,8 +40,26 @@ public: ax208_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: + ax208_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_reset() override; + virtual std::unique_ptr create_disassembler() override; virtual const tiny_rom_entry *device_rom_region() const override; + + void ax208_internal_program_mem(address_map &map); + void ax208_internal_data_mem(address_map &map); +}; + +class ax208p_cpu_device : public ax208_cpu_device +{ +public: + // construction/destruction + ax208p_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual const tiny_rom_entry *device_rom_region() const override; }; + #endif // MAME_CPU_MCS51_AXC51_CORE_H diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index 051a336f1e4..9f5bd04e4c0 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -267,10 +267,10 @@ void mcs51_cpu_device::data_internal(address_map &map) -mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width, uint8_t features) +mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map, address_map_constructor data_map, int program_width, int data_width, uint8_t features) : cpu_device(mconfig, type, tag, owner, clock) - , m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(mcs51_cpu_device::program_internal), this)) - , m_data_config("data", ENDIANNESS_LITTLE, 8, 9, 0, address_map_constructor(FUNC(mcs51_cpu_device::data_internal), this)) + , m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, program_map) + , m_data_config("data", ENDIANNESS_LITTLE, 8, 9, 0, data_map) , m_io_config("io", ENDIANNESS_LITTLE, 8, (features & FEATURE_DS5002FP) ? 17 : 16, 0) , m_pc(0) , m_features(features) @@ -295,6 +295,12 @@ mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type ty } +mcs51_cpu_device::mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width, uint8_t features) + : mcs51_cpu_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(mcs51_cpu_device::program_internal), this), address_map_constructor(FUNC(mcs51_cpu_device::data_internal), this), program_width, data_width, features) +{ +} + + i8031_device::i8031_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : mcs51_cpu_device(mconfig, I8031, tag, owner, clock, 0, 7) { diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h index a4c081be0d5..14d55792f38 100644 --- a/src/devices/cpu/mcs51/mcs51.h +++ b/src/devices/cpu/mcs51/mcs51.h @@ -72,6 +72,7 @@ public: protected: // construction/destruction mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_width, int data_width, uint8_t features = 0); + mcs51_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map, address_map_constructor data_map, int program_width, int data_width, uint8_t features = 0); // device-level overrides virtual void device_start() override; diff --git a/src/mame/skeleton/monon_color.cpp b/src/mame/skeleton/monon_color.cpp index 247256f164b..d9555cb3e88 100644 --- a/src/mame/skeleton/monon_color.cpp +++ b/src/mame/skeleton/monon_color.cpp @@ -31,7 +31,7 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_mainram(*this, "mainram"), - m_otherram(*this, "otherram"), + //m_otherram(*this, "otherram"), m_bootcopy(0) { } @@ -51,7 +51,7 @@ private: required_device m_screen; required_device m_palette; required_shared_ptr m_mainram; - required_shared_ptr m_otherram; + //required_shared_ptr m_otherram; DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load); @@ -73,8 +73,6 @@ void monon_color_state::machine_start() void monon_color_state::machine_reset() { - m_maincpu->set_state_int(MCS51_PC, 0x4000); - uint8_t* flash = memregion("flash")->base(); uint8_t* maincpu = &m_mainram[0]; @@ -130,7 +128,7 @@ INPUT_PORTS_END void monon_color_state::monon_color_map(address_map &map) { map(0x4000, 0x6fff).ram().share("mainram"); - map(0x9000, 0x9fff).ram().share("otherram"); // lots of jumps to here, is there some kind of BIOS? none of the code appears to map here? +// map(0x9000, 0x9fff).rom() // internal to CPU } void monon_color_state::monon_color(machine_config &config) -- cgit v1.2.3