libsidplayfp  1.8.7
c64vic.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2007-2010 Antti Lankila
6  * Copyright 2001 Simon White
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef C64VIC_H
24 #define C64VIC_H
25 
26 // The VIC emulation is very generic and here we need to effectively
27 // wire it into the computer (like adding a chip to a PCB).
28 
29 #include "Banks/Bank.h"
30 #include "c64/c64env.h"
31 #include "sidendian.h"
32 #include "VIC_II/mos656x.h"
33 
39 class c64vic: public MOS656X, public Bank
40 {
41 private:
42  c64env &m_env;
43 
44 protected:
45  void interrupt(bool state)
46  {
47  m_env.interruptIRQ (state);
48  }
49 
50  void setBA(bool state)
51  {
52  m_env.setBA (state);
53  }
54 
55 public:
56  c64vic(c64env *env) :
57  MOS656X(&(env->context ())),
58  m_env(*env) {}
59 
60  void poke(uint_least16_t address, uint8_t value)
61  {
62  write(endian_16lo8(address), value);
63  }
64 
65  uint8_t peek(uint_least16_t address)
66  {
67  return read(endian_16lo8(address));
68  }
69 };
70 
71 #endif // C64VIC_H
Definition: c64vic.h:39
Definition: mos656x.h:36
Definition: c64env.h:37
void poke(uint_least16_t address, uint8_t value)
Definition: c64vic.h:60
Definition: Bank.h:32
uint8_t read(uint_least8_t addr)
Definition: mos656x.cpp:104
void write(uint_least8_t addr, uint8_t data)
Definition: mos656x.cpp:140
uint8_t peek(uint_least16_t address)
Definition: c64vic.h:65