libsidplayfp 2.15.0
c64vic.h
1/*
2 * This file is part of libsidplayfp, a SID player engine.
3 *
4 * Copyright 2011-2019 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
34#include "sidcxx11.h"
35
36namespace libsidplayfp
37{
38
44class c64vic final : public MOS656X, public Bank
45{
46private:
47 c64env &m_env;
48
49protected:
50 void interrupt(bool state) override
51 {
52 m_env.interruptIRQ(state);
53 }
54
55 void setBA(bool state) override
56 {
57 m_env.setBA(state);
58 }
59
60public:
61 c64vic(c64env &env) :
62 MOS656X(env.scheduler()),
63 m_env(env) {}
64
65 void poke(uint_least16_t address, uint8_t value) override
66 {
67 write(endian_16lo8(address), value);
68 }
69
70 uint8_t peek(uint_least16_t address) override
71 {
72 return read(endian_16lo8(address));
73 }
74};
75
76}
77
78#endif // C64VIC_H
Definition Bank.h:36
Definition mos656x.h:46
void write(uint_least8_t addr, uint8_t data)
Definition mos656x.cpp:156
uint8_t read(uint_least8_t addr)
Definition mos656x.cpp:119
Definition c64env.h:41
Definition c64vic.h:45
void poke(uint_least16_t address, uint8_t value) override
Definition c64vic.h:65
uint8_t peek(uint_least16_t address) override
Definition c64vic.h:70