Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libgambatte/src/video/lyc_irq.h
2 views
1
/***************************************************************************
2
* Copyright (C) 2007 by Sindre Aamås *
3
* [email protected] *
4
* *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License version 2 as *
7
* published by the Free Software Foundation. *
8
* *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License version 2 for more details. *
13
* *
14
* You should have received a copy of the GNU General Public License *
15
* version 2 along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18
***************************************************************************/
19
#ifndef VIDEO_LYC_IRQ_H
20
#define VIDEO_LYC_IRQ_H
21
22
#include "newstate.h"
23
24
namespace gambatte {
25
26
struct SaveState;
27
class LyCounter;
28
29
class LycIrq {
30
unsigned long time_;
31
unsigned char lycRegSrc_;
32
unsigned char statRegSrc_;
33
unsigned char lycReg_;
34
unsigned char statReg_;
35
bool cgb_;
36
37
void regChange(unsigned statReg, unsigned lycReg, const LyCounter &lyCounter, unsigned long cc);
38
39
public:
40
LycIrq();
41
void doEvent(unsigned char *ifreg, const LyCounter &lyCounter);
42
unsigned lycReg() const { return lycRegSrc_; }
43
void loadState(const SaveState &state);
44
unsigned long time() const { return time_; }
45
void setCgb(const bool cgb) { cgb_ = cgb; }
46
void lcdReset();
47
void reschedule(const LyCounter & lyCounter, unsigned long cc);
48
49
void statRegChange(unsigned statReg, const LyCounter &lyCounter, unsigned long cc) {
50
regChange(statReg, lycRegSrc_, lyCounter, cc);
51
}
52
53
void lycRegChange(unsigned lycReg, const LyCounter &lyCounter, unsigned long cc) {
54
regChange(statRegSrc_, lycReg, lyCounter, cc);
55
}
56
57
template<bool isReader>void SyncState(NewState *ns);
58
};
59
60
}
61
62
#endif
63
64