~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/emucore/CartCV.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Mario Iseli
  • Date: 2006-04-08 18:38:25 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060408183825-vu1jk57rk929derx
* New Maintainer (Closes: #361345)
* New upstream release (Closes: #349725)
* Build-Depend now on libslang2-dev (Closes: #325577)
* Complete rebuild of debian/, upgraded to policy-standards
  3.6.2 and compat-level 5.
* Removed stellarc since stella only reads ~/.stellarc and even
  works without a first config.
* New debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
//  SS  SS   tt   ee      ll   ll  aa  aa
9
9
//   SSSS     ttt  eeeee llll llll  aaaaa
10
10
//
11
 
// Copyright (c) 1995-1998 by Bradford W. Mott
 
11
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
12
12
//
13
13
// See the file "license" for information on usage and redistribution of
14
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
15
//
16
 
// $Id: CartCV.cxx,v 1.4 2002/05/14 15:22:28 stephena Exp $
 
16
// $Id: CartCV.cxx,v 1.10 2005/12/17 01:23:07 stephena Exp $
17
17
//============================================================================
18
18
 
19
19
#include <assert.h>
37
37
    }
38
38
 
39
39
    // Initialize RAM with random values
40
 
    Random random;
 
40
    class Random random;
41
41
    for(uInt32 i = 0; i < 1024; ++i)
42
42
    {
43
43
      myRAM[i] = random.next();
132
132
}
133
133
 
134
134
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
135
bool CartridgeCV::patch(uInt16 address, uInt8 value)
 
136
{
 
137
        myImage[address & 0x07FF] = value;
 
138
        return true;
 
139
 
140
 
 
141
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135
142
bool CartridgeCV::save(Serializer& out)
136
143
{
137
144
  string cart = name();
141
148
    out.putString(cart);
142
149
 
143
150
    // Output RAM
144
 
    out.putLong(1024);
 
151
    out.putInt(1024);
145
152
    for(uInt32 addr = 0; addr < 1024; ++addr)
146
 
      out.putLong(myRAM[addr]);
 
153
      out.putInt(myRAM[addr]);
147
154
  }
148
155
  catch(char *msg)
149
156
  {
170
177
      return false;
171
178
 
172
179
    // Input RAM
173
 
    uInt32 limit = (uInt32) in.getLong();
 
180
    uInt32 limit = (uInt32) in.getInt();
174
181
    for(uInt32 addr = 0; addr < limit; ++addr)
175
 
      myRAM[addr] = (uInt8) in.getLong();
 
182
      myRAM[addr] = (uInt8) in.getInt();
176
183
  }
177
184
  catch(char *msg)
178
185
  {
187
194
 
188
195
  return true;
189
196
}
 
197
 
 
198
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
199
uInt8* CartridgeCV::getImage(int& size) {
 
200
  size = 2048;
 
201
  return &myImage[0];
 
202
}