libsidplayfp  1.5.3
psiddrv.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2012-2014 Leandro Nini <drfiemost@users.sourceforge.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef PSIDDRV_H
22 #define PSIDDRV_H
23 
24 #include <stdint.h>
25 
26 class SidTuneInfo;
27 class sidmemory;
28 
29 class psiddrv
30 {
31 private:
32  const SidTuneInfo *m_tuneInfo;
33  const char *m_errorString;
34 
35  uint8_t *reloc_driver;
36  int reloc_size;
37 
38  uint_least16_t m_driverAddr;
39  uint_least16_t m_driverLength;
40  uint_least16_t m_powerOnDelay;
41 
42 private:
43  static uint8_t psid_driver[];
44 
45 private:
52  uint8_t iomap(uint_least16_t addr) const;
53 
57  void copyPoweronPattern(sidmemory *mem) const;
58 
59 public:
60  psiddrv(const SidTuneInfo *tuneInfo) :
61  m_tuneInfo(tuneInfo),
62  m_powerOnDelay(0) {}
63 
69  void powerOnDelay(uint_least16_t delay) { m_powerOnDelay = delay; }
70 
74  bool drvReloc();
75 
83  void install(sidmemory *mem, uint8_t video) const;
84 
90  const char* errorString() const { return m_errorString; }
91 
92  uint_least16_t driverAddr() const { return m_driverAddr; }
93  uint_least16_t driverLength() const { return m_driverLength; }
94 };
95 
96 #endif