src/mess/machine/vic1210.c
| r14227 | r14228 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | 3 | Commodore VIC-1210 3K RAM Expansion Cartridge emulation |
| 4 | Commodore VIC-1211A Super Expander with 3K RAM Cartridge emulation |
| 4 | 5 | |
| 5 | 6 | Copyright MESS Team. |
| 6 | 7 | Visit http://mamedev.org for licensing and usage restrictions. |
| r14227 | r14228 | |
| 16 | 17 | //************************************************************************** |
| 17 | 18 | |
| 18 | 19 | const device_type VIC1210 = &device_creator<vic1210_device>; |
| 20 | const device_type VIC1211A = &device_creator<vic1211a_device>; |
| 19 | 21 | |
| 20 | 22 | |
| 23 | //------------------------------------------------- |
| 24 | // ROM( vic1211a ) |
| 25 | //------------------------------------------------- |
| 21 | 26 | |
| 27 | ROM_START( vic1211a ) |
| 28 | ROM_REGION( 0x2000, "blk5", 0 ) |
| 29 | ROM_LOAD( "325323-01", 0x0000, 0x1000, CRC(c576ba40) SHA1(aa92ac00a945d8496d7f2bf1c869736ee840d7c5) ) |
| 30 | ROM_END |
| 31 | |
| 32 | |
| 33 | //------------------------------------------------- |
| 34 | // rom_region - device-specific ROM region |
| 35 | //------------------------------------------------- |
| 36 | |
| 37 | const rom_entry *vic1211a_device::device_rom_region() const |
| 38 | { |
| 39 | return ROM_NAME( vic1211a ); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | |
| 22 | 44 | //************************************************************************** |
| 23 | 45 | // LIVE DEVICE |
| 24 | 46 | //************************************************************************** |
| r14227 | r14228 | |
| 27 | 49 | // vic1210_device - constructor |
| 28 | 50 | //------------------------------------------------- |
| 29 | 51 | |
| 52 | vic1210_device::vic1210_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) |
| 53 | : device_t(mconfig, type, name, tag, owner, clock), |
| 54 | device_vic20_expansion_card_interface(mconfig, *this) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | |
| 30 | 59 | vic1210_device::vic1210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 31 | 60 | : device_t(mconfig, VIC1210, "VIC1210", tag, owner, clock), |
| 32 | 61 | device_vic20_expansion_card_interface(mconfig, *this) |
| r14227 | r14228 | |
| 35 | 64 | |
| 36 | 65 | |
| 37 | 66 | //------------------------------------------------- |
| 67 | // vic1211a_device - constructor |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | vic1211a_device::vic1211a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 71 | : vic1210_device(mconfig, VIC1211A, "VIC1211A", tag, owner, clock) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | |
| 76 | //------------------------------------------------- |
| 38 | 77 | // device_start - device-specific startup |
| 39 | 78 | //------------------------------------------------- |
| 40 | 79 | |
| r14227 | r14228 | |
| 46 | 85 | |
| 47 | 86 | |
| 48 | 87 | //------------------------------------------------- |
| 88 | // device_start - device-specific startup |
| 89 | //------------------------------------------------- |
| 90 | |
| 91 | void vic1211a_device::device_start() |
| 92 | { |
| 93 | // allocate memory |
| 94 | m_ram = auto_alloc_array(machine(), UINT8, 0xc00); |
| 95 | m_rom = subregion("blk5")->base(); |
| 96 | } |
| 97 | |
| 98 | |
| 99 | //------------------------------------------------- |
| 49 | 100 | // vic20_ram1_r - RAM 1 read |
| 50 | 101 | //------------------------------------------------- |
| 51 | 102 | |
| r14227 | r14228 | |
| 103 | 154 | { |
| 104 | 155 | m_ram[0x800 | (offset & 0x3ff)] = data; |
| 105 | 156 | } |
| 157 | |
| 158 | |
| 159 | //------------------------------------------------- |
| 160 | // vic20_blk5_r - block 5 read |
| 161 | //------------------------------------------------- |
| 162 | |
| 163 | UINT8 vic1211a_device::vic20_blk5_r(address_space &space, offs_t offset) |
| 164 | { |
| 165 | return m_rom[offset & 0xfff]; |
| 166 | } |
src/mess/machine/vic1210.h
| r14227 | r14228 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | 3 | Commodore VIC-1210 3K RAM Expansion Cartridge emulation |
| 4 | Commodore VIC-1211A Super Expander with 3K RAM Cartridge emulation |
| 4 | 5 | |
| 5 | 6 | Copyright MESS Team. |
| 6 | 7 | Visit http://mamedev.org for licensing and usage restrictions. |
| r14227 | r14228 | |
| 30 | 31 | { |
| 31 | 32 | public: |
| 32 | 33 | // construction/destruction |
| 34 | vic1210_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); |
| 33 | 35 | vic1210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 34 | 36 | |
| 35 | 37 | protected: |
| r14227 | r14228 | |
| 44 | 46 | virtual UINT8 vic20_ram3_r(address_space &space, offs_t offset); |
| 45 | 47 | virtual void vic20_ram3_w(address_space &space, offs_t offset, UINT8 data); |
| 46 | 48 | |
| 47 | | private: |
| 48 | 49 | UINT8 *m_ram; |
| 49 | 50 | }; |
| 50 | 51 | |
| 51 | 52 | |
| 53 | // ======================> vic1211a_device |
| 54 | |
| 55 | class vic1211a_device : public vic1210_device |
| 56 | { |
| 57 | public: |
| 58 | // construction/destruction |
| 59 | vic1211a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 60 | |
| 61 | protected: |
| 62 | // device-level overrides |
| 63 | virtual void device_start(); |
| 64 | virtual void device_config_complete() { m_shortname = "vic1211a"; } |
| 65 | |
| 66 | // optional information overrides |
| 67 | virtual const rom_entry *device_rom_region() const; |
| 68 | |
| 69 | // device_vic20_expansion_card_interface overrides |
| 70 | virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset); |
| 71 | |
| 72 | private: |
| 73 | UINT8 *m_rom; |
| 74 | }; |
| 75 | |
| 76 | |
| 52 | 77 | // device type definition |
| 53 | 78 | extern const device_type VIC1210; |
| 79 | extern const device_type VIC1211A; |
| 54 | 80 | |
| 55 | 81 | |
| 56 | 82 | |