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

« back to all changes in this revision

Viewing changes to src/emucore/CartFE.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Tom Lear
  • Date: 1999-11-06 16:41:05 UTC
  • Revision ID: james.westby@ubuntu.com-19991106164105-iygopamo5mpcozvx
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//============================================================================
 
2
//
 
3
//   SSSS    tt          lll  lll       
 
4
//  SS  SS   tt           ll   ll        
 
5
//  SS     tttttt  eeee   ll   ll   aaaa 
 
6
//   SSSS    tt   ee  ee  ll   ll      aa
 
7
//      SS   tt   eeeeee  ll   ll   aaaaa  --  "An Atari 2600 VCS Emulator"
 
8
//  SS  SS   tt   ee      ll   ll  aa  aa
 
9
//   SSSS     ttt  eeeee llll llll  aaaaa
 
10
//
 
11
// Copyright (c) 1995-1998 by Bradford W. Mott
 
12
//
 
13
// See the file "license" for information on usage and redistribution of
 
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
15
//
 
16
// $Id: CartFE.cxx,v 1.2 1998/07/15 20:51:03 bwmott Exp $
 
17
//============================================================================
 
18
 
 
19
#include <assert.h>
 
20
#include "CartFE.hxx"
 
21
#include "System.hxx"
 
22
 
 
23
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
24
CartridgeFE::CartridgeFE(const uInt8* image)
 
25
{
 
26
  // Copy the ROM image into my buffer
 
27
  for(uInt32 addr = 0; addr < 8192; ++addr)
 
28
  {
 
29
    myImage[addr] = image[addr];
 
30
  }
 
31
}
 
32
 
 
33
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
34
CartridgeFE::~CartridgeFE()
 
35
{
 
36
}
 
37
 
 
38
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
39
const char* CartridgeFE::name() const
 
40
{
 
41
  return "CartridgeFE";
 
42
}
 
43
 
 
44
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
45
void CartridgeFE::reset()
 
46
{
 
47
}
 
48
 
 
49
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
50
void CartridgeFE::install(System& system)
 
51
{
 
52
  mySystem = &system;
 
53
  uInt16 shift = mySystem->pageShift();
 
54
  uInt16 mask = mySystem->pageMask();
 
55
 
 
56
  // Make sure the system we're being installed in has a page size that'll work
 
57
  assert((0x1000 & mask) == 0);
 
58
 
 
59
  // Map all of the accesses to call peek and poke
 
60
  System::PageAccess access;
 
61
  for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
 
62
  {
 
63
    access.directPeekBase = 0;
 
64
    access.directPokeBase = 0;
 
65
    access.device = this;
 
66
    mySystem->setPageAccess(i >> shift, access);
 
67
  }
 
68
}
 
69
 
 
70
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
71
uInt8 CartridgeFE::peek(uInt16 address)
 
72
{
 
73
  // The bank is determined by A13 of the processor
 
74
  return myImage[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)];
 
75
}
 
76
 
 
77
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
78
void CartridgeFE::poke(uInt16, uInt8)
 
79
{
 
80
}
 
81