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