src/mess/machine/vic1111.c
| r0 | r14226 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Commodore VIC-1111 16K RAM Expansion Cartridge emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "vic1111.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | //************************************************************************** |
| 15 | // DEVICE DEFINITIONS |
| 16 | //************************************************************************** |
| 17 | |
| 18 | const device_type VIC1111 = &device_creator<vic1111_device>; |
| 19 | |
| 20 | |
| 21 | |
| 22 | //************************************************************************** |
| 23 | // LIVE DEVICE |
| 24 | //************************************************************************** |
| 25 | |
| 26 | //------------------------------------------------- |
| 27 | // vic1111_device - constructor |
| 28 | //------------------------------------------------- |
| 29 | |
| 30 | vic1111_device::vic1111_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 31 | : device_t(mconfig, VIC1111, "VIC1111", 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 vic1111_device::device_start() |
| 42 | { |
| 43 | // allocate memory |
| 44 | m_ram = auto_alloc_array(machine(), UINT8, 0x4000); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | //------------------------------------------------- |
| 49 | // vic20_blk1_r - block 1 read |
| 50 | //------------------------------------------------- |
| 51 | |
| 52 | UINT8 vic1111_device::vic20_blk1_r(address_space &space, offs_t offset) |
| 53 | { |
| 54 | return m_ram[offset & 0x1fff]; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | //------------------------------------------------- |
| 59 | // vic20_blk1_w - block 1 write |
| 60 | //------------------------------------------------- |
| 61 | |
| 62 | void vic1111_device::vic20_blk1_w(address_space &space, offs_t offset, UINT8 data) |
| 63 | { |
| 64 | m_ram[offset & 0x1fff] = data; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | //------------------------------------------------- |
| 69 | // vic20_blk2_r - block 2 read |
| 70 | //------------------------------------------------- |
| 71 | |
| 72 | UINT8 vic1111_device::vic20_blk2_r(address_space &space, offs_t offset) |
| 73 | { |
| 74 | return m_ram[0x2000 | (offset & 0x1fff)]; |
| 75 | } |
| 76 | |
| 77 | |
| 78 | //------------------------------------------------- |
| 79 | // vic20_blk2_w - block 2 write |
| 80 | //------------------------------------------------- |
| 81 | |
| 82 | void vic1111_device::vic20_blk2_w(address_space &space, offs_t offset, UINT8 data) |
| 83 | { |
| 84 | m_ram[0x2000 | (offset & 0x1fff)] = data; |
| 85 | } |
src/mess/machine/vic1111.h
| r0 | r14226 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Commodore VIC-1111 16K 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 __VIC1111__ |
| 13 | #define __VIC1111__ |
| 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 | // ======================> vic1111_device |
| 27 | |
| 28 | class vic1111_device : public device_t, |
| 29 | public device_vic20_expansion_card_interface |
| 30 | { |
| 31 | public: |
| 32 | // construction/destruction |
| 33 | vic1111_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_blk1_r(address_space &space, offs_t offset); |
| 41 | virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data); |
| 42 | virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset); |
| 43 | virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data); |
| 44 | |
| 45 | private: |
| 46 | UINT8 *m_ram; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | // device type definition |
| 51 | extern const device_type VIC1111; |
| 52 | |
| 53 | |
| 54 | |
| 55 | #endif |