1 /******************************************************************************/
2 /* Mednafen - Multi-system Emulator                                           */
3 /******************************************************************************/
4 /* SPCReader.h:
5 **  Copyright (C) 2015-2016 Mednafen Team
6 **
7 ** This program is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU General Public License
9 ** as published by the Free Software Foundation; either version 2
10 ** of the License, or (at your option) any later version.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software Foundation, Inc.,
19 ** 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 */
21 
22 #ifndef __MDFN_SPCREADER_H
23 #define __MDFN_SPCREADER_H
24 
25 #include <mednafen/Stream.h>
26 
27 namespace Mednafen
28 {
29 
30 class SPCReader
31 {
32  public:
33 
34  static bool TestMagic(Stream* fp);
35 
36  SPCReader(Stream* fp);
37  ~SPCReader();
38 
APURAM(void)39  INLINE const uint8* APURAM(void) { return apuram; }
DSPRegs(void)40  INLINE const uint8* DSPRegs(void) { return dspregs; }
41 
PC(void)42  INLINE uint16 PC(void) { return reg_pc; }
A(void)43  INLINE uint8 A(void) { return reg_a; }
X(void)44  INLINE uint8 X(void) { return reg_x; }
Y(void)45  INLINE uint8 Y(void) { return reg_y; }
PSW(void)46  INLINE uint8 PSW(void) { return reg_psw; }
SP(void)47  INLINE uint8 SP(void) { return reg_sp; }
48 
GameName(void)49  INLINE std::string GameName(void) { return game_name; }
ArtistName(void)50  INLINE std::string ArtistName(void) { return artist_name; }
SongName(void)51  INLINE std::string SongName(void) { return song_name; }
52 
53  private:
54  uint8 apuram[65536];
55  uint8 dspregs[128];
56 
57  uint16 reg_pc;
58  uint8 reg_a, reg_x, reg_y;
59  uint8 reg_psw;
60  uint8 reg_sp;
61 
62  std::string game_name;
63  std::string artist_name;
64  std::string song_name;
65 };
66 
67 }
68 #endif
69