~ubuntu-branches/ubuntu/wily/xmms2/wily

« back to all changes in this revision

Viewing changes to src/plugins/gme/gme/Spc_Cpu.h

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2008-07-04 16:23:34 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080704162334-b3esbkcapt8wbrk4
Tags: 0.5DrLecter-2ubuntu1
* Merge from debian unstable (LP: #241098), remaining changes:
  + debian/control:
    + Update Maintainer field
    + add lpia to xmms2-plugin-alsa supported architectures
    + Added liba52-0.7.4-dev to build depends
  + debian/rules: Added patch, patch-stamp and unpatch
  + changed 01_gcc4.3.patch:
    + src/include/xmmsclient/xmmsclient++/helpers.h: Added #include <climits>
* New upstream relase fixes LP: #212566, #222341

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Super Nintendo (SNES) SPC-700 CPU emulator
 
2
 
 
3
// Game_Music_Emu 0.5.2
 
4
#ifndef SPC_CPU_H
 
5
#define SPC_CPU_H
 
6
 
 
7
#include "blargg_common.h"
 
8
 
 
9
typedef unsigned spc_addr_t;
 
10
typedef blargg_long spc_time_t;
 
11
 
 
12
class Snes_Spc;
 
13
 
 
14
class Spc_Cpu {
 
15
        typedef BOOST::uint8_t uint8_t;
 
16
        uint8_t* const ram;
 
17
public:
 
18
        // Keeps pointer to 64K RAM
 
19
        Spc_Cpu( Snes_Spc* spc, uint8_t* ram );
 
20
        
 
21
        // SPC-700 registers. *Not* kept updated during a call to run().
 
22
        struct registers_t {
 
23
                long pc; // more than 16 bits to allow overflow detection
 
24
                uint8_t a;
 
25
                uint8_t x;
 
26
                uint8_t y;
 
27
                uint8_t status;
 
28
                uint8_t sp;
 
29
        } r;
 
30
        
 
31
        // Run CPU for at least 'count' cycles. Return the number of cycles remaining
 
32
        // when emulation stopped (negative if extra cycles were emulated). Emulation
 
33
        // stops when there are no more remaining cycles or an unhandled instruction
 
34
        // is encountered (STOP, SLEEP, and any others not yet implemented). In the
 
35
        // latter case, the return value is greater than zero.
 
36
        spc_time_t run( spc_time_t count );
 
37
        
 
38
        // Number of clock cycles remaining for current run() call
 
39
        spc_time_t remain() const;
 
40
        
 
41
        // Access memory as the emulated CPU does
 
42
        int  read ( spc_addr_t );
 
43
        void write( spc_addr_t, int );
 
44
        
 
45
private:
 
46
        // noncopyable
 
47
        Spc_Cpu( const Spc_Cpu& );
 
48
        Spc_Cpu& operator = ( const Spc_Cpu& );
 
49
        unsigned mem_bit( spc_addr_t );
 
50
        
 
51
        spc_time_t remain_;
 
52
        Snes_Spc& emu;
 
53
};
 
54
 
 
55
inline spc_time_t Spc_Cpu::remain() const { return remain_; }
 
56
 
 
57
#endif