src/mess/machine/z88_ram.h
| r14744 | r14745 | |
| 29 | 29 | virtual DECLARE_READ8_MEMBER(read); |
| 30 | 30 | virtual DECLARE_WRITE8_MEMBER(write); |
| 31 | 31 | virtual UINT8* get_cart_base(); |
| 32 | | virtual int get_cart_size() { return 0x8000; } |
| 32 | virtual UINT32 get_cart_size() { return 0x8000; } |
| 33 | 33 | |
| 34 | 34 | protected: |
| 35 | 35 | // internal state |
| r14744 | r14745 | |
| 49 | 49 | virtual void device_config_complete() { m_shortname = "z88_128k_ram"; } |
| 50 | 50 | |
| 51 | 51 | // z88cart_interface overrides |
| 52 | | virtual int get_cart_size() { return 0x20000; } |
| 52 | virtual UINT32 get_cart_size() { return 0x20000; } |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | 55 | // ======================> z88_512k_ram_device |
| r14744 | r14745 | |
| 65 | 65 | virtual void device_config_complete() { m_shortname = "z88_512k_ram"; } |
| 66 | 66 | |
| 67 | 67 | // z88cart_interface overrides |
| 68 | | virtual int get_cart_size() { return 0x80000; } |
| 68 | virtual UINT32 get_cart_size() { return 0x80000; } |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | 71 | // ======================> z88_1024k_ram_device |
| r14744 | r14745 | |
| 81 | 81 | virtual void device_config_complete() { m_shortname = "z88_1024k_ram"; } |
| 82 | 82 | |
| 83 | 83 | // z88cart_interface overrides |
| 84 | | virtual int get_cart_size() { return 0x100000; } |
| 84 | virtual UINT32 get_cart_size() { return 0x100000; } |
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | 87 | // device type definition |
src/mess/machine/z88_flash.c
| r0 | r14745 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | z88_flash.c |
| 4 | |
| 5 | Z88 Flash cartridges emulation |
| 6 | |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | #include "emu.h" |
| 10 | #include "z88_flash.h" |
| 11 | |
| 12 | |
| 13 | //************************************************************************** |
| 14 | // MACROS/CONSTANTS |
| 15 | //************************************************************************** |
| 16 | |
| 17 | #define FLASH_TAG "flash" |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // DEVICE DEFINITIONS |
| 21 | //************************************************************************** |
| 22 | |
| 23 | const device_type Z88_1024K_FLASH = &device_creator<z88_1024k_flash_device>; |
| 24 | |
| 25 | //------------------------------------------------- |
| 26 | // MACHINE_CONFIG_FRAGMENT( z88_flash ) |
| 27 | //------------------------------------------------- |
| 28 | |
| 29 | static MACHINE_CONFIG_FRAGMENT(z88_flash) |
| 30 | MCFG_INTEL_E28F008SA_ADD(FLASH_TAG) |
| 31 | MACHINE_CONFIG_END |
| 32 | |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // LIVE DEVICE |
| 36 | //************************************************************************** |
| 37 | |
| 38 | //------------------------------------------------- |
| 39 | // z88_1024k_flash_device - constructor |
| 40 | //------------------------------------------------- |
| 41 | |
| 42 | z88_1024k_flash_device::z88_1024k_flash_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 43 | : device_t(mconfig, Z88_1024K_FLASH, "Z88 1024KB Flash", tag, owner, clock), |
| 44 | device_z88cart_interface( mconfig, *this ), |
| 45 | m_flash(*this, FLASH_TAG) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | //------------------------------------------------- |
| 50 | // device_start - device-specific startup |
| 51 | //------------------------------------------------- |
| 52 | |
| 53 | void z88_1024k_flash_device::device_start() |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // device_mconfig_additions |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | machine_config_constructor z88_1024k_flash_device::device_mconfig_additions() const |
| 63 | { |
| 64 | return MACHINE_CONFIG_NAME( z88_flash ); |
| 65 | } |
| 66 | |
| 67 | /*------------------------------------------------- |
| 68 | get_cart_base |
| 69 | -------------------------------------------------*/ |
| 70 | |
| 71 | UINT8* z88_1024k_flash_device::get_cart_base() |
| 72 | { |
| 73 | return (UINT8*)m_flash->space()->get_read_ptr(0); |
| 74 | } |
| 75 | |
| 76 | /*------------------------------------------------- |
| 77 | read |
| 78 | -------------------------------------------------*/ |
| 79 | |
| 80 | READ8_MEMBER(z88_1024k_flash_device::read) |
| 81 | { |
| 82 | return m_flash->read(offset & (get_cart_size() - 1)); |
| 83 | } |
| 84 | |
| 85 | /*------------------------------------------------- |
| 86 | write |
| 87 | -------------------------------------------------*/ |
| 88 | |
| 89 | WRITE8_MEMBER(z88_1024k_flash_device::write) |
| 90 | { |
| 91 | m_flash->write(offset & (get_cart_size() - 1), data); |
| 92 | } |
src/mess/machine/z88_flash.h
| r0 | r14745 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __Z88_FLASH_H__ |
| 4 | #define __Z88_FLASH_H__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | #include "machine/z88cart.h" |
| 8 | #include "machine/intelfsh.h" |
| 9 | |
| 10 | //************************************************************************** |
| 11 | // TYPE DEFINITIONS |
| 12 | //************************************************************************** |
| 13 | |
| 14 | // ======================> z88_1024k_flash_device |
| 15 | |
| 16 | class z88_1024k_flash_device : public device_t, |
| 17 | public device_z88cart_interface |
| 18 | { |
| 19 | public: |
| 20 | // construction/destruction |
| 21 | z88_1024k_flash_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 22 | |
| 23 | // optional information overrides |
| 24 | virtual machine_config_constructor device_mconfig_additions() const; |
| 25 | |
| 26 | protected: |
| 27 | // device-level overrides |
| 28 | virtual void device_start(); |
| 29 | virtual void device_config_complete() { m_shortname = "z88_1024k_flash"; } |
| 30 | |
| 31 | // z88cart_interface overrides |
| 32 | virtual DECLARE_READ8_MEMBER(read); |
| 33 | virtual DECLARE_WRITE8_MEMBER(write); |
| 34 | virtual UINT8* get_cart_base(); |
| 35 | virtual UINT32 get_cart_size() { return 0x100000; } |
| 36 | |
| 37 | private: |
| 38 | required_device<intelfsh8_device> m_flash; |
| 39 | }; |
| 40 | |
| 41 | // device type definition |
| 42 | extern const device_type Z88_1024K_FLASH; |
| 43 | |
| 44 | |
| 45 | #endif /* __Z88_FLASH_H__ */ |
src/mess/machine/z88_rom.h
| r14744 | r14745 | |
| 28 | 28 | // z88cart_interface overrides |
| 29 | 29 | virtual DECLARE_READ8_MEMBER(read); |
| 30 | 30 | virtual UINT8* get_cart_base(); |
| 31 | | virtual int get_cart_size() { return 0x8000; } |
| 31 | virtual UINT32 get_cart_size() { return 0x8000; } |
| 32 | 32 | |
| 33 | 33 | protected: |
| 34 | 34 | // internal state |
| r14744 | r14745 | |
| 48 | 48 | virtual void device_config_complete() { m_shortname = "z88_128k_rom"; } |
| 49 | 49 | |
| 50 | 50 | // z88cart_interface overrides |
| 51 | | virtual int get_cart_size() { return 0x20000; } |
| 51 | virtual UINT32 get_cart_size() { return 0x20000; } |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | // ======================> z88_256k_rom_device |
| r14744 | r14745 | |
| 64 | 64 | virtual void device_config_complete() { m_shortname = "z88_256k_rom"; } |
| 65 | 65 | |
| 66 | 66 | // z88cart_interface overrides |
| 67 | | virtual int get_cart_size() { return 0x200000; } |
| 67 | virtual UINT32 get_cart_size() { return 0x200000; } |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | 70 | // device type definition |