summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/hp48.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/includes/hp48.h')
-rw-r--r--src/mame/includes/hp48.h62
1 files changed, 6 insertions, 56 deletions
diff --git a/src/mame/includes/hp48.h b/src/mame/includes/hp48.h
index 99a2eb95d05..46d26139f1b 100644
--- a/src/mame/includes/hp48.h
+++ b/src/mame/includes/hp48.h
@@ -12,6 +12,8 @@
#pragma once
+#include "machine/hp48_port.h"
+
#include "sound/dac.h"
#include "screen.h"
@@ -55,7 +57,8 @@ public:
, m_maincpu(*this, "maincpu")
, m_dac(*this, "dac")
, m_palette(*this, "palette")
- , m_screen(*this, "screen") {}
+ , m_screen(*this, "screen")
+ , m_port(*this, "port%u", 1U) {}
virtual void machine_reset() override;
void base_machine_start(hp48_models model);
@@ -131,13 +134,11 @@ public:
/* from highest to lowest priority: HDW, NCE2, CE1, CE2, NCE3, NCE1 */
hp48_module m_modules[6];
- /* RAM/ROM extensions, GX/SX only (each uint8_t stores one nibble)
+ /* RAM/ROM extensions, GX/SX only
port1: SX/GX: 32/128 KB
port2: SX:32/128KB, GX:128/512/4096 KB
*/
- uint32_t m_port_size[2];
- uint8_t m_port_write[2];
- std::unique_ptr<uint8_t[]> m_port_data[2];
+ optional_device_array<hp48_port_image_device, 2> m_port;
uint32_t m_bank_switch;
uint32_t m_io_addr;
@@ -187,55 +188,4 @@ public:
#define HP48_NCE3 4
#define HP48_NCE1 5
-/****************************** cards ********************************/
-
-class hp48_port_image_device : public device_t,
- public device_image_interface
-{
-public:
- // construction/destruction
- hp48_port_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
- void set_port_config(int port, int module, int max_size)
- {
- m_port = port;
- m_module = module;
- m_max_size = max_size;
- }
-
- // image-level overrides
- virtual iodevice_t image_type() const override { return IO_MEMCARD; }
-
- virtual bool is_readable() const override { return 1; }
- virtual bool is_writeable() const override { return 1; }
- virtual bool is_creatable() const override { return 1; }
- virtual bool must_be_loaded() const override { return 0; }
- virtual bool is_reset_on_load() const override { return 0; }
- virtual const char *file_extensions() const override { return "crd"; }
- virtual const char *custom_instance_name() const override { return "port"; }
- virtual const char *custom_brief_instance_name() const override { return "p"; }
-
- virtual image_init_result call_load() override;
- virtual void call_unload() override;
- virtual image_init_result call_create(int format_type, util::option_resolution *format_options) override;
-
-protected:
- // device-level overrides
- virtual void device_start() override;
-private:
- void fill_port();
- void unfill_port();
-
- int m_port; /* port index: 0 or 1 (for port 1 and 2) */
- int m_module; /* memory module where the port is visible */
- int m_max_size; /* maximum size, in bytes 128 KB or 4 GB */
-};
-
-// device type definition
-DECLARE_DEVICE_TYPE(HP48_PORT, hp48_port_image_device)
-
-#define MCFG_HP48_PORT_ADD(_tag, _port, _module, _max_size) \
- MCFG_DEVICE_ADD(_tag, HP48_PORT, 0) \
- downcast<hp48_port_image_device &>(*device).set_port_config(_port, _module, _max_size);
-
#endif // MAME_INCLUDES_HP84_H