trunk/src/emu/machine/x2212.c
| r26798 | r26799 | |
| 30 | 30 | |
| 31 | 31 | // device type definition |
| 32 | 32 | const device_type X2212 = &device_creator<x2212_device>; |
| 33 | const device_type X2210 = &device_creator<x2210_device>; |
| 33 | 34 | |
| 34 | 35 | //------------------------------------------------- |
| 35 | 36 | // x2212_device - constructor |
| r26798 | r26799 | |
| 47 | 48 | { |
| 48 | 49 | } |
| 49 | 50 | |
| 51 | x2212_device::x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 52 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 53 | device_memory_interface(mconfig, *this), |
| 54 | device_nvram_interface(mconfig, *this), |
| 55 | m_auto_save(false), |
| 56 | m_sram_space_config("SRAM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_sram_map)), |
| 57 | m_e2prom_space_config("E2PROM", ENDIANNESS_BIG, 8, 8, 0, *ADDRESS_MAP_NAME(x2212_e2prom_map)), |
| 58 | m_store(false), |
| 59 | m_array_recall(false) |
| 60 | { |
| 61 | } |
| 50 | 62 | |
| 51 | 63 | //------------------------------------------------- |
| 52 | 64 | // static_set_auto_save - configuration helper |
| r26798 | r26799 | |
| 70 | 82 | |
| 71 | 83 | m_sram = m_addrspace[0]; |
| 72 | 84 | m_e2prom = m_addrspace[1]; |
| 85 | |
| 86 | SIZE_DATA = 0x100; |
| 73 | 87 | } |
| 74 | 88 | |
| 89 | void x2210_device::device_start() |
| 90 | { |
| 91 | save_item(NAME(m_store)); |
| 92 | save_item(NAME(m_array_recall)); |
| 75 | 93 | |
| 94 | m_sram = m_addrspace[0]; |
| 95 | m_e2prom = m_addrspace[1]; |
| 96 | |
| 97 | SIZE_DATA = 0x40; |
| 98 | } |
| 99 | |
| 100 | |
| 76 | 101 | //------------------------------------------------- |
| 77 | 102 | // memory_space_config - return a description of |
| 78 | 103 | // any address spaces owned by this device |
| r26798 | r26799 | |
| 225 | 250 | recall(); |
| 226 | 251 | m_array_recall = (state != 0); |
| 227 | 252 | } |
| 253 | |
| 254 | |
| 255 | x2210_device::x2210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 256 | : x2212_device(mconfig, X2210, "X2210", tag, owner, clock, "x2210", __FILE__) |
| 257 | { |
| 258 | } |
trunk/src/emu/machine/x2212.h
| r26798 | r26799 | |
| 25 | 25 | MCFG_DEVICE_ADD(_tag, X2212, 0) \ |
| 26 | 26 | x2212_device::static_set_auto_save(*device); |
| 27 | 27 | |
| 28 | #define MCFG_X2210_ADD(_tag) \ |
| 29 | MCFG_DEVICE_ADD(_tag, X2210, 0) |
| 28 | 30 | |
| 31 | #define MCFG_X2210_ADD_AUTOSAVE(_tag) \ |
| 32 | MCFG_DEVICE_ADD(_tag, X2210, 0) \ |
| 33 | x2212_device::static_set_auto_save(*device); |
| 34 | |
| 35 | |
| 29 | 36 | //************************************************************************** |
| 30 | 37 | // TYPE DEFINITIONS |
| 31 | 38 | //************************************************************************** |
| r26798 | r26799 | |
| 40 | 47 | public: |
| 41 | 48 | // construction/destruction |
| 42 | 49 | x2212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 50 | x2212_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 43 | 51 | |
| 44 | 52 | // inline configuration helpers |
| 45 | 53 | static void static_set_auto_save(device_t &device); |
| r26798 | r26799 | |
| 67 | 75 | virtual void nvram_read(emu_file &file); |
| 68 | 76 | virtual void nvram_write(emu_file &file); |
| 69 | 77 | |
| 70 | | static const int SIZE_DATA = 0x100; |
| 78 | int SIZE_DATA; |
| 71 | 79 | |
| 72 | 80 | // configuration state |
| 73 | 81 | bool m_auto_save; |
| r26798 | r26799 | |
| 84 | 92 | bool m_array_recall; |
| 85 | 93 | }; |
| 86 | 94 | |
| 95 | class x2210_device : public x2212_device |
| 96 | { |
| 97 | public: |
| 98 | x2210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 87 | 99 | |
| 100 | protected: |
| 101 | // device-level overrides |
| 102 | virtual void device_start(); |
| 103 | }; |
| 104 | |
| 105 | |
| 88 | 106 | // device type definition |
| 89 | 107 | extern const device_type X2212; |
| 108 | extern const device_type X2210; |
| 90 | 109 | |
| 91 | 110 | |
| 92 | 111 | #endif |