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

« back to all changes in this revision

Viewing changes to src/emucore/CartE7.hxx

  • 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: CartE7.hxx,v 1.2 1998/07/15 20:30:56 bwmott Exp $
 
17
//============================================================================
 
18
 
 
19
#ifndef CARTRIDGEE7_HXX
 
20
#define CARTRIDGEE7_HXX
 
21
 
 
22
class CartridgeE7;
 
23
 
 
24
#include "bspf.hxx"
 
25
#include "Cart.hxx"
 
26
 
 
27
/**
 
28
  This is the cartridge class for M-Network bankswitched games.  
 
29
  In this bankswitching scheme the 2600's 4K cartridge address 
 
30
  space is broken into two 2K segments.
 
31
 
 
32
  Kevin Horton describes E7 as follows:
 
33
 
 
34
    Only M-Network used this scheme. This has to be the 
 
35
    most complex method used in any cart! :-)  It allows 
 
36
    for the capability of 2K of RAM; although it doesn't 
 
37
    have to be used (in fact, only one cart used it).  
 
38
    There are now 8 2K banks, instead of 4.  The last 2K 
 
39
    in the cart always points to the last 2K of the ROM 
 
40
    image, while the first 2K is selectable.  You access 
 
41
    1FE0 to 1FE6 to select which 2K bank. Note that you
 
42
    cannot select the last 2K of the ROM image into the 
 
43
    lower 2K of the cart!  Accessing 1FE7 selects 1K of 
 
44
    RAM at 1000-17FF instead of ROM!  The 2K of RAM is
 
45
    broken up into two 1K sections.  One 1K section is 
 
46
    mapped in at 1000-17FF if 1FE7 has been accessed.  
 
47
    1000-13FF is the write port, while 1400-17FF is the 
 
48
    read port.  The second 1K of RAM appears at 1800-19FF.  
 
49
    1800-18FF is the write port while 1900-19FF is the 
 
50
    read port.  You select which 256 byte block appears 
 
51
    here by accessing 1FF8 to 1FFB.
 
52
 
 
53
  @author  Bradford W. Mott
 
54
  @version $Id: CartE7.hxx,v 1.2 1998/07/15 20:30:56 bwmott Exp $
 
55
*/
 
56
class CartridgeE7 : public Cartridge
 
57
{
 
58
  public:
 
59
    /**
 
60
      Create a new cartridge using the specified image
 
61
 
 
62
      @param image Pointer to the ROM image
 
63
    */
 
64
    CartridgeE7(const uInt8* image);
 
65
 
 
66
    /**
 
67
      Destructor
 
68
    */
 
69
    virtual ~CartridgeE7();
 
70
 
 
71
  public:
 
72
    /**
 
73
      Get a null terminated string which is the device's name (i.e. "M6532")
 
74
 
 
75
      @return The name of the device
 
76
    */
 
77
    virtual const char* name() const;
 
78
 
 
79
    /**
 
80
      Reset device to its power-on state
 
81
    */
 
82
    virtual void reset();
 
83
 
 
84
    /**
 
85
      Install cartridge in the specified system.  Invoked by the system
 
86
      when the cartridge is attached to it.
 
87
 
 
88
      @param system The system the device should install itself in
 
89
    */
 
90
    virtual void install(System& system);
 
91
 
 
92
  public:
 
93
    /**
 
94
      Get the byte at the specified address.
 
95
 
 
96
      @return The byte at the specified address
 
97
    */
 
98
    virtual uInt8 peek(uInt16 address);
 
99
 
 
100
    /**
 
101
      Change the byte at the specified address to the given value
 
102
 
 
103
      @param address The address where the value should be stored
 
104
      @param value The value to be stored at the address
 
105
    */
 
106
    virtual void poke(uInt16 address, uInt8 value);
 
107
 
 
108
  private:
 
109
    /**
 
110
      Map the specfied bank into the first segment
 
111
 
 
112
      @param bank The bank that should be installed in the system
 
113
    */
 
114
    void bank(uInt16 bank);
 
115
 
 
116
    /**
 
117
      Install pages for the specified 256 byte bank of RAM
 
118
 
 
119
      @param bank The bank that should be installed in the system
 
120
    */
 
121
    void bankRAM(uInt16 bank);
 
122
 
 
123
  private:
 
124
    // Indicates which slice is in the segment
 
125
    uInt16 myCurrentSlice[2];
 
126
 
 
127
    // Indicates which 256 byte bank of RAM is being used
 
128
    uInt16 myCurrentRAM;
 
129
 
 
130
    // The 16K ROM image of the cartridge
 
131
    uInt8 myImage[16384];
 
132
 
 
133
    // The 2048 bytes of RAM
 
134
    uInt8 myRAM[2048];
 
135
};
 
136
#endif
 
137