Previous 15994 Revisions Next

r14935 Sunday 15th April, 2012 at 15:03:39 UTC by Curt Coder
[C64] Added support for the NeoRAM cartridge. [Curt Coder]
[src/mess]mess.mak
[src/mess/machine]c64_georam.c c64_neoram.c* c64_neoram.h* cbmipt.c cbmipt.h

src/mess/machine/cbmipt.c
r14934r14935
11511151   SLOT_INTERFACE("dqbb", C64_DQBB)
11521152   SLOT_INTERFACE("easyflash", C64_EASYFLASH)
11531153   SLOT_INTERFACE("georam", C64_GEORAM)
1154   SLOT_INTERFACE("neoram", C64_NEORAM)
11541155   SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
11551156   SLOT_INTERFACE("xl80", C64_XL80)
11561157
src/mess/machine/cbmipt.h
r14934r14935
3232#include "machine/c64_magic_formel.h"
3333#include "machine/c64_mikro_assembler.h"
3434#include "machine/c64_multiscreen.h"
35#include "machine/c64_neoram.h"
3536#include "machine/c64_ocean.h"
3637#include "machine/c64_pagefox.h"
3738#include "machine/c64_prophet64.h"
src/mess/machine/c64_neoram.c
r0r14935
1/**********************************************************************
2 
3    NeoRAM cartridge emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************/
9 
10#include "c64_neoram.h"
11 
12 
13 
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17 
18const device_type C64_NEORAM = &device_creator<c64_neoram_cartridge_device>;
19 
20 
21 
22//**************************************************************************
23//  LIVE DEVICE
24//**************************************************************************
25 
26//-------------------------------------------------
27//  c64_neoram_cartridge_device - constructor
28//-------------------------------------------------
29 
30c64_neoram_cartridge_device::c64_neoram_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
31   device_t(mconfig, C64_NEORAM, "C64 NeoRAM cartridge", tag, owner, clock),
32   device_c64_expansion_card_interface(mconfig, *this),
33    device_nvram_interface(mconfig, *this)
34{
35}
36 
37 
38//-------------------------------------------------
39//  device_start - device-specific startup
40//-------------------------------------------------
41 
42void c64_neoram_cartridge_device::device_start()
43{
44   // allocate memory
45   c64_nvram_pointer(machine(), 0x200000);
46 
47   // state saving
48   save_item(NAME(m_bank));
49}
50 
51 
52//-------------------------------------------------
53//  device_reset - device-specific reset
54//-------------------------------------------------
55 
56void c64_neoram_cartridge_device::device_reset()
57{
58   m_bank = 0;
59}
60 
61 
62//-------------------------------------------------
63//  c64_cd_r - cartridge data read
64//-------------------------------------------------
65 
66UINT8 c64_neoram_cartridge_device::c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
67{
68   UINT8 data = 0;
69 
70   if (!io1)
71   {
72      offs_t addr = (m_bank << 8) | (offset & 0xff);
73      data = m_nvram[addr];
74   }
75 
76   return data;
77}
78 
79 
80//-------------------------------------------------
81//  c64_cd_w - cartridge data write
82//-------------------------------------------------
83 
84void c64_neoram_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
85{
86   if (!io1)
87   {
88      offs_t addr = (m_bank << 8) | (offset & 0xff);
89      m_nvram[addr] = data;
90   }
91   else if (!io2)
92   {
93      if (BIT(offset, 0))
94      {
95         m_bank = ((data & 0x7f) << 6) | (m_bank & 0x3f);
96      }
97      else
98      {
99         m_bank = (m_bank & 0x1fc0) | (data & 0x3f);
100      }
101   }
102}
src/mess/machine/c64_neoram.h
r0r14935
1/**********************************************************************
2 
3    NeoRAM 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 __NEORAM__
13#define __NEORAM__
14 
15 
16#include "emu.h"
17#include "machine/c64exp.h"
18 
19 
20 
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24 
25// ======================> c64_neoram_cartridge_device
26 
27class c64_neoram_cartridge_device : public device_t,
28                           public device_c64_expansion_card_interface,
29                           public device_nvram_interface
30{
31public:
32   // construction/destruction
33   c64_neoram_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34 
35protected:
36   // device-level overrides
37   virtual void device_start();
38   virtual void device_reset();
39   virtual void device_config_complete() { m_shortname = "c64_neoram"; }
40 
41   // device_nvram_interface overrides
42   virtual void nvram_default() { }
43   virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
44   virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
45 
46   // device_c64_expansion_card_interface overrides
47   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
48   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
49 
50private:
51   UINT16 m_bank;
52};
53 
54 
55// device type definition
56extern const device_type C64_NEORAM;
57 
58 
59#endif
src/mess/machine/c64_georam.c
r14934r14935
4141void c64_georam_cartridge_device::device_start()
4242{
4343   // allocate memory
44   m_ram = auto_alloc_array(machine(), UINT8, 0x80000);
44   c64_ram_pointer(machine(), 0x80000);
4545 
4646   // state saving
4747   save_item(NAME(m_bank));
src/mess/mess.mak
r14934r14935
806806   $(MESS_MACHINE)/c64_magic_formel.o   \
807807   $(MESS_MACHINE)/c64_mikro_assembler.o   \
808808   $(MESS_MACHINE)/c64_multiscreen.o   \
809   $(MESS_MACHINE)/c64_neoram.o   \
809810   $(MESS_MACHINE)/c64_ocean.o   \
810811   $(MESS_MACHINE)/c64_pagefox.o   \
811812   $(MESS_MACHINE)/c64_prophet64.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team