~ubuntu-branches/debian/sid/stella/sid

« back to all changes in this revision

Viewing changes to src/emucore/Cart4A50.cxx

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2012-06-02 07:33:16 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120602073316-20r4hr32t4oj36u9
Tags: 3.7-1
* New upstream version.
* Update description and documentation with new features in 3.7, notably
  Blargg TV filters (replacing the filters available in versions 3.4.1
  and earlier).
* Switch to debhelper compatibility level 9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
// See the file "License.txt" for information on usage and redistribution of
15
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
16
//
17
 
// $Id: Cart4A50.cxx 2318 2011-12-31 21:56:36Z stephena $
 
17
// $Id: Cart4A50.cxx 2499 2012-05-25 12:41:19Z stephena $
18
18
//============================================================================
19
19
 
20
20
#include <cassert>
452
452
    out.putString(name());
453
453
 
454
454
    // The 32K bytes of RAM
455
 
    out.putInt(32768);
456
 
    for(uInt32 i = 0; i < 32768; ++i)
457
 
      out.putByte((char)myRAM[i]);
 
455
    out.putByteArray(myRAM, 32768);
458
456
 
459
457
    // Index pointers
460
 
    out.putInt(mySliceLow);
461
 
    out.putInt(mySliceMiddle);
462
 
    out.putInt(mySliceHigh);
 
458
    out.putShort(mySliceLow);
 
459
    out.putShort(mySliceMiddle);
 
460
    out.putShort(mySliceHigh);
463
461
 
464
462
    // Whether index pointers are for ROM or RAM
465
463
    out.putBool(myIsRomLow);
468
466
 
469
467
    // Last address and data values
470
468
    out.putByte(myLastData);
471
 
    out.putInt(myLastAddress);
 
469
    out.putShort(myLastAddress);
472
470
  }
473
 
  catch(const char* msg)
 
471
  catch(...)
474
472
  {
475
 
    cerr << "ERROR: Cartridge4A40::save" << endl << "  " << msg << endl;
 
473
    cerr << "ERROR: Cartridge4A40::save" << endl;
476
474
    return false;
477
475
  }
478
476
 
487
485
    if(in.getString() != name())
488
486
      return false;
489
487
 
490
 
    uInt32 limit = (uInt32) in.getInt();
491
 
    for(uInt32 i = 0; i < limit; ++i)
492
 
      myRAM[i] = (uInt8) in.getByte();
 
488
    in.getByteArray(myRAM, 32768);
493
489
 
494
490
    // Index pointers
495
 
    mySliceLow = (uInt16) in.getInt();
496
 
    mySliceMiddle = (uInt16) in.getInt();
497
 
    mySliceHigh = (uInt16) in.getInt();
 
491
    mySliceLow = in.getShort();
 
492
    mySliceMiddle = in.getShort();
 
493
    mySliceHigh = in.getShort();
498
494
 
499
495
    // Whether index pointers are for ROM or RAM
500
496
    myIsRomLow = in.getBool();
502
498
    myIsRomHigh = in.getBool();
503
499
 
504
500
    // Last address and data values
505
 
    myLastData = (uInt8) in.getByte();
506
 
    myLastAddress = (uInt16) in.getInt();
 
501
    myLastData = in.getByte();
 
502
    myLastAddress = in.getShort();
507
503
  }
508
 
  catch(const char* msg)
 
504
  catch(...)
509
505
  {
510
 
    cerr << "ERROR: Cartridge4A50::load" << endl << "  " << msg << endl;
 
506
    cerr << "ERROR: Cartridge4A50::load" << endl;
511
507
    return false;
512
508
  }
513
509