trunk/src/emu/machine/machine.mak
| r31821 | r31822 | |
| 890 | 890 | |
| 891 | 891 | #------------------------------------------------- |
| 892 | 892 | # |
| 893 | #@src/emu/machine/mb8421.h,MACHINES += MB8421 |
| 894 | #------------------------------------------------- |
| 895 | |
| 896 | ifneq ($(filter MB8421,$(MACHINES)),) |
| 897 | MACHINEOBJS += $(MACHINEOBJ)/mb8421.o |
| 898 | endif |
| 899 | |
| 900 | #------------------------------------------------- |
| 901 | # |
| 893 | 902 | #@src/emu/machine/mb87078.h,MACHINES += MB87078 |
| 894 | 903 | #------------------------------------------------- |
| 895 | 904 | |
trunk/src/emu/machine/mb8421.c
| r0 | r31822 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:hap |
| 3 | /********************************************************************** |
| 4 | |
| 5 | Fujitsu MB8421/22/31/32-90/-90L/-90LL/-12/-12L/-12LL |
| 6 | CMOS 16K-bit (2KB) dual-port SRAM |
| 7 | |
| 8 | TODO: |
| 9 | - retransmit (RT pin) |
| 10 | - cascaded width expansion mode (when needed) |
| 11 | |
| 12 | **********************************************************************/ |
| 13 | |
| 14 | #include "machine/mb8421.h" |
| 15 | |
| 16 | |
| 17 | const device_type MB8421 = &device_creator<mb8421_device>; |
| 18 | |
| 19 | //------------------------------------------------- |
| 20 | // mb8421_device - constructor |
| 21 | //------------------------------------------------- |
| 22 | |
| 23 | mb8421_device::mb8421_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 24 | : device_t(mconfig, MB8421, "MB8421 DPSRAM", tag, owner, clock, "mb8421", __FILE__), |
| 25 | m_intl_handler(*this), |
| 26 | m_intr_handler(*this) |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | //------------------------------------------------- |
| 31 | // device_start - device-specific startup |
| 32 | //------------------------------------------------- |
| 33 | |
| 34 | void mb8421_device::device_start() |
| 35 | { |
| 36 | memset(m_ram, 0, 0x800); |
| 37 | |
| 38 | // resolve callbacks |
| 39 | m_intl_handler.resolve_safe(); |
| 40 | m_intr_handler.resolve_safe(); |
| 41 | |
| 42 | // state save |
| 43 | save_item(NAME(m_ram)); |
| 44 | } |
| 45 | |
| 46 | //------------------------------------------------- |
| 47 | // device_reset - device-specific reset |
| 48 | //------------------------------------------------- |
| 49 | |
| 50 | void mb8421_device::device_reset() |
| 51 | { |
| 52 | m_intl_handler(0); |
| 53 | m_intr_handler(0); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | |
| 58 | WRITE8_MEMBER(mb8421_device::left_w) |
| 59 | { |
| 60 | offset &= 0x7ff; |
| 61 | |
| 62 | if (offset == 0x7ff) |
| 63 | m_intr_handler(1); |
| 64 | |
| 65 | m_ram[offset] = data; |
| 66 | } |
| 67 | |
| 68 | READ8_MEMBER(mb8421_device::left_r) |
| 69 | { |
| 70 | offset &= 0x7ff; |
| 71 | |
| 72 | if (offset == 0x7fe) |
| 73 | m_intl_handler(0); |
| 74 | |
| 75 | return m_ram[offset]; |
| 76 | } |
| 77 | |
| 78 | WRITE8_MEMBER(mb8421_device::right_w) |
| 79 | { |
| 80 | offset &= 0x7ff; |
| 81 | |
| 82 | if (offset == 0x7fe) |
| 83 | m_intl_handler(1); |
| 84 | |
| 85 | m_ram[offset] = data; |
| 86 | } |
| 87 | |
| 88 | READ8_MEMBER(mb8421_device::right_r) |
| 89 | { |
| 90 | offset &= 0x7ff; |
| 91 | |
| 92 | if (offset == 0x7ff) |
| 93 | m_intr_handler(0); |
| 94 | |
| 95 | return m_ram[offset]; |
| 96 | } |
trunk/src/emu/machine/mb8421.h
| r0 | r31822 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:hap |
| 3 | /********************************************************************** |
| 4 | |
| 5 | Fujitsu MB8421/22/31/32-90/-90L/-90LL/-12/-12L/-12LL |
| 6 | CMOS 16K-bit (2KB) dual-port SRAM |
| 7 | |
| 8 | Copyright MAME Team. |
| 9 | Visit http://mamedev.org for licensing and usage restrictions. |
| 10 | |
| 11 | **********************************************************************/ |
| 12 | |
| 13 | #pragma once |
| 14 | |
| 15 | #ifndef _MB8421_H |
| 16 | #define _MB8421_H |
| 17 | |
| 18 | #include "emu.h" |
| 19 | |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // INTERFACE CONFIGURATION MACROS |
| 23 | //************************************************************************** |
| 24 | |
| 25 | // note: INT pins are only available on MB84x1 |
| 26 | // INTL is for the CPU on the left side, INTR for the one on the right |
| 27 | #define MCFG_MB8421_INTL_HANDLER(_devcb) \ |
| 28 | devcb = &mb8421_device::set_intl_handler(*device, DEVCB_##_devcb); |
| 29 | |
| 30 | #define MCFG_MB8421_INTR_HANDLER(_devcb) \ |
| 31 | devcb = &mb8421_device::set_intr_handler(*device, DEVCB_##_devcb); |
| 32 | |
| 33 | |
| 34 | |
| 35 | //************************************************************************** |
| 36 | // TYPE DEFINITIONS |
| 37 | //************************************************************************** |
| 38 | |
| 39 | // ======================> mb8421_device |
| 40 | |
| 41 | class mb8421_device : public device_t |
| 42 | { |
| 43 | public: |
| 44 | mb8421_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 45 | |
| 46 | // static configuration helpers |
| 47 | template<class _Object> static devcb_base &set_intl_handler(device_t &device, _Object object) { return downcast<mb8421_device &>(device).m_intl_handler.set_callback(object); } |
| 48 | template<class _Object> static devcb_base &set_intr_handler(device_t &device, _Object object) { return downcast<mb8421_device &>(device).m_intr_handler.set_callback(object); } |
| 49 | |
| 50 | DECLARE_READ_LINE_MEMBER( busy_r ) { return 0; } // _BUSY pin - not emulated |
| 51 | |
| 52 | DECLARE_WRITE8_MEMBER( left_w ); |
| 53 | DECLARE_READ8_MEMBER( left_r ); |
| 54 | DECLARE_WRITE8_MEMBER( right_w ); |
| 55 | DECLARE_READ8_MEMBER( right_r ); |
| 56 | |
| 57 | protected: |
| 58 | // device-level overrides |
| 59 | virtual void device_start(); |
| 60 | virtual void device_reset(); |
| 61 | |
| 62 | private: |
| 63 | UINT8 m_ram[0x800]; |
| 64 | |
| 65 | devcb_write_line m_intl_handler; |
| 66 | devcb_write_line m_intr_handler; |
| 67 | }; |
| 68 | |
| 69 | // device type definition |
| 70 | extern const device_type MB8421; |
| 71 | |
| 72 | |
| 73 | #endif /* _MB8421_H */ |