src/mess/machine/vic1210.c
| r0 | r14225 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Commodore VIC-1210 3K RAM Expansion Cartridge emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "vic1210.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // DEVICE DEFINITIONS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | const device_type VIC1210 = &device_creator<vic1210_device>; |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // LIVE DEVICE |
| 24 | //************************************************************************** |
| 25 | |
| 26 | //------------------------------------------------- |
| 27 | // vic1210_device - constructor |
| 28 | //------------------------------------------------- |
| 29 | |
| 30 | vic1210_device::vic1210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 31 | : device_t(mconfig, VIC1210, "VIC1210", tag, owner, clock), |
| 32 | device_vic20_expansion_card_interface(mconfig, *this) |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | |
| 37 | //------------------------------------------------- |
| 38 | // device_start - device-specific startup |
| 39 | //------------------------------------------------- |
| 40 | |
| 41 | void vic1210_device::device_start() |
| 42 | { |
| 43 | // allocate memory |
| 44 | m_ram = auto_alloc_array(machine(), UINT8, 0xc00); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | //------------------------------------------------- |
| 49 | // vic20_ram1_r - RAM 1 read |
| 50 | //------------------------------------------------- |
| 51 | |
| 52 | UINT8 vic1210_device::vic20_ram1_r(address_space &space, offs_t offset) |
| 53 | { |
| 54 | return m_ram[offset & 0x3ff]; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // vic20_ram1_w - RAM 1 write |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | void vic1210_device::vic20_ram1_w(address_space &space, offs_t offset, UINT8 data) |
| 63 | { |
| 64 | m_ram[offset & 0x3ff] = data; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | //------------------------------------------------- |
| 69 | // vic20_ram2_r - RAM 2 read |
| 70 | //------------------------------------------------- |
| 71 | |
| 72 | UINT8 vic1210_device::vic20_ram2_r(address_space &space, offs_t offset) |
| 73 | { |
| 74 | return m_ram[0x400 | (offset & 0x3ff)]; |
| 75 | } |
| 76 | |
| 77 | |
| 78 | //------------------------------------------------- |
| 79 | // vic20_ram2_w - RAM 2 write |
| 80 | //------------------------------------------------- |
| 81 | |
| 82 | void vic1210_device::vic20_ram2_w(address_space &space, offs_t offset, UINT8 data) |
| 83 | { |
| 84 | m_ram[0x400 | (offset & 0x3ff)] = data; |
| 85 | } |
| 86 | |
| 87 | |
| 88 | //------------------------------------------------- |
| 89 | // vic20_ram3_r - RAM 3 read |
| 90 | //------------------------------------------------- |
| 91 | |
| 92 | UINT8 vic1210_device::vic20_ram3_r(address_space &space, offs_t offset) |
| 93 | { |
| 94 | return m_ram[0x800 | (offset & 0x3ff)]; |
| 95 | } |
| 96 | |
| 97 | |
| 98 | //------------------------------------------------- |
| 99 | // vic20_ram3_w - RAM 3 write |
| 100 | //------------------------------------------------- |
| 101 | |
| 102 | void vic1210_device::vic20_ram3_w(address_space &space, offs_t offset, UINT8 data) |
| 103 | { |
| 104 | m_ram[0x800 | (offset & 0x3ff)] = data; |
| 105 | } |
src/mess/machine/vic1210.h
| r0 | r14225 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Commodore VIC-1210 3K RAM Expansion Cartridge emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #ifndef __VIC1210__ |
| 13 | #define __VIC1210__ |
| 14 | |
| 15 | #define ADDRESS_MAP_MODERN |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "machine/vic20exp.h" |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // TYPE DEFINITIONS |
| 24 | //************************************************************************** |
| 25 | |
| 26 | // ======================> vic1210_device |
| 27 | |
| 28 | class vic1210_device : public device_t, |
| 29 | public device_vic20_expansion_card_interface |
| 30 | { |
| 31 | public: |
| 32 | // construction/destruction |
| 33 | vic1210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | |
| 35 | protected: |
| 36 | // device-level overrides |
| 37 | virtual void device_start(); |
| 38 | |
| 39 | // device_vic20_expansion_card_interface overrides |
| 40 | virtual UINT8 vic20_ram1_r(address_space &space, offs_t offset); |
| 41 | virtual void vic20_ram1_w(address_space &space, offs_t offset, UINT8 data); |
| 42 | virtual UINT8 vic20_ram2_r(address_space &space, offs_t offset); |
| 43 | virtual void vic20_ram2_w(address_space &space, offs_t offset, UINT8 data); |
| 44 | virtual UINT8 vic20_ram3_r(address_space &space, offs_t offset); |
| 45 | virtual void vic20_ram3_w(address_space &space, offs_t offset, UINT8 data); |
| 46 | |
| 47 | private: |
| 48 | UINT8 *m_ram; |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | // device type definition |
| 53 | extern const device_type VIC1210; |
| 54 | |
| 55 | |
| 56 | |
| 57 | #endif |