summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2018-05-18 15:54:56 +0200
committer angelosa <salese_corp_ltd@email.it>2018-05-18 15:54:56 +0200
commit49d866b5c3c360e4a044d96e08d7b4063a84f7bb (patch)
treefbcb734f35b19b8868279c99ed68688b2a554500
parent121a0cf14980888d75df2f42ca04738c9cde70c5 (diff)
dc-ctrl.cpp: refactor/renaming common device settings (nw)
-rw-r--r--src/mame/machine/dc-ctrl.cpp30
-rw-r--r--src/mame/machine/dc-ctrl.h14
2 files changed, 27 insertions, 17 deletions
diff --git a/src/mame/machine/dc-ctrl.cpp b/src/mame/machine/dc-ctrl.cpp
index b76b7a450b0..36b56ab73e0 100644
--- a/src/mame/machine/dc-ctrl.cpp
+++ b/src/mame/machine/dc-ctrl.cpp
@@ -67,14 +67,17 @@ DEFINE_DEVICE_TYPE(DC_CONTROLLER, dc_controller_device, "dcctrl", "Dreamcast Con
dc_controller_device::dc_controller_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
dc_common_device(mconfig, DC_CONTROLLER, tag, owner, clock)
{
- id = "Dreamcast Controller";
+ model = "Dreamcast Controller";
license = "Produced By or Under License From SEGA ENTERPRISES,LTD.";
versions = "Version 1.000,1998/05/11,315-6215-AB ,Analog Module: The 4th Edition. 05/08";
+ id = 0x01000000; // Controller
+ electric_current = 0x01f401ae; // max 50mA, standby 43mA
+ region = 0x00ff;
}
void dc_controller_device::fixed_status(uint32_t *dest)
{
- dest[0] = 0x01000000; // Controller
+ dest[0] = id;
dest[1] =
((port[2] != nullptr) ? 0x0100 : 0) |
((port[3] != nullptr) ? 0x0200 : 0) |
@@ -86,10 +89,10 @@ void dc_controller_device::fixed_status(uint32_t *dest)
((port[1] ? port[1]->active() : 0) << 16); // 1st function - controller
dest[2] = 0; // No 2nd function
dest[3] = 0; // No 3rd function
- dest[4] = 0x00ff; // Every region, no expansion
- copy_with_spaces(((uint8_t *)dest) + 18, id, 30);
+ dest[4] = region; // Every region, no expansion
+ copy_with_spaces(((uint8_t *)dest) + 18, model, 30);
copy_with_spaces(((uint8_t *)dest) + 48, license, 60);
- dest[27] = 0x01f401ae; // standby 43mA, max 50mA
+ dest[27] = electric_current;
}
void dc_controller_device::free_status(uint32_t *dest)
@@ -99,7 +102,7 @@ void dc_controller_device::free_status(uint32_t *dest)
void dc_controller_device::read(uint32_t *dest)
{
- dest[0] = 0x01000000; // Controller
+ dest[0] = id; // Controller
dest[1] =
(port[0] ? port[0]->read() : 0xff) |
((port[1] ? port[1]->read() : 0xff) << 8) |
@@ -123,21 +126,24 @@ DEFINE_DEVICE_TYPE(DC_KEYBOARD, dc_keyboard_device, "dckb", "Dreamcast Keyboard"
dc_keyboard_device::dc_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
dc_common_device(mconfig, DC_KEYBOARD, tag, owner, clock)
{
- id = "92key Keyboard for JPN";
+ model = "92key Keyboard for JPN";
license = "Produced By or Under License From SEGA ENTERPRISES,LTD.";
versions = "Version 1.000,1998/06/12,315-6215-AD ,Key Scan Module: The 1st Edition. 05/20";
+ id = 0x40000000; // Keyboard
+ electric_current = 0x0190015e; // max 40mA, standby 35mA
+ region = 0x0002; // Japan region, no expansion
}
void dc_keyboard_device::fixed_status(uint32_t *dest)
{
- dest[0] = 0x40000000; // Keyboard
+ dest[0] = id; // Keyboard
dest[1] = 0x00201000; // 1st function
dest[2] = 0x00000008; // No 2nd function (doc returns 8 here tho?)
dest[3] = 0x00000000; // No 3rd function
- dest[4] = 0x00000002; // Japan region, no expansion
- copy_with_spaces(((uint8_t *)dest) + 18, id, 30);
+ dest[4] = region;
+ copy_with_spaces(((uint8_t *)dest) + 18, model, 30);
copy_with_spaces(((uint8_t *)dest) + 48, license, 60);
- dest[27] = 0x0190015e; // standby 35mA, max 40mA
+ dest[27] = electric_current;
}
void dc_keyboard_device::free_status(uint32_t *dest)
@@ -147,7 +153,7 @@ void dc_keyboard_device::free_status(uint32_t *dest)
void dc_keyboard_device::read(uint32_t *dest)
{
- dest[0] = 0x40000000; // Keyboard
+ dest[0] = id;
// key code
dest[1] =
(port[0] ? port[0]->read() : 0) |
diff --git a/src/mame/machine/dc-ctrl.h b/src/mame/machine/dc-ctrl.h
index 3db218e3afc..51b040be08e 100644
--- a/src/mame/machine/dc-ctrl.h
+++ b/src/mame/machine/dc-ctrl.h
@@ -18,8 +18,8 @@
downcast<dc_common_device &>(*device).set_port_tag(6, a4); \
downcast<dc_common_device &>(*device).set_port_tag(7, a5);
-#define MCFG_DC_CONTROLLER_SET_ID(id) \
- downcast<dc_common_device &>(*device).set_id(id);
+#define MCFG_DC_CONTROLLER_SET_MODEL(name) \
+ downcast<dc_common_device &>(*device).set_model(name);
#define MCFG_DC_CONTROLLER_SET_LICENSE(license) \
downcast<dc_common_device &>(*device).set_license(license);
@@ -34,7 +34,8 @@ public:
dc_common_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void set_port_tag(int port, const char *tag) { port_tag[port] = tag; }
- void set_id(const char *new_id) { id = new_id; }
+ // TODO: we probably don't need these setters
+ void set_model(const char *new_id) { model = new_id; }
void set_license(const char *new_license) { license = new_license; }
void set_versions(const char *new_versions) { versions = new_versions; }
@@ -45,8 +46,11 @@ protected:
virtual void device_start() override;
const char *port_tag[8];
- const char *id, *license, *versions;
-
+ const char *model, *license, *versions;
+ uint32_t id;
+ uint32_t electric_current;
+ uint32_t region;
+
ioport_port *port[8];
virtual void fixed_status(uint32_t *dest) = 0;